Use Caps Lock as arbitrary shortcut key in KDE5












0














I'd like to run a bash script when I press caps lock in KDE5. I had this working just fine in KDE4. I can easily assign Caps Lock as the trigger to a command in system settings -> shortcuts -> custom shortcuts, but it simply doesn't work.



There are some options in system settings -> input devices -> keyboard -> advanced under "Caps lock key behaviour", but they're all pretty specific such as using caps as an additional modifier key. Disabling also actually disables it completely, rather than just disabling the caps functionality, which is a problem with this approach.



Is there a workaround to properly remap caps?










share|improve this question





























    0














    I'd like to run a bash script when I press caps lock in KDE5. I had this working just fine in KDE4. I can easily assign Caps Lock as the trigger to a command in system settings -> shortcuts -> custom shortcuts, but it simply doesn't work.



    There are some options in system settings -> input devices -> keyboard -> advanced under "Caps lock key behaviour", but they're all pretty specific such as using caps as an additional modifier key. Disabling also actually disables it completely, rather than just disabling the caps functionality, which is a problem with this approach.



    Is there a workaround to properly remap caps?










    share|improve this question



























      0












      0








      0







      I'd like to run a bash script when I press caps lock in KDE5. I had this working just fine in KDE4. I can easily assign Caps Lock as the trigger to a command in system settings -> shortcuts -> custom shortcuts, but it simply doesn't work.



      There are some options in system settings -> input devices -> keyboard -> advanced under "Caps lock key behaviour", but they're all pretty specific such as using caps as an additional modifier key. Disabling also actually disables it completely, rather than just disabling the caps functionality, which is a problem with this approach.



      Is there a workaround to properly remap caps?










      share|improve this question















      I'd like to run a bash script when I press caps lock in KDE5. I had this working just fine in KDE4. I can easily assign Caps Lock as the trigger to a command in system settings -> shortcuts -> custom shortcuts, but it simply doesn't work.



      There are some options in system settings -> input devices -> keyboard -> advanced under "Caps lock key behaviour", but they're all pretty specific such as using caps as an additional modifier key. Disabling also actually disables it completely, rather than just disabling the caps functionality, which is a problem with this approach.



      Is there a workaround to properly remap caps?







      shortcut-keys kde kde5






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:25









      Community

      1




      1










      asked Jul 27 '15 at 10:23









      jozxyqk

      605617




      605617






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Not the most optimal solution, but mapping caps lock to another key, such as 'F22', with xmodmap allows KDE's custom shortcuts to capture caps lock. Then disable the caps functionality:



          Add to ~/.Xmodmap:



          ! May need the following line. On ubuntu this seems to cause an error.
          ! remove Lock = Caps_Lock
          keycode 66 = F22
          clear Lock


          (Run xmodmap ~/.Xmodmap to parse immediately, rather than relog)



          Not sure if both lock lines are needed, but I've spent long enough on this already.





          Using setxkbmap works too, but doesn't have the convenience of .Xmodmap. I've tried throwing it in ~/.bash_profile, although this doesn't seem to work there. I suspect because KDE jumps in and re-enables caps lock after its run.



          setxkbmap -option ctrl:nocaps
          xmodmap -e "keycode 66 = F22"





          share|improve this answer























          • First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
            – Collin Peters
            Jun 7 '17 at 4:19











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f653239%2fuse-caps-lock-as-arbitrary-shortcut-key-in-kde5%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Not the most optimal solution, but mapping caps lock to another key, such as 'F22', with xmodmap allows KDE's custom shortcuts to capture caps lock. Then disable the caps functionality:



          Add to ~/.Xmodmap:



          ! May need the following line. On ubuntu this seems to cause an error.
          ! remove Lock = Caps_Lock
          keycode 66 = F22
          clear Lock


          (Run xmodmap ~/.Xmodmap to parse immediately, rather than relog)



          Not sure if both lock lines are needed, but I've spent long enough on this already.





          Using setxkbmap works too, but doesn't have the convenience of .Xmodmap. I've tried throwing it in ~/.bash_profile, although this doesn't seem to work there. I suspect because KDE jumps in and re-enables caps lock after its run.



          setxkbmap -option ctrl:nocaps
          xmodmap -e "keycode 66 = F22"





          share|improve this answer























          • First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
            – Collin Peters
            Jun 7 '17 at 4:19
















          1














          Not the most optimal solution, but mapping caps lock to another key, such as 'F22', with xmodmap allows KDE's custom shortcuts to capture caps lock. Then disable the caps functionality:



          Add to ~/.Xmodmap:



          ! May need the following line. On ubuntu this seems to cause an error.
          ! remove Lock = Caps_Lock
          keycode 66 = F22
          clear Lock


          (Run xmodmap ~/.Xmodmap to parse immediately, rather than relog)



          Not sure if both lock lines are needed, but I've spent long enough on this already.





          Using setxkbmap works too, but doesn't have the convenience of .Xmodmap. I've tried throwing it in ~/.bash_profile, although this doesn't seem to work there. I suspect because KDE jumps in and re-enables caps lock after its run.



          setxkbmap -option ctrl:nocaps
          xmodmap -e "keycode 66 = F22"





          share|improve this answer























          • First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
            – Collin Peters
            Jun 7 '17 at 4:19














          1












          1








          1






          Not the most optimal solution, but mapping caps lock to another key, such as 'F22', with xmodmap allows KDE's custom shortcuts to capture caps lock. Then disable the caps functionality:



          Add to ~/.Xmodmap:



          ! May need the following line. On ubuntu this seems to cause an error.
          ! remove Lock = Caps_Lock
          keycode 66 = F22
          clear Lock


          (Run xmodmap ~/.Xmodmap to parse immediately, rather than relog)



          Not sure if both lock lines are needed, but I've spent long enough on this already.





          Using setxkbmap works too, but doesn't have the convenience of .Xmodmap. I've tried throwing it in ~/.bash_profile, although this doesn't seem to work there. I suspect because KDE jumps in and re-enables caps lock after its run.



          setxkbmap -option ctrl:nocaps
          xmodmap -e "keycode 66 = F22"





          share|improve this answer














          Not the most optimal solution, but mapping caps lock to another key, such as 'F22', with xmodmap allows KDE's custom shortcuts to capture caps lock. Then disable the caps functionality:



          Add to ~/.Xmodmap:



          ! May need the following line. On ubuntu this seems to cause an error.
          ! remove Lock = Caps_Lock
          keycode 66 = F22
          clear Lock


          (Run xmodmap ~/.Xmodmap to parse immediately, rather than relog)



          Not sure if both lock lines are needed, but I've spent long enough on this already.





          Using setxkbmap works too, but doesn't have the convenience of .Xmodmap. I've tried throwing it in ~/.bash_profile, although this doesn't seem to work there. I suspect because KDE jumps in and re-enables caps lock after its run.



          setxkbmap -option ctrl:nocaps
          xmodmap -e "keycode 66 = F22"






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 13 '18 at 21:17

























          answered Jul 27 '15 at 12:10









          jozxyqk

          605617




          605617












          • First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
            – Collin Peters
            Jun 7 '17 at 4:19


















          • First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
            – Collin Peters
            Jun 7 '17 at 4:19
















          First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
          – Collin Peters
          Jun 7 '17 at 4:19




          First remove Lock line wasn't need for me and actually caused an error. But still works one removed! +1
          – Collin Peters
          Jun 7 '17 at 4:19


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f653239%2fuse-caps-lock-as-arbitrary-shortcut-key-in-kde5%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Quarter-circle Tiles

          build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

          Mont Emei