Author Topic: Peppermint Shutdown Options with ALT+F4 when Desktop is in focus.  (Read 407 times)

Offline babis1

  • Newly Subscribed
  • *
  • Posts: 19
  • Karma: 14
  • Admirer and Enthusiast of Peppermint Linux OS.
    • View Profile
  • Peppermint version(s): 10
First install xdotool and wmctrl via terminal:
sudo apt-get install xdotool wmctrl

The following script works without problems to start shutdown options (aka Session Logout Options) using ALT+F4 when the user is viewing the Desktop, just as it is seen with Linux Mint Xfce distribution.

#!/bin/bash

if [ "$(xdotool getactivewindow getwindowname)" = "Desktop" ] || [ "$(xdotool getactivewindow getwindowname)" = "" ]
then
    peppermint-logout
else
    wmctrl -c :ACTIVE:
fi
exit 0


Save the script in a file using your preferred filename.  Then in a terminal type sudo chmod +x /pathtofile/filename in order to make it executable. Then you can create a shortcut in keyboard settings by going through Menu -> Peppermint Settings Panel -> User -> Keyboard Settings -> Application Shortcuts -> Add.
Type the path of the script file you just created, and assign a hotkey (ALT+F4 in my case - see the following post how to assign ALT+F4 to the script correctly).

I hope that people find my method useful.
--Isaak.
« Last Edit: August 02, 2020, 03:52:51 pm by babis1 »
Don't forget to click applaud to encourage effort on this forum whenever you learn something new, or interesting.  It will inspire me to research new information and put up new tutorials.
-Isaak.

Offline babis1

  • Newly Subscribed
  • *
  • Posts: 19
  • Karma: 14
  • Admirer and Enthusiast of Peppermint Linux OS.
    • View Profile
  • Peppermint version(s): 10
Re: Peppermint Shutdown Options with ALT+F4 when Desktop is in focus.
« Reply #1 on: June 18, 2020, 06:42:38 pm »
Before you can set the shortcut to be Alt+F4 you need to do the following.
Goto: Menu->Peppermint Settings Panel->Peppermint Control Center->Keyboard Shortcuts
Scroll down to "close_window_key" and double click on the assigned shortcut and reassign it to a different hotkey.  If you fail to do this and assign Alt+F4 to the script above it will not work. This is because Peppermint will put close_window_key as a priority over the script shortcut you created.  If you mistakenly assigned Alt+F4 to the script above and close_window_key option is no longer listed for reassignment you can undo that by the following method (note you will loose your assigned keyboard shortcuts):
you need to copy xfce4-keyboard-shortcuts.xml file from a newly created user on your system to ~/home/your user folder/.config/xfce4/xfconf/xfce-perchannel-xml folder.
Reboot and reassign close_window_key to another hotkey and then you can use Alt+F4 for the script in the previous post.

--Isaak
« Last Edit: June 20, 2020, 07:39:05 am by babis1 »
Don't forget to click applaud to encourage effort on this forum whenever you learn something new, or interesting.  It will inspire me to research new information and put up new tutorials.
-Isaak.