Assign multiple keyboard shortcuts for one action












13














I've been wondering how can I assign to multiple keyboard shortcuts to do the same action?
More specifically, I want to be able to change my volume with both my headset buttons and my keyboard.



I'm able to change the volume with just one at the time: with the one I define in the 'Keyboard shortcuts' application.
Is there any way?










share|improve this question
























  • Related: askubuntu.com/questions/292494/…
    – AlikElzin-kilaka
    Mar 20 '18 at 8:42
















13














I've been wondering how can I assign to multiple keyboard shortcuts to do the same action?
More specifically, I want to be able to change my volume with both my headset buttons and my keyboard.



I'm able to change the volume with just one at the time: with the one I define in the 'Keyboard shortcuts' application.
Is there any way?










share|improve this question
























  • Related: askubuntu.com/questions/292494/…
    – AlikElzin-kilaka
    Mar 20 '18 at 8:42














13












13








13


4





I've been wondering how can I assign to multiple keyboard shortcuts to do the same action?
More specifically, I want to be able to change my volume with both my headset buttons and my keyboard.



I'm able to change the volume with just one at the time: with the one I define in the 'Keyboard shortcuts' application.
Is there any way?










share|improve this question















I've been wondering how can I assign to multiple keyboard shortcuts to do the same action?
More specifically, I want to be able to change my volume with both my headset buttons and my keyboard.



I'm able to change the volume with just one at the time: with the one I define in the 'Keyboard shortcuts' application.
Is there any way?







keyboard shortcuts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 29 '12 at 9:21









Bruno Pereira

59.5k26179206




59.5k26179206










asked Aug 30 '11 at 7:19









ksemeks

1766




1766












  • Related: askubuntu.com/questions/292494/…
    – AlikElzin-kilaka
    Mar 20 '18 at 8:42


















  • Related: askubuntu.com/questions/292494/…
    – AlikElzin-kilaka
    Mar 20 '18 at 8:42
















Related: askubuntu.com/questions/292494/…
– AlikElzin-kilaka
Mar 20 '18 at 8:42




Related: askubuntu.com/questions/292494/…
– AlikElzin-kilaka
Mar 20 '18 at 8:42










3 Answers
3






active

oldest

votes


















4














I do just that with Custom Shortcuts:



screenshot of keyboard shortcuts settings



I use xdotool key --clearmodifiers XF86AudioLowerVolume (and XF86AudioRaiseVolume) command instead of amixer set 'Master' 10%+. The only difference/downside I notice is that even Repeat Keys on Typing tab is set this doesn't apply to this custom shortcut.



However, I wasn't able to do same things like use Fn+F7 to turn off my screen (xset dpms force standby). It doesn't detect it as a shortcut event.






share|improve this answer































    2














    You could probably use xmodmap to reassign the buttons on your headset to the same as you use for your keyboard.






    share|improve this answer





















    • Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
      – ksemeks
      Aug 30 '11 at 7:50












    • @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
      – danjjl
      Aug 30 '11 at 9:05












    • @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
      – ksemeks
      Aug 30 '11 at 9:10



















    0














    You can assign multiple keyboard shortcuts (keybindings) for the same command using gsettings command line.



    One important thing to know is that Ubuntu 18.04 Settings GUI only shows the first keybinding for a command, so if you have multiple keybindings for a command, the others won't appear in Settings. You can use gsettings to all the keybindings.



    Let's say I want to add another keybinding for "Switch to Workspace 1". The default for me was Super+Home, but I want to add a second keybinding Ctrl+1.



    # list all keybindings
    gsettings list-recursively | grep -e org.gnome.desktop.wm.keybindings -e org.gnome.settings-daemon.plugins.media-keys -e org.gnome.settings-daemon.plugins.power | sort

    # confirm no other keybinding conflicts
    gsettings list-recursively | grep '<Control>1'

    # set multiple keybindings for "Switch to Workspace 1"
    gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Control>1']"

    # confirm value is set correctly
    gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-1


    Now you can use either Super+Home or Control+1 to Switch to Workspace 1. Remember, you will only see the first one Super+Home in the Settings GUI, but it will work!






    share|improve this answer





















    • This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
      – hackel
      Dec 17 '18 at 21:38











    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%2f59250%2fassign-multiple-keyboard-shortcuts-for-one-action%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









    4














    I do just that with Custom Shortcuts:



    screenshot of keyboard shortcuts settings



    I use xdotool key --clearmodifiers XF86AudioLowerVolume (and XF86AudioRaiseVolume) command instead of amixer set 'Master' 10%+. The only difference/downside I notice is that even Repeat Keys on Typing tab is set this doesn't apply to this custom shortcut.



    However, I wasn't able to do same things like use Fn+F7 to turn off my screen (xset dpms force standby). It doesn't detect it as a shortcut event.






    share|improve this answer




























      4














      I do just that with Custom Shortcuts:



      screenshot of keyboard shortcuts settings



      I use xdotool key --clearmodifiers XF86AudioLowerVolume (and XF86AudioRaiseVolume) command instead of amixer set 'Master' 10%+. The only difference/downside I notice is that even Repeat Keys on Typing tab is set this doesn't apply to this custom shortcut.



      However, I wasn't able to do same things like use Fn+F7 to turn off my screen (xset dpms force standby). It doesn't detect it as a shortcut event.






      share|improve this answer


























        4












        4








        4






        I do just that with Custom Shortcuts:



        screenshot of keyboard shortcuts settings



        I use xdotool key --clearmodifiers XF86AudioLowerVolume (and XF86AudioRaiseVolume) command instead of amixer set 'Master' 10%+. The only difference/downside I notice is that even Repeat Keys on Typing tab is set this doesn't apply to this custom shortcut.



        However, I wasn't able to do same things like use Fn+F7 to turn off my screen (xset dpms force standby). It doesn't detect it as a shortcut event.






        share|improve this answer














        I do just that with Custom Shortcuts:



        screenshot of keyboard shortcuts settings



        I use xdotool key --clearmodifiers XF86AudioLowerVolume (and XF86AudioRaiseVolume) command instead of amixer set 'Master' 10%+. The only difference/downside I notice is that even Repeat Keys on Typing tab is set this doesn't apply to this custom shortcut.



        However, I wasn't able to do same things like use Fn+F7 to turn off my screen (xset dpms force standby). It doesn't detect it as a shortcut event.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 19 '18 at 17:44

























        answered Jan 17 '17 at 23:30









        Pablo Bianchi

        2,3741528




        2,3741528

























            2














            You could probably use xmodmap to reassign the buttons on your headset to the same as you use for your keyboard.






            share|improve this answer





















            • Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
              – ksemeks
              Aug 30 '11 at 7:50












            • @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
              – danjjl
              Aug 30 '11 at 9:05












            • @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
              – ksemeks
              Aug 30 '11 at 9:10
















            2














            You could probably use xmodmap to reassign the buttons on your headset to the same as you use for your keyboard.






            share|improve this answer





















            • Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
              – ksemeks
              Aug 30 '11 at 7:50












            • @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
              – danjjl
              Aug 30 '11 at 9:05












            • @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
              – ksemeks
              Aug 30 '11 at 9:10














            2












            2








            2






            You could probably use xmodmap to reassign the buttons on your headset to the same as you use for your keyboard.






            share|improve this answer












            You could probably use xmodmap to reassign the buttons on your headset to the same as you use for your keyboard.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 30 '11 at 7:29









            Jo-Erlend Schinstad

            26.4k556108




            26.4k556108












            • Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
              – ksemeks
              Aug 30 '11 at 7:50












            • @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
              – danjjl
              Aug 30 '11 at 9:05












            • @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
              – ksemeks
              Aug 30 '11 at 9:10


















            • Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
              – ksemeks
              Aug 30 '11 at 7:50












            • @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
              – danjjl
              Aug 30 '11 at 9:05












            • @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
              – ksemeks
              Aug 30 '11 at 9:10
















            Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
            – ksemeks
            Aug 30 '11 at 7:50






            Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset.
            – ksemeks
            Aug 30 '11 at 7:50














            @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
            – danjjl
            Aug 30 '11 at 9:05






            @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge
            – danjjl
            Aug 30 '11 at 9:05














            @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
            – ksemeks
            Aug 30 '11 at 9:10




            @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts
            – ksemeks
            Aug 30 '11 at 9:10











            0














            You can assign multiple keyboard shortcuts (keybindings) for the same command using gsettings command line.



            One important thing to know is that Ubuntu 18.04 Settings GUI only shows the first keybinding for a command, so if you have multiple keybindings for a command, the others won't appear in Settings. You can use gsettings to all the keybindings.



            Let's say I want to add another keybinding for "Switch to Workspace 1". The default for me was Super+Home, but I want to add a second keybinding Ctrl+1.



            # list all keybindings
            gsettings list-recursively | grep -e org.gnome.desktop.wm.keybindings -e org.gnome.settings-daemon.plugins.media-keys -e org.gnome.settings-daemon.plugins.power | sort

            # confirm no other keybinding conflicts
            gsettings list-recursively | grep '<Control>1'

            # set multiple keybindings for "Switch to Workspace 1"
            gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Control>1']"

            # confirm value is set correctly
            gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-1


            Now you can use either Super+Home or Control+1 to Switch to Workspace 1. Remember, you will only see the first one Super+Home in the Settings GUI, but it will work!






            share|improve this answer





















            • This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
              – hackel
              Dec 17 '18 at 21:38
















            0














            You can assign multiple keyboard shortcuts (keybindings) for the same command using gsettings command line.



            One important thing to know is that Ubuntu 18.04 Settings GUI only shows the first keybinding for a command, so if you have multiple keybindings for a command, the others won't appear in Settings. You can use gsettings to all the keybindings.



            Let's say I want to add another keybinding for "Switch to Workspace 1". The default for me was Super+Home, but I want to add a second keybinding Ctrl+1.



            # list all keybindings
            gsettings list-recursively | grep -e org.gnome.desktop.wm.keybindings -e org.gnome.settings-daemon.plugins.media-keys -e org.gnome.settings-daemon.plugins.power | sort

            # confirm no other keybinding conflicts
            gsettings list-recursively | grep '<Control>1'

            # set multiple keybindings for "Switch to Workspace 1"
            gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Control>1']"

            # confirm value is set correctly
            gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-1


            Now you can use either Super+Home or Control+1 to Switch to Workspace 1. Remember, you will only see the first one Super+Home in the Settings GUI, but it will work!






            share|improve this answer





















            • This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
              – hackel
              Dec 17 '18 at 21:38














            0












            0








            0






            You can assign multiple keyboard shortcuts (keybindings) for the same command using gsettings command line.



            One important thing to know is that Ubuntu 18.04 Settings GUI only shows the first keybinding for a command, so if you have multiple keybindings for a command, the others won't appear in Settings. You can use gsettings to all the keybindings.



            Let's say I want to add another keybinding for "Switch to Workspace 1". The default for me was Super+Home, but I want to add a second keybinding Ctrl+1.



            # list all keybindings
            gsettings list-recursively | grep -e org.gnome.desktop.wm.keybindings -e org.gnome.settings-daemon.plugins.media-keys -e org.gnome.settings-daemon.plugins.power | sort

            # confirm no other keybinding conflicts
            gsettings list-recursively | grep '<Control>1'

            # set multiple keybindings for "Switch to Workspace 1"
            gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Control>1']"

            # confirm value is set correctly
            gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-1


            Now you can use either Super+Home or Control+1 to Switch to Workspace 1. Remember, you will only see the first one Super+Home in the Settings GUI, but it will work!






            share|improve this answer












            You can assign multiple keyboard shortcuts (keybindings) for the same command using gsettings command line.



            One important thing to know is that Ubuntu 18.04 Settings GUI only shows the first keybinding for a command, so if you have multiple keybindings for a command, the others won't appear in Settings. You can use gsettings to all the keybindings.



            Let's say I want to add another keybinding for "Switch to Workspace 1". The default for me was Super+Home, but I want to add a second keybinding Ctrl+1.



            # list all keybindings
            gsettings list-recursively | grep -e org.gnome.desktop.wm.keybindings -e org.gnome.settings-daemon.plugins.media-keys -e org.gnome.settings-daemon.plugins.power | sort

            # confirm no other keybinding conflicts
            gsettings list-recursively | grep '<Control>1'

            # set multiple keybindings for "Switch to Workspace 1"
            gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Control>1']"

            # confirm value is set correctly
            gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-1


            Now you can use either Super+Home or Control+1 to Switch to Workspace 1. Remember, you will only see the first one Super+Home in the Settings GUI, but it will work!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 4 '18 at 21:36









            wisbucky

            76498




            76498












            • This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
              – hackel
              Dec 17 '18 at 21:38


















            • This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
              – hackel
              Dec 17 '18 at 21:38
















            This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
            – hackel
            Dec 17 '18 at 21:38




            This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays.
            – hackel
            Dec 17 '18 at 21:38


















            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%2f59250%2fassign-multiple-keyboard-shortcuts-for-one-action%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?