Can I use complex mouse button combinations with xbindkeys?












4















I am running Ubuntu 16.04 and have connected Logitech M705 mouse. This mouse has a total of 10 buttons, button 1 being left click, button 2 right click, button 10 "thumb button".



I have set up xbindkeys



# History Back & Forward
"xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' "
b:6 + Release
"xte 'keydown Alt_L' 'key Right' 'keyup Alt_L' "
b:7 + Release

# page down
"xte 'key Next' "
b:8

# page up
"xte 'key Prior' "
b:9

# powerclick
"xte 'keydown Control_L' 'mouseclick 1' 'keyup Control_L' "


This all works very well. What I call powerclick is used to open links in FF in new tab.



Now what I would like to achieve: when I click button 1 THEN button 10 THEN I select some text and I release both buttons, text should be copied into clipboard. So kind of a quickedit mode for any window, as soon as text is selected this way, it is copied.



# quickcopy
"xte 'keydown Control_L' 'key c' 'keyup Control_L' "
b:10 + b:1 + Release


But this does not do the desired effect.



Is there a way to map such complex conditions? I can imagine this being of a great use, considering that the "thumb button" might work similarly to Ctrl key on keyboard, i.e. to modify standard click behavior.



Later Id like to make Paste function for button 10 (thumb button) + button 2 (Right button)



Thanks










