Can Lock Screen background be other than current desktop BG? [SOLVED]

Forum rules
Before you post please read how to get help
Post Reply
lazarus
Level 3
Level 3
Posts: 148
Joined: Mon Jul 02, 2018 11:36 pm
Location: Oberon, OZ

Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by lazarus » Sat Aug 04, 2018 2:11 am

LM18.3 Cinnamon
LightDm

As the title says, is it possible to get the Lock Screen background to display other than the current desktop?

Ideally I'd like to run a cron script to change the displayed Lock Screen BG depending on time of day, which is simple enough IF I can get the Lock Screen to load from a specified file.

Looking in /etc/lightdm/slick-greeter.conf there is a line:

Code: Select all

[Greeter]
background=/usr/share/backgrounds/mybackground.jpg
...that appears to hold the target file, at least for the initial login screen. It's never displayed, it's also not the one displayed by the Lock Screen, which is always the current backdrop. (I have my BG in slideshow mode, changing every 15mins.)

PS. Even the initial login background after a reboot is the last session backdrop that was used. WTH?

/etc/lightdm/lightdm-gtk-greeter.conf.d contains:

Code: Select all

[greeter]
background=/usr/share/backgrounds/linuxmint/default_background.jpg
...which at a glance appears to be the right line to edit except that this background isn't the one being displayed either! :| That's the default one from a vanilla install and hasn't been displayed in weeks.

Looking at logs, /var/log/lightdm/seat0-greeter.log contains:

Code: Select all

[+0.00s] DEBUG: settings.vala:155: Overriding dconf setting for background with /usr/share/backgrounds/mybackground.jpg
---8<---
[+5.20s] DEBUG: background.vala:68: Making background /mnt/RAID_Store/Media/Pictures/Backdrops/BG_47.jpg at 1366x768
[+5.47s] DEBUG: background.vala:121: Render of background /mnt/RAID_Store/Media/Pictures/Backdrops/BG_47.jpg complete
...which appears to be linked to the Slideshow changes. However, as I said above re /etc/lightdm/slick-greeter.conf, /usr/share/backgrounds/mybackground.jpg is never shown.

Am I just chasing my own tail here? Ummm... Help?
Last edited by lazarus on Sat Aug 04, 2018 11:23 pm, edited 2 times in total.
- Andy

I may be weird but I'm saving up to become eccentric.

User avatar
smurphos
Level 8
Level 8
Posts: 2013
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Can Lock Screen background be other than current desktop BG?

Post by smurphos » Sat Aug 04, 2018 7:26 am

cinnamon-screensaver manages the lock screen in Cinnamon not lightdm.

Off the top of my head I'm not aware of an easy way to achieve what you want. Will have a think....

lazarus
Level 3
Level 3
Posts: 148
Joined: Mon Jul 02, 2018 11:36 pm
Location: Oberon, OZ

Re: Can Lock Screen background be other than current desktop BG?

Post by lazarus » Sat Aug 04, 2018 7:37 am

Ahhh... thank you.

On a side note, I've just realised that the reason I was never seeing the file defined for the Login window (ie. as set in slick-greeter.conf) is because by default it uses the background of the currently selected user. Naturally, on my system it defaults to my account.

Switching to Guest or another account and it does display correctly. :oops:
- Andy

I may be weird but I'm saving up to become eccentric.

User avatar
smurphos
Level 8
Level 8
Posts: 2013
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Can Lock Screen background be other than current desktop BG?

Post by smurphos » Sat Aug 04, 2018 7:46 am

Thinking done - :wink:

You could write a bash script, which runs at startup with a continuous loop to check the output of cinnamon-screensaver-command -q

If the screensaver is active it should return the string The screensaver is active, in which the script will use gsettings to change the background e.g. gsettings set org.cinnamon.desktop.background picture-uri "file://path/to/background".

The script would then switch to checking for the string The screensaver is inactive to switch back to the users desired normal desktop background.

Not a particularly straightforward bit of scripting. I might have a bash (pun intended) at putting it together. If I can get a working solution I'll post back. if you manage to do it first please share... :)

lazarus
Level 3
Level 3
Posts: 148
Joined: Mon Jul 02, 2018 11:36 pm
Location: Oberon, OZ

Re: Can Lock Screen background be other than current desktop BG?

Post by lazarus » Sat Aug 04, 2018 11:21 pm

Considering that I'm new to Mint (cinnamon in particular) and cinnamon-screensaver-command -q is a new cmd to me, I expect that you'll beat me to the punch on this one if you decide to accept this particular challenge.

Thank you kindly Sirrah, for pointing me in the right direction. :)

Huh. What I thought was basically a walk in the park has become an adventure into the great unknown! Let's hope I don't encounter a grue...

(As the answer is "no, not simply" I'll tag this thread as solved.)
- Andy

I may be weird but I'm saving up to become eccentric.

User avatar
smurphos
Level 8
Level 8
Posts: 2013
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Can Lock Screen background be other than current desktop BG?

Post by smurphos » Sun Aug 05, 2018 4:08 am

lazarus wrote:
Sat Aug 04, 2018 11:21 pm
if you decide to accept this particular challenge.
Accepted and done. Save the script somewhere sensible make sure its executable and add a custom command in Startup Applications to run it. It will run continuously in the background. Optionally increase the value of the sleep command if you don't mind a short delay in the background changing and want to reduce the cpu use of running cinnamon-screensaver-command -q every second.

Version 1 - sets a specific lock screen background on lock screen activation, goes back to the original desktop background on unlock. Change the LOCK_BACKGROUND to a picture of your choice.

Code: Select all

#!/bin/bash

# Script to set a different lock screen background to the normal desktop background.
# Background file definitions
LOCK_BACKGROUND="file:///opt/backgrounds/Material_Design/3840x2160_Material_Design_2c0b554d1af345c1a62fb7233a06951b32e5cf3be5b253099e26b839b1b0f1f5.jpg"
DESK_BACKGROUND=$(gsettings get org.cinnamon.desktop.background picture-uri)
# Start the main loop to monitor screensaver status
while :
do
	ACTIVE=false
	INACTIVE=false
#Screensaver active loop
	while cinnamon-screensaver-command -q | grep -q "The screensaver is active" 
	do
		if ( ! $ACTIVE ) ; then
		DESK_BACKGROUND=$(gsettings get org.cinnamon.desktop.background picture-uri)
		gsettings set org.cinnamon.desktop.background picture-uri "$LOCK_BACKGROUND"
		ACTIVE=true
		fi
		sleep 1
	done
#Screensaver inactive loop
	while cinnamon-screensaver-command -q | grep -q "The screensaver is inactive"
	do
		if ( ! $INACTIVE ) ; then
		gsettings set org.cinnamon.desktop.background picture-uri "$DESK_BACKGROUND"
		INACTIVE=true
		fi
		sleep 1
	done
done
Version 2 - sets a random lock screen background from backgrounds in a specified folder, goes back to the original desktop background on unlock. Change DIR to a directory of your choice containing backgrounds.

Code: Select all

#!/bin/bash

# Script to set a different lock screen background to the normal desktop background.
# Background file definitions
DIR="/opt/backgrounds/Material_Design"
DESK_BACKGROUND=$(gsettings get org.cinnamon.desktop.background picture-uri)
# Start the main loop to monitor screensaver status
while :
do
	ACTIVE=false
	INACTIVE=false
#Screensaver active loop
	while cinnamon-screensaver-command -q | grep -q "The screensaver is active" 
	do
		if ( ! $ACTIVE ) ; then
		DESK_BACKGROUND=$(gsettings get org.cinnamon.desktop.background picture-uri)
		LOCK_BACKGROUND=$(find $DIR/*.jpg | shuf -n1)
		gsettings set org.cinnamon.desktop.background picture-uri "file://$LOCK_BACKGROUND"
		ACTIVE=true
		fi
		sleep 1
	done
#Screensaver inactive loop
	while cinnamon-screensaver-command -q | grep -q "The screensaver is inactive"
	do
		if ( ! $INACTIVE ) ; then
		gsettings set org.cinnamon.desktop.background picture-uri "$DESK_BACKGROUND"
		INACTIVE=true
		fi
		sleep 1
	done
done

lazarus
Level 3
Level 3
Posts: 148
Joined: Mon Jul 02, 2018 11:36 pm
Location: Oberon, OZ

Re: Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by lazarus » Mon Aug 06, 2018 1:48 am

Woohoo! Thank you kindly, sirrah!

With a few minor modifications - selecting the Lock Screen BG depending on time of day - I think your scripts'll be just the ticket. :)

I'm uncertain whether the fact that the backdrop is changed after the Lock Screen is triggered - even if only by 0.1s - will display the appropriate BG or not. Nor whether the BG is static under Lockscreen or will be changed by the desktop slideshow, I don't think so, but there's only one way to be sure.
- Andy

I may be weird but I'm saving up to become eccentric.

User avatar
jimallyn
Level 18
Level 18
Posts: 8469
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: Can Lock Screen background be other than current desktop BG?

Post by jimallyn » Mon Aug 06, 2018 2:05 am

smurphos wrote:
Sun Aug 05, 2018 4:08 am
Accepted and done.
This is the sort of thing that I just love about Linux and open source: Not only will there be somebody who knows how to do it, or can figure out how to do it, they will provide you with a script so you can do it. Where else can you get that kind of support? No place that I know of!
Image

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan

User avatar
smurphos
Level 8
Level 8
Posts: 2013
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by smurphos » Mon Aug 06, 2018 2:30 am

lazarus wrote:
Mon Aug 06, 2018 1:48 am
Woohoo! Thank you kindly, sirrah!

With a few minor modifications - selecting the Lock Screen BG depending on time of day - I think your scripts'll be just the ticket. :)

I'm uncertain whether the fact that the backdrop is changed after the Lock Screen is triggered - even if only by 0.1s - will display the appropriate BG or not. Nor whether the BG is static under Lockscreen or will be changed by the desktop slideshow, I don't think so, but there's only one way to be sure.
You are welcome. I've got the second version running on my system now and it works great. With the script running after doing Ctrl-Alt-L the screensaver comes up with the current background and then transitions into the new one within a few seconds. Same in reverse on unlock. It's working fine with lock on suspend, timed lock etc as-well.

If you do have desktop slideshow set on it will continue to cycle through the backgrounds on the lock screen. You should be able to work around this by adding lines to the script to toggle the slideshow pause when locked/unlocked.

gsettings set org.cinnamon.desktop.background.slideshow slideshow-paused false
gsettings set org.cinnamon.desktop.background.slideshow slideshow-paused true

User avatar
smurphos
Level 8
Level 8
Posts: 2013
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Can Lock Screen background be other than current desktop BG?

Post by smurphos » Mon Aug 06, 2018 2:31 am

jimallyn wrote:
Mon Aug 06, 2018 2:05 am
smurphos wrote:
Sun Aug 05, 2018 4:08 am
Accepted and done.
Where else can you get that kind of support? No place that I know of!
:D

lazarus
Level 3
Level 3
Posts: 148
Joined: Mon Jul 02, 2018 11:36 pm
Location: Oberon, OZ

Re: Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by lazarus » Mon Aug 06, 2018 4:14 am

smurphos wrote:
Mon Aug 06, 2018 2:30 am
You are welcome. I've got the second version running on my system now and it works great. With the script running after doing Ctrl-Alt-L the screensaver comes up with the current background and then transitions into the new one within a few seconds. Same in reverse on unlock. It's working fine with lock on suspend, timed lock etc as-well.
I'm now running a variant of the first version and am more than satisfied with the result; it does exactly what I was trying to accomplish.
gsettings set org.cinnamon.desktop.background.slideshow slideshow-paused false
gsettings set org.cinnamon.desktop.background.slideshow slideshow-paused true
Kudos to you, sir. Answered my question before I'd even posed it in my head! I am now a very happy chappy. :D

Just for practice, to ensure I understand the relevant code I'm looking at setting two different BG folders, one for Lock Screen and one for Desktop, so I can hopefully have different slideshows in each mode. Not looking for help on this one... it takes all the fun out of it when someone else fills in all the crossword puzzle! ;)
- Andy

I may be weird but I'm saving up to become eccentric.

Hultan
Level 1
Level 1
Posts: 18
Joined: Mon Aug 27, 2018 10:58 am

Re: Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by Hultan » Mon Aug 27, 2018 11:34 am

Thank you Smurphos, you are awesome!

I have been looking for a solution to this for weeks, on and off, and finally I found a solution that works perfectly for a Linux-newb like me. I went with script number 1. I personally think that this is a bit of a privacy flaw in Mint, MY desktop should not be shared with other users. What if my fetish is shaved donkeys on roller blades with huge silicon t*ts? That would definitely be something that I would like to keep to myself, so why is Cinnamon/Mint sharing that with other users? My desktop background is MY desktop background, let me be alone with my desktop donkeys...:-)

/Per

Hultan
Level 1
Level 1
Posts: 18
Joined: Mon Aug 27, 2018 10:58 am

Re: Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by Hultan » Wed Aug 29, 2018 10:31 am

Turns out, I spoke to soon, now the login screen is showing my desktop instead. Why is this so hard? Why isn't there just three different settings:

* Desktop background
* Lock screen background
* Login screen background

I guess the last two could be the same background, and I would be ok with that.

Anyway, I give up, I just feel that an OS that prides itself of being secure and private, should not share one users desktops with other users. /per

User avatar
smurphos
Level 8
Level 8
Posts: 2013
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Can Lock Screen background be other than current desktop BG? [SOLVED]

Post by smurphos » Thu Aug 30, 2018 1:38 am

Hultan wrote:
Wed Aug 29, 2018 10:31 am
Turns out, I spoke to soon, now the login screen is showing my desktop instead.
The Login-screen background is handled by LightDM/Slickgreeter. Settings for it are accessed via the GUI App Login Window. In the Login Window app you can check whether or not to use User backgrounds. If you choose not to you can set a system wide login-screen background here as-well.

The lock-screen is handled by Cinnamon Screensaver which defaults to the logged in users background. The scripts here are a workaround to toggle that user background on screensaver activation. Agreed it would be a nice feature for cinnamon-screensaver to offer the ability to set a user-specific lock-screen background - maybe a candidate feature request

Post Reply

Return to “Themes, Icons, & Wallpaper”