Make MATE Menu turn off the screen on lock

:ubuntu_mate: 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.

:ubuntu_mate: 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.

:pen: 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:

:pencil2: 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.

:spiral_notepad: In an elevated editor of preference, for what will become /usr/bin/

mate-screensaver-command -la
xset dpms force off

:spiral_notepad: In an elevated editor of preference, for what will become /usr/bin/

xdg-screensaver lock
xset dpms force off

Save both as and respectively, for what will be done next.

:wrench: Fixing MATE Menu

Perform the following in a terminal to make them executable:

:heavy_dollar_sign: In x-terminal-emulator

sudo chmod +x /usr/bin/
sudo chmod +x /usr/bin/

Once saved and made executable, you can then make the following changes to MATE Menu, by first:

:heavy_dollar_sign: In x-temrinal-emulator:

cd /usr/lib/python3/dist-packages/mate_menu/plugins

Then open with elevation to make the following changes:

:spiral_notepad: In an elevated editor of preference, for

        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, "" )
                Button5.connect( "clicked", self.ButtonClicked, "" )

After, either place the MATE Menu applet from panel preferences wherever for testing, or if you have it already perform the following:

:heavy_dollar_sign: In x-terminal-emulator:

mate-panel --replace

Test by locking the screen — You will know success is achieved once the display turns itself off.

:speech_balloon: 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!

:right_anger_bubble: 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.


I haven't tried this solution, but the one here works for me and looks to be simpler : How do I turn off screen (backlight included) instead of screensaver - #2 by Mirko_Grcic


As far as I can remember (I could be mistaken), there is also the system application "light-locker" which replaces the screensaver and switches backlight off when activated. It used to be the standard locker for Ubuntu for a while.

1 Like