Skip to content

Instantly share code, notes, and snippets.

@tobynet
Last active December 11, 2015 20:18
Show Gist options
  • Save tobynet/4653900 to your computer and use it in GitHub Desktop.
Save tobynet/4653900 to your computer and use it in GitHub Desktop.
Suppress unintentionally closing application by Ctrl+Q on Ubuntu 12.04 desktop.
#!/bin/bash
# 概要: Ubuntu 12.04 デスクトップ上で、Ctrl+Qにて意図せずアプリケーションが終了されてしまうのを防ぐ
# 必要: $ sudo apt-get install gconf2
# 確認方法: $ gconftool-2 -a /desktop/gnome/keybindings/$KEYBINDING_KEY
# 注意点: 誤ってキーが押されたら notify-send で通知しているので、邪魔なら外してください
KEYBINDING_KEY=custom100
if [[ -z "$(gconftool-2 -a /desktop/gnome/keybindings/$KEYBINDING_KEY)" ]] ; then
gconftool-2 --set --type string /desktop/gnome/keybindings/$KEYBINDING_KEY/name 'unintentionally Ctrl+Q killer'
gconftool-2 --set --type string /desktop/gnome/keybindings/$KEYBINDING_KEY/action 'notify-send "!!! suppressed Ctrl+Q !!!"'
gconftool-2 --set --type string /desktop/gnome/keybindings/$KEYBINDING_KEY/binding '<Ctrl>q'
else
echo "WARNING: Gnome $KEYBINDING_KEY shortcut already exists."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment