Try this one on for size:
Code:
#!/bin/sh
function set_command {
gconftool-2 --type string --set /apps/metacity/keybinding_commands/command_$1 $2
}
function get_command {
gconftool-2 --get /apps/metacity/keybinding_commands/command_$1
}
function set_shortcut {
gconftool-2 --type string --set /apps/metacity/global_keybindings/run_command_$1 $2
}
function get_shortcut {
gconftool-2 --get /apps/metacity/global_keybindings/run_command_$1
}
if [ $1 == "-get" ]; then
if [ -z $2 ]; then
echo "Useage: $0 [ -get | -set ] commandno [shortcut] [command]"
exit 1
fi
get_shortcut $2
get_command $2
elif [ $1 == "-set" ]; then
if [ -z $2 ] | [ -z $3 ] | [ -z $4 ]; then
echo "Useage: $0 [ -get | -set ] commandno [shortcut] [command]"
exit 1
fi
set_shortcut $2 $3
set_command $2 $4
else
echo "Useage: $0 [ -get | -set ] commandno [shortcut] [command]"
exit 2
fi
Lets you check what a shortcut is before you replace it.
Type checking doesn't realy exist so be carefull use like:
Code:
$ shortcut.sh -get 1
<Alt>Home
/usr/local/bin/somefile
$ shortcut.sh -set 1 "<Alt>Home" "playpause.sh"
Bookmarks