1

I'm using i3wm with XFCE as my desktop environment. I've disable the default XFCE lockscreen (light-locker, I believe) in favor of my own locking script which uses i3lock-color, and I'm using xss-lock to trigger the locking script on lid close. The script itself (full script here) basically takes a screenshot, uses ImageMagick to pixellate the image and add a dark rectangle in the bottom left corner of the image (the rectangle provides extra contrast for the text that is overlaid by i3lock-color). Then it uses i3lock-color to lock the screen and display a clock, some text, etc.

When I run the script from the terminal, the result is as expected. The screen is locked with the correct image (including the dark rectangle). Correct lockscreen

However, after activating xss-lock with xss-lock -l /path/to/script/lock.sh and then closing the lid, the script runs but the rectangle is not drawn, leading to sometimes unreadable lockscreen text. Incorrect lockscreen

I've tried modifying the script so that it doesn't delete the screenshot that it takes and edits, but the screenshot contains the dark rectangle. I think it's something weird with ImageMagick, since the pixellation and the rectangle drawing are specified in the same command, and the pixellation occurs but the rectangle drawing doesn't.

I'm very confused as to how this could occur. Neither journalctl nor /var/log display anything that looks related to this. Any help on where to begin debugging would be appreciated.

theasianpianist
  • 249
  • 3
  • 12
  • Hooray for i3, and a nice script is that! Please change line 33 to IFS=" " read -ra SRA <<<"${RES//[x+]/ }" (see SC2206). If that doesn’t help substitute $rectangles in line 39 with the values for your screen to debug – if it works it’s line 31 to 36 you need to check. Oh btw, doesn’t xrandr need the DISPLAY variable set? That may not be the case with xss-lock. I’d start by logging stdout and stderr output from this and the other lines constructing $rectangles. – dessert Mar 21 '19 at 21:21
  • You were right about xrandr! Turns out suspending causes the xrandr query to return no displays connected, which leads to no rectangle being drawn. I solved it by simply hardcoding the output of the quiry into $SR. Thanks for your help! Also the script isn't mine, I basically copied it from here – theasianpianist Mar 22 '19 at 00:28

1 Answers1

0

The rectangle proportions are calculated relative to the currently connected screen(s) resolution(s) using xrandr on line 31, but xrandr needs the DISPLAY variable set which may not be the case here. You have two options:

  • explicitly set the variable, e.g. for the first display:

    SR=$(DISPLAY=:0 xrandr --query | …
    
  • hardcode the value of $rectangles in line 29, this makes lines 30 to 37 obsolete (comment out or delete them), e.g. for one 1680x1050 screen:

    rectangles="rectangle 80,970 380,870"
    

Further reading:

dessert
  • 39,982