Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dunst notifications are not paused as postlock directly executes #389

Closed
1 task done
I-Al-Istannen opened this issue Jun 18, 2023 · 17 comments · Fixed by #395
Closed
1 task done

Dunst notifications are not paused as postlock directly executes #389

I-Al-Istannen opened this issue Jun 18, 2023 · 17 comments · Fixed by #395
Labels

Comments

@I-Al-Istannen
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Operating system

Arch linux, 6.3.7-arch1-1

Installation method

Package Manager (from OS)

Betterlockscreen & Dependency-Versions

Betterlockscreen: version: v4.0.4 (dunst: true, feh: true)
i3lock: version 2.13.c.4 © 2010 Michael Stapelberg, © 2015 Cassandra Fox, © 2021 Raymond Li
Version: ImageMagick 7.1.1-11 Q16-HDRI x86_64 21206 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP(4.5) 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype heic jbig jng jp2 jpeg jxl lcms lqr ltdl lzma openexr pangocairo png raqm raw rsvg tiff webp wmf x xml zip zlib
Compiler: gcc (13.1)
dunst version: 1.9.2
feh version 3.10
Compile-time switches: curl exif inotify help magic stat64 verscmp xinerama 
[B] Betterlockscreen

Bug description

Locking the screen does not pause notifications. It executes the prelock (including dunstcl pause) and then directly runs the postlock (dunstcl unpause), resulting in all notifications still being displayed.

It works correctly when suspending, notifications are still paused when the computer resumes.

I am not quite sure why you are not using --nofork. I found a few issues regarding this (#28, #47), the PR said it would break notification display, but I did not find any resolution. Currently lockselect never blocks and instead always forks.
This leads to the behaviour, as

lockselect "$@"
does not wait for the lock to be dismissed.

As far as I understand the no-fork option was disabled for suspension. But the suspend command explicitly forks the lockselect method (which, as far as I can tell, it does not need to do currently. lockselect forks, the additional & doesn't do much):

lockselect "$@" &

Adding --nofork and keeping the fork (&) in the suspend case seems to fix all problems for me, but I am sure there is a good reason it is the way it is? I could manually wrap my lock command in dunstcl set-paused, but it sounds like something betterlockscreen should be doing correctly in all cases.

Steps to reproduce

  1. Display some (persistent) notifications
  2. Run betterlockscreen -l
  3. You still see all notifications on the lockscreen :(

Relevant log output

No response

@SebTM
Copy link
Collaborator

SebTM commented Aug 27, 2023

Please retry newest release, can't reproduce as I don't use betterlockscreen anymore but open to pull-requests if the issue gets confirmed.

@I-Al-Istannen
Copy link
Author

The problem still persists for me. I wonder whether I am on the only one with that problem now… This issue did not gain a single reaction as far as I can judge and that should be a relatively glaring problem.

@LAST7
Copy link

LAST7 commented Aug 31, 2023

Same issue here. My dunst is still sending notifications after locking the screen with betterlockscreen -l, even when I put dunstctl set-paused true into the custom-pre.sh, and nothing in the custom-post.sh.
I used sleep 5 && dunstctl is-paused on one terminal, and then quickly locked the screen with betterlockscreen -l on another terminal. When I was back from the lockscreen, the result indicated that dunst was in fact not paused when the screen was locked.
I have no idea why this is happening, but I do consider the post-lock function being executed right after the screen is locked as a possible cause. If so, it would be weird to me, shouldn't the post-lock function be executed after the screen is UNlocked?

I am using the newest release and bspwm btw.

@SebTM
Copy link
Collaborator

SebTM commented Aug 31, 2023

From my point of view the suggested --no-fork is already there (https://github.com/betterlockscreen/betterlockscreen/blob/next/betterlockscreen#L850), could you try out to replace line 307 (https://github.com/betterlockscreen/betterlockscreen/blob/next/betterlockscreen#L307) with this:

lockselect "$@" &

does that help?

@LAST7
Copy link

LAST7 commented Aug 31, 2023

Nope, dunst is still showing notifications after, sry about that...

Btw I have checked multiple related issues, some of them mentioned about compton like picom, but even with unredir-if-possible = true being written in picom's config file, the problem still remain.

@SebTM
Copy link
Collaborator

SebTM commented Aug 31, 2023

I don't see what/why picom/compton as compositor should have todo with dunst not pausing notifications right?

Can you place set -x at the top of betterlockscreen and post the full output for more information's please?

@LAST7
Copy link

LAST7 commented Aug 31, 2023

Sure, there you go:

+ lockargs+=(-n)
+ init_config
+ display_on=0
+ span_image=false
+ lock_timeout=300
+ fx_list=(dim blur dimblur pixel dimpixel color)
+ dim_level=40
+ blur_level=1
+ pixel_scale=10,1000
+ solid_color=333333
+ description=
+ quiet=false
+ i3lockcolor_bin=i3lock-color
+ suspend_command='systemctl suspend'
+ cmd_exists i3lock-color
+ command -v i3lock-color
+ cmd_exists i3lock
+ command -v i3lock
+ i3lockcolor_bin=i3lock
+ loginbox=00000066
+ loginshadow=00000000
+ locktext='Type password to unlock...'
+ font=sans-serif
+ ringcolor=ffffffff
+ insidecolor=00000000
+ separatorcolor=00000000
+ ringvercolor=ffffffff
+ insidevercolor=00000000
+ ringwrongcolor=ffffffff
+ insidewrongcolor=d23c3dff
+ timecolor=ffffffff
+ time_format=%H:%M:%S
+ greetercolor=ffffffff
+ layoutcolor=ffffffff
+ keyhlcolor=d23c3dff
+ bshlcolor=d23c3dff
+ veriftext=Verifying...
+ verifcolor=ffffffff
+ wrongtext='Failure!'
+ wrongcolor=d23c3dff
+ modifcolor=d23c3dff
+ bgcolor=000000ff
+ wallpaper_cmd='feh --bg-fill'
+ USER_CONF_DIR=/home/last/.config
+ USER_CONF=/home/last/.config/betterlockscreenrc
+ SYS_CONF=/etc/betterlockscreenrc
+ XDG_USER_CONF=/home/last/.config/betterlockscreen/betterlockscreenrc
+ '[' -e /etc/betterlockscreenrc ']'
+ '[' -e /home/last/.config/betterlockscreenrc ']'
+ '[' -e /home/last/.config/betterlockscreen/betterlockscreenrc ']'
+ source /home/last/.config/betterlockscreen/betterlockscreenrc
++ display_on=0
++ span_image=false
++ lock_timeout=300
++ fx_list=(dim blur dimblur pixel dimpixel color)
++ dim_level=40
++ blur_level=1
++ pixel_scale=10,1000
++ solid_color=333333
++ wallpaper_cmd='feh --bg-fill'
++ quiet=false
++ loginbox=00000066
++ loginshadow=00000000
++ locktext='Type password to unlock...'
++ font='Noto Sans'
++ ringcolor=ffffffff
++ insidecolor=00000000
++ separatorcolor=00000000
++ ringvercolor=ffffffff
++ insidevercolor=00000000
++ ringwrongcolor=ffffffff
++ insidewrongcolor=d23c3dff
++ timecolor=ffffffff
++ time_format=%H:%M:%S
++ greetercolor=ffffffff
++ layoutcolor=ffffffff
++ keyhlcolor=d23c3dff
++ bshlcolor=d23c3dff
++ veriftext=Verifying...
++ verifcolor=ffffffff
++ wrongtext='Failure!'
++ wrongcolor=d23c3dff
++ modifcolor=d23c3dff
++ bgcolor=000000ff
+ cmd_exists i3lock
+ command -v i3lock
+ VERSION=4.1.0
+ CACHE_DIR=/home/last/.cache/betterlockscreen
+ CUR_DIR=/home/last/.cache/betterlockscreen/current
+ CUR_W_RESIZE=/home/last/.cache/betterlockscreen/current/wall_resize.png
+ CUR_W_DIM=/home/last/.cache/betterlockscreen/current/wall_dim.png
+ CUR_W_BLUR=/home/last/.cache/betterlockscreen/current/wall_blur.png
+ CUR_W_DIMBLUR=/home/last/.cache/betterlockscreen/current/wall_dimblur.png
+ CUR_W_PIXEL=/home/last/.cache/betterlockscreen/current/wall_pixel.png
+ CUR_W_DIMPIXEL=/home/last/.cache/betterlockscreen/current/wall_dimpixel.png
+ CUR_W_COLOR=/home/last/.cache/betterlockscreen/current/wall_color.png
+ CUR_L_RESIZE=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ CUR_L_DIM=/home/last/.cache/betterlockscreen/current/lock_dim.png
+ CUR_L_BLUR=/home/last/.cache/betterlockscreen/current/lock_blur.png
+ CUR_L_DIMBLUR=/home/last/.cache/betterlockscreen/current/lock_dimblur.png
+ CUR_L_PIXEL=/home/last/.cache/betterlockscreen/current/lock_pixel.png
+ CUR_L_DIMPIXEL=/home/last/.cache/betterlockscreen/current/lock_dimpixel.png
+ CUR_L_COLOR=/home/last/.cache/betterlockscreen/current/lock_color.png
++ cut -d ' ' -f4
+++ xset q
+++ sed -n 25p
+ DEFAULT_TIMEOUT=600
++ xset q
++ awk '/^[[:blank:]]*DPMS is/ {print $(NF)}'
+ DEFAULT_DPMS=Enabled
+ DUNST_INSTALLED=false
++ command -v dunstctl
+ [[ -e /usr/bin/dunstctl ]]
+ DUNST_INSTALLED=true
+ DUNST_IS_PAUSED=false
+ [[ true == \t\r\u\e ]]
++ dunstctl is-paused
+ DUNST_IS_PAUSED=false
+ FEH_INSTALLED=false
++ command -v feh
+ [[ -e /usr/bin/feh ]]
+ FEH_INSTALLED=true
+ [[ -l = '' ]]
+ lockargs=()
+ for arg in "$@"
+ [[ - = \- ]]
+ case "$1" in
+ runlock=true
+ [[ '' = \- ]]
+ lockstyle=
+ shift 2
+ echof header Betterlockscreen
+ local prefix=header
+ local message=Betterlockscreen
+ case "$prefix" in
+ msgpfx='[\e[1;95mB\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;95mB\e[m] Betterlockscreen'
[B] Betterlockscreen
+ [[ -n '' ]]
+ [[ -n true ]]
+ lockinit ''
+ pgrep -u last i3lock
+ echof act 'Running prelock...'
+ local prefix=act
+ local 'message=Running prelock...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Running prelock...'
[*] Running prelock...
+ prelock
+ '[' Enabled == Enabled ']'
+ xset dpms 300
+ [[ true == \t\r\u\e ]]
+ [[ false == \f\a\l\s\e ]]
+ dunstctl set-paused true
+ '[' -e /home/last/.config/custom-pre.sh ']'
+ [[ -n '' ]]
+ lockselect ''
+ case "$1" in
+ '[' -f /home/last/.cache/betterlockscreen/current/lock_resize.png ']'
+ lock /home/last/.cache/betterlockscreen/current/lock_resize.png
+ echof act 'Locking screen...'
+ local prefix=act
+ local 'message=Locking screen...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Locking screen...'
[*] Locking screen...
+ local image=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ local fontlg=32
+ local fontmd=16
+ local fontsm=12
+ i3lock --image /home/last/.cache/betterlockscreen/current/lock_resize.png --color 000000ff --screen 0 --ind-pos=x+310:y+h-80 --radius=25 --ring-width=5 --inside-color=00000000 --ring-color=ffffffff --separator-color=00000000 --insidever-color=00000000 --insidewrong-color=d23c3dff --ringver-color=ffffffff --ringwrong-color=ffffffff --line-uses-inside --keyhl-color=d23c3dff --bshl-color=d23c3dff --clock --force-clock --time-pos=ix-265:iy-10 --time-align 1 --time-str %H:%M:%S --time-color=ffffffff '--time-font=Noto Sans' --time-size=32 --date-str '' --greeter-pos=ix-265:iy+12 --greeter-align 1 --greeter-text 'Type password to unlock...' --greeter-color=ffffffff '--greeter-font=Noto Sans' --greeter-size=16 --layout-pos=ix-265:iy+32 --layout-align 1 --layout-color=ffffffff '--layout-font=Noto Sans' --layout-size=12 --verif-pos=ix+35:iy-34 --verif-align 2 --verif-text=Verifying... --verif-color=ffffffff '--verif-font=Noto Sans' --verif-size=12 --wrong-pos=ix+24:iy-34 --wrong-align 2 '--wrong-text=Failure!' --wrong-color=d23c3dff '--wrong-font=Noto Sans' --wrong-size=12 --modif-pos=ix+45:iy+43 --modif-align 2 --modif-size=12 --modif-color=d23c3dff --noinput-text= --pass-media-keys --pass-screen-keys --pass-volume-keys --pass-power-keys
+ echof act 'Running postlock...'
+ local prefix=act
+ local 'message=Running postlock...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Running postlock...'
[*] Running postlock...
+ postlock
+ '[' Enabled == Enabled ']'
+ xset dpms 600
+ [[ true == \t\r\u\e ]]
+ [[ false == \f\a\l\s\e ]]
+ dunstctl set-paused false
+ '[' -e /home/last/.config/custom-post.sh ']'
+ exit 0

Whats more, if I manually pause dunst with dunstctl set-paused true and then lock the screen with betterlockscreen -l, then its done, no notification on the lockscreen anymore. Btw writing that command into custom-pre.sh does not help as well.

@SebTM
Copy link
Collaborator

SebTM commented Aug 31, 2023

Can you add date output to prelock and postlock and wait between locking and unlocking around 15-30 seconds and repost the logs?

I want to ensure if postlock is called after unlocking or right after locking if you have another idea how to do that.

Did you check your journalctl or dunst-service logs if the command raised any silent/logged errors in background?

@LAST7
Copy link

LAST7 commented Aug 31, 2023

I found multiple errors using journalctl, they all look like this: dunst[9842]: CRITICAL: Source ID 165 was not found when attempting to remove it

+ lockargs+=(-n)
+ init_config
+ display_on=0
+ span_image=false
+ lock_timeout=300
+ fx_list=(dim blur dimblur pixel dimpixel color)
+ dim_level=40
+ blur_level=1
+ pixel_scale=10,1000
+ solid_color=333333
+ description=
+ quiet=false
+ i3lockcolor_bin=i3lock-color
+ suspend_command='systemctl suspend'
+ cmd_exists i3lock-color
+ command -v i3lock-color
+ cmd_exists i3lock
+ command -v i3lock
+ i3lockcolor_bin=i3lock
+ loginbox=00000066
+ loginshadow=00000000
+ locktext='Type password to unlock...'
+ font=sans-serif
+ ringcolor=ffffffff
+ insidecolor=00000000
+ separatorcolor=00000000
+ ringvercolor=ffffffff
+ insidevercolor=00000000
+ ringwrongcolor=ffffffff
+ insidewrongcolor=d23c3dff
+ timecolor=ffffffff
+ time_format=%H:%M:%S
+ greetercolor=ffffffff
+ layoutcolor=ffffffff
+ keyhlcolor=d23c3dff
+ bshlcolor=d23c3dff
+ veriftext=Verifying...
+ verifcolor=ffffffff
+ wrongtext='Failure!'
+ wrongcolor=d23c3dff
+ modifcolor=d23c3dff
+ bgcolor=000000ff
+ wallpaper_cmd='feh --bg-fill'
+ USER_CONF_DIR=/home/last/.config
+ USER_CONF=/home/last/.config/betterlockscreenrc
+ SYS_CONF=/etc/betterlockscreenrc
+ XDG_USER_CONF=/home/last/.config/betterlockscreen/betterlockscreenrc
+ '[' -e /etc/betterlockscreenrc ']'
+ '[' -e /home/last/.config/betterlockscreenrc ']'
+ '[' -e /home/last/.config/betterlockscreen/betterlockscreenrc ']'
+ source /home/last/.config/betterlockscreen/betterlockscreenrc
++ display_on=0
++ span_image=false
++ lock_timeout=300
++ fx_list=(dim blur dimblur pixel dimpixel color)
++ dim_level=40
++ blur_level=1
++ pixel_scale=10,1000
++ solid_color=333333
++ wallpaper_cmd='feh --bg-fill'
++ quiet=false
++ loginbox=00000066
++ loginshadow=00000000
++ locktext='Type password to unlock...'
++ font='Noto Sans'
++ ringcolor=ffffffff
++ insidecolor=00000000
++ separatorcolor=00000000
++ ringvercolor=ffffffff
++ insidevercolor=00000000
++ ringwrongcolor=ffffffff
++ insidewrongcolor=d23c3dff
++ timecolor=ffffffff
++ time_format=%H:%M:%S
++ greetercolor=ffffffff
++ layoutcolor=ffffffff
++ keyhlcolor=d23c3dff
++ bshlcolor=d23c3dff
++ veriftext=Verifying...
++ verifcolor=ffffffff
++ wrongtext='Failure!'
++ wrongcolor=d23c3dff
++ modifcolor=d23c3dff
++ bgcolor=000000ff
+ cmd_exists i3lock
+ command -v i3lock
+ VERSION=4.1.0
+ CACHE_DIR=/home/last/.cache/betterlockscreen
+ CUR_DIR=/home/last/.cache/betterlockscreen/current
+ CUR_W_RESIZE=/home/last/.cache/betterlockscreen/current/wall_resize.png
+ CUR_W_DIM=/home/last/.cache/betterlockscreen/current/wall_dim.png
+ CUR_W_BLUR=/home/last/.cache/betterlockscreen/current/wall_blur.png
+ CUR_W_DIMBLUR=/home/last/.cache/betterlockscreen/current/wall_dimblur.png
+ CUR_W_PIXEL=/home/last/.cache/betterlockscreen/current/wall_pixel.png
+ CUR_W_DIMPIXEL=/home/last/.cache/betterlockscreen/current/wall_dimpixel.png
+ CUR_W_COLOR=/home/last/.cache/betterlockscreen/current/wall_color.png
+ CUR_L_RESIZE=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ CUR_L_DIM=/home/last/.cache/betterlockscreen/current/lock_dim.png
+ CUR_L_BLUR=/home/last/.cache/betterlockscreen/current/lock_blur.png
+ CUR_L_DIMBLUR=/home/last/.cache/betterlockscreen/current/lock_dimblur.png
+ CUR_L_PIXEL=/home/last/.cache/betterlockscreen/current/lock_pixel.png
+ CUR_L_DIMPIXEL=/home/last/.cache/betterlockscreen/current/lock_dimpixel.png
+ CUR_L_COLOR=/home/last/.cache/betterlockscreen/current/lock_color.png
++ cut -d ' ' -f4
+++ xset q
+++ sed -n 25p
+ DEFAULT_TIMEOUT=600
++ xset q
++ awk '/^[[:blank:]]*DPMS is/ {print $(NF)}'
+ DEFAULT_DPMS=Enabled
+ DUNST_INSTALLED=false
++ command -v dunstctl
+ [[ -e /usr/bin/dunstctl ]]
+ DUNST_INSTALLED=true
+ DUNST_IS_PAUSED=false
+ [[ true == \t\r\u\e ]]
++ dunstctl is-paused
+ DUNST_IS_PAUSED=false
+ FEH_INSTALLED=false
++ command -v feh
+ [[ -e /usr/bin/feh ]]
+ FEH_INSTALLED=true
+ [[ -l = '' ]]
+ lockargs=()
+ for arg in "$@"
+ [[ - = \- ]]
+ case "$1" in
+ runlock=true
+ [[ '' = \- ]]
+ lockstyle=
+ shift 2
+ echof header Betterlockscreen
+ local prefix=header
+ local message=Betterlockscreen
+ case "$prefix" in
+ msgpfx='[\e[1;95mB\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;95mB\e[m] Betterlockscreen'
[B] Betterlockscreen
+ [[ -n '' ]]
+ [[ -n true ]]
+ lockinit ''
+ pgrep -u last i3lock
+ echof act 'Running prelock...'
+ local prefix=act
+ local 'message=Running prelock...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Running prelock...'
[*] Running prelock...
+ prelock
+ date
Fri Sep  1 07:22:48 AM CST 2023
+ '[' Enabled == Enabled ']'
+ xset dpms 300
+ [[ true == \t\r\u\e ]]
+ [[ false == \f\a\l\s\e ]]
+ dunstctl set-paused true
+ '[' -e /home/last/.config/custom-pre.sh ']'
+ [[ -n '' ]]
+ echof act 'Running postlock...'
+ lockselect ''
+ local prefix=act
+ local 'message=Running postlock...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Running postlock...'
[*] Running postlock...
+ case "$1" in
+ postlock
+ date
+ '[' -f /home/last/.cache/betterlockscreen/current/lock_resize.png ']'
+ lock /home/last/.cache/betterlockscreen/current/lock_resize.png
+ echof act 'Locking screen...'
+ local prefix=act
+ local 'message=Locking screen...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Locking screen...'
[*] Locking screen...
+ local image=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ local fontlg=32
+ local fontmd=16
+ local fontsm=12
+ i3lock --image /home/last/.cache/betterlockscreen/current/lock_resize.png --color 000000ff --screen 0 --ind-pos=x+310:y+h-80 --radius=25 --ring-width=5 --inside-color=00000000 --ring-color=ffffffff --separator-color=00000000 --insidever-color=00000000 --insidewrong-color=d23c3dff --ringver-color=ffffffff --ringwrong-color=ffffffff --line-uses-inside --keyhl-color=d23c3dff --bshl-color=d23c3dff --clock --force-clock --time-pos=ix-265:iy-10 --time-align 1 --time-str %H:%M:%S --time-color=ffffffff '--time-font=Noto Sans' --time-size=32 --date-str '' --greeter-pos=ix-265:iy+12 --greeter-align 1 --greeter-text 'Type password to unlock...' --greeter-color=ffffffff '--greeter-font=Noto Sans' --greeter-size=16 --layout-pos=ix-265:iy+32 --layout-align 1 --layout-color=ffffffff '--layout-font=Noto Sans' --layout-size=12 --verif-pos=ix+35:iy-34 --verif-align 2 --verif-text=Verifying... --verif-color=ffffffff '--verif-font=Noto Sans' --verif-size=12 --wrong-pos=ix+24:iy-34 --wrong-align 2 '--wrong-text=Failure!' --wrong-color=d23c3dff '--wrong-font=Noto Sans' --wrong-size=12 --modif-pos=ix+45:iy+43 --modif-align 2 --modif-size=12 --modif-color=d23c3dff --noinput-text= --pass-media-keys --pass-screen-keys --pass-volume-keys --pass-power-keys
Fri Sep  1 07:22:48 AM CST 2023
+ '[' Enabled == Enabled ']'
+ xset dpms 600
+ [[ true == \t\r\u\e ]]
+ [[ false == \f\a\l\s\e ]]
+ dunstctl set-paused false
+ '[' -e /home/last/.config/custom-post.sh ']'
+ exit 0

pre(copied from above):

+ prelock
+ date
Fri Sep  1 07:22:48 AM CST 2023
+ '[' Enabled == Enabled ']'

post:

+ postlock
+ date
+ '[' -f /home/last/.cache/betterlockscreen/current/lock_resize.png ']'
+ lock /home/last/.cache/betterlockscreen/current/lock_resize.png
+ echof act 'Locking screen...'
+ local prefix=act
+ local 'message=Locking screen...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Locking screen...'
[*] Locking screen...
+ local image=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ local fontlg=32
+ local fontmd=16
+ local fontsm=12
+ i3lock --image /home/last/.cache/betterlockscreen/current/lock_resize.png --color 000000ff --screen 0 --ind-pos=x+310:y+h-80 --radius=25 --ring-width=5 --inside-color=00000000 --ring-color=ffffffff --separator-color=00000000 --insidever-color=00000000 --insidewrong-color=d23c3dff --ringver-color=ffffffff --ringwrong-color=ffffffff --line-uses-inside --keyhl-color=d23c3dff --bshl-color=d23c3dff --clock --force-clock --time-pos=ix-265:iy-10 --time-align 1 --time-str %H:%M:%S --time-color=ffffffff '--time-font=Noto Sans' --time-size=32 --date-str '' --greeter-pos=ix-265:iy+12 --greeter-align 1 --greeter-text 'Type password to unlock...' --greeter-color=ffffffff '--greeter-font=Noto Sans' --greeter-size=16 --layout-pos=ix-265:iy+32 --layout-align 1 --layout-color=ffffffff '--layout-font=Noto Sans' --layout-size=12 --verif-pos=ix+35:iy-34 --verif-align 2 --verif-text=Verifying... --verif-color=ffffffff '--verif-font=Noto Sans' --verif-size=12 --wrong-pos=ix+24:iy-34 --wrong-align 2 '--wrong-text=Failure!' --wrong-color=d23c3dff '--wrong-font=Noto Sans' --wrong-size=12 --modif-pos=ix+45:iy+43 --modif-align 2 --modif-size=12 --modif-color=d23c3dff --noinput-text= --pass-media-keys --pass-screen-keys --pass-volume-keys --pass-power-keys
Fri Sep  1 07:22:48 AM CST 2023
+ '[' Enabled == Enabled ']'

It seems that the pre-lock and post-lock function are executed at the same time? Is it the main cause?
(I'm sure I've waited for at least 10 seconds after the screen is locked)

@SebTM
Copy link
Collaborator

SebTM commented Aug 31, 2023

I think there is the bug - it seems that https://github.com/betterlockscreen/betterlockscreen/blob/next/betterlockscreen#L858C1-L858C12 overwrites the https://github.com/betterlockscreen/betterlockscreen/blob/next/betterlockscreen#L850 additionally lockargs does not exist at the time of the addition.

can you move lockargs=() to line 849 and try again/post log please?

@LAST7
Copy link

LAST7 commented Sep 1, 2023

Log:

+ lockargs=()
+ lockargs+=(-n)
+ init_config
+ display_on=0
+ span_image=false
+ lock_timeout=300
+ fx_list=(dim blur dimblur pixel dimpixel color)
+ dim_level=40
+ blur_level=1
+ pixel_scale=10,1000
+ solid_color=333333
+ description=
+ quiet=false
+ i3lockcolor_bin=i3lock-color
+ suspend_command='systemctl suspend'
+ cmd_exists i3lock-color
+ command -v i3lock-color
+ cmd_exists i3lock
+ command -v i3lock
+ i3lockcolor_bin=i3lock
+ loginbox=00000066
+ loginshadow=00000000
+ locktext='Type password to unlock...'
+ font=sans-serif
+ ringcolor=ffffffff
+ insidecolor=00000000
+ separatorcolor=00000000
+ ringvercolor=ffffffff
+ insidevercolor=00000000
+ ringwrongcolor=ffffffff
+ insidewrongcolor=d23c3dff
+ timecolor=ffffffff
+ time_format=%H:%M:%S
+ greetercolor=ffffffff
+ layoutcolor=ffffffff
+ keyhlcolor=d23c3dff
+ bshlcolor=d23c3dff
+ veriftext=Verifying...
+ verifcolor=ffffffff
+ wrongtext='Failure!'
+ wrongcolor=d23c3dff
+ modifcolor=d23c3dff
+ bgcolor=000000ff
+ wallpaper_cmd='feh --bg-fill'
+ USER_CONF_DIR=/home/last/.config
+ USER_CONF=/home/last/.config/betterlockscreenrc
+ SYS_CONF=/etc/betterlockscreenrc
+ XDG_USER_CONF=/home/last/.config/betterlockscreen/betterlockscreenrc
+ '[' -e /etc/betterlockscreenrc ']'
+ '[' -e /home/last/.config/betterlockscreenrc ']'
+ '[' -e /home/last/.config/betterlockscreen/betterlockscreenrc ']'
+ source /home/last/.config/betterlockscreen/betterlockscreenrc
++ display_on=0
++ span_image=false
++ lock_timeout=300
++ fx_list=(dim blur dimblur pixel dimpixel color)
++ dim_level=40
++ blur_level=1
++ pixel_scale=10,1000
++ solid_color=333333
++ wallpaper_cmd='feh --bg-fill'
++ quiet=false
++ loginbox=00000066
++ loginshadow=00000000
++ locktext='Type password to unlock...'
++ font='Noto Sans'
++ ringcolor=ffffffff
++ insidecolor=00000000
++ separatorcolor=00000000
++ ringvercolor=ffffffff
++ insidevercolor=00000000
++ ringwrongcolor=ffffffff
++ insidewrongcolor=d23c3dff
++ timecolor=ffffffff
++ time_format=%H:%M:%S
++ greetercolor=ffffffff
++ layoutcolor=ffffffff
++ keyhlcolor=d23c3dff
++ bshlcolor=d23c3dff
++ veriftext=Verifying...
++ verifcolor=ffffffff
++ wrongtext='Failure!'
++ wrongcolor=d23c3dff
++ modifcolor=d23c3dff
++ bgcolor=000000ff
+ cmd_exists i3lock
+ command -v i3lock
+ VERSION=4.1.0
+ CACHE_DIR=/home/last/.cache/betterlockscreen
+ CUR_DIR=/home/last/.cache/betterlockscreen/current
+ CUR_W_RESIZE=/home/last/.cache/betterlockscreen/current/wall_resize.png
+ CUR_W_DIM=/home/last/.cache/betterlockscreen/current/wall_dim.png
+ CUR_W_BLUR=/home/last/.cache/betterlockscreen/current/wall_blur.png
+ CUR_W_DIMBLUR=/home/last/.cache/betterlockscreen/current/wall_dimblur.png
+ CUR_W_PIXEL=/home/last/.cache/betterlockscreen/current/wall_pixel.png
+ CUR_W_DIMPIXEL=/home/last/.cache/betterlockscreen/current/wall_dimpixel.png
+ CUR_W_COLOR=/home/last/.cache/betterlockscreen/current/wall_color.png
+ CUR_L_RESIZE=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ CUR_L_DIM=/home/last/.cache/betterlockscreen/current/lock_dim.png
+ CUR_L_BLUR=/home/last/.cache/betterlockscreen/current/lock_blur.png
+ CUR_L_DIMBLUR=/home/last/.cache/betterlockscreen/current/lock_dimblur.png
+ CUR_L_PIXEL=/home/last/.cache/betterlockscreen/current/lock_pixel.png
+ CUR_L_DIMPIXEL=/home/last/.cache/betterlockscreen/current/lock_dimpixel.png
+ CUR_L_COLOR=/home/last/.cache/betterlockscreen/current/lock_color.png
++ cut -d ' ' -f4
+++ xset q
+++ sed -n 25p
+ DEFAULT_TIMEOUT=600
++ xset q
++ awk '/^[[:blank:]]*DPMS is/ {print $(NF)}'
+ DEFAULT_DPMS=Enabled
+ DUNST_INSTALLED=false
++ command -v dunstctl
+ [[ -e /usr/bin/dunstctl ]]
+ DUNST_INSTALLED=true
+ DUNST_IS_PAUSED=false
+ [[ true == \t\r\u\e ]]
++ dunstctl is-paused
+ DUNST_IS_PAUSED=false
+ FEH_INSTALLED=false
++ command -v feh
+ [[ -e /usr/bin/feh ]]
+ FEH_INSTALLED=true
+ [[ -l = '' ]]
+ for arg in "$@"
+ [[ - = \- ]]
+ case "$1" in
+ runlock=true
+ [[ '' = \- ]]
+ lockstyle=
+ shift 2
+ echof header Betterlockscreen
+ local prefix=header
+ local message=Betterlockscreen
+ case "$prefix" in
+ msgpfx='[\e[1;95mB\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;95mB\e[m] Betterlockscreen'
[B] Betterlockscreen
+ [[ -n '' ]]
+ [[ -n true ]]
+ lockinit ''
+ pgrep -u last i3lock
+ echof act 'Running prelock...'
+ local prefix=act
+ local 'message=Running prelock...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Running prelock...'
[*] Running prelock...
+ prelock
+ date
Fri Sep  1 08:00:46 AM CST 2023
+ '[' Enabled == Enabled ']'
+ xset dpms 300
+ [[ true == \t\r\u\e ]]
+ [[ false == \f\a\l\s\e ]]
+ dunstctl set-paused true
+ '[' -e /home/last/.config/custom-pre.sh ']'
+ [[ -n '' ]]
+ echof act 'Running postlock...'
+ local prefix=act
+ local 'message=Running postlock...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ lockselect ''
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Running postlock...'
[*] Running postlock...
+ postlock
+ date
+ case "$1" in
+ '[' -f /home/last/.cache/betterlockscreen/current/lock_resize.png ']'
+ lock /home/last/.cache/betterlockscreen/current/lock_resize.png
+ echof act 'Locking screen...'
+ local prefix=act
+ local 'message=Locking screen...'
+ case "$prefix" in
+ msgpfx='[\e[1;92m*\e[m]'
+ '[' false '!=' true ']'
+ echo -e '[\e[1;92m*\e[m] Locking screen...'
[*] Locking screen...
+ local image=/home/last/.cache/betterlockscreen/current/lock_resize.png
+ local fontlg=32
+ local fontmd=16
+ local fontsm=12
+ i3lock --image /home/last/.cache/betterlockscreen/current/lock_resize.png --color 000000ff --screen 0 --ind-pos=x+310:y+h-80 --radius=25 --ring-width=5 --inside-color=00000000 --ring-color=ffffffff --separator-color=00000000 --insidever-color=00000000 --insidewrong-color=d23c3dff --ringver-color=ffffffff --ringwrong-color=ffffffff --line-uses-inside --keyhl-color=d23c3dff --bshl-color=d23c3dff --clock --force-clock --time-pos=ix-265:iy-10 --time-align 1 --time-str %H:%M:%S --time-color=ffffffff '--time-font=Noto Sans' --time-size=32 --date-str '' --greeter-pos=ix-265:iy+12 --greeter-align 1 --greeter-text 'Type password to unlock...' --greeter-color=ffffffff '--greeter-font=Noto Sans' --greeter-size=16 --layout-pos=ix-265:iy+32 --layout-align 1 --layout-color=ffffffff '--layout-font=Noto Sans' --layout-size=12 --verif-pos=ix+35:iy-34 --verif-align 2 --verif-text=Verifying... --verif-color=ffffffff '--verif-font=Noto Sans' --verif-size=12 --wrong-pos=ix+24:iy-34 --wrong-align 2 '--wrong-text=Failure!' --wrong-color=d23c3dff '--wrong-font=Noto Sans' --wrong-size=12 --modif-pos=ix+45:iy+43 --modif-align 2 --modif-size=12 --modif-color=d23c3dff --noinput-text= --pass-media-keys --pass-screen-keys --pass-volume-keys --pass-power-keys -n
Fri Sep  1 08:00:46 AM CST 2023
+ '[' Enabled == Enabled ']'
+ xset dpms 600
+ [[ true == \t\r\u\e ]]
+ [[ false == \f\a\l\s\e ]]
+ dunstctl set-paused false
+ '[' -e /home/last/.config/custom-post.sh ']'
+ exit 0

img

Dunst is still sending message to locked screen :( and the output of the two date are still identical(I have waited for a while in the locked screen)
(Just in case it matters, I am using bspwm rather than i3wm)

@I-Al-Istannen
Copy link
Author

I-Al-Istannen commented Sep 1, 2023

Moving the lockargs+=(-n) below the lockargs=() works for me and has the same effect as hardcoding --no-fork as outlined in the OP.

Before:

❯ betterlockscreen -l
[B] Betterlockscreen
[*] Running prelock...
Fr 1. Sep 10:07:34 CEST 2023
[*] Locking screen...
[*] Running postlock...
Fr 1. Sep 10:07:34 CEST 2023

After:

❯ betterlockscreen -l
[B] Betterlockscreen
[*] Running prelock...
Fr 1. Sep 10:07:51 CEST 2023
[*] Locking screen...
[*] Running postlock...
Fr 1. Sep 10:07:54 CEST 2023

@LAST7
Copy link

LAST7 commented Sep 1, 2023

Oh yes, moving lockargs+=(-n) below lockargs=() does help. Dunst is paused aftert lock, Cheers!

@LAST7
Copy link

LAST7 commented Sep 1, 2023

Also, it seems that the program would only seek for custom-pre.sh and custom-post.sh in ~/.config rather than ~/.config/betterlockscreen.
It seems that the program is still using "${XDG_CONFIG_HOME:-$HOME/.config}" as USER_CONF_DIR(see line 56), and the ~/.config/betterlockscreen is not used as the config directory when executing custom scripts.(see line 134)

I believe the fix for this problem should be easy, just deprecate the previous config dir or seek custom scripts in both two dirs.
Thanks for your great work!

SebTM added a commit that referenced this issue Sep 2, 2023
…sh only from betterlockscreen XDG-dir not ~/.config/, Prepare for v4.2.0 release
@SebTM SebTM mentioned this issue Sep 2, 2023
2 tasks
@SebTM
Copy link
Collaborator

SebTM commented Sep 2, 2023

Hey, can please everyone having issues try the pull-request #395 and let me know if it fixes your issues so I can make a release?

@LAST7
Copy link

LAST7 commented Sep 2, 2023

Hey, can please everyone having issues try the pull-request #395 and let me know if it fixes your issues so I can make a release?

Both pausing dunst and executing custom pre/post script works perfectly for me. Thanks! :)

@SebTM SebTM closed this as completed in #395 Sep 2, 2023
SebTM added a commit that referenced this issue Sep 2, 2023
@I-Al-Istannen
Copy link
Author

Seems to work, though after a suspend the screen is shown for a second before the lockscreen appears. But that's probably more on my side.

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants