diff options
author | Sourav Das <souravdas142@gmail.com> | 2021-06-07 03:43:44 +0530 |
---|---|---|
committer | Sebastian Sellmeier <mail@sebastian-sellmeier.de> | 2021-07-21 01:03:46 +0200 |
commit | 321b8e8c5fbf494e559be014ca02a55df106dea3 (patch) | |
tree | 12083fa6dbeb70cc0f8fa5bb7143fc3253a5f3d1 /betterlockscreen | |
parent | a64ce8f441e16b11a9acf9336e3e84f4f0fd05b5 (diff) |
Don't change state of dunst on unlock if paused on lock (#233)
* Fix: Don't change state of dunst on unlock if paused on lock (credits to @souravdas142)
Diffstat (limited to 'betterlockscreen')
-rwxr-xr-x | betterlockscreen | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/betterlockscreen b/betterlockscreen index c9152ad..84974b3 100755 --- a/betterlockscreen +++ b/betterlockscreen @@ -40,6 +40,9 @@ init_config () { wallpaper_cmd="feh --bg-fill --no-fehbg" time_format="%H:%M:%S" + # Storing current state of dunst before locking + dunst_paused_state="$(dunstctl is-paused)" + # read user config USER_CONF="$HOME/.config/betterlockscreenrc" if [ -e "$USER_CONF" ]; then @@ -82,8 +85,8 @@ prelock() { if [ "$DEFAULT_DPMS" == "Enabled" ]; then xset dpms "$lock_timeout" fi - # pause dunst - if command -v dunstctl &>/dev/null + # If dusnt is already paused don't pause it again + if [[ -e "$(command -v dunstctl)" && "$dunst_paused_state" == "false" ]] then dunstctl set-paused true fi @@ -149,8 +152,8 @@ postlock() { xset dpms "$DEFAULT_TIMEOUT" fi - # unpause dunst - if command -v dunstctl &>/dev/null + # If dunst already paused before locking don't unpause dunst + if [[ -e "$(command -v dunstctl)" && "$dunst_paused_state" == "false" ]] then dunstctl set-paused false fi |