share|improve this question



























    4















    I am running Ubuntu 16.04 and have connected Logitech M705 mouse. This mouse has a total of 10 buttons, button 1 being left click, button 2 right click, button 10 "thumb button".



    I have set up xbindkeys



    # History Back & Forward
    "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' "
    b:6 + Release
    "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L' "
    b:7 + Release

    # page down
    "xte 'key Next' "
    b:8

    # page up
    "xte 'key Prior' "
    b:9

    # powerclick
    "xte 'keydown Control_L' 'mouseclick 1' 'keyup Control_L' "


    This all works very well. What I call powerclick is used to open links in FF in new tab.



    Now what I would like to achieve: when I click button 1 THEN button 10 THEN I select some text and I release both buttons, text should be copied into clipboard. So kind of a quickedit mode for any window, as soon as text is selected this way, it is copied.



    # quickcopy
    "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
    b:10 + b:1 + Release


    But this does not do the desired effect.



    Is there a way to map such complex conditions? I can imagine this being of a great use, considering that the "thumb button" might work similarly to Ctrl key on keyboard, i.e. to modify standard click behavior.



    Later Id like to make Paste function for button 10 (thumb button) + button 2 (Right button)



    Thanks










    share|improve this question

























      4












      4








      4


      1






      I am running Ubuntu 16.04 and have connected Logitech M705 mouse. This mouse has a total of 10 buttons, button 1 being left click, button 2 right click, button 10 "thumb button".



      I have set up xbindkeys



      # History Back & Forward
      "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' "
      b:6 + Release
      "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L' "
      b:7 + Release

      # page down
      "xte 'key Next' "
      b:8

      # page up
      "xte 'key Prior' "
      b:9

      # powerclick
      "xte 'keydown Control_L' 'mouseclick 1' 'keyup Control_L' "


      This all works very well. What I call powerclick is used to open links in FF in new tab.



      Now what I would like to achieve: when I click button 1 THEN button 10 THEN I select some text and I release both buttons, text should be copied into clipboard. So kind of a quickedit mode for any window, as soon as text is selected this way, it is copied.



      # quickcopy
      "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
      b:10 + b:1 + Release


      But this does not do the desired effect.



      Is there a way to map such complex conditions? I can imagine this being of a great use, considering that the "thumb button" might work similarly to Ctrl key on keyboard, i.e. to modify standard click behavior.



      Later Id like to make Paste function for button 10 (thumb button) + button 2 (Right button)



      Thanks










      share|improve this question














      I am running Ubuntu 16.04 and have connected Logitech M705 mouse. This mouse has a total of 10 buttons, button 1 being left click, button 2 right click, button 10 "thumb button".



      I have set up xbindkeys



      # History Back & Forward
      "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' "
      b:6 + Release
      "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L' "
      b:7 + Release

      # page down
      "xte 'key Next' "
      b:8

      # page up
      "xte 'key Prior' "
      b:9

      # powerclick
      "xte 'keydown Control_L' 'mouseclick 1' 'keyup Control_L' "


      This all works very well. What I call powerclick is used to open links in FF in new tab.



      Now what I would like to achieve: when I click button 1 THEN button 10 THEN I select some text and I release both buttons, text should be copied into clipboard. So kind of a quickedit mode for any window, as soon as text is selected this way, it is copied.



      # quickcopy
      "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
      b:10 + b:1 + Release


      But this does not do the desired effect.



      Is there a way to map such complex conditions? I can imagine this being of a great use, considering that the "thumb button" might work similarly to Ctrl key on keyboard, i.e. to modify standard click behavior.



      Later Id like to make Paste function for button 10 (thumb button) + button 2 (Right button)



      Thanks







      keyboard shortcut-keys mouse xbindkeys






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 3 '16 at 2:15









      michnovkamichnovka

      1579




      1579






















          3 Answers
          3






          active

          oldest

          votes


















          2














          Running xbindkeys -n -v in a terminal outputs:



          1 keys in /home/whoever/.xbindkeysrc

          min_keycode=8 max_keycode=255 (ie: know keycodes)
          "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
          Release + m:0x0 + b:1 (mouse)
          starting loop...


          As I think m:0x0 is a mouse state, seems like xbindkeys is interpreting b:10 + b:1 + Release as simply b:1 + Release.



          I don't know if we are doing it wrong and there is a correct way of writing it, or if using a two-mouse-button combination is simply not possible in xbindkeys.






          share|improve this answer

































            2














            It's not possible to do normally, but fortunately xbindkeys supports a scripting language called guile that allows you to do things like set states/variables which allows you to create buttons that act like modifier keys.



            I made a thread about it:
            https://www.linuxquestions.org/questions/linux-desktop-74/%5Bxbindkeys%5D-advanced-mouse-binds-4175428297/






            share|improve this answer































              0














              Example



              implementing b:3 + b:1, right click in combination with left click send CTRL+F5 in this example... this require xbindkeys to be built with guile support



              Create this additional config file /home/user/.xbindkeysrc.scm with the following content.




              Basically this will




              • intercept first watched key > then

              • watch for second key


                • case of key1 + key2 it send its command

                • otherwise it send command for first key


                • restart xbindkeys (to start over in a clean way)






              ;;   This configuration is guile based.
              ;; http://www.gnu.org/software/guile/guile.html


              ;; Right Click
              (define (first-binding)
              "First binding"
              (xbindkey-function '("b:3") b3-second-binding)
              )

              (define (reset-first-binding)
              "reset first binding"
              (ungrab-all-keys)
              (remove-all-keys)
              )

              (define (b3-second-binding)
              "Button Extra Functions"
              (reset-first-binding)

              ;; First Key Down + Second Key = Action Ctrl+F5 And Release
              (xbindkey-function '("b:1")
              (lambda ()
              (reset-first-binding)
              (run-command "xte 'keydown Control_R' 'keydown F5' 'keyup F5' 'keyup Control_R'")
              (run-command "killall xbindkeys; xbindkeys")
              )
              )

              ;; First Key Up = Release
              (xbindkey-function '(release "b:3")
              (lambda ()
              (reset-first-binding)
              (run-command "xte 'mouseclick 3'")
              (run-command "killall xbindkeys; xbindkeys")
              )
              )
              )

              (first-binding)


              Thanks to David Bobb





              share























                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%2f832411%2fcan-i-use-complex-mouse-button-combinations-with-xbindkeys%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                2














                Running xbindkeys -n -v in a terminal outputs:



                1 keys in /home/whoever/.xbindkeysrc

                min_keycode=8 max_keycode=255 (ie: know keycodes)
                "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
                Release + m:0x0 + b:1 (mouse)
                starting loop...


                As I think m:0x0 is a mouse state, seems like xbindkeys is interpreting b:10 + b:1 + Release as simply b:1 + Release.



                I don't know if we are doing it wrong and there is a correct way of writing it, or if using a two-mouse-button combination is simply not possible in xbindkeys.






                share|improve this answer






























                  2














                  Running xbindkeys -n -v in a terminal outputs:



                  1 keys in /home/whoever/.xbindkeysrc

                  min_keycode=8 max_keycode=255 (ie: know keycodes)
                  "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
                  Release + m:0x0 + b:1 (mouse)
                  starting loop...


                  As I think m:0x0 is a mouse state, seems like xbindkeys is interpreting b:10 + b:1 + Release as simply b:1 + Release.



                  I don't know if we are doing it wrong and there is a correct way of writing it, or if using a two-mouse-button combination is simply not possible in xbindkeys.






                  share|improve this answer




























                    2












                    2








                    2







                    Running xbindkeys -n -v in a terminal outputs:



                    1 keys in /home/whoever/.xbindkeysrc

                    min_keycode=8 max_keycode=255 (ie: know keycodes)
                    "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
                    Release + m:0x0 + b:1 (mouse)
                    starting loop...


                    As I think m:0x0 is a mouse state, seems like xbindkeys is interpreting b:10 + b:1 + Release as simply b:1 + Release.



                    I don't know if we are doing it wrong and there is a correct way of writing it, or if using a two-mouse-button combination is simply not possible in xbindkeys.






                    share|improve this answer















                    Running xbindkeys -n -v in a terminal outputs:



                    1 keys in /home/whoever/.xbindkeysrc

                    min_keycode=8 max_keycode=255 (ie: know keycodes)
                    "xte 'keydown Control_L' 'key c' 'keyup Control_L' "
                    Release + m:0x0 + b:1 (mouse)
                    starting loop...


                    As I think m:0x0 is a mouse state, seems like xbindkeys is interpreting b:10 + b:1 + Release as simply b:1 + Release.



                    I don't know if we are doing it wrong and there is a correct way of writing it, or if using a two-mouse-button combination is simply not possible in xbindkeys.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 7 '16 at 18:41

























                    answered Dec 6 '16 at 11:38









                    100r100r

                    716




                    716

























                        2














                        It's not possible to do normally, but fortunately xbindkeys supports a scripting language called guile that allows you to do things like set states/variables which allows you to create buttons that act like modifier keys.



                        I made a thread about it:
                        https://www.linuxquestions.org/questions/linux-desktop-74/%5Bxbindkeys%5D-advanced-mouse-binds-4175428297/






                        share|improve this answer




























                          2














                          It's not possible to do normally, but fortunately xbindkeys supports a scripting language called guile that allows you to do things like set states/variables which allows you to create buttons that act like modifier keys.



                          I made a thread about it:
                          https://www.linuxquestions.org/questions/linux-desktop-74/%5Bxbindkeys%5D-advanced-mouse-binds-4175428297/






                          share|improve this answer


























                            2












                            2








                            2







                            It's not possible to do normally, but fortunately xbindkeys supports a scripting language called guile that allows you to do things like set states/variables which allows you to create buttons that act like modifier keys.



                            I made a thread about it:
                            https://www.linuxquestions.org/questions/linux-desktop-74/%5Bxbindkeys%5D-advanced-mouse-binds-4175428297/






                            share|improve this answer













                            It's not possible to do normally, but fortunately xbindkeys supports a scripting language called guile that allows you to do things like set states/variables which allows you to create buttons that act like modifier keys.



                            I made a thread about it:
                            https://www.linuxquestions.org/questions/linux-desktop-74/%5Bxbindkeys%5D-advanced-mouse-binds-4175428297/







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 23 '17 at 7:26









                            David BobbDavid Bobb

                            212




                            212























                                0














                                Example



                                implementing b:3 + b:1, right click in combination with left click send CTRL+F5 in this example... this require xbindkeys to be built with guile support



                                Create this additional config file /home/user/.xbindkeysrc.scm with the following content.




                                Basically this will




                                • intercept first watched key > then

                                • watch for second key


                                  • case of key1 + key2 it send its command

                                  • otherwise it send command for first key


                                  • restart xbindkeys (to start over in a clean way)






                                ;;   This configuration is guile based.
                                ;; http://www.gnu.org/software/guile/guile.html


                                ;; Right Click
                                (define (first-binding)
                                "First binding"
                                (xbindkey-function '("b:3") b3-second-binding)
                                )

                                (define (reset-first-binding)
                                "reset first binding"
                                (ungrab-all-keys)
                                (remove-all-keys)
                                )

                                (define (b3-second-binding)
                                "Button Extra Functions"
                                (reset-first-binding)

                                ;; First Key Down + Second Key = Action Ctrl+F5 And Release
                                (xbindkey-function '("b:1")
                                (lambda ()
                                (reset-first-binding)
                                (run-command "xte 'keydown Control_R' 'keydown F5' 'keyup F5' 'keyup Control_R'")
                                (run-command "killall xbindkeys; xbindkeys")
                                )
                                )

                                ;; First Key Up = Release
                                (xbindkey-function '(release "b:3")
                                (lambda ()
                                (reset-first-binding)
                                (run-command "xte 'mouseclick 3'")
                                (run-command "killall xbindkeys; xbindkeys")
                                )
                                )
                                )

                                (first-binding)


                                Thanks to David Bobb





                                share




























                                  0














                                  Example



                                  implementing b:3 + b:1, right click in combination with left click send CTRL+F5 in this example... this require xbindkeys to be built with guile support



                                  Create this additional config file /home/user/.xbindkeysrc.scm with the following content.




                                  Basically this will




                                  • intercept first watched key > then

                                  • watch for second key


                                    • case of key1 + key2 it send its command

                                    • otherwise it send command for first key


                                    • restart xbindkeys (to start over in a clean way)






                                  ;;   This configuration is guile based.
                                  ;; http://www.gnu.org/software/guile/guile.html


                                  ;; Right Click
                                  (define (first-binding)
                                  "First binding"
                                  (xbindkey-function '("b:3") b3-second-binding)
                                  )

                                  (define (reset-first-binding)
                                  "reset first binding"
                                  (ungrab-all-keys)
                                  (remove-all-keys)
                                  )

                                  (define (b3-second-binding)
                                  "Button Extra Functions"
                                  (reset-first-binding)

                                  ;; First Key Down + Second Key = Action Ctrl+F5 And Release
                                  (xbindkey-function '("b:1")
                                  (lambda ()
                                  (reset-first-binding)
                                  (run-command "xte 'keydown Control_R' 'keydown F5' 'keyup F5' 'keyup Control_R'")
                                  (run-command "killall xbindkeys; xbindkeys")
                                  )
                                  )

                                  ;; First Key Up = Release
                                  (xbindkey-function '(release "b:3")
                                  (lambda ()
                                  (reset-first-binding)
                                  (run-command "xte 'mouseclick 3'")
                                  (run-command "killall xbindkeys; xbindkeys")
                                  )
                                  )
                                  )

                                  (first-binding)


                                  Thanks to David Bobb





                                  share


























                                    0












                                    0








                                    0







                                    Example



                                    implementing b:3 + b:1, right click in combination with left click send CTRL+F5 in this example... this require xbindkeys to be built with guile support



                                    Create this additional config file /home/user/.xbindkeysrc.scm with the following content.




                                    Basically this will




                                    • intercept first watched key > then

                                    • watch for second key


                                      • case of key1 + key2 it send its command

                                      • otherwise it send command for first key


                                      • restart xbindkeys (to start over in a clean way)






                                    ;;   This configuration is guile based.
                                    ;; http://www.gnu.org/software/guile/guile.html


                                    ;; Right Click
                                    (define (first-binding)
                                    "First binding"
                                    (xbindkey-function '("b:3") b3-second-binding)
                                    )

                                    (define (reset-first-binding)
                                    "reset first binding"
                                    (ungrab-all-keys)
                                    (remove-all-keys)
                                    )

                                    (define (b3-second-binding)
                                    "Button Extra Functions"
                                    (reset-first-binding)

                                    ;; First Key Down + Second Key = Action Ctrl+F5 And Release
                                    (xbindkey-function '("b:1")
                                    (lambda ()
                                    (reset-first-binding)
                                    (run-command "xte 'keydown Control_R' 'keydown F5' 'keyup F5' 'keyup Control_R'")
                                    (run-command "killall xbindkeys; xbindkeys")
                                    )
                                    )

                                    ;; First Key Up = Release
                                    (xbindkey-function '(release "b:3")
                                    (lambda ()
                                    (reset-first-binding)
                                    (run-command "xte 'mouseclick 3'")
                                    (run-command "killall xbindkeys; xbindkeys")
                                    )
                                    )
                                    )

                                    (first-binding)


                                    Thanks to David Bobb





                                    share













                                    Example



                                    implementing b:3 + b:1, right click in combination with left click send CTRL+F5 in this example... this require xbindkeys to be built with guile support



                                    Create this additional config file /home/user/.xbindkeysrc.scm with the following content.




                                    Basically this will




                                    • intercept first watched key > then

                                    • watch for second key


                                      • case of key1 + key2 it send its command

                                      • otherwise it send command for first key


                                      • restart xbindkeys (to start over in a clean way)






                                    ;;   This configuration is guile based.
                                    ;; http://www.gnu.org/software/guile/guile.html


                                    ;; Right Click
                                    (define (first-binding)
                                    "First binding"
                                    (xbindkey-function '("b:3") b3-second-binding)
                                    )

                                    (define (reset-first-binding)
                                    "reset first binding"
                                    (ungrab-all-keys)
                                    (remove-all-keys)
                                    )

                                    (define (b3-second-binding)
                                    "Button Extra Functions"
                                    (reset-first-binding)

                                    ;; First Key Down + Second Key = Action Ctrl+F5 And Release
                                    (xbindkey-function '("b:1")
                                    (lambda ()
                                    (reset-first-binding)
                                    (run-command "xte 'keydown Control_R' 'keydown F5' 'keyup F5' 'keyup Control_R'")
                                    (run-command "killall xbindkeys; xbindkeys")
                                    )
                                    )

                                    ;; First Key Up = Release
                                    (xbindkey-function '(release "b:3")
                                    (lambda ()
                                    (reset-first-binding)
                                    (run-command "xte 'mouseclick 3'")
                                    (run-command "killall xbindkeys; xbindkeys")
                                    )
                                    )
                                    )

                                    (first-binding)


                                    Thanks to David Bobb






                                    share











                                    share


                                    share










                                    answered 5 mins ago









                                    intikaintika

                                    24016




                                    24016






























                                        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.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f832411%2fcan-i-use-complex-mouse-button-combinations-with-xbindkeys%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

                                        GameSpot

                                        日野市

                                        Tu-95轟炸機