avoid leaking user wallpaper on lightdm lock screen

Forum rules
Before you post please read how to get help
User avatar
smurphos
Level 16
Level 16
Posts: 6396
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: avoid leaking user wallpaper on lightdm lock screen

Post by smurphos »

I can talk you that process if you like - it's pretty straightforward. Not right now unfortunately - I'm on dinner duties this evening.....
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 16
Level 16
Posts: 6396
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: avoid leaking user wallpaper on lightdm lock screen

Post by smurphos »

Hi - so here is the background script method.

1) Make your local bin directory

Code: Select all

mkdir -p ~/.local/bin
2) Write the script file. This is a single copy and paste command into the terminal.

Code: Select all

tee ~/.local/bin/mate_lock_background.sh <<'EOB'
#!/bin/bash

# Script to set a custom background for the MATE lockscreen
# Save the script as ~/.local/bin/mate_lock_background.sh and make executable
# Add a entry to Startup Applications to launch the script after user login with a delay of 30 seconds
# Install dependency qdbus - apt install qdbus

# These variables are intended to be set by the end user.

# Set STATIC_BACKGROUND to the path to your image of choice for the lockscreen background
STATIC_BACKGROUND="/usr/share/backgrounds/linuxmint/default_background.jpg"

# Main script starts here
# Check for existing instances and kill them leaving current instance running
for PID in $(pidof -o %PPID -x "${0##*/}"); do
    if [ "$PID" != $$ ]; then
        kill -9 "$PID"
    fi 
done

# set initial status
ACTIVE=false

# Start the main loop to monitor screensaver status changes
dbus-monitor --profile "interface='org.mate.ScreenSaver', member='ActiveChanged'" | while read -r
do
  # Screensaver active loop.
  while $(qdbus org.mate.ScreenSaver /org/mate/ScreenSaver org.mate.ScreenSaver.GetActive) == true
  do
    # If screensaver just activated get user background and set static lock screen background
    if ( ! $ACTIVE ) ; then
      DESK_BACKGROUND=$(gsettings get org.mate.background picture-filename)
      gsettings set org.mate.background picture-filename "$STATIC_BACKGROUND"
      ACTIVE=true
    fi
  sleep 1
  done 
  # Set background back to the user background on screensaver de-activation
  if ( $ACTIVE ) ; then
    gsettings set org.mate.background picture-filename "$DESK_BACKGROUND"
    ACTIVE=false
  fi
done
EOB
3) Edit the script to set your preferred STATIC_BACKGROUND

Code: Select all

xed ~/.local/bin/mate_lock_background.sh
4) Make the script executable

Code: Select all

chmod +x ~/.local/bin/mate_lock_background.sh
5) Write the autostart entry - another single copy / paste command

Code: Select all

tee ~/.config/autostart/mate_lock_background.desktop <<'EOB'
[Desktop Entry]
Type=Application
Exec=mate_lock_background.sh
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name=mate_lock_background.desktop
Comment=Sets a custom lockscreen background for MATE.
X-GNOME-Autostart-Delay=30
EOB
6) Install qdbus

Code: Select all

apt install qdbus
7) Log out and log back in. Wait 30 seconds then lock the computer and test the lock screen.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 16
Level 16
Posts: 6396
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: avoid leaking user wallpaper on lightdm lock screen

Post by smurphos »

This is the modify and recompile mate-screensaver method to revert to the lockscreen always using the default system background.

1) Open Software Sources Application via the menu - Check Source Code repositories

Open a terminal and

2) Make and enter a working directory

Code: Select all

mkdir -p $HOME/mate-screensaver-mod; cd $HOME/mate-screensaver-mod
3) Download the mate-screensaver source-code

Code: Select all

apt source mate-screensaver
4) Enter the source code directory (note the version string string is specific to MATE on Mint 19.3)

Code: Select all

cd mate-screensaver-1.22.2
5) Install build dependencies

Code: Select all

apt build-dep mate-screensaver
6) Modify the source code with a text editor. So if we are going to revert https://github.com/mate-desktop/mate-sc ... 2d361eb27f we need to...

Code: Select all

xed $HOME/mate-screensaver-mod/mate-screensaver-1.22.2/src/gs-manager.c
And revert the changes noted in that commit. The line numbers are the same bar the last one which is line 1941 in the current version.

Save and exit the text editor having made the modifications.

7) This particular package will complain about the modifications unless you commit your local patch and specify a patch name. Run

Code: Select all

dpkg-source --commit
Follow the prompts, name the patch something like mate_lock_background, and save / exit the terminal text editor.

8) Recompile from the modified source. Ignore any error at the end about failing to sign the package.

Code: Select all

apt build
9) Install the modified debs just made.

Code: Select all

cd ..; apt deb *.deb
10) Reboot and test.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

piramiday
Level 1
Level 1
Posts: 37
Joined: Tue Jun 25, 2013 10:07 am

Re: avoid leaking user wallpaper on lightdm lock screen

Post by piramiday »

hey smurphos, thanks a lot for such actionable intel! I'll try and play around with it.
in the mean time, I really hope someone might pop up with a one-liner or, even better, a proper MATE/lightdm setting for it. :D

Post Reply

Return to “MATE”