Skip to content

Commit acc5257

Browse files
committed
feat: hyprland qt utils
1 parent dcccb0c commit acc5257

File tree

6 files changed

+304
-20
lines changed

6 files changed

+304
-20
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} aquamarine
9090
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprland-protocols
9191
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprland-qt-support
92+
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprland-qtutils
9293
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprpolkitagent
9394
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprsysteminfo
9495
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprpaper
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
diff --git a/utils/dialog/CMakeLists.txt b/utils/dialog/CMakeLists.txt
2+
index ad7ae44..5611a34 100644
3+
--- a/utils/dialog/CMakeLists.txt
4+
+++ b/utils/dialog/CMakeLists.txt
5+
@@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient)
8+
find_package(PkgConfig REQUIRED)
9+
+find_package(fmt REQUIRED)
10+
11+
pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils)
12+
13+
@@ -24,7 +25,7 @@ qt_add_qml_module(hyprland-dialog
14+
)
15+
16+
target_link_libraries(hyprland-dialog PRIVATE
17+
- Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
18+
+ Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils fmt::fmt
19+
)
20+
21+
22+
diff --git a/utils/dialog/Dialog.cpp b/utils/dialog/Dialog.cpp
23+
index 8b161c7..73465e2 100644
24+
--- a/utils/dialog/Dialog.cpp
25+
+++ b/utils/dialog/Dialog.cpp
26+
@@ -1,5 +1,5 @@
27+
#include "Dialog.hpp"
28+
-#include <print>
29+
+#include <fmt/core.h>
30+
#include <hyprutils/string/String.hpp>
31+
using namespace Hyprutils::String;
32+
33+
@@ -8,6 +8,6 @@ CDialog::CDialog(QObject* parent) : QObject(parent) {
34+
}
35+
36+
void CDialog::onButtonPress(QString buttonName) {
37+
- std::print("{}\n", trim(buttonName.toStdString()));
38+
+ fmt::print("{}\n", trim(buttonName.toStdString()));
39+
exit(0);
40+
}
41+
diff --git a/utils/dialog/main.cpp b/utils/dialog/main.cpp
42+
index 7fd3c75..b15f0ad 100644
43+
--- a/utils/dialog/main.cpp
44+
+++ b/utils/dialog/main.cpp
45+
@@ -1,6 +1,6 @@
46+
#include "Dialog.hpp"
47+
#include <hyprutils/string/VarList.hpp>
48+
-#include <print>
49+
+#include <fmt/core.h>
50+
#include <qapplication.h>
51+
#include <qqmlapplicationengine.h>
52+
#include <qquickstyle.h>
53+
@@ -21,7 +21,7 @@ int main(int argc, char* argv[]) {
54+
55+
if (arg == "--title") {
56+
if (i + 1 >= argc) {
57+
- std::print(stderr, "--title requires a parameter\n");
58+
+ fmt::print(stderr, "--title requires a parameter\n");
59+
return 1;
60+
}
61+
62+
@@ -33,7 +33,7 @@ int main(int argc, char* argv[]) {
63+
64+
if (arg == "--apptitle") {
65+
if (i + 1 >= argc) {
66+
- std::print(stderr, "--apptitle requires a parameter\n");
67+
+ fmt::print(stderr, "--apptitle requires a parameter\n");
68+
return 1;
69+
}
70+
71+
@@ -45,7 +45,7 @@ int main(int argc, char* argv[]) {
72+
73+
if (arg == "--text") {
74+
if (i + 1 >= argc) {
75+
- std::print(stderr, "--text requires a parameter\n");
76+
+ fmt::print(stderr, "--text requires a parameter\n");
77+
return 1;
78+
}
79+
80+
@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
81+
82+
if (arg == "--buttons") {
83+
if (i + 1 >= argc) {
84+
- std::print(stderr, "--buttons requires a parameter\n");
85+
+ fmt::print(stderr, "--buttons requires a parameter\n");
86+
return 1;
87+
}
88+
89+
@@ -71,7 +71,7 @@ int main(int argc, char* argv[]) {
90+
continue;
91+
}
92+
93+
- std::print(stderr, "invalid arg {}\n", argv[i]);
94+
+ fmt::print(stderr, "invalid arg {}\n", argv[i]);
95+
return 1;
96+
}
97+
98+
diff --git a/utils/donate-screen/CMakeLists.txt b/utils/donate-screen/CMakeLists.txt
99+
index cad04e6..9d9ff0f 100644
100+
--- a/utils/donate-screen/CMakeLists.txt
101+
+++ b/utils/donate-screen/CMakeLists.txt
102+
@@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
103+
104+
find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient)
105+
find_package(PkgConfig REQUIRED)
106+
+find_package(fmt REQUIRED)
107+
108+
pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils)
109+
110+
@@ -24,7 +25,7 @@ qt_add_qml_module(hyprland-donate-screen
111+
)
112+
113+
target_link_libraries(hyprland-donate-screen PRIVATE
114+
- Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
115+
+ Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils fmt::fmt
116+
)
117+
118+
119+
diff --git a/utils/donate-screen/DonateScreen.cpp b/utils/donate-screen/DonateScreen.cpp
120+
index 66c3ac5..05e3b29 100644
121+
--- a/utils/donate-screen/DonateScreen.cpp
122+
+++ b/utils/donate-screen/DonateScreen.cpp
123+
@@ -1,6 +1,6 @@
124+
#include "DonateScreen.hpp"
125+
126+
-#include <print>
127+
+#include <fmt/core.h>
128+
#include <QDesktopServices>
129+
130+
#include <hyprutils/string/String.hpp>
131+
diff --git a/utils/donate-screen/main.cpp b/utils/donate-screen/main.cpp
132+
index 48f8ca1..258c06a 100644
133+
--- a/utils/donate-screen/main.cpp
134+
+++ b/utils/donate-screen/main.cpp
135+
@@ -1,6 +1,6 @@
136+
#include "DonateScreen.hpp"
137+
#include <hyprutils/string/VarList.hpp>
138+
-#include <print>
139+
+#include <fmt/core.h>
140+
#include <qapplication.h>
141+
#include <qqmlapplicationengine.h>
142+
#include <qquickstyle.h>
143+
diff --git a/utils/update-screen/CMakeLists.txt b/utils/update-screen/CMakeLists.txt
144+
index 17d2096..e43486c 100644
145+
--- a/utils/update-screen/CMakeLists.txt
146+
+++ b/utils/update-screen/CMakeLists.txt
147+
@@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
148+
149+
find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2 WaylandClient)
150+
find_package(PkgConfig REQUIRED)
151+
+find_package(fmt REQUIRED)
152+
153+
pkg_check_modules(hyprutils REQUIRED IMPORTED_TARGET hyprutils)
154+
155+
@@ -26,7 +27,7 @@ qt_add_qml_module(hyprland-update-screen
156+
)
157+
158+
target_link_libraries(hyprland-update-screen PRIVATE
159+
- Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils
160+
+ Qt6::Widgets Qt6::QuickControls2 Qt6::WaylandClientPrivate PkgConfig::hyprutils fmt::fmt
161+
)
162+
163+
164+
diff --git a/utils/update-screen/UpdateScreen.cpp b/utils/update-screen/UpdateScreen.cpp
165+
index 71ddb67..d1a287d 100644
166+
--- a/utils/update-screen/UpdateScreen.cpp
167+
+++ b/utils/update-screen/UpdateScreen.cpp
168+
@@ -1,6 +1,6 @@
169+
#include "UpdateScreen.hpp"
170+
171+
-#include <print>
172+
+#include <fmt/core.h>
173+
#include <QDesktopServices>
174+
175+
#include <hyprutils/string/String.hpp>
176+
diff --git a/utils/update-screen/main.cpp b/utils/update-screen/main.cpp
177+
index 6885efa..11a5bb7 100644
178+
--- a/utils/update-screen/main.cpp
179+
+++ b/utils/update-screen/main.cpp
180+
@@ -1,6 +1,6 @@
181+
#include "UpdateScreen.hpp"
182+
#include <hyprutils/string/VarList.hpp>
183+
-#include <print>
184+
+#include <fmt/core.h>
185+
#include <qapplication.h>
186+
#include <qqmlapplicationengine.h>
187+
#include <qquickstyle.h>
188+
@@ -21,7 +21,7 @@ int main(int argc, char* argv[]) {
189+
190+
if (arg == "--new-version") {
191+
if (i + 1 >= argc) {
192+
- std::println(stderr, "--new-version requires a parameter");
193+
+ fmt::print(stderr, "--new-version requires a parameter");
194+
return 1;
195+
}
196+
197+
@@ -31,12 +31,12 @@ int main(int argc, char* argv[]) {
198+
continue;
199+
}
200+
201+
- std::println(stderr, "invalid arg {}", argv[i]);
202+
+ fmt::print(stderr, "invalid arg {}", argv[i]);
203+
return 1;
204+
}
205+
206+
if (dialog->newVersion.isEmpty()) {
207+
- std::println(stderr, "missing --new-version");
208+
+ fmt::print(stderr, "missing --new-version");
209+
return 1;
210+
}
211+

srcpkgs/hyprland-qtutils/template

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Template file for 'hyprland-qtutils'
2+
pkgname=hyprland-qtutils
3+
version=0.1.3
4+
revision=1
5+
build_style=cmake
6+
configure_args=" --no-warn-unused-cli -DCMAKE_BUILD_TYPE=Release"
7+
hostmakedepends="cmake pkg-config"
8+
makedepends="
9+
hyprutils-devel
10+
hyprland-qt-support
11+
qt6-base-devel
12+
qt6-wayland-devel
13+
qt6-declarative-devel
14+
qt6-tools-devel
15+
"
16+
depends="
17+
hyprland-qt-support
18+
"
19+
short_desc="Qt/QML utility apps for Hyprland"
20+
maintainer="hesam-init <hesam.init@gmail.com>"
21+
license="BSD-3-Clause"
22+
homepage="https://github.com/hyprwm/hyprland-qtutils"
23+
distfiles="https://github.com/hyprwm/hyprland-qtutils/archive/refs/tags/v${version}.tar.gz"
24+
checksum="3e57617ebd849ebf074c492bf828efa37a5b47fd6d43b392462874069170c5ed"
25+
26+
build_options="clang gcc"
27+
build_options_default="gcc"
28+
desc_option_clang="Use clang to build"
29+
desc_option_gcc="Use gcc to build"
30+
31+
if [ "$build_option_gcc" ]; then
32+
hostmakedepends+=" gcc"
33+
makedepends+=" libgcc-devel fmt-devel"
34+
fi
35+
36+
if [ "$build_option_clang" ]; then
37+
hostmakedepends+=" clang19"
38+
makedepends+=" libcxx libcxx-devel libcxxabi libcxxabi-devel"
39+
fi
40+
41+
_apply_patch() {
42+
local args="$1" pname="$(basename $2)"
43+
44+
if [ ! -f ".${pname}_done" ]; then
45+
patch -N $args -i $2
46+
touch .${pname}_done
47+
fi
48+
}
49+
50+
pre_configure() {
51+
if [ "$build_option_gcc" ]; then
52+
_apply_patch -p1 ${FILESDIR}/gcc.patch
53+
fi
54+
55+
if [ "$build_option_clang" ]; then
56+
export CC=clang
57+
export CXX=clang++
58+
59+
configure_args+=" -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_FLAGS=-stdlib=libc++"
60+
fi
61+
}
62+
63+
post_install() {
64+
vlicense LICENSE
65+
}

srcpkgs/hyprland/files/gcc.patch

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,23 +1040,3 @@ index 464ed97..81076c0 100644
10401040
return 1;
10411041
}
10421042

1043-
diff --git a/src/version.h b/src/version.h
1044-
index e0cbb8a..e346047 100644
1045-
--- a/src/version.h
1046-
+++ b/src/version.h
1047-
@@ -1,8 +1,8 @@
1048-
#pragma once
1049-
-#define GIT_COMMIT_HASH "882f7ad7d2bbfc7440d0ccaef93b1cdd78e8e3ff"
1050-
-#define GIT_BRANCH ""
1051-
-#define GIT_COMMIT_MESSAGE " version: bump to 0.47.2"
1052-
-#define GIT_COMMIT_DATE "Sun Feb 2 00:47:17 2025"
1053-
-#define GIT_DIRTY ""
1054-
-#define GIT_TAG "v0.47.2"
1055-
-#define GIT_COMMITS "5767"
1056-
+#define GIT_COMMIT_HASH "869e9b1edb7dd01837c541f383e17489220ca731"
1057-
+#define GIT_BRANCH "master"
1058-
+#define GIT_COMMIT_MESSAGE "VoidLinux Build"
1059-
+#define GIT_COMMIT_DATE "Thu Mar 6 21:38:25 2025"
1060-
+#define GIT_DIRTY "dirty"
1061-
+#define GIT_TAG "0.47.0"
1062-
+#define GIT_COMMITS "1"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/scripts/generateVersion.sh b/scripts/generateVersion.sh
2+
index fdcc471..f67035a 100755
3+
--- a/scripts/generateVersion.sh
4+
+++ b/scripts/generateVersion.sh
5+
@@ -1,13 +1,13 @@
6+
#!/bin/sh
7+
cp -fr ./src/version.h.in ./src/version.h
8+
9+
-HASH=${HASH-$(git rev-parse HEAD)}
10+
-BRANCH=${BRANCH-$(git branch --show-current)}
11+
-MESSAGE=${MESSAGE-$(git show | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')}
12+
-DATE=${DATE-$(git show --no-patch --format=%cd --date=local)}
13+
-DIRTY=${DIRTY-$(git diff-index --quiet HEAD -- || echo dirty)}
14+
-TAG=${TAG-$(git describe --tags)}
15+
-COMMITS=${COMMITS-$(git rev-list --count HEAD)}
16+
+HASH="882f7ad7d2bbfc7440d0ccaef93b1cdd78e8e3ff"
17+
+BRANCH="master"
18+
+MESSAGE="VoidLinux Build"
19+
+DATE="2025"
20+
+DIRTY="No"
21+
+TAG="0.47.2"
22+
+COMMITS=""
23+
24+
sed -i -e "s#@HASH@#${HASH}#" ./src/version.h
25+
sed -i -e "s#@BRANCH@#${BRANCH}#" ./src/version.h

srcpkgs/hyprland/template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ _apply_patch() {
104104
}
105105

106106
pre_configure() {
107+
_apply_patch -p1 ${FILESDIR}/version.patch
108+
107109
if [ "$build_option_gcc" ]; then
108110
_apply_patch -p1 ${FILESDIR}/gcc.patch
109111
fi

0 commit comments

Comments
 (0)