{"id":675,"date":"2008-08-21T23:24:50","date_gmt":"2008-08-22T03:24:50","guid":{"rendered":"http:\/\/www.psychocats.net\/ubuntucat\/?p=675"},"modified":"2008-08-21T23:24:50","modified_gmt":"2008-08-22T03:24:50","slug":"keyboardshortcut","status":"publish","type":"post","link":"https:\/\/www.psychocats.net\/ubuntucat\/keyboardshortcut\/","title":{"rendered":"Making a custom keyboard shortcut in Ubuntu"},"content":{"rendered":"<p>Ubuntu uses a graphical interface called Gnome (sometimes you may hear it referred to as a <i>desktop environment<\/i>), which allows you to easily define keyboard shortcuts for some common commands by going to <b>System<\/b> > <b>Preferences<\/b> > <b>Keyboard Shortcuts<\/b>. <\/p>\n<p>Sometimes, though, you may want to define keyboard shortcuts for custom commands that aren&#8217;t available through that menu. In this example, you&#8217;ll see how to make a keyboard shortcut for a command that will allow you to open a file browser as &#8220;root&#8221; (or the ultimate administrative user). <\/p>\n<p> First, press <b>Alt-F2<\/b>. This will open a <i>Run Application<\/i> dialogue. <\/p>\n<p> <a href=\"http:\/\/www.psychocats.net\/wpimages\/keyboardshortcut01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.psychocats.net\/wpimages\/keyboardshortcutthumb01.png\" width=\"300\" height=\"173\" border=\"0\"><\/a> <br \/> In that dialogue, paste the command <\/p>\n<div class=\"terminal\">gconf-editor<\/div>\n<p>\n<a href=\"http:\/\/www.psychocats.net\/wpimages\/keyboardshortcut02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.psychocats.net\/wpimages\/keyboardshortcutthumb02.png\" width=\"300\" height=\"231\" border=\"0\"><\/a> <br \/> In the Configuration Editor window that appears, click on the menu <b>Apps<\/b> and then select <b>Metacity<\/b>. Within <b>Metacity<\/b>, you&#8217;ll see several submenus. The first one you&#8217;ll select will be <b>global_keybindings<\/b>. Once you select that, you&#8217;ll see a bunch of <i>disabled<\/i> commands with numbers attached to them. Find an empty one, most probably <b>run_command_1<\/b>, click on the <i>Value<\/i> column next to it, and then type the keyboard shortcut. <\/p>\n<p> You&#8217;ll have to actually type out the words describing the shortcut. You can&#8217;t, as you would in the normal Keyboard Shortcut menu, just press the key combination you want. In this case, the shortcut <\/p>\n<div class=\"terminal\">&lt;Mod4&gt;&lt;Hyper&gt;n<\/div>\n<p> means Windows+N (or holding down the Windows key and then pressing the <i>n<\/i> key). <\/p>\n<p> This assumes you&#8217;ve already <a href=\"http:\/\/www.psychocats.net\/ubuntucat\/windowsmodifier\/\">made Windows a modifier key<\/a>. If you haven&#8217;t yet completed that step, you can use other modifier keys like &lt;Shift&gt; or &lt;Alt&gt; <\/p>\n<p> <a href=\"http:\/\/www.psychocats.net\/wpimages\/keyboardshortcut03.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.psychocats.net\/wpimages\/keyboardshortcutthumb03.png\" width=\"300\" height=\"229\" border=\"0\"><\/a> <br \/>Then, again within the submenu of <b>Metacity<\/b>, select <b>keybinding_commands<\/b>, pick the corresponding empty command (since we selected <i>run_command_1<\/i> before, we should now select <i>command_1<\/i>). For the command, we&#8217;re putting <\/p>\n<div class=\"terminal\">gksudo nautilus<\/div>\n<p> <a href=\"http:\/\/www.psychocats.net\/wpimages\/gksudonautilus01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.psychocats.net\/wpimages\/gksudonautilusthumb01.png\" width=\"300\" height=\"185\" border=\"0\"><\/a> <br \/> Now when you press Windows+N, you&#8217;ll get a password authentication dialogue to escalate to root privileges temporarily&#8230; <\/p>\n<p> <a href=\"http:\/\/www.psychocats.net\/wpimages\/gksudonautilus02.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.psychocats.net\/wpimages\/gksudonautilusthumb02.png\" width=\"300\" height=\"175\" border=\"0\"><\/a> <br \/> And then you can browse and make changes to the filesystem as root.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu uses a graphical interface called Gnome (sometimes you may hear it referred to as a desktop environment), which allows you to easily define keyboard shortcuts for some common commands by going to System > Preferences > Keyboard Shortcuts. Sometimes, though, you may want to define keyboard shortcuts for custom commands that aren&#8217;t available through&hellip; <a class=\"more-link\" href=\"https:\/\/www.psychocats.net\/ubuntucat\/keyboardshortcut\/\">Continue reading <span class=\"screen-reader-text\">Making a custom keyboard shortcut in Ubuntu<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,21],"tags":[417,416,911,919],"class_list":["post-675","post","type-post","status-publish","format-standard","hentry","category-linux","category-ubuntu","tag-gnome","tag-keyboard-shortcuts","tag-linux","tag-ubuntu","entry"],"_links":{"self":[{"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/posts\/675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/comments?post=675"}],"version-history":[{"count":6,"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/posts\/675\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/posts\/675\/revisions\/696"}],"wp:attachment":[{"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/media?parent=675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/categories?post=675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.psychocats.net\/ubuntucat\/wp-json\/wp\/v2\/tags?post=675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}