How to make the hot corner show desktop and restore windows

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

How to make the hot corner show desktop and restore windows

Postby Zorba on Fri Mar 07, 2014 5:28 am

1- Solution 1:

a- install wmctrl
Code: Select all
sudo apt-get install wmctrl


b- go to " hot corners" in the s"ystem setting" and set two hot corners to custom and in one box enter:
Code: Select all
wmctrl -k on

and in the other enter:
Code: Select all
wmctrl -k off


the first will show your desktop and the other will restore windows :D

2- Solution two:

a- install wmctrl
Code: Select all
sudo apt-get install wmctrl


b- create a script with the following content and make it excutable:
Code: Select all
#!/bin/bash

current_mode="$(wmctrl -m | grep 'showing the desktop')"

if [[ "${current_mode##* }" == ON ]]; then
    wmctrl -k off
else
    wmctrl -k on
fi


c- name it "showdesktop" (or whatever you want) and place it in your home folder or somewhere safe then give the directory to this script in the hot corner box in your system settings. For example, I put it in my home folder and made it hidden by placing a period before it like this:
Code: Select all
/home/mint/.showdesktop


Image

now the same corner will do both :D



Explanation of above code:
Code: Select all
#!/bin/bash

This is a shebang comment.
Code: Select all
current_mode="$(wmctrl -m | grep 'showing the desktop')"

This captures the output of wmctrl -m piped through grep 'showing the desktop' into the variable $current_mode.
Code: Select all
if [[ "${current_mode##* }" == ON ]]; then
    wmctrl -k off
else
    wmctrl -k on
fi

An if...else... statement in Bash. ${current_mode##* } returns $current_mode with the longest match of anything up until a space deleted from the front of the string. If this returns ON, turns desktop off; else turns desktop on. :D :D
Image
User avatar
Zorba
Level 8
Level 8
 
Posts: 2292
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Linux Mint is funded by ads and donations.
 

Re: How to make the hot corner show desktop and restore wind

Postby gusti on Tue May 06, 2014 1:15 pm

or you can try toggle it

Code: Select all
#!/bin/sh

TOGGLE=$HOME/.toggle

if [ ! -e $TOGGLE ]; then
        touch $TOGGLE
        wmctrl -k off

else
        rm $TOGGLE
        wmctrl -k on

fi
gusti
Level 1
Level 1
 
Posts: 1
Joined: Tue May 06, 2014 1:08 pm

Re: How to make the hot corner show desktop and restore wind

Postby Zorba on Tue May 06, 2014 7:33 pm

This feature is included by default in Cinnamon 2.2 and so n Linux Mint17 :D
Image
User avatar
Zorba
Level 8
Level 8
 
Posts: 2292
Joined: Tue May 29, 2012 10:12 pm
Location: Tunisia

Re: How to make the hot corner show desktop and restore wind

Postby dazz13 on Mon Jul 28, 2014 3:53 pm

But my use case is, I want to go to the corner, see the desktop, select an image, go back to the corner to unhide the desktop, and drop the image in the browser. When I got to the corner while dragging an image, it does not activate the hot corner. :?: :cry:
dazz13
Level 1
Level 1
 
Posts: 1
Joined: Mon Jul 28, 2014 3:50 pm


Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 10 guests