Adjust volume using mouse multimedia buttons

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I know that there are many questions on the internet about setting keyboard/mouse multimedia keys/buttons in Linux, nevertheless my question is more specific.



My wireless input devices:




  • Logitech K270 keyboard,


  • Logitech M510 mouse.

The above-mentioned keyboard has i.a.:



  • volume up,

  • volume down

keys which work fine. My mouse has few multimedia buttons which don't have assigned any actions. I want to assign to two mouse buttons, the same actions, which are assigned to the volume up/down keyboard keys.



Important note:




When I hold the volume up/down keyboard key down, the volume is
gradually getting louder/quieter until volume is maximum/muted. I want
the same effect with my mouse.




To fulfill above requirements I followed following steps:



  1. I installed xvkbd, which is virtual keyboard for X window system,

  2. I checked with xev what are the codes of mouse's buttons (8 - volume down, 9 - volume up),


  3. I added following lines to ~/.xbindkeysrc:



    "xvkbd -text '[XF86AudioLowerVolume]'"
    b:8

    "xvkbd -text '[XF86AudioRaiseVolume]'"
    b:9



  4. I brutally 'reloaded' xbindkeys daemon (actually I don't know if it can be called daemon because it starts from /etc/xdg/autostart):



    pkill -f xbindkeys && xbindkeys


    BTW: I don't know how to reload it gracefully.



and it almost works. Now I can turn the volume up/down with mouse buttons but if I keep holding volume up/down button, the volume is not getting gradually louder/quieter. It stops after one 'iteration'. I want 'auto-repeat' as long as I'm holding the button down.



Questions:



  • How can I fix it?

  • Is there any other way I can do it? For instance using only xmodmap, instead xvkbd + xbindkeys?


For the sake of completeness:




  • xmodmap result:



    abc@xyz:~$ xmodmap -pke | grep -i volume
    keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
    keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume


  • Related commands: xmodmap, xev, showkeys, xbindkeys, xvkbd.


  • Nice ArchWiki webpage about extra keyboard keys.

  • All keysyms are defined in following header files: /usr/include/X11/keysymdef.h and here /usr/include/X11/XF86keysym.h.









share|improve this question



























    up vote
    2
    down vote

    favorite












    I know that there are many questions on the internet about setting keyboard/mouse multimedia keys/buttons in Linux, nevertheless my question is more specific.



    My wireless input devices:




    • Logitech K270 keyboard,


    • Logitech M510 mouse.

    The above-mentioned keyboard has i.a.:



    • volume up,

    • volume down

    keys which work fine. My mouse has few multimedia buttons which don't have assigned any actions. I want to assign to two mouse buttons, the same actions, which are assigned to the volume up/down keyboard keys.



    Important note:




    When I hold the volume up/down keyboard key down, the volume is
    gradually getting louder/quieter until volume is maximum/muted. I want
    the same effect with my mouse.




    To fulfill above requirements I followed following steps:



    1. I installed xvkbd, which is virtual keyboard for X window system,

    2. I checked with xev what are the codes of mouse's buttons (8 - volume down, 9 - volume up),


    3. I added following lines to ~/.xbindkeysrc:



      "xvkbd -text '[XF86AudioLowerVolume]'"
      b:8

      "xvkbd -text '[XF86AudioRaiseVolume]'"
      b:9



    4. I brutally 'reloaded' xbindkeys daemon (actually I don't know if it can be called daemon because it starts from /etc/xdg/autostart):



      pkill -f xbindkeys && xbindkeys


      BTW: I don't know how to reload it gracefully.



    and it almost works. Now I can turn the volume up/down with mouse buttons but if I keep holding volume up/down button, the volume is not getting gradually louder/quieter. It stops after one 'iteration'. I want 'auto-repeat' as long as I'm holding the button down.



    Questions:



    • How can I fix it?

    • Is there any other way I can do it? For instance using only xmodmap, instead xvkbd + xbindkeys?


    For the sake of completeness:




    • xmodmap result:



      abc@xyz:~$ xmodmap -pke | grep -i volume
      keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
      keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume


    • Related commands: xmodmap, xev, showkeys, xbindkeys, xvkbd.


    • Nice ArchWiki webpage about extra keyboard keys.

    • All keysyms are defined in following header files: /usr/include/X11/keysymdef.h and here /usr/include/X11/XF86keysym.h.









    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I know that there are many questions on the internet about setting keyboard/mouse multimedia keys/buttons in Linux, nevertheless my question is more specific.



      My wireless input devices:




      • Logitech K270 keyboard,


      • Logitech M510 mouse.

      The above-mentioned keyboard has i.a.:



      • volume up,

      • volume down

      keys which work fine. My mouse has few multimedia buttons which don't have assigned any actions. I want to assign to two mouse buttons, the same actions, which are assigned to the volume up/down keyboard keys.



      Important note:




      When I hold the volume up/down keyboard key down, the volume is
      gradually getting louder/quieter until volume is maximum/muted. I want
      the same effect with my mouse.




      To fulfill above requirements I followed following steps:



      1. I installed xvkbd, which is virtual keyboard for X window system,

      2. I checked with xev what are the codes of mouse's buttons (8 - volume down, 9 - volume up),


      3. I added following lines to ~/.xbindkeysrc:



        "xvkbd -text '[XF86AudioLowerVolume]'"
        b:8

        "xvkbd -text '[XF86AudioRaiseVolume]'"
        b:9



      4. I brutally 'reloaded' xbindkeys daemon (actually I don't know if it can be called daemon because it starts from /etc/xdg/autostart):



        pkill -f xbindkeys && xbindkeys


        BTW: I don't know how to reload it gracefully.



      and it almost works. Now I can turn the volume up/down with mouse buttons but if I keep holding volume up/down button, the volume is not getting gradually louder/quieter. It stops after one 'iteration'. I want 'auto-repeat' as long as I'm holding the button down.



      Questions:



      • How can I fix it?

      • Is there any other way I can do it? For instance using only xmodmap, instead xvkbd + xbindkeys?


      For the sake of completeness:




      • xmodmap result:



        abc@xyz:~$ xmodmap -pke | grep -i volume
        keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
        keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume


      • Related commands: xmodmap, xev, showkeys, xbindkeys, xvkbd.


      • Nice ArchWiki webpage about extra keyboard keys.

      • All keysyms are defined in following header files: /usr/include/X11/keysymdef.h and here /usr/include/X11/XF86keysym.h.









      share|improve this question















      I know that there are many questions on the internet about setting keyboard/mouse multimedia keys/buttons in Linux, nevertheless my question is more specific.



      My wireless input devices:




      • Logitech K270 keyboard,


      • Logitech M510 mouse.

      The above-mentioned keyboard has i.a.:



      • volume up,

      • volume down

      keys which work fine. My mouse has few multimedia buttons which don't have assigned any actions. I want to assign to two mouse buttons, the same actions, which are assigned to the volume up/down keyboard keys.



      Important note:




      When I hold the volume up/down keyboard key down, the volume is
      gradually getting louder/quieter until volume is maximum/muted. I want
      the same effect with my mouse.




      To fulfill above requirements I followed following steps:



      1. I installed xvkbd, which is virtual keyboard for X window system,

      2. I checked with xev what are the codes of mouse's buttons (8 - volume down, 9 - volume up),


      3. I added following lines to ~/.xbindkeysrc:



        "xvkbd -text '[XF86AudioLowerVolume]'"
        b:8

        "xvkbd -text '[XF86AudioRaiseVolume]'"
        b:9



      4. I brutally 'reloaded' xbindkeys daemon (actually I don't know if it can be called daemon because it starts from /etc/xdg/autostart):



        pkill -f xbindkeys && xbindkeys


        BTW: I don't know how to reload it gracefully.



      and it almost works. Now I can turn the volume up/down with mouse buttons but if I keep holding volume up/down button, the volume is not getting gradually louder/quieter. It stops after one 'iteration'. I want 'auto-repeat' as long as I'm holding the button down.



      Questions:



      • How can I fix it?

      • Is there any other way I can do it? For instance using only xmodmap, instead xvkbd + xbindkeys?


      For the sake of completeness:




      • xmodmap result:



        abc@xyz:~$ xmodmap -pke | grep -i volume
        keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
        keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume


      • Related commands: xmodmap, xev, showkeys, xbindkeys, xvkbd.


      • Nice ArchWiki webpage about extra keyboard keys.

      • All keysyms are defined in following header files: /usr/include/X11/keysymdef.h and here /usr/include/X11/XF86keysym.h.






      audio keyboard-shortcuts mouse multimedia xbindkeys






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:22









      Community♦

      1




      1










      asked Aug 11 '15 at 18:37









      patryk.beza

      480517




      480517




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          1
          down vote













          $ sudo apt-get install xdotool
          $ sudo apt-get install xbindkeys
          $ vim ~/.xbindkeysrc


          Contents:



          # Sound Lower
          "xdotool key XF86AudioLowerVolume"
          b:8

          # Sound Louder
          "xdotool key XF86AudioRaiseVolume"
          b:9


          Save and close.



          $ xbindkeys


          This works for me. Logitech M500 on Ubuntu 14.04.






          share|improve this answer



























            up vote
            0
            down vote













            Some logitech mice have programmable buttons. Some of those have onboard storage to make profiles stored on the mouse. If you have access to a computer that can run Logitech's mouse setup software, you could make the mouse's USB keyboard component send multimedia-key presses (I think with autorepeat), instead of handling it in software on the GNU/Linux side.



            For example, my G602 sends an F6 keypress when I press one of its buttons, even when I have it connected to my Linux desktop. Mice without onboard profile storage will only be able to have their buttons remapped by software (e.g. what you did, or Logitech's own software running under Windows).



            IDK how to set up autorepeat for mouse buttons mapped to keyboard keys as you've done.






            share|improve this answer






















            • Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
              – patryk.beza
              Aug 11 '15 at 20:15











            • @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
              – Peter Cordes
              Aug 11 '15 at 20:33


















            up vote
            0
            down vote













            If you want the mouse buttons to act the same as the multimedia buttons on a keyboard, you have to emulate the keydown and keyup events as opposed to a one-shot keypress. Here's a quick script I use to set this up on my systems:



            sudo apt install xdotool xbindkeys

            echo "Setting up ~/.xbindkeysrc"
            cat <<EOF >> ~/.xbindkeysrc
            # Sound Lower
            "xdotool keydown XF86AudioLowerVolume"
            b:8
            "xdotool keyup XF86AudioLowerVolume"
            b:8 + release

            # Sound Louder
            "xdotool keydown XF86AudioRaiseVolume"
            b:9
            "xdotool keyup XF86AudioRaiseVolume"
            b:9 + release
            EOF

            echo "Running xbindkeys"
            xbindkeys


            ~






            share|improve this answer



























              up vote
              0
              down vote













              Optimal solution



              "xdotool keydown XF86AudioLowerVolume"
              b:8

              "xdotool keyup XF86AudioLowerVolume"
              b:8 + Release

              "xdotool keydown XF86AudioRaiseVolume"
              b:9

              "xdotool keyup XF86AudioRaiseVolume"
              b:9 + Release


              This will behave as the keyboard keys as it will continue changing up/down the volume until you release the mouse button.



              Happy coding...






              share|improve this answer




















                Your Answer







                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "106"
                ;
                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',
                convertImagesToLinks: false,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f222580%2fadjust-volume-using-mouse-multimedia-buttons%23new-answer', 'question_page');

                );

                Post as a guest






























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                1
                down vote













                $ sudo apt-get install xdotool
                $ sudo apt-get install xbindkeys
                $ vim ~/.xbindkeysrc


                Contents:



                # Sound Lower
                "xdotool key XF86AudioLowerVolume"
                b:8

                # Sound Louder
                "xdotool key XF86AudioRaiseVolume"
                b:9


                Save and close.



                $ xbindkeys


                This works for me. Logitech M500 on Ubuntu 14.04.






                share|improve this answer
























                  up vote
                  1
                  down vote













                  $ sudo apt-get install xdotool
                  $ sudo apt-get install xbindkeys
                  $ vim ~/.xbindkeysrc


                  Contents:



                  # Sound Lower
                  "xdotool key XF86AudioLowerVolume"
                  b:8

                  # Sound Louder
                  "xdotool key XF86AudioRaiseVolume"
                  b:9


                  Save and close.



                  $ xbindkeys


                  This works for me. Logitech M500 on Ubuntu 14.04.






                  share|improve this answer






















                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    $ sudo apt-get install xdotool
                    $ sudo apt-get install xbindkeys
                    $ vim ~/.xbindkeysrc


                    Contents:



                    # Sound Lower
                    "xdotool key XF86AudioLowerVolume"
                    b:8

                    # Sound Louder
                    "xdotool key XF86AudioRaiseVolume"
                    b:9


                    Save and close.



                    $ xbindkeys


                    This works for me. Logitech M500 on Ubuntu 14.04.






                    share|improve this answer












                    $ sudo apt-get install xdotool
                    $ sudo apt-get install xbindkeys
                    $ vim ~/.xbindkeysrc


                    Contents:



                    # Sound Lower
                    "xdotool key XF86AudioLowerVolume"
                    b:8

                    # Sound Louder
                    "xdotool key XF86AudioRaiseVolume"
                    b:9


                    Save and close.



                    $ xbindkeys


                    This works for me. Logitech M500 on Ubuntu 14.04.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 12 '16 at 11:42









                    hpfdf

                    111




                    111






















                        up vote
                        0
                        down vote













                        Some logitech mice have programmable buttons. Some of those have onboard storage to make profiles stored on the mouse. If you have access to a computer that can run Logitech's mouse setup software, you could make the mouse's USB keyboard component send multimedia-key presses (I think with autorepeat), instead of handling it in software on the GNU/Linux side.



                        For example, my G602 sends an F6 keypress when I press one of its buttons, even when I have it connected to my Linux desktop. Mice without onboard profile storage will only be able to have their buttons remapped by software (e.g. what you did, or Logitech's own software running under Windows).



                        IDK how to set up autorepeat for mouse buttons mapped to keyboard keys as you've done.






                        share|improve this answer






















                        • Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
                          – patryk.beza
                          Aug 11 '15 at 20:15











                        • @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
                          – Peter Cordes
                          Aug 11 '15 at 20:33















                        up vote
                        0
                        down vote













                        Some logitech mice have programmable buttons. Some of those have onboard storage to make profiles stored on the mouse. If you have access to a computer that can run Logitech's mouse setup software, you could make the mouse's USB keyboard component send multimedia-key presses (I think with autorepeat), instead of handling it in software on the GNU/Linux side.



                        For example, my G602 sends an F6 keypress when I press one of its buttons, even when I have it connected to my Linux desktop. Mice without onboard profile storage will only be able to have their buttons remapped by software (e.g. what you did, or Logitech's own software running under Windows).



                        IDK how to set up autorepeat for mouse buttons mapped to keyboard keys as you've done.






                        share|improve this answer






















                        • Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
                          – patryk.beza
                          Aug 11 '15 at 20:15











                        • @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
                          – Peter Cordes
                          Aug 11 '15 at 20:33













                        up vote
                        0
                        down vote










                        up vote
                        0
                        down vote









                        Some logitech mice have programmable buttons. Some of those have onboard storage to make profiles stored on the mouse. If you have access to a computer that can run Logitech's mouse setup software, you could make the mouse's USB keyboard component send multimedia-key presses (I think with autorepeat), instead of handling it in software on the GNU/Linux side.



                        For example, my G602 sends an F6 keypress when I press one of its buttons, even when I have it connected to my Linux desktop. Mice without onboard profile storage will only be able to have their buttons remapped by software (e.g. what you did, or Logitech's own software running under Windows).



                        IDK how to set up autorepeat for mouse buttons mapped to keyboard keys as you've done.






                        share|improve this answer














                        Some logitech mice have programmable buttons. Some of those have onboard storage to make profiles stored on the mouse. If you have access to a computer that can run Logitech's mouse setup software, you could make the mouse's USB keyboard component send multimedia-key presses (I think with autorepeat), instead of handling it in software on the GNU/Linux side.



                        For example, my G602 sends an F6 keypress when I press one of its buttons, even when I have it connected to my Linux desktop. Mice without onboard profile storage will only be able to have their buttons remapped by software (e.g. what you did, or Logitech's own software running under Windows).



                        IDK how to set up autorepeat for mouse buttons mapped to keyboard keys as you've done.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Aug 11 '15 at 20:31

























                        answered Aug 11 '15 at 19:13









                        Peter Cordes

                        4,0931032




                        4,0931032











                        • Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
                          – patryk.beza
                          Aug 11 '15 at 20:15











                        • @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
                          – Peter Cordes
                          Aug 11 '15 at 20:33

















                        • Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
                          – patryk.beza
                          Aug 11 '15 at 20:15











                        • @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
                          – Peter Cordes
                          Aug 11 '15 at 20:33
















                        Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
                        – patryk.beza
                        Aug 11 '15 at 20:15





                        Very unclear answer for me. I mentioned which model of Logitech mouse I own. I don't understand how setting up some mouse's profile (what is mouse's profile?) on different system can help. This mouse works fine (ie. as I want to work on Linux) on Windows 8.1 out of the box. I want solution for Linux. You can assume that I have only Linux Debian.
                        – patryk.beza
                        Aug 11 '15 at 20:15













                        @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
                        – Peter Cordes
                        Aug 11 '15 at 20:33





                        @patryk.beza: I edited an explanation into my answer. I used to have a Windows gaming machine around, and I used that to set up the buttons on a mouse that I now use with GNU/Linux. I know this isn't a very good answer, since it assumes access to a Windows PC. This might work from a VM if you give it direct access to a USB port. (and have a copy of windows you can run in the VM)
                        – Peter Cordes
                        Aug 11 '15 at 20:33











                        up vote
                        0
                        down vote













                        If you want the mouse buttons to act the same as the multimedia buttons on a keyboard, you have to emulate the keydown and keyup events as opposed to a one-shot keypress. Here's a quick script I use to set this up on my systems:



                        sudo apt install xdotool xbindkeys

                        echo "Setting up ~/.xbindkeysrc"
                        cat <<EOF >> ~/.xbindkeysrc
                        # Sound Lower
                        "xdotool keydown XF86AudioLowerVolume"
                        b:8
                        "xdotool keyup XF86AudioLowerVolume"
                        b:8 + release

                        # Sound Louder
                        "xdotool keydown XF86AudioRaiseVolume"
                        b:9
                        "xdotool keyup XF86AudioRaiseVolume"
                        b:9 + release
                        EOF

                        echo "Running xbindkeys"
                        xbindkeys


                        ~






                        share|improve this answer
























                          up vote
                          0
                          down vote













                          If you want the mouse buttons to act the same as the multimedia buttons on a keyboard, you have to emulate the keydown and keyup events as opposed to a one-shot keypress. Here's a quick script I use to set this up on my systems:



                          sudo apt install xdotool xbindkeys

                          echo "Setting up ~/.xbindkeysrc"
                          cat <<EOF >> ~/.xbindkeysrc
                          # Sound Lower
                          "xdotool keydown XF86AudioLowerVolume"
                          b:8
                          "xdotool keyup XF86AudioLowerVolume"
                          b:8 + release

                          # Sound Louder
                          "xdotool keydown XF86AudioRaiseVolume"
                          b:9
                          "xdotool keyup XF86AudioRaiseVolume"
                          b:9 + release
                          EOF

                          echo "Running xbindkeys"
                          xbindkeys


                          ~






                          share|improve this answer






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            If you want the mouse buttons to act the same as the multimedia buttons on a keyboard, you have to emulate the keydown and keyup events as opposed to a one-shot keypress. Here's a quick script I use to set this up on my systems:



                            sudo apt install xdotool xbindkeys

                            echo "Setting up ~/.xbindkeysrc"
                            cat <<EOF >> ~/.xbindkeysrc
                            # Sound Lower
                            "xdotool keydown XF86AudioLowerVolume"
                            b:8
                            "xdotool keyup XF86AudioLowerVolume"
                            b:8 + release

                            # Sound Louder
                            "xdotool keydown XF86AudioRaiseVolume"
                            b:9
                            "xdotool keyup XF86AudioRaiseVolume"
                            b:9 + release
                            EOF

                            echo "Running xbindkeys"
                            xbindkeys


                            ~






                            share|improve this answer












                            If you want the mouse buttons to act the same as the multimedia buttons on a keyboard, you have to emulate the keydown and keyup events as opposed to a one-shot keypress. Here's a quick script I use to set this up on my systems:



                            sudo apt install xdotool xbindkeys

                            echo "Setting up ~/.xbindkeysrc"
                            cat <<EOF >> ~/.xbindkeysrc
                            # Sound Lower
                            "xdotool keydown XF86AudioLowerVolume"
                            b:8
                            "xdotool keyup XF86AudioLowerVolume"
                            b:8 + release

                            # Sound Louder
                            "xdotool keydown XF86AudioRaiseVolume"
                            b:9
                            "xdotool keyup XF86AudioRaiseVolume"
                            b:9 + release
                            EOF

                            echo "Running xbindkeys"
                            xbindkeys


                            ~







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 17 '17 at 22:26









                            cilynx

                            1




                            1




















                                up vote
                                0
                                down vote













                                Optimal solution



                                "xdotool keydown XF86AudioLowerVolume"
                                b:8

                                "xdotool keyup XF86AudioLowerVolume"
                                b:8 + Release

                                "xdotool keydown XF86AudioRaiseVolume"
                                b:9

                                "xdotool keyup XF86AudioRaiseVolume"
                                b:9 + Release


                                This will behave as the keyboard keys as it will continue changing up/down the volume until you release the mouse button.



                                Happy coding...






                                share|improve this answer
























                                  up vote
                                  0
                                  down vote













                                  Optimal solution



                                  "xdotool keydown XF86AudioLowerVolume"
                                  b:8

                                  "xdotool keyup XF86AudioLowerVolume"
                                  b:8 + Release

                                  "xdotool keydown XF86AudioRaiseVolume"
                                  b:9

                                  "xdotool keyup XF86AudioRaiseVolume"
                                  b:9 + Release


                                  This will behave as the keyboard keys as it will continue changing up/down the volume until you release the mouse button.



                                  Happy coding...






                                  share|improve this answer






















                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    Optimal solution



                                    "xdotool keydown XF86AudioLowerVolume"
                                    b:8

                                    "xdotool keyup XF86AudioLowerVolume"
                                    b:8 + Release

                                    "xdotool keydown XF86AudioRaiseVolume"
                                    b:9

                                    "xdotool keyup XF86AudioRaiseVolume"
                                    b:9 + Release


                                    This will behave as the keyboard keys as it will continue changing up/down the volume until you release the mouse button.



                                    Happy coding...






                                    share|improve this answer












                                    Optimal solution



                                    "xdotool keydown XF86AudioLowerVolume"
                                    b:8

                                    "xdotool keyup XF86AudioLowerVolume"
                                    b:8 + Release

                                    "xdotool keydown XF86AudioRaiseVolume"
                                    b:9

                                    "xdotool keyup XF86AudioRaiseVolume"
                                    b:9 + Release


                                    This will behave as the keyboard keys as it will continue changing up/down the volume until you release the mouse button.



                                    Happy coding...







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 26 at 23:02









                                    Jože Ws

                                    1011




                                    1011



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f222580%2fadjust-volume-using-mouse-multimedia-buttons%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Popular posts from this blog

                                        How to check contact read email or not when send email to Individual?

                                        Displaying single band from multi-band raster using QGIS

                                        How many registers does an x86_64 CPU actually have?