{"id":1100,"date":"2012-02-21T11:51:28","date_gmt":"2012-02-21T16:51:28","guid":{"rendered":"http:\/\/ywwg.com\/wordpress\/?p=1100"},"modified":"2012-02-21T11:51:37","modified_gmt":"2012-02-21T16:51:37","slug":"keybinding-gtk-to-shifted-numbers","status":"publish","type":"post","link":"https:\/\/ywwg.com\/wordpress\/archives\/1100","title":{"rendered":"Keybinding GTK to shifted numbers"},"content":{"rendered":"<p>GTK (and I think QT also) has a fairly intuitive system for binding keys to commands: Control 3 is just <code>\"&lt;Ctrl&gt;3\"<\/code>.  However when you want to bind a key with Shift, things get tricky.  I had tried <code>\"&lt;Ctrl&gt;&lt;Shift&gt;3\"<\/code>, and <code>\"&lt;Ctrl&gt;#\"<\/code>, and <code>\"&lt;Ctrl&gt;&lt;Shift>#\"<\/code>, all without success.<\/p>\n<p>To make this particular keybinding work, you have to use the special X11 keysym name for that key.  I found permanent url that describes these keys <a href=\"http:\/\/www.x.org\/wiki\/KeySyms\" title=\"X11 Keysyms\" target=\"_blank\">here<\/a>, and a better list with printable characters <a href=\"http:\/\/www.in-ulm.de\/~mascheck\/X11\/keysyms.txt\" title=\"X11 Keysyms with printable character equivalents\" target=\"_blank\">here<\/a>.<\/p>\n<p>So for my example, the proper binding would be <code>\"&lt;Ctrl&gt;&lt;Shift&gt;numbersign\"<\/code>.<\/p>\n<p>However keybindings like this are very tricky and shouldn&#8217;t be used in production applications (this example is a personal plugin for GEdit).  This is because keyboards in other countries have different symbols over different numbers.  So it&#8217;s not a given that Shift-3 is the same as numbersign in every country.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GTK (and I think QT also) has a fairly intuitive system for binding keys to commands: Control 3 is just &#8220;&lt;Ctrl&gt;3&#8221;. However when you want to bind a key with Shift, things get tricky. I had tried &#8220;&lt;Ctrl&gt;&lt;Shift&gt;3&#8221;, and &#8220;&lt;Ctrl&gt;#&#8221;, and &#8220;&lt;Ctrl&gt;&lt;Shift>#&#8221;, all without success. To make this particular keybinding work, you have to use &hellip; <a href=\"https:\/\/ywwg.com\/wordpress\/archives\/1100\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Keybinding GTK to shifted numbers&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,13],"tags":[],"_links":{"self":[{"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/posts\/1100"}],"collection":[{"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1100"}],"version-history":[{"count":6,"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/posts\/1100\/revisions"}],"predecessor-version":[{"id":1106,"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/posts\/1100\/revisions\/1106"}],"wp:attachment":[{"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ywwg.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}