mirror of
https://github.com/hyprwm/hyprland-qtutils.git
synced 2025-12-20 08:40:03 +01:00
Compare commits
24 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56d993aced | |||
|
|
629b15c19f | ||
|
|
5ffdfc13ed | ||
| 119bcb9aa7 | |||
| b308a818b9 | |||
| b13c7481e3 | |||
|
|
396e8aa1c0 | ||
| 4be1d324fa | |||
| e0514a390b | |||
| 5917536fb5 | |||
| 3504a293c8 | |||
|
|
96bf0677fa | ||
|
|
5d979b5a5d | ||
| 9c0831ff98 | |||
| a9852dbf5a | |||
|
|
534cd1badc | ||
| b0214844d8 | |||
| 8c9483a21f | |||
| 196e043cd9 | |||
| 6cc1cf51f2 | |||
| 6997fe382d | |||
| 8fcc443630 | |||
| c77109d7e1 | |||
| 3833097e50 |
23 changed files with 423 additions and 40 deletions
31
.github/workflows/nix.yml
vendored
31
.github/workflows/nix.yml
vendored
|
|
@ -7,8 +7,35 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- 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
|
||||
|
|
|
|||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -33,4 +33,8 @@
|
|||
|
||||
build/
|
||||
.cache/
|
||||
.vscode/
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# nix
|
||||
result*
|
||||
|
|
|
|||
|
|
@ -18,4 +18,5 @@ qt_standard_project_setup(REQUIRES 6.5)
|
|||
|
||||
add_subdirectory(utils/dialog)
|
||||
add_subdirectory(utils/update-screen)
|
||||
add_subdirectory(utils/donate-screen)
|
||||
|
||||
|
|
|
|||
13
README.md
13
README.md
|
|
@ -1,7 +1,18 @@
|
|||
# Hyprland QT utils
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This repo has been superseded by 
|
||||
|
||||
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 qqc2-desktop-style from KDE.
|
||||
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`
|
||||
```
|
||||
|
|
|
|||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
0.1.1
|
||||
0.1.5
|
||||
73
flake.lock
generated
73
flake.lock
generated
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"nodes": {
|
||||
"hyprutils": {
|
||||
"hyprland-qt-support": {
|
||||
"inputs": {
|
||||
"hyprlang": [
|
||||
"hyprlang"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
|
|
@ -10,11 +13,60 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732288281,
|
||||
"narHash": "sha256-XTU9B53IjGeJiJ7LstOhuxcRjCOFkQFl01H78sT9Lg4=",
|
||||
"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": "b26f33cc1c8a7fd5076e19e2cce3f062dca6351c",
|
||||
"rev": "e36db00dfb3a3d3fdcc4069cb292ff60d2699ccb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -25,11 +77,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1733392399,
|
||||
"narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=",
|
||||
"lastModified": 1748929857,
|
||||
"narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661",
|
||||
"rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -41,7 +93,12 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"hyprutils": "hyprutils",
|
||||
"hyprland-qt-support": "hyprland-qt-support",
|
||||
"hyprlang": "hyprlang",
|
||||
"hyprutils": [
|
||||
"hyprlang",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
|
|
|
|||
20
flake.nix
20
flake.nix
|
|
@ -5,8 +5,17 @@
|
|||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
|
||||
hyprutils = {
|
||||
url = "github:hyprwm/hyprutils";
|
||||
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";
|
||||
};
|
||||
|
|
@ -34,5 +43,12 @@
|
|||
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;
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
cmake,
|
||||
pkg-config,
|
||||
hyprutils,
|
||||
kdePackages,
|
||||
hyprland-qt-support,
|
||||
pciutils,
|
||||
qt6,
|
||||
version ? "0",
|
||||
|
|
@ -32,7 +32,7 @@ in
|
|||
|
||||
buildInputs = [
|
||||
hyprutils
|
||||
kdePackages.kirigami-addons
|
||||
hyprland-qt-support
|
||||
qt6.qtbase
|
||||
qt6.qtsvg
|
||||
qt6.qtwayland
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@ in {
|
|||
|
||||
hyprland-qtutils = lib.composeManyExtensions [
|
||||
inputs.hyprutils.overlays.default
|
||||
inputs.hyprland-qt-support.overlays.default
|
||||
(final: prev: {
|
||||
hyprland-qtutils = final.callPackage ./. {
|
||||
stdenv = final.gcc14Stdenv;
|
||||
stdenv = final.gcc15Stdenv;
|
||||
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
|
||||
};
|
||||
})
|
||||
|
|
|
|||
26
nix/shell.nix
Normal file
26
nix/shell.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
pkgs ? import <nixpkgs> {},
|
||||
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 .
|
||||
'';
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ 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(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient WaylandClientPrivate)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils)
|
||||
|
|
@ -24,7 +24,7 @@ qt_add_qml_module(hyprland-dialog
|
|||
)
|
||||
|
||||
target_link_libraries(hyprland-dialog PRIVATE
|
||||
Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
|
||||
Qt6::Quick Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include "Dialog.hpp"
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
#include <print>
|
||||
#include <qapplication.h>
|
||||
#include <qqmlapplicationengine.h>
|
||||
#include <qquickstyle.h>
|
||||
#include <qtenvironmentvariables.h>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
#include <QtEnvironmentVariables>
|
||||
#include <print>
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
|
||||
using namespace Hyprutils::String;
|
||||
|
||||
|
|
@ -75,11 +75,11 @@ int main(int argc, char* argv[]) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QGuiApplication app(argc, argv);
|
||||
app.setApplicationName(appTitle.isEmpty() ? dialog->title : appTitle);
|
||||
|
||||
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
|
||||
QQuickStyle::setStyle("org.kde.desktop");
|
||||
QQuickStyle::setStyle("org.hyprland.style");
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextProperty("dialog", dialog);
|
||||
|
|
|
|||
42
utils/donate-screen/CMakeLists.txt
Normal file
42
utils/donate-screen/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
cmake_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 WaylandClientPrivate)
|
||||
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::Quick 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}
|
||||
)
|
||||
19
utils/donate-screen/DonateScreen.cpp
Normal file
19
utils/donate-screen/DonateScreen.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include "DonateScreen.hpp"
|
||||
|
||||
#include <print>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include <hyprutils/string/String.hpp>
|
||||
#include <hyprutils/os/Process.hpp>
|
||||
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"));
|
||||
}
|
||||
20
utils/donate-screen/DonateScreen.hpp
Normal file
20
utils/donate-screen/DonateScreen.hpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qqmlintegration.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CDonateScreen : public QObject {
|
||||
Q_OBJECT;
|
||||
QML_NAMED_ELEMENT(DonateScreen);
|
||||
QML_SINGLETON;
|
||||
|
||||
public:
|
||||
explicit CDonateScreen(QObject* parent = nullptr);
|
||||
|
||||
Q_INVOKABLE void onButtonPress(QString buttonName = "");
|
||||
};
|
||||
4
utils/donate-screen/assets/heart.svg
Normal file
4
utils/donate-screen/assets/heart.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19.5355 5.46448C21.4881 7.4171 21.4881 10.5829 19.5355 12.5355L12.7071 19.364C12.3166 19.7545 11.6834 19.7545 11.2929 19.364L4.46447 12.5355C2.51184 10.5829 2.51184 7.4171 4.46447 5.46448C6.0168 3.91215 7.89056 3.43683 9.78125 4.35939C10.5317 4.72556 11.5156 5.46448 12 6.4297C12.4844 5.46448 13.4683 4.72556 14.2187 4.35939C16.1094 3.43683 17.9832 3.91215 19.5355 5.46448Z" stroke="#f309e8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 698 B |
29
utils/donate-screen/main.cpp
Normal file
29
utils/donate-screen/main.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "DonateScreen.hpp"
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
#include <QtEnvironmentVariables>
|
||||
#include <hyprutils/string/VarList.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 CDonateScreen();
|
||||
|
||||
QGuiApplication 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();
|
||||
}
|
||||
102
utils/donate-screen/main.qml
Normal file
102
utils/donate-screen/main.qml
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
pragma 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.<br/>Your support is valuable, and helps fund Hyprland's continued existence.<br/><br/>You can donate once, or monthly, and it takes less than 5 minutes.<br/>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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ 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(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient WaylandClientPrivate)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils)
|
||||
|
|
@ -25,8 +25,14 @@ qt_add_qml_module(hyprland-update-screen
|
|||
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
|
||||
Qt6::Quick Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "UpdateScreen.hpp"
|
||||
|
||||
#include <print>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include <hyprutils/string/String.hpp>
|
||||
#include <hyprutils/os/Process.hpp>
|
||||
|
|
@ -13,4 +14,6 @@ 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"));
|
||||
}
|
||||
|
|
|
|||
4
utils/update-screen/assets/heart.svg
Normal file
4
utils/update-screen/assets/heart.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19.5355 5.46448C21.4881 7.4171 21.4881 10.5829 19.5355 12.5355L12.7071 19.364C12.3166 19.7545 11.6834 19.7545 11.2929 19.364L4.46447 12.5355C2.51184 10.5829 2.51184 7.4171 4.46447 5.46448C6.0168 3.91215 7.89056 3.43683 9.78125 4.35939C10.5317 4.72556 11.5156 5.46448 12 6.4297C12.4844 5.46448 13.4683 4.72556 14.2187 4.35939C16.1094 3.43683 17.9832 3.91215 19.5355 5.46448Z" stroke="#f309e8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 698 B |
|
|
@ -1,12 +1,12 @@
|
|||
#include "UpdateScreen.hpp"
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
#include <print>
|
||||
#include <qapplication.h>
|
||||
#include <qqmlapplicationengine.h>
|
||||
#include <qquickstyle.h>
|
||||
#include <qtenvironmentvariables.h>
|
||||
#include <QQmlContext>
|
||||
#include "Dialog.hpp"
|
||||
#include "UpdateScreen.hpp"
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
#include <QtEnvironmentVariables>
|
||||
#include <print>
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
|
||||
using namespace Hyprutils::String;
|
||||
|
||||
|
|
@ -40,12 +40,12 @@ int main(int argc, char* argv[]) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QGuiApplication app(argc, argv);
|
||||
app.setApplicationName("Hyprland Updated!");
|
||||
app.setApplicationDisplayName("Hyprland Updated");
|
||||
|
||||
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
|
||||
QQuickStyle::setStyle("org.kde.desktop");
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -79,6 +79,17 @@ ApplicationWindow {
|
|||
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) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue