
HyprIdle is a dynamic tool tailored for managing idle states in systems using the HyprLand compositor.
What is HyprIdle?
HyprIdle is a simple application that controls idle states in environments powered by the HyprLand compositor. It plays a key role in energy conservation by adjusting the screen state when your system is idle. For example, users can see up to a 20% reduction in energy usage by leveraging these features, especially if their systems are left unattended for extended periods.
Installation of HyprIdle
To begin using HyprIdle, you will need to install it. The steps will vary depending on your Linux distribution.
In Arch-based Systems:
Open your terminal.
Enter the following command to install HyprIdle:
sudo pacman -S hypridle
In Fedora-based Systems:
Open your terminal
Enter the following command to install Hypridle:
sudo dnf install hypridle
In other distros:
The result may vary.
The hyprland's ecosystem does not work very well in Debian-stable distributions because the packages are outdated.
In other distributions you should check with the package manager first.
If not in the official repo(s) you may need to build it by yourself.
Configuring HyprIdle
Once installed, it’s time to configure HyprIdle to your liking. This application offers various options allowing you to adjust its behavior effectively.
Basic Configuration
HyprIdle uses a configuration file typically found at `~/.config/hyprland/hypridle.conf`. If this file is not already present, you can create it:
touch ~/.config/hyprland/hypridle.conf
Open this configuration file with your preferred text editor (nano, vim, gedit, xed etc)
Configurable Options
Within the configuration file, you can modify parameters to control the idle behavior:
idle_timeout: This sets the duration in seconds before the system is deemed idle. For example, setting this to 300 means HyprIdle will wait for 5 minutes before acting.
idle_timeout=300
screen_off_command: This command determines what happens when entering idle state. For example, you could turn off the display:
screen_off_command=turn_off_display_command
wake_up_command: This command is executed when the system wakes up from idle. You might set it to activate the display:
wake_up_command=turn_on_display_command
Personalize these options according to your habits and preferences for effective results.
A simple configuration example
The below example is simple "hypridle.conf" file that:
start a lock screen application ( "hyprlock" ) after 600 seconds
show a black screen after 660 seconds
You can copy and paste it into your ~/.config/hypr/hypridle.conf file.
All the lines starting with # are comments.
# ~/.config/hypr/hypridle.conf
general {
# set the command to lock the screen and avoid
# running mutliple instances of it.
lock_cmd = pidof hyprlock || hyprlock
# set the command to lock the session before sleep
before_sleep_cmd = loginctl lock-session
# avoid having to press a key twice to turn on the display
after_sleep_cmd = hyprctl dispatch dpms on
}
# event handlers (or 'listeners')
# event that locks the session
listener {
timeout = 600
on-timeout = loginctl lock-session
}
# even that turns your screen black and turn it on
# when a key or a mouse button is pressed
listener {
timeout = 660
# when the timeout is reached it turns the screen black
on-timeout = hyprctl dispatch dpms off
# when pressing a key or a mouse button, the screen is
# turned on
on-resume = hyprctl dispatch dpms on
}
There are more "listeners" (event handlers) that can be used in Hypridle.
You can configure an event also for the 'suspend' action.
For further details check the hypridle webpage here.
Using Hypridle with systemd
Hypridle installs a systemd service in your system that can be used to enable and start the service.
Enable the Hypridle service
To start the HyprIdle service and set it to enable at system boot:
Open your terminal
Enter the following command to enable the Hypridle service:
systemctl --user enable hypridle.service
Starting the Hypridle service
To start the HyprIdle daemon:
Open your terminal
Enter the following command to start the Hypridle daemon:
systemctl --user start hypridle.service
Setting up Hypridle in your Hyprland configuration
The hypridle service should be started each time hyprland starts.
In order to do so you need to add the following command to the ~/.config/hypr/hyprland.conf file
Open the ~/.config/hypr/hypr/hyprland.conf file with your text editor of choice
Add the following line to the file
systemctl start hypridle
Save the file and restart Hyprland
This addition makes sure that HyprIdle is always running, enhancing your idle state management.
Testing Your Setup
Once you finish configuring, it's essential to test whether HyprIdle performs well.
Simulate Idle Conditions: Allow your system to remain idle for the duration set in your configuration. Monitor whether the commands trigger as expected.
Check Logs: If any issues arise, check the service status and logs for troubleshooting:
systemctl status hypridle.service
journalctl -u hypridle.service
Final Thoughts
If configured correctly, HyprIdle is a useful tool to optimize the idle state and the power consumption of your system.
Comments