- Clone/Download the project
- Copy
pause-auto-sleep
to/home/YOUR_USERNAME/.local/bin/pause-auto-sleep
mkdir -p ~/.local/bin/ && cp pause-auto-sleep ~/.local/bin/pause-auto-sleep
- Make
pause-auto-sleep
executable
chmod u+x ~/.local/bin/pause-auto-sleep
1. With application_name + reason_for_inhibit:
pause-auto-sleep "application_name or desktop.entry.name" "reason for inhibit"
To show the app icon and name in the Plasma's Battery and Brightness widget "application_name" should be set to the program name or desktop entry name. To get a program desktop entry name use the following command:
ls /usr/share/applications .local/share/applications/ | grep -i YOUR_PROGRAM_NAME
Example:
pause-auto-sleep org.kde.konsole "SSH session"
2. Without arguments (Toggle mode):
When running without arguments:
- application willl be set as "User"
- reason will be set as "Manually enabled"
If the script is run a second time, it will look for existing inhibitor process and stop it, ending the inhibition
Example:
pause-auto-sleep & # run in background
3. As a shortcut:
In KDE Plasma
- Go to System Settings > Shortcuts
- Click + Add command...
- Enter
/home/YOUR_USERNAME/.local/bin/pause-auto-sleep
in the command text box (replace YOUR_USERNAME with yours) - Click + Add
- Click + Add custom shortcut in the next view and type your shortcut
- Hit Apply
- Test your shortcut while looking at the Batter and Brightness or Display Configuration widget
Note: If you're using a version of KDE Plasma older/newer than 2.27.5 those steps may be different
In GNOME
- Go to Settings > Keyboard
- Click View and Customize Shortcuts under Keyboard Shortcuts
- Click Custom Shortcuts > Add Shortcut
- Set a descriptive name
- Enter
/home/YOUR_USERNAME/.local/bin/pause-auto-sleep
in the command text box (replace YOUR_USERNAME with yours) - Click Set Shortcut... and type your shortcut
- Click on Add
- Test your shortcut, this was tested and working in GNOME 43.0, I don't know if there is a visual indicator for this, it there isn't you can test by waiting for your screen to blank (not to blank in this case)
Note: If you're using a version of GNOME older/newer than 43.0 those steps may be different