Compare commits

..

No commits in common. "main" and "v0.1.2" have entirely different histories.
main ... v0.1.2

21 changed files with 15 additions and 359 deletions

View file

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

5
.gitignore vendored
View file

@ -33,7 +33,4 @@
build/
.cache/
.vscode/
# nix
result*
.vscode/

View file

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

View file

@ -4,12 +4,4 @@ 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`
```
This depends on qt6 and qt6-qml, as well as qqc2-desktop-style from KDE.

View file

@ -1 +1 @@
0.1.4
0.1.2

View file

@ -1,72 +1,20 @@
{
"nodes": {
"hyprland-qt-support": {
"inputs": {
"hyprlang": [
"hyprlang"
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1737634706,
"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=",
"lastModified": 1734796073,
"narHash": "sha256-TnuKsa8OHrSJEmHm3TLGOWbPNA1gRjmZLsRzKrCqOsg=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "006620eb29d54ea9086538891404c78563d1bae1",
"rev": "c3331116ebd0b71df5ae8c6efe9a7f94148b03bf",
"type": "github"
},
"original": {
@ -77,11 +25,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1737632463,
"narHash": "sha256-38J9QfeGSej341ouwzqf77WIHAScihAKCt8PQJ+NH28=",
"lastModified": 1734649271,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0aa475546ed21629c4f5bbf90e38c846a99ec9e9",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"type": "github"
},
"original": {
@ -93,12 +41,7 @@
},
"root": {
"inputs": {
"hyprland-qt-support": "hyprland-qt-support",
"hyprlang": "hyprlang",
"hyprutils": [
"hyprlang",
"hyprutils"
],
"hyprutils": "hyprutils",
"nixpkgs": "nixpkgs",
"systems": "systems"
}

View file

@ -5,17 +5,8 @@
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";
hyprutils = {
url = "github:hyprwm/hyprutils";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
};
@ -43,12 +34,5 @@
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;
};
});
};
}

View file

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

View file

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

View file

@ -1,26 +0,0 @@
{
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);
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("org.hyprland.style");
QQuickStyle::setStyle("org.kde.desktop");
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("dialog", dialog);

View file

@ -1,42 +0,0 @@
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

@ -1,19 +0,0 @@
#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

@ -1,20 +0,0 @@
#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

@ -1,4 +0,0 @@
<?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>

Before

Width:  |  Height:  |  Size: 698 B

View file

@ -1,30 +0,0 @@
#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

@ -1,102 +0,0 @@
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,12 +25,6 @@ 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
)

View file

@ -1,4 +0,0 @@
<?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>

Before

Width:  |  Height:  |  Size: 698 B

View file

@ -45,7 +45,7 @@ int main(int argc, char* argv[]) {
app.setApplicationDisplayName("Hyprland Updated");
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("org.hyprland.style");
QQuickStyle::setStyle("org.kde.desktop");
// 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.

View file

@ -80,10 +80,6 @@ ApplicationWindow {
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");