Skip to content

luisbocanegra/linux-pause-auto-sleep-and-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Manually block sleep and screen locking from commandline or a shortcut

Battery and brightness showing sleep blocking enabled

Installation

  1. Clone/Download the project
  2. 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
  1. Make pause-auto-sleep executable
chmod u+x ~/.local/bin/pause-auto-sleep

Usage:

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

  1. Go to System Settings > Shortcuts
  2. Click + Add command...
  3. Enter /home/YOUR_USERNAME/.local/bin/pause-auto-sleep in the command text box (replace YOUR_USERNAME with yours)
  4. Click + Add
  5. Click + Add custom shortcut in the next view and type your shortcut
  6. Hit Apply
  7. 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

  1. Go to Settings > Keyboard
  2. Click View and Customize Shortcuts under Keyboard Shortcuts
  3. Click Custom Shortcuts > Add Shortcut
  4. Set a descriptive name
  5. Enter /home/YOUR_USERNAME/.local/bin/pause-auto-sleep in the command text box (replace YOUR_USERNAME with yours)
  6. Click Set Shortcut... and type your shortcut
  7. Click on Add
  8. 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

Demo

demo.mp4

Credits & Resources

About

Manually block auto suspend and screen locking from commandline or a keyboard shortcut

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages