misc: add makefile and remove unused import

This commit is contained in:
Sabarigirish Manikandan 2026-03-01 15:21:02 +05:30
parent 833eb85d05
commit ef4e28ce77
3 changed files with 41 additions and 16 deletions

18
Makefile Normal file
View file

@ -0,0 +1,18 @@
PREFIX = /usr
release:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
clear:
rm -rf build
all:
$(MAKE) clear
$(MAKE) release
install:
cmake --install ./build
uninstall:
xargs rm < ./build/install_manifest.txt

View file

@ -1,10 +1,12 @@
# hypridle
Hyprland's idle daemon
## Features
- based on the `ext-idle-notify-v1` wayland protocol
- support for dbus' loginctl commands (lock / unlock / before-sleep)
- support for dbus' inhibit (used by e.g. firefox / steam)
- based on the `ext-idle-notify-v1` wayland protocol
- support for dbus' loginctl commands (lock / unlock / before-sleep)
- support for dbus' inhibit (used by e.g. firefox / steam)
## Configuration
@ -32,22 +34,25 @@ You can add as many listeners as you please. Omitting `on-timeout` or `on-resume
will make those events ignored.
## Dependencies
- wayland
- wayland-protocols
- hyprland-protocols
- hyprlang >= 0.4.0
- sdbus-c++
- hyprwayland-scanner
- wayland
- wayland-protocols
- hyprland-protocols
- hyprlang >= 0.4.0
- sdbus-c++
- hyprwayland-scanner
## Building & Installation
### Building:
```sh
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
```
### Installation:
```sh
sudo cmake --install build
```
@ -56,10 +61,13 @@ sudo cmake --install build
Hypridle should ideally be launched after logging in. This can be done by your compositor or by systemd.
For example, for Hyprland, use the following in your `hyprland.conf`.
```hyprlang
exec-once = hypridle
```
If, instead, you want to have systemd do this for you, you'll just need to enable the service using
```sh
systemctl --user enable --now hypridle.service
```

View file

@ -2,7 +2,6 @@
#include "Hypridle.hpp"
#include "../helpers/Log.hpp"
#include "../config/ConfigManager.hpp"
#include "csignal"
#include <sys/wait.h>
#include <sys/poll.h>
#include <sys/mman.h>
@ -453,8 +452,8 @@ static void handleDbusBlockInhibitsPropertyChanged(sdbus::Message msg) {
}
static uint32_t handleDbusScreensaver(std::string app, std::string reason, uint32_t cookie, bool inhibit, const char* sender) {
std::string ownerID = sender;
bool cookieFound = false;
std::string ownerID = sender;
bool cookieFound = false;
if (!inhibit) {
Debug::log(TRACE, "Read uninhibit cookie: {}", cookie);
@ -462,9 +461,9 @@ static uint32_t handleDbusScreensaver(std::string app, std::string reason, uint3
if (COOKIE.cookie == 0) {
Debug::log(WARN, "No cookie in uninhibit");
} else {
app = COOKIE.app;
reason = COOKIE.reason;
ownerID = COOKIE.ownerID;
app = COOKIE.app;
reason = COOKIE.reason;
ownerID = COOKIE.ownerID;
cookieFound = true;
if (!g_pHypridle->unregisterDbusInhibitCookie(COOKIE))