PDA

View Full Version : [ubuntu] Second shortcut for "show desktop"



eneth80
October 21st, 2009, 10:56 PM
Hi,
I want Ctrl+Alt+d to show the desktop, my girlfriend wants Meta+d .
How to add <mod4>d without having to substitute Ctrl+Alt+d?
Basically in gconf-editor >apps>metacity>keybinding_commands, I need a command to do the "show desktop", or I need to duplicate the existing show_desktop in gconf-editor >apps>metacity>global_keybindings

Thanks,
Alex

undecim
October 22nd, 2009, 04:45 AM
http://ubuntuforums.org/showthread.php?t=555829

you should be able to install wmctrl and create a new shortcut in System -> Preferences -> Keyboard Shortcuts

EDIT: only problem is that its an on or off command, rather than a toggle. If you want a toggle, then put this a script in your home directory, run chmod a+x on it, and use that script as the command:

#!/bin/bash
if test -e /etc/shm/showdesk; then
rm /etc/shm/showdesk
wmctrl -k off
else
touch /etc/shm/showdesk
wmctrl -k on
fi

stinkeye
October 22nd, 2009, 08:14 AM
Give her a separate user account.

80aless
October 22nd, 2009, 09:27 AM
http://ubuntuforums.org/showthread.php?t=555829

you should be able to install wmctrl and create a new shortcut in System -> Preferences -> Keyboard Shortcuts

EDIT: only problem is that its an on or off command, rather than a toggle. If you want a toggle, then put this a script in your home directory, run chmod a+x on it, and use that script as the command:

#!/bin/bash
if test -e /etc/shm/showdesk; then
rm /etc/shm/showdesk
wmctrl -k off
else
touch /etc/shm/showdesk
wmctrl -k on
fi

Thank you very much, I added in metacity a command calling your script and indeed it shows the desktop after META+d. But it does not toggle: if I press META+d again nothing happens. I looked in your script and I think the first part of your if condition is never satisfied, because I do not have the /etc/shm directory (what is it?)
Thanks again

80aless
October 22nd, 2009, 10:54 AM
Ok sorry, I got it. I change your /etc/shm/showdesk to ~/showdesk and it works. SOLVED!
Thanks again,
Alex