Skip to content

Commit bdd913e

Browse files
committed
feat: hypridle and hyprlock
1 parent 20805fa commit bdd913e

File tree

6 files changed

+165
-11
lines changed

6 files changed

+165
-11
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
# ./xbps-src pkg -j$(nproc) -m masterdir-x86_64 libtoml++
8080
# ./xbps-src pkg -j$(nproc) -m masterdir-x86_64 libspng
8181
# ./xbps-src pkg -j$(nproc) -m masterdir-x86_64 glaze
82-
# ./xbps-src pkg -j$(nproc) -m masterdir-x86_64 sdbus-cpp
82+
./xbps-src pkg -j$(nproc) -m masterdir-x86_64 sdbus-cpp
8383
ls -la
8484
8585
- name: build packages
@@ -92,8 +92,8 @@ jobs:
9292
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} aquamarine
9393
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprland-protocols
9494
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprpaper
95-
# ./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprlock
96-
# ./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hypridle
95+
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprlock
96+
./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hypridle
9797
# ./xbps-src pkg -j$(nproc) -m masterdir-${{ matrix.arch }} hyprland
9898
9999
- name: show built packages
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 3d60b42..279447e 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -26,7 +26,7 @@ include(GNUInstallDirs)
6+
set(CMAKE_CXX_STANDARD 23)
7+
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value
8+
-Wno-missing-field-initializers -Wno-narrowing)
9+
-configure_file(systemd/hypridle.service.in systemd/hypridle.service @ONLY)
10+
+# configure_file(systemd/hypridle.service.in systemd/hypridle.service @ONLY)
11+
12+
# dependencies
13+
message(STATUS "Checking deps...")
14+
@@ -90,8 +90,8 @@ protocol("staging/ext-idle-notify/ext-idle-notify-v1.xml" "ext-idle-notify-v1"
15+
16+
# Installation
17+
install(TARGETS hypridle)
18+
-install(FILES ${CMAKE_BINARY_DIR}/systemd/hypridle.service
19+
- DESTINATION "lib/systemd/user")
20+
+# install(FILES ${CMAKE_BINARY_DIR}/systemd/hypridle.service
21+
+# DESTINATION "lib/systemd/user")
22+
23+
install(
24+
FILES ${CMAKE_SOURCE_DIR}/assets/example.conf

srcpkgs/hypridle/template

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,30 @@ changelog="https://github.com/hyprwm/${pkgname}/releases"
2222
distfiles="https://github.com/hyprwm/hypridle/archive/refs/tags/v${version}.tar.gz"
2323
checksum=40ab0bc7183e880f46fcc2d24b182226a5dfd8ce7695af6c320527eccf8d7c79
2424

25-
build_options="clang"
26-
build_options_default="clang"
25+
build_options="clang gcc"
26+
build_options_default="gcc"
2727
desc_option_clang="Use clang to build"
28+
desc_option_gcc="Use gcc to build"
29+
30+
if [ "$build_option_gcc" ]; then
31+
hostmakedepends+=" gcc"
32+
makedepends+=" libgcc-devel fmt-devel"
33+
fi
2834

2935
if [ "$build_option_clang" ]; then
3036
hostmakedepends+=" clang19"
3137
makedepends+=" libcxx libcxx-devel libcxxabi libcxxabi-devel"
3238
fi
3339

40+
_apply_patch() {
41+
local args="$1" pname="$(basename $2)"
42+
43+
if [ ! -f ".${pname}_done" ]; then
44+
patch -N $args -i $2
45+
touch .${pname}_done
46+
fi
47+
}
48+
3449
pre_configure() {
3550
if [ "$build_option_clang" ]; then
3651
export CC=clang

srcpkgs/hyprlock/files/gcc.patch

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index d1cec67..cdf8e50 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -70,6 +70,7 @@ message(STATUS "Checking deps...")
6+
7+
find_package(Threads REQUIRED)
8+
find_package(PkgConfig REQUIRED)
9+
+find_package(fmt REQUIRED)
10+
find_package(OpenGL REQUIRED COMPONENTS EGL GLES3)
11+
find_package(hyprwayland-scanner 0.4.4 REQUIRED)
12+
pkg_check_modules(
13+
@@ -96,7 +97,7 @@ pkg_check_modules(
14+
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
15+
add_executable(hyprlock ${SRCFILES})
16+
target_link_libraries(hyprlock PRIVATE pam rt Threads::Threads PkgConfig::deps
17+
- OpenGL::EGL OpenGL::GLES3)
18+
+ OpenGL::EGL OpenGL::GLES3 fmt::fmt)
19+
20+
# protocols
21+
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
22+
diff --git a/src/helpers/Log.hpp b/src/helpers/Log.hpp
23+
index 00770da..ec6e68d 100644
24+
--- a/src/helpers/Log.hpp
25+
+++ b/src/helpers/Log.hpp
26+
@@ -1,7 +1,7 @@
27+
#pragma once
28+
#include <format>
29+
#include <string>
30+
-#include <print>
31+
+#include <fmt/core.h>
32+
33+
enum eLogLevel {
34+
TRACE = 0,
35+
@@ -48,7 +48,7 @@ namespace Debug {
36+
return;
37+
38+
if (level != NONE) {
39+
- std::println("[{}] {}", logLevelString(level), std::vformat(fmt, std::make_format_args(args...)));
40+
+ fmt::print("[{}] {}", logLevelString(level), std::vformat(fmt, std::make_format_args(args...)));
41+
}
42+
}
43+
};
44+
\ No newline at end of file
45+
diff --git a/src/main.cpp b/src/main.cpp
46+
index ff2bcbc..da5436c 100644
47+
--- a/src/main.cpp
48+
+++ b/src/main.cpp
49+
@@ -5,9 +5,10 @@
50+
#include "core/AnimationManager.hpp"
51+
#include <cstddef>
52+
#include <string_view>
53+
+#include <fmt/core.h>
54+
55+
void help() {
56+
- std::println("Usage: hyprlock [options]\n\n"
57+
+ fmt::print("Usage: hyprlock [options]\n\n"
58+
"Options:\n"
59+
" -v, --verbose - Enable verbose logging\n"
60+
" -q, --quiet - Disable logging\n"
61+
@@ -24,7 +25,7 @@ std::optional<std::string> parseArg(const std::vector<std::string>& args, const
62+
if (i + 1 < args.size()) {
63+
return args[++i];
64+
} else {
65+
- std::println(stderr, "Error: Missing value for {} option.", flag);
66+
+ fmt::print(stderr, "Error: Missing value for {} option.", flag);
67+
return std::nullopt;
68+
}
69+
}
70+
@@ -49,9 +50,9 @@ int main(int argc, char** argv, char** envp) {
71+
if (arg == "--version" || arg == "-V") {
72+
constexpr bool ISTAGGEDRELEASE = std::string_view(HYPRLOCK_COMMIT) == HYPRLOCK_VERSION_COMMIT;
73+
if (ISTAGGEDRELEASE)
74+
- std::println("Hyprlock version v{}", HYPRLOCK_VERSION);
75+
+ fmt::print("Hyprlock version v{}", HYPRLOCK_VERSION);
76+
else
77+
- std::println("Hyprlock version v{} (commit {})", HYPRLOCK_VERSION, HYPRLOCK_COMMIT);
78+
+ fmt::print("Hyprlock version v{} (commit {})", HYPRLOCK_VERSION, HYPRLOCK_COMMIT);
79+
80+
return 0;
81+
}
82+
@@ -84,7 +85,7 @@ int main(int argc, char** argv, char** envp) {
83+
noFadeIn = true;
84+
85+
else {
86+
- std::println(stderr, "Unknown option: {}", arg);
87+
+ fmt::print(stderr, "Unknown option: {}", arg);
88+
help();
89+
return 1;
90+
}

srcpkgs/hyprlock/template

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Template file for 'hyprlock'
22
pkgname=hyprlock
3-
version=0.4.1
3+
version=0.7.0
44
revision=1
55
build_style=cmake
66
configure_args=" --no-warn-unused-cli -DCMAKE_BUILD_TYPE=Release"
@@ -31,18 +31,37 @@ license="BSD-3-Clause"
3131
homepage="https://github.com/hyprwm/hyprlock"
3232
changelog="https://github.com/hyprwm/hyprlock/releases"
3333
distfiles="https://github.com/hyprwm/hyprlock/archive/refs/tags/v${version}.tar.gz"
34-
checksum="87531a43088cafcadf29115889f37f73ab4a8cb1e4347723dfe8d53fa0aaba60"
34+
checksum="0ee8d363cfe84bbca9b32062e34926aa713b9505927117593cc595d6e1e67cbe"
3535

36-
build_options="clang"
37-
build_options_default="clang"
36+
build_options="clang gcc"
37+
build_options_default="gcc"
3838
desc_option_clang="Use clang to build"
39+
desc_option_gcc="Use gcc to build"
40+
41+
if [ "$build_option_gcc" ]; then
42+
hostmakedepends+=" gcc"
43+
makedepends+=" libgcc-devel fmt-devel"
44+
fi
3945

4046
if [ "$build_option_clang" ]; then
4147
hostmakedepends+=" clang19"
4248
makedepends+=" libcxx libcxx-devel libcxxabi libcxxabi-devel"
4349
fi
4450

51+
_apply_patch() {
52+
local args="$1" pname="$(basename $2)"
53+
54+
if [ ! -f ".${pname}_done" ]; then
55+
patch -N $args -i $2
56+
touch .${pname}_done
57+
fi
58+
}
59+
4560
pre_configure() {
61+
if [ "$build_option_gcc" ]; then
62+
_apply_patch -p1 ${FILESDIR}/gcc.patch
63+
fi
64+
4665
if [ "$build_option_clang" ]; then
4766
export CC=clang
4867
export CXX=clang++

srcpkgs/sdbus-cpp/template

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ homepage="https://github.com/Kistler-Group/sdbus-cpp"
1313
distfiles="https://github.com/Kistler-Group/sdbus-cpp/archive/refs/tags/v${version}.tar.gz"
1414
checksum="6025e5dc6cddd532ff960d14e68ced5f42a1916b23a73fea6bcb437f06992eaf"
1515

16-
build_options="clang"
17-
build_options_default="clang"
16+
build_options="clang gcc"
17+
build_options_default="gcc"
1818
desc_option_clang="Use clang to build"
19+
desc_option_gcc="Use gcc to build"
20+
21+
if [ "$build_option_gcc" ]; then
22+
hostmakedepends+=" gcc"
23+
makedepends+=" libgcc-devel fmt-devel"
24+
fi
1925

2026
if [ "$build_option_clang" ]; then
2127
hostmakedepends+=" clang19"

0 commit comments

Comments
 (0)