pax_global_header00006660000000000000000000000064150602710140014506gustar00rootroot0000000000000052 comment=119bcb9aa742658107b326c50dcd24ab59b309b7 hyprwm-hyprland-qtutils-119bcb9/000077500000000000000000000000001506027101400167725ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/.clang-format000066400000000000000000000034161506027101400213510ustar00rootroot00000000000000--- Language: Cpp BasedOnStyle: LLVM AccessModifierOffset: -2 AlignAfterOpenBracket: Align AlignConsecutiveMacros: true AlignConsecutiveAssignments: true AlignEscapedNewlines: Right AlignOperands: false AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes BreakBeforeBraces: Attach BreakBeforeTernaryOperators: false BreakConstructorInitializers: AfterColon ColumnLimit: 180 CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: false IncludeBlocks: Preserve IndentCaseLabels: true IndentWidth: 4 PointerAlignment: Left ReflowComments: false SortIncludes: false SortUsingDeclarations: false SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Auto TabWidth: 4 UseTab: Never AllowShortEnumsOnASingleLine: false BraceWrapping: AfterEnum: false AlignConsecutiveDeclarations: AcrossEmptyLines NamespaceIndentation: All hyprwm-hyprland-qtutils-119bcb9/.github/000077500000000000000000000000001506027101400203325ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/.github/workflows/000077500000000000000000000000001506027101400223675ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/.github/workflows/nix.yml000066400000000000000000000031011506027101400237030ustar00rootroot00000000000000name: Build on: [push, pull_request, workflow_dispatch] jobs: nix: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Nix uses: nixbuild/nix-quick-install-action@v31 with: nix_conf: | keep-env-derivations = true keep-outputs = true - name: Restore and save Nix store uses: nix-community/cache-nix-action@v6 with: # restore and save a cache using this key primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} # if there's no cache hit, restore a cache by this prefix restore-prefixes-first-match: nix-${{ runner.os }}- # collect garbage until the Nix store size (in bytes) is at most this number # before trying to save a new cache # 1G = 1073741824 gc-max-store-size-linux: 1G # do purge caches purge: true # purge all versions of the cache purge-prefixes: nix-${{ runner.os }}- # created more than this number of seconds ago purge-created: 0 # or, last accessed more than this number of seconds ago # relative to the start of the `Post Restore and save Nix store` phase purge-last-accessed: 0 # except any version with the key that is the same as the `primary-key` purge-primary-key: never # not needed (yet) # - uses: cachix/cachix-action@v12 # with: # name: hyprland # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build run: nix build --print-build-logs --keep-going hyprwm-hyprland-qtutils-119bcb9/.gitignore000066400000000000000000000004661506027101400207700ustar00rootroot00000000000000# Prerequisites *.d # Compiled Object files *.slo *.lo *.o *.obj # Precompiled Headers *.gch *.pch # Compiled Dynamic libraries *.so *.dylib *.dll # Fortran module files *.mod *.smod # Compiled Static libraries *.lai *.la *.a *.lib # Executables *.exe *.out *.app build/ .cache/ .vscode/ # nix result* hyprwm-hyprland-qtutils-119bcb9/CMakeLists.txt000066400000000000000000000011101506027101400215230ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) # Get version file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW) string(STRIP ${VER_RAW} VER) project(hyprland-qtutils VERSION ${VER} LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient) find_package(PkgConfig REQUIRED) pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils) qt_standard_project_setup(REQUIRES 6.5) add_subdirectory(utils/dialog) add_subdirectory(utils/update-screen) add_subdirectory(utils/donate-screen) hyprwm-hyprland-qtutils-119bcb9/LICENSE000066400000000000000000000027371506027101400200100ustar00rootroot00000000000000BSD 3-Clause License Copyright (c) 2024, Hypr Development Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. hyprwm-hyprland-qtutils-119bcb9/README.md000066400000000000000000000007111506027101400202500ustar00rootroot00000000000000# Hyprland QT utils This repo houses some qt/qml utilities that might be used by various hypr* apps. ## Dependencies This depends on qt6 and qt6-qml, as well as hyprland-qt-support. ## Building You can build it with this command: ```sh cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` ``` hyprwm-hyprland-qtutils-119bcb9/VERSION000066400000000000000000000000051506027101400200350ustar00rootroot000000000000000.1.5hyprwm-hyprland-qtutils-119bcb9/flake.lock000066400000000000000000000056361506027101400207400ustar00rootroot00000000000000{ "nodes": { "hyprland-qt-support": { "inputs": { "hyprlang": [ "hyprlang" ], "nixpkgs": [ "nixpkgs" ], "systems": [ "systems" ] }, "locked": { "lastModified": 1749154592, "narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=", "owner": "hyprwm", "repo": "hyprland-qt-support", "rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074", "type": "github" }, "original": { "owner": "hyprwm", "repo": "hyprland-qt-support", "type": "github" } }, "hyprlang": { "inputs": { "hyprutils": "hyprutils", "nixpkgs": [ "nixpkgs" ], "systems": [ "systems" ] }, "locked": { "lastModified": 1749145882, "narHash": "sha256-qr0KXeczF8Sma3Ae7+dR2NHhvG7YeLBJv19W4oMu6ZE=", "owner": "hyprwm", "repo": "hyprlang", "rev": "1bfb84f54d50c7ae6558c794d3cfd5f6a7e6e676", "type": "github" }, "original": { "owner": "hyprwm", "repo": "hyprlang", "type": "github" } }, "hyprutils": { "inputs": { "nixpkgs": [ "hyprlang", "nixpkgs" ], "systems": [ "hyprlang", "systems" ] }, "locked": { "lastModified": 1749135356, "narHash": "sha256-Q8mAKMDsFbCEuq7zoSlcTuxgbIBVhfIYpX0RjE32PS0=", "owner": "hyprwm", "repo": "hyprutils", "rev": "e36db00dfb3a3d3fdcc4069cb292ff60d2699ccb", "type": "github" }, "original": { "owner": "hyprwm", "repo": "hyprutils", "type": "github" } }, "nixpkgs": { "locked": { "lastModified": 1748929857, "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", "owner": "NixOS", "repo": "nixpkgs", "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", "type": "github" }, "original": { "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { "hyprland-qt-support": "hyprland-qt-support", "hyprlang": "hyprlang", "hyprutils": [ "hyprlang", "hyprutils" ], "nixpkgs": "nixpkgs", "systems": "systems" } }, "systems": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", "repo": "default-linux", "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", "repo": "default-linux", "type": "github" } } }, "root": "root", "version": 7 } hyprwm-hyprland-qtutils-119bcb9/flake.nix000066400000000000000000000024541506027101400206010ustar00rootroot00000000000000{ description = "Hyprland QT/qml utility apps"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; systems.url = "github:nix-systems/default-linux"; hyprlang = { url = "github:hyprwm/hyprlang"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; }; hyprutils.follows = "hyprlang/hyprutils"; hyprland-qt-support = { url = "github:hyprwm/hyprland-qt-support"; inputs.hyprlang.follows = "hyprlang"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; }; }; outputs = { self, nixpkgs, systems, ... } @ inputs: let inherit (nixpkgs) lib; eachSystem = lib.genAttrs (import systems); pkgsFor = eachSystem ( system: import nixpkgs { localSystem = system; overlays = [self.overlays.default]; } ); in { overlays = import ./nix/overlays.nix {inherit inputs self lib;}; packages = eachSystem (system: { default = self.packages.${system}.hyprland-qtutils; inherit (pkgsFor.${system}) hyprland-qtutils; }); devShells = eachSystem (system: { default = import ./nix/shell.nix { pkgs = pkgsFor.${system}; inherit (pkgsFor.${system}) hyprland-qtutils; }; }); }; } hyprwm-hyprland-qtutils-119bcb9/nix/000077500000000000000000000000001506027101400175705ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/nix/default.nix000066400000000000000000000020431506027101400217330ustar00rootroot00000000000000{ lib, stdenv, cmake, pkg-config, hyprutils, hyprland-qt-support, pciutils, qt6, version ? "0", }: let inherit (lib.sources) cleanSource cleanSourceWith; inherit (lib.strings) hasSuffix makeBinPath; in stdenv.mkDerivation { pname = "hyprland-qtutils"; inherit version; src = cleanSourceWith { filter = name: _type: let baseName = baseNameOf (toString name); in ! (hasSuffix ".nix" baseName); src = cleanSource ../.; }; nativeBuildInputs = [ cmake pkg-config qt6.wrapQtAppsHook ]; buildInputs = [ hyprutils hyprland-qt-support qt6.qtbase qt6.qtsvg qt6.qtwayland ]; preFixup = '' qtWrapperArgs+=(--prefix PATH : "${makeBinPath [pciutils]}") ''; meta = { description = "Hyprland QT/qml utility apps"; homepage = "https://github.com/hyprwm/hyprland-qtlibs"; license = lib.licenses.bsd3; maintainers = [lib.maintainers.fufexan]; platforms = lib.platforms.linux; }; } hyprwm-hyprland-qtutils-119bcb9/nix/overlays.nix000066400000000000000000000013061506027101400221540ustar00rootroot00000000000000{ inputs, self, lib, }: let mkDate = longDate: (lib.concatStringsSep "-" [ (builtins.substring 0 4 longDate) (builtins.substring 4 2 longDate) (builtins.substring 6 2 longDate) ]); date = mkDate (self.lastModifiedDate or "19700101"); version = lib.removeSuffix "\n" (builtins.readFile ../VERSION); in { default = self.overlays.hyprland-qtutils; hyprland-qtutils = lib.composeManyExtensions [ inputs.hyprutils.overlays.default inputs.hyprland-qt-support.overlays.default (final: prev: { hyprland-qtutils = final.callPackage ./. { stdenv = final.gcc15Stdenv; version = "${version}+date=${date}_${self.shortRev or "dirty"}"; }; }) ]; } hyprwm-hyprland-qtutils-119bcb9/nix/shell.nix000066400000000000000000000013671506027101400214260ustar00rootroot00000000000000{ pkgs ? import {}, hyprland-qtutils ? pkgs.callPackage ./default.nix {}, ... }: pkgs.mkShell { inputsFrom = [ hyprland-qtutils ]; nativeBuildInputs = [ pkgs.clang-tools pkgs.pciutils ]; shellHook = let inherit (pkgs.lib.strings) concatMapStringsSep; qtLibPath = f: concatMapStringsSep ":" f (with pkgs.qt6; [ qtbase qtdeclarative qtwayland pkgs.hyprland-qt-support ]); in '' # Add Qt-related environment variables. export QT_PLUGIN_PATH=${qtLibPath (p: "${p}/lib/qt-6/plugins")} export QML2_IMPORT_PATH=${qtLibPath (p: "${p}/lib/qt-6/qml")} # Generate compile_commands.json CMAKE_EXPORT_COMPILE_COMMANDS=1 cmake -S . -B ./build ln -s build/compile_commands.json . ''; } hyprwm-hyprland-qtutils-119bcb9/utils/000077500000000000000000000000001506027101400201325ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/dialog/000077500000000000000000000000001506027101400213715ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/dialog/CMakeLists.txt000066400000000000000000000015401506027101400241310ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) project(hyprland-dialog VERSION ${VER} LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient) find_package(PkgConfig REQUIRED) pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils) qt_standard_project_setup(REQUIRES 6.5) qt_add_executable(hyprland-dialog main.cpp Dialog.cpp ) qt_add_qml_module(hyprland-dialog URI org.hyprland.dialog VERSION 1.0 QML_FILES main.qml ) target_link_libraries(hyprland-dialog PRIVATE Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils ) include(GNUInstallDirs) install(TARGETS hyprland-dialog BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) hyprwm-hyprland-qtutils-119bcb9/utils/dialog/Dialog.cpp000066400000000000000000000004521506027101400232750ustar00rootroot00000000000000#include "Dialog.hpp" #include #include using namespace Hyprutils::String; CDialog::CDialog(QObject* parent) : QObject(parent) { ; } void CDialog::onButtonPress(QString buttonName) { std::print("{}\n", trim(buttonName.toStdString())); exit(0); } hyprwm-hyprland-qtutils-119bcb9/utils/dialog/Dialog.hpp000066400000000000000000000012241506027101400233000ustar00rootroot00000000000000#pragma once #include #include #include #include #include #include #include class CDialog : public QObject { Q_OBJECT; QML_NAMED_ELEMENT(Dialog); QML_SINGLETON; Q_PROPERTY(QString dialogTitle MEMBER title CONSTANT); Q_PROPERTY(QString dialogText MEMBER text CONSTANT); Q_PROPERTY(QVector dialogButtons MEMBER buttons CONSTANT); public: explicit CDialog(QObject* parent = nullptr); QString title, text; QVector buttons; Q_INVOKABLE void onButtonPress(QString buttonName = ""); }; hyprwm-hyprland-qtutils-119bcb9/utils/dialog/main.cpp000066400000000000000000000043051506027101400230230ustar00rootroot00000000000000#include "Dialog.hpp" #include #include #include #include #include #include #include using namespace Hyprutils::String; int main(int argc, char* argv[]) { // disable logs to not trash the stdout qputenv("QT_LOGGING_RULES", QByteArray("*.debug=false;qml=false")); QString appTitle; auto dialog = new CDialog(); for (int i = 1; i < argc; ++i) { std::string_view arg = argv[i]; if (arg == "--title") { if (i + 1 >= argc) { std::print(stderr, "--title requires a parameter\n"); return 1; } dialog->title = argv[i + 1]; i++; continue; } if (arg == "--apptitle") { if (i + 1 >= argc) { std::print(stderr, "--apptitle requires a parameter\n"); return 1; } appTitle = argv[i + 1]; i++; continue; } if (arg == "--text") { if (i + 1 >= argc) { std::print(stderr, "--text requires a parameter\n"); return 1; } dialog->text = argv[i + 1]; i++; continue; } if (arg == "--buttons") { if (i + 1 >= argc) { std::print(stderr, "--buttons requires a parameter\n"); return 1; } CVarList buttonz(argv[i + 1], 0, ';', true); for (auto& b : buttonz) { dialog->buttons.emplace_back(b.c_str()); } i++; continue; } std::print(stderr, "invalid arg {}\n", argv[i]); return 1; } QApplication app(argc, argv); app.setApplicationName(appTitle.isEmpty() ? dialog->title : appTitle); if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) QQuickStyle::setStyle("org.hyprland.style"); QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("dialog", dialog); engine.load("qrc:/qt/qml/org/hyprland/dialog/main.qml"); return app.exec(); } hyprwm-hyprland-qtutils-119bcb9/utils/dialog/main.qml000066400000000000000000000044431506027101400230350ustar00rootroot00000000000000pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import QtQuick.Layouts ApplicationWindow { id: window FontMetrics { id: fontMetrics } property var windowPadding: 10 minimumWidth: Math.max(fontMetrics.height * 10, mainLayout.Layout.minimumWidth) + mainLayout.anchors.margins * 2 + windowPadding * 2 minimumHeight: Math.max(fontMetrics.height * 10, mainLayout.Layout.minimumHeight) + mainLayout.anchors.margins * 2 + windowPadding * 2 maximumWidth: minimumWidth maximumHeight: minimumHeight visible: true component Separator: Rectangle { color: Qt.darker(system.windowText, 1.5) } component VSeparator: Separator { implicitWidth: 1 Layout.fillHeight: true Layout.topMargin: fontMetrics.height Layout.bottomMargin: fontMetrics.height } component HSeparator: Separator { implicitHeight: 1 Layout.fillWidth: true Layout.leftMargin: fontMetrics.height * 8 Layout.rightMargin: fontMetrics.height * 8 } SystemPalette { id: system colorGroup: SystemPalette.Active } ColumnLayout { id: mainLayout spacing: fontMetrics.height anchors { fill: parent margins: 4 } Text { font.pointSize: fontMetrics.height color: system.windowText text: dialog.dialogTitle Layout.alignment: Qt.AlignHCenter } HSeparator {} Text { color: system.windowText text: dialog.dialogText Layout.alignment: Qt.AlignHCenter } Rectangle { color: "transparent" Layout.minimumHeight: 10 Layout.fillHeight: true } RowLayout { spacing: 6 Layout.leftMargin: 20 Layout.alignment: Qt.AlignRight Repeater { model: dialog.dialogButtons Button { required property int index; text: dialog.dialogButtons[index] onClicked: (e) => { dialog.onButtonPress(dialog.dialogButtons[index]) window.close() } } } } } } hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/000077500000000000000000000000001506027101400226615ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/CMakeLists.txt000066400000000000000000000017661506027101400254330ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) project(hyprland-donate-screen VERSION ${VER} LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient) find_package(PkgConfig REQUIRED) pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils) qt_standard_project_setup(REQUIRES 6.5) qt_add_executable(hyprland-donate-screen main.cpp DonateScreen.cpp ) qt_add_qml_module(hyprland-donate-screen URI org.hyprland.donate-screen VERSION 1.0 QML_FILES main.qml ) qt_add_resources(hyprland-donate-screen "assets" PREFIX "/" FILES assets/heart.svg ) target_link_libraries(hyprland-donate-screen PRIVATE Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils ) include(GNUInstallDirs) install(TARGETS hyprland-donate-screen BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/DonateScreen.cpp000066400000000000000000000007341506027101400257430ustar00rootroot00000000000000#include "DonateScreen.hpp" #include #include #include #include using namespace Hyprutils::String; CDonateScreen::CDonateScreen(QObject* parent) : QObject(parent) { ; } void CDonateScreen::onButtonPress(QString buttonName) { if (buttonName == "quit") exit(0); if (buttonName == "donate") QDesktopServices::openUrl(QUrl("https://account.hypr.land/pricing")); } hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/DonateScreen.hpp000066400000000000000000000006511506027101400257460ustar00rootroot00000000000000#pragma once #include #include #include #include #include #include #include class CDonateScreen : public QObject { Q_OBJECT; QML_NAMED_ELEMENT(DonateScreen); QML_SINGLETON; public: explicit CDonateScreen(QObject* parent = nullptr); Q_INVOKABLE void onButtonPress(QString buttonName = ""); }; hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/assets/000077500000000000000000000000001506027101400241635ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/assets/heart.svg000066400000000000000000000012721506027101400260110ustar00rootroot00000000000000 hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/main.cpp000066400000000000000000000016211506027101400243110ustar00rootroot00000000000000#include "DonateScreen.hpp" #include #include #include #include #include #include #include using namespace Hyprutils::String; int main(int argc, char* argv[]) { // disable logs to not trash the stdout qputenv("QT_LOGGING_RULES", QByteArray("*.debug=false;qml=false")); auto dialog = new CDonateScreen(); QApplication app(argc, argv); app.setApplicationName("Support Hyprland"); app.setApplicationDisplayName("Support Hyprland"); if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) QQuickStyle::setStyle("org.hyprland.style"); QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("donateScreen", dialog); engine.load("qrc:/qt/qml/org/hyprland/donate-screen/main.qml"); return app.exec(); } hyprwm-hyprland-qtutils-119bcb9/utils/donate-screen/main.qml000066400000000000000000000056441506027101400243310ustar00rootroot00000000000000pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import QtQuick.Layouts import './' ApplicationWindow { id: window FontMetrics { id: fontMetrics } property var windowPaddingH: 30 property var windowPaddingV: 3 minimumWidth: Math.max(fontMetrics.height * 9, mainLayout.Layout.minimumWidth) + mainLayout.anchors.margins * 2 + windowPaddingH * 2 minimumHeight: Math.max(fontMetrics.height * 9, mainLayout.Layout.minimumHeight) + mainLayout.anchors.margins * 2 + windowPaddingV * 2 maximumWidth: minimumWidth maximumHeight: minimumHeight visible: true component Separator: Rectangle { color: Qt.darker(system.windowText, 1.5) } component VSeparator: Separator { implicitWidth: 1 Layout.fillHeight: true Layout.topMargin: fontMetrics.height Layout.bottomMargin: fontMetrics.height } component HSeparator: Separator { implicitHeight: 1 Layout.fillWidth: true Layout.leftMargin: fontMetrics.height * 8 Layout.rightMargin: fontMetrics.height * 8 } SystemPalette { id: system colorGroup: SystemPalette.Active } ColumnLayout { id: mainLayout spacing: fontMetrics.height anchors { fill: parent margins: 4 } Text { font.pointSize: fontMetrics.height color: system.windowText text: "Support Hyprland" Layout.alignment: Qt.AlignHCenter } HSeparator {} Text { color: system.windowText text: "Hyprland is maintained by volunteers, and led by one person in their free time.
Your support is valuable, and helps fund Hyprland's continued existence.

You can donate once, or monthly, and it takes less than 5 minutes.
We also have Hyprperks, which is 5€ + tax / mo, and gives you access to a few \"Thank you\" goodies from us." Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter textFormat: TextEdit.RichText onLinkActivated: Qt.openUrlExternally(link) } Rectangle { color: "transparent" Layout.minimumHeight: 4 Layout.fillHeight: true } RowLayout { spacing: 6 Layout.leftMargin: 20 Layout.alignment: Qt.AlignRight Button { icon.color: "transparent" icon.source: "qrc:/assets/heart.svg" icon.height: 18 icon.width: 18 text: "Donate" onClicked: (e) => { donateScreen.onButtonPress("donate"); } } Button { text: "No thanks" onClicked: (e) => { donateScreen.onButtonPress("quit"); } } } } } hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/000077500000000000000000000000001506027101400226715ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/CMakeLists.txt000066400000000000000000000020431506027101400254300ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) project(hyprland-update-screen VERSION ${VER} LANGUAGES CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient) find_package(PkgConfig REQUIRED) pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils) qt_standard_project_setup(REQUIRES 6.5) qt_add_executable(hyprland-update-screen main.cpp Dialog.cpp Dialog.hpp UpdateScreen.cpp ) qt_add_qml_module(hyprland-update-screen URI org.hyprland.update-screen VERSION 1.0 QML_FILES main.qml dialogMain.qml ) qt_add_resources(hyprland-update-screen "assets" PREFIX "/" FILES assets/heart.svg ) target_link_libraries(hyprland-update-screen PRIVATE Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils ) include(GNUInstallDirs) install(TARGETS hyprland-update-screen BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/Dialog.cpp000066400000000000000000000002201506027101400245660ustar00rootroot00000000000000#include "Dialog.hpp" CDialog::CDialog(QObject* parent) : QObject(parent) { ; } void CDialog::onButtonPress(QString buttonName) { ; } hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/Dialog.hpp000077700000000000000000000000001506027101400301562../dialog/Dialog.hppustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/UpdateScreen.cpp000066400000000000000000000007271506027101400257650ustar00rootroot00000000000000#include "UpdateScreen.hpp" #include #include #include #include using namespace Hyprutils::String; CUpdateScreen::CUpdateScreen(QObject* parent) : QObject(parent) { ; } void CUpdateScreen::onButtonPress(QString buttonName) { if (buttonName == "quit") exit(0); if (buttonName == "donate") QDesktopServices::openUrl(QUrl("https://hyprland.org/support")); } hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/UpdateScreen.hpp000066400000000000000000000010121506027101400257560ustar00rootroot00000000000000#pragma once #include #include #include #include #include #include #include class CUpdateScreen : public QObject { Q_OBJECT; QML_NAMED_ELEMENT(UpdateScreen); QML_SINGLETON; Q_PROPERTY(QString newVersion MEMBER newVersion CONSTANT); public: explicit CUpdateScreen(QObject* parent = nullptr); QString newVersion; Q_INVOKABLE void onButtonPress(QString buttonName = ""); }; hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/assets/000077500000000000000000000000001506027101400241735ustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/assets/heart.svg000066400000000000000000000012721506027101400260210ustar00rootroot00000000000000 hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/dialogMain.qml000077700000000000000000000000001506027101400305542../dialog/main.qmlustar00rootroot00000000000000hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/main.cpp000066400000000000000000000036061506027101400243260ustar00rootroot00000000000000#include "UpdateScreen.hpp" #include #include #include #include #include #include #include #include "Dialog.hpp" using namespace Hyprutils::String; int main(int argc, char* argv[]) { // disable logs to not trash the stdout qputenv("QT_LOGGING_RULES", QByteArray("*.debug=false;qml=false")); auto dialog = new CUpdateScreen(); for (int i = 1; i < argc; ++i) { std::string_view arg = argv[i]; if (arg == "--new-version") { if (i + 1 >= argc) { std::println(stderr, "--new-version requires a parameter"); return 1; } dialog->newVersion = argv[i + 1]; i++; continue; } std::println(stderr, "invalid arg {}", argv[i]); return 1; } if (dialog->newVersion.isEmpty()) { std::println(stderr, "missing --new-version"); return 1; } QApplication app(argc, argv); app.setApplicationName("Hyprland Updated!"); app.setApplicationDisplayName("Hyprland Updated"); if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) QQuickStyle::setStyle("org.hyprland.style"); // This entire mechanism fucking sucks, // but I also suck at qml and I want to avoid spawning a new process as it takes a while. auto popup = new CDialog(); popup->title = "Information"; popup->text = "If you wish to disable this dialog, set ecosystem:no_update_news to true in your Hyprland config."; popup->buttons = {"ok"}; QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("updateScreen", dialog); engine.rootContext()->setContextProperty("dialog", popup); engine.load("qrc:/qt/qml/org/hyprland/update-screen/main.qml"); return app.exec(); } hyprwm-hyprland-qtutils-119bcb9/utils/update-screen/main.qml000066400000000000000000000065141506027101400243360ustar00rootroot00000000000000pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import QtQuick.Layouts import './' ApplicationWindow { id: window FontMetrics { id: fontMetrics } property var windowPadding: 10 minimumWidth: Math.max(fontMetrics.height * 10, mainLayout.Layout.minimumWidth) + mainLayout.anchors.margins * 2 + windowPadding * 2 minimumHeight: Math.max(fontMetrics.height * 10, mainLayout.Layout.minimumHeight) + mainLayout.anchors.margins * 2 + windowPadding * 2 maximumWidth: minimumWidth maximumHeight: minimumHeight visible: true component Separator: Rectangle { color: Qt.darker(system.windowText, 1.5) } component VSeparator: Separator { implicitWidth: 1 Layout.fillHeight: true Layout.topMargin: fontMetrics.height Layout.bottomMargin: fontMetrics.height } component HSeparator: Separator { implicitHeight: 1 Layout.fillWidth: true Layout.leftMargin: fontMetrics.height * 8 Layout.rightMargin: fontMetrics.height * 8 } SystemPalette { id: system colorGroup: SystemPalette.Active } ColumnLayout { id: mainLayout spacing: fontMetrics.height anchors { fill: parent margins: 4 } Text { font.pointSize: fontMetrics.height color: system.windowText text: "Hyprland updated to " + updateScreen.newVersion + "!" Layout.alignment: Qt.AlignHCenter } HSeparator {} Text { color: system.windowText text: "Hyprland has been updated! 😄

Please check the release notes on GitHub: https://github.com/hyprwm/Hyprland/releases

Every release may come with breaking changes, so if you get any config errors, try checking the latest release notes.

If you are using plugins, you will need to rebuild them." Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter textFormat: TextEdit.RichText onLinkActivated: Qt.openUrlExternally(link) } Rectangle { color: "transparent" Layout.minimumHeight: 10 Layout.fillHeight: true } RowLayout { spacing: 6 Layout.leftMargin: 20 Layout.alignment: Qt.AlignRight Button { icon.color: "transparent" icon.source: "qrc:/assets/heart.svg" icon.height: 18 icon.width: 18 text: "Support the project" onClicked: (e) => { updateScreen.onButtonPress("donate"); } } Button { text: "Don't show this when I update" onClicked: (e) => { var component = Qt.createComponent("dialogMain.qml") var newWindow = component.createObject(window) newWindow.show() } } Button { text: "Thanks!" onClicked: (e) => { updateScreen.onButtonPress("quit"); } } } } }