Skip to content

Instantly share code, notes, and snippets.

@ooonea
Created June 12, 2022 14:29
Show Gist options
  • Save ooonea/ff54c7b51755858560efe08e688af77e to your computer and use it in GitHub Desktop.
Save ooonea/ff54c7b51755858560efe08e688af77e to your computer and use it in GitHub Desktop.
#!/bin/sh
revert() {
xset dpms 0 0 0
}
trap revert HUP INT TERM
xset +dpms dpms 5 5 5
i3lock -n
revert
@wwalker
Copy link

wwalker commented Jun 13, 2022

Nice little wrapper script!

line 2-4 - revert() function, which sets all DPMS (Display Power Management System) functions to OFF
line 5 - if the program is interrupted (e.g., by kill, or by the terminal it is running in dying (HUP (Hang Up)) call the revert() function
line 6 - turns on DPMS to suspend, standby, and power to all trigger at 5 minutes
line 7 - runs the i3lock screen locker
line 8 - when i3lock has exited (e.g., someone entered the password) run revert to disable DPMS (so the screen never turns off or standby or suspends while you are working)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment