{"id":417,"date":"2014-11-25T23:28:03","date_gmt":"2014-11-26T04:28:03","guid":{"rendered":"http:\/\/muthii.com\/blog\/?p=417"},"modified":"2014-12-01T00:21:51","modified_gmt":"2014-12-01T05:21:51","slug":"disable-sleep-keyboard-button-linux","status":"publish","type":"post","link":"https:\/\/muthii.com\/blog\/?p=417","title":{"rendered":"Disable sleep keyboard button Linux"},"content":{"rendered":"<p>Recently I needed to disable the sleep button on my Fedora desktop. At first I was going to use <code>xmodmap<\/code> but the main drawback with this method is that changes made are cleared on reboot so I would need to create a script to be run at boot to maintain my settings.<br \/>\nA little more googling and I found a better way of performing the change using <code>pklocalauthority<\/code>. By creating a file &#8220;\/etc\/polkit-1\/localauthority\/50-local.d\/somefile.pkla&#8221; having extension .pkla with the following entries:<br \/>\n<code><br \/>\n[Disable suspend]<br \/>\nIdentity=unix-user:*<br \/>\nAction=org.freedesktop.upower.suspend<br \/>\nResultAny=no<br \/>\nResultActive=no<br \/>\nResultInctive=no<\/p>\n<p>[Disable hibernate]<br \/>\nIdentity=unix-user:*<br \/>\nAction=org.freedesktop.upower.hibernate<br \/>\nResultAny=no<br \/>\nResultActive=no<br \/>\nResultInctive=no<br \/>\n<\/code><\/p>\n<p>This has been tested successfully on Fedora 20, my centos box doesn&#8217;t need this as sleep is blocked by default.<\/p>\n<p>FYI: Some xmodmap commands i found useful when researching the issue.<br \/>\nTo list all keycode mappings <code> xmodmap -pke<\/code><br \/>\nTo disable keyboard mapping for sleep&#8221;X86Sleep&#8221; button on my system which is mapped to &#8220;keycode 150&#8221;.<code>xmodmap -e 'keycode  150 = NoSymbol'<\/code><\/p>\n<p>Update:<br \/>\nAfter second reboot KDE ignored the localpolicy file and I had to reconfigure the sleep button within KDE. I can&#8217;t explain why it worked after first reboot, but for now am just going with redefining the button in KDE.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I needed to disable the sleep button on my Fedora desktop. At first I was going to use xmodmap but the main drawback with this method is that changes made are cleared on reboot so I would need to create a script to be run at boot to maintain my settings. A little more &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/muthii.com\/blog\/?p=417\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Disable sleep keyboard button Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[],"_links":{"self":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/417"}],"collection":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=417"}],"version-history":[{"count":6,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/417\/revisions"}],"predecessor-version":[{"id":424,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/417\/revisions\/424"}],"wp:attachment":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}