These are not official instructions, and regardless whatever you do with your machine is at your own risk. This also isn't the best solution, but it is a way that works without complicated scripting.
Preface / Introduction
Screen lock behaviour at the moment no longer blanks out (really: turns off) the display on lock. For some people, this behaviour is desired. After much trial and error I figured out a way to do this in what some may argue is the worst way possible, but it doesn't involve any fancy scripting, and what basic scripting is shown, any individual regardless of skill could do without reading this guide.
Composing the scripts
In this example, two scripts will be present, and they will be stored in /usr/bin
where they can be executed by filename alone. The two scripts as follows:
You can name these files whatever you want, but know those names have to be used for MATE Menu — else it won't work! Names used are for the functional example presented below.
In an elevated editor of preference, for what will become
/usr/bin/mate_dpmslock.sh
:#!/bin/bash mate-screensaver-command -la xset dpms force off
In an elevated editor of preference, for what will become
/usr/bin/xdg_dpmslock.sh
:#!/bin/bash xdg-screensaver lock xset dpms force off
Save both as mate_dpmslock.sh
and xdg_dpmslock.sh
respectively, for what will be done next.
Fixing MATE Menu
Perform the following in a terminal to make them executable:
In
x-terminal-emulator
sudo chmod +x /usr/bin/mate_dpmslock.sh sudo chmod +x /usr/bin/xdg_dpmslock.sh
Once saved and made executable, you can then make the following changes to MATE Menu, by first:
In
x-temrinal-emulator
:cd /usr/lib/python3/dist-packages/mate_menu/plugins
Then open with elevation system_management.py
to make the following changes:
In an elevated editor of preference, for
system_management.py
:if ( self.showLockScreen == True ): Button5 = easyButton( "system-lock-screen", self.iconsize, [_("Lock Screen")], -1, -1 ) if pathExists("mate-screensaver-command"): Button5.connect( "clicked", self.ButtonClicked, "mate_dpmslock.sh" ) else: Button5.connect( "clicked", self.ButtonClicked, "xdg_dpmslock.sh" )
After, either place the MATE Menu applet from panel preferences wherever for testing, or if you have it already perform the following:
In
x-terminal-emulator
:mate-panel --replace
Test by locking the screen — You will know success is achieved once the display turns itself off.
A better alternative?
There are certainly better ways to resolve this, so if you want to toss in your two cents feel free to reply with more efficient solutions which do the same exact thing. I've already tried using sh
in place of the scripts for the fix shown above, and using the commands directly as if it were a terminal prompt; neither of those worked. Best of luck for people posting better solutions than this!
Corrections
Forgot that chmod
requires full paths, not just the filename. Regardless, once made executable the terminal and future scripting can execute files by name (and optional) extension alone when saved in /usr/bin
. Also spiffed the post up a bit since first iteration.
Further, modified the post to be more accurate as for what it does. Blanking the screen and turning off the screen are two entirely different things.