Compare commits

..

13 commits
v0.1.2 ... main

Author SHA1 Message Date
Vaxry
4be1d324fa
version: bump to 0.1.4
Some checks failed
Build / nix (push) Has been cancelled
2025-04-29 19:31:34 +01:00
Vaxry
e0514a390b
update-screen: add icon for support button 2025-04-29 19:31:22 +01:00
Vaxry
5917536fb5
donate-screen: add heart icon 2025-04-29 19:29:54 +01:00
Mihai Fufezan
3504a293c8
CI: remove deprecated magic-nix-cache-action 2025-02-08 23:09:43 +02:00
matt1432
96bf0677fa chore: add result to gitignore 2025-01-27 14:41:51 +02:00
matt1432
5d979b5a5d nix: fix duplicate inputs 2025-01-27 14:41:51 +02:00
Mihai Fufezan
9c0831ff98
flake.lock: update 2025-01-25 15:30:48 +02:00
Mihai Fufezan
a9852dbf5a
flake.lock: update 2025-01-23 14:20:10 +02:00
Manu Cornet
534cd1badc
README: Add build instructions (#8) 2025-01-13 14:20:15 +01:00
vaxerski
b0214844d8 version: bump to 0.1.3 2025-01-10 16:51:04 +01:00
outfoxxed
8c9483a21f
nix: move to hyprland-qt-support (#7) 2025-01-08 23:17:52 +00:00
vaxerski
196e043cd9 core: move to hyprland-qt-support instead of KDE's qqc2 2025-01-08 23:07:04 +01:00
vaxerski
6cc1cf51f2 utils: add donate-screen 2025-01-07 14:53:19 +01:00
21 changed files with 360 additions and 16 deletions

View file

@ -8,7 +8,6 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
# not needed (yet) # not needed (yet)
# - uses: cachix/cachix-action@v12 # - uses: cachix/cachix-action@v12

3
.gitignore vendored
View file

@ -34,3 +34,6 @@
build/ build/
.cache/ .cache/
.vscode/ .vscode/
# nix
result*

View file

@ -18,4 +18,5 @@ qt_standard_project_setup(REQUIRES 6.5)
add_subdirectory(utils/dialog) add_subdirectory(utils/dialog)
add_subdirectory(utils/update-screen) add_subdirectory(utils/update-screen)
add_subdirectory(utils/donate-screen)

View file

@ -4,4 +4,12 @@ This repo houses some qt/qml utilities that might be used by various hypr* apps.
## Dependencies ## 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`
```

View file

@ -1 +1 @@
0.1.2 0.1.4

View file

@ -1,7 +1,10 @@
{ {
"nodes": { "nodes": {
"hyprutils": { "hyprland-qt-support": {
"inputs": { "inputs": {
"hyprlang": [
"hyprlang"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
@ -10,11 +13,60 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734796073, "lastModified": 1737634706,
"narHash": "sha256-TnuKsa8OHrSJEmHm3TLGOWbPNA1gRjmZLsRzKrCqOsg=", "narHash": "sha256-nGCibkfsXz7ARx5R+SnisRtMq21IQIhazp6viBU8I/A=",
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"rev": "8810df502cdee755993cb803eba7b23f189db795",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"hyprutils": "hyprutils",
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1737634606,
"narHash": "sha256-W7W87Cv6wqZ9PHegI6rH1+ve3zJPiyevMFf0/HwdbCQ=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "f41271d35cc0f370d300413d756c2677f386af9d",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
"hyprlang",
"nixpkgs"
],
"systems": [
"hyprlang",
"systems"
]
},
"locked": {
"lastModified": 1737632363,
"narHash": "sha256-X9I8POSlHxBVjD0fiX1O2j7U9Zi1+4rIkrsyHP0uHXY=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprutils", "repo": "hyprutils",
"rev": "c3331116ebd0b71df5ae8c6efe9a7f94148b03bf", "rev": "006620eb29d54ea9086538891404c78563d1bae1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -25,11 +77,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734649271, "lastModified": 1737632463,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=", "narHash": "sha256-38J9QfeGSej341ouwzqf77WIHAScihAKCt8PQJ+NH28=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507", "rev": "0aa475546ed21629c4f5bbf90e38c846a99ec9e9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,7 +93,12 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"hyprutils": "hyprutils", "hyprland-qt-support": "hyprland-qt-support",
"hyprlang": "hyprlang",
"hyprutils": [
"hyprlang",
"hyprutils"
],
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"systems": "systems" "systems": "systems"
} }

View file

@ -5,8 +5,17 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux"; systems.url = "github:nix-systems/default-linux";
hyprutils = { hyprlang = {
url = "github:hyprwm/hyprutils"; 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.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems"; inputs.systems.follows = "systems";
}; };
@ -34,5 +43,12 @@
default = self.packages.${system}.hyprland-qtutils; default = self.packages.${system}.hyprland-qtutils;
inherit (pkgsFor.${system}) hyprland-qtutils; inherit (pkgsFor.${system}) hyprland-qtutils;
}); });
devShells = eachSystem (system: {
default = import ./nix/shell.nix {
pkgs = pkgsFor.${system};
inherit (pkgsFor.${system}) hyprland-qtutils;
};
});
}; };
} }

View file

@ -4,6 +4,7 @@
cmake, cmake,
pkg-config, pkg-config,
hyprutils, hyprutils,
hyprland-qt-support,
pciutils, pciutils,
qt6, qt6,
version ? "0", version ? "0",
@ -31,6 +32,7 @@ in
buildInputs = [ buildInputs = [
hyprutils hyprutils
hyprland-qt-support
qt6.qtbase qt6.qtbase
qt6.qtsvg qt6.qtsvg
qt6.qtwayland qt6.qtwayland

View file

@ -15,6 +15,7 @@ in {
hyprland-qtutils = lib.composeManyExtensions [ hyprland-qtutils = lib.composeManyExtensions [
inputs.hyprutils.overlays.default inputs.hyprutils.overlays.default
inputs.hyprland-qt-support.overlays.default
(final: prev: { (final: prev: {
hyprland-qtutils = final.callPackage ./. { hyprland-qtutils = final.callPackage ./. {
stdenv = final.gcc14Stdenv; stdenv = final.gcc14Stdenv;

26
nix/shell.nix Normal file
View 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 .
'';
}

View file

@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
app.setApplicationName(appTitle.isEmpty() ? dialog->title : appTitle); app.setApplicationName(appTitle.isEmpty() ? dialog->title : appTitle);
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("org.kde.desktop"); QQuickStyle::setStyle("org.hyprland.style");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("dialog", dialog); engine.rootContext()->setContextProperty("dialog", dialog);

View 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)
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}
)

View 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://hyprland.org/support"));
}

View 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 = "");
};

View 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

View file

@ -0,0 +1,30 @@
#include "DonateScreen.hpp"
#include <hyprutils/string/VarList.hpp>
#include <print>
#include <qapplication.h>
#include <qqmlapplicationengine.h>
#include <qquickstyle.h>
#include <qtenvironmentvariables.h>
#include <QQmlContext>
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();
}

View 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."
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");
}
}
}
}
}

View file

@ -25,6 +25,12 @@ qt_add_qml_module(hyprland-update-screen
QML_FILES main.qml dialogMain.qml 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 target_link_libraries(hyprland-update-screen PRIVATE
Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
) )

View 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

View file

@ -45,7 +45,7 @@ int main(int argc, char* argv[]) {
app.setApplicationDisplayName("Hyprland Updated"); app.setApplicationDisplayName("Hyprland Updated");
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("org.kde.desktop"); QQuickStyle::setStyle("org.hyprland.style");
// This entire mechanism fucking sucks, // 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. // but I also suck at qml and I want to avoid spawning a new process as it takes a while.

View file

@ -80,6 +80,10 @@ ApplicationWindow {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
Button { Button {
icon.color: "transparent"
icon.source: "qrc:/assets/heart.svg"
icon.height: 18
icon.width: 18
text: "Support the project" text: "Support the project"
onClicked: (e) => { onClicked: (e) => {
updateScreen.onButtonPress("donate"); updateScreen.onButtonPress("donate");