From 7dd83ed6e9c61021a5111b3312f3b2f0ccf90a3a Mon Sep 17 00:00:00 2001 From: Drew Walters Date: Sat, 23 Dec 2017 22:33:52 -0600 Subject: [PATCH] Add suspend and lock support (#20) --- README.md | 30 ++++++++++++++++++++++++++++++ betterlockscreen | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/README.md b/README.md index 42bfe3a..9e381ff 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ Make sure you have following packages installed. * [xrandr](https://www.x.org/wiki/Projects/XRandR/) - depends for xdpyinfo * [background.jpg](https://unsplash.com/) - find your fav background image +*Note: systemd is required for the suspend feature.* + ### Arch users To install required packages @@ -154,6 +156,34 @@ betterlockscreen -l dimblur --- +### To suspend system with lockscreen + +Original image as background + +``` +betterlockscreen -s +``` + +Use dimmed image as lockscreen background + +``` +betterlockscreen -s dim +``` + +Use blurred image as lockscreen background + +``` +betterlockscreen -s blur +``` + +Use dim + blurred image as lockscreen background + +``` +betterlockscreen -s dimblur +``` + +--- + ### To set wallpaper Original Image diff --git a/betterlockscreen b/betterlockscreen index a37e31d..b585675 100755 --- a/betterlockscreen +++ b/betterlockscreen @@ -132,6 +132,14 @@ case "$1" in echo " Ex: betterlockscreen -l dimblur (for dimmed + blurred background)" echo echo + echo " -s --suspend" + echo " to suspend system and lock screen, Ex. betterlockscreen -s" + echo " you can also use dimmed or blurred background for lockscreen" + echo " Ex: betterlockscreen -s dim (for dimmed background)" + echo " Ex: betterlockscreen -s blur (for blurred background)" + echo " Ex: betterlockscreen -s dimblur (for dimmed + blurred background)" + echo + echo echo " -w --wall" echo " you can also set lockscreen background as wallpaper" echo " to set wallpaper. Ex betterlockscreen -w or betterlockscreen --wall" @@ -174,6 +182,39 @@ case "$1" in esac ;; + -s | --suspend) + case "$2" in + "") + # default lockscreen + prelock + systemctl suspend && lock "$l_resized" + postlock + ;; + + dim) + # lockscreen with dimmed background + prelock + systemctl suspend && lock "$l_dim" + postlock + ;; + + blur) + # set lockscreen with blurred background + prelock + systemctl suspend && lock "$l_blur" + postlock + ;; + + dimblur) + # set lockscreen with dimmed + blurred background + prelock + systemctl suspend && lock "$l_dimblur" + postlock + ;; + esac + ;; + + -w | --wall) case "$2" in "")