How to send Ctrl+Alt+F1 (and other special keystrokes) to X window?











up vote
3
down vote

favorite












When I press Ctrl+Alt+F{1..12}, it switches me to other virtual terminal.



Even xte "keydown Control_L" "keydown Alt_L" "key F1" "keyup Alt_L" "keyup Control_L" leads to switching to vt instead of sending that keys to focused window.



Use cases of this includes (but not limits to) sending special keystrokes to VNC or virtualization clients to be handled by clinet/guest system instead of the host one. Sometimes (like in VirtualBox) applications explicitly map some special alternative keystroke to that special ones (like Ctrl+Alt+Del or Ctrl+Alt+Backspace in VirtualBox), but I want clean and universal solution.










share|improve this question
























  • The answer depends on which VNC client you're using; each has a different way of doing this. Which VNC client are you using?
    – Michael Hampton
    Jul 24 '12 at 16:13










  • I want universal solution for any X programs, not any VNC or virtual machine client -specific ones.
    – Vi.
    Jul 24 '12 at 19:59










  • I think you just need to run xte on the remote machine, rather than the local machine.
    – Michael Hampton
    Jul 24 '12 at 20:56










  • It's not about local or remote things at all (this is just one use case). It is about delivering arbitrary key presses to X applications in general.
    – Vi.
    Jul 24 '12 at 23:53










  • Perhaps you should clarify your question, then?
    – Michael Hampton
    Jul 24 '12 at 23:58















up vote
3
down vote

favorite












When I press Ctrl+Alt+F{1..12}, it switches me to other virtual terminal.



Even xte "keydown Control_L" "keydown Alt_L" "key F1" "keyup Alt_L" "keyup Control_L" leads to switching to vt instead of sending that keys to focused window.



Use cases of this includes (but not limits to) sending special keystrokes to VNC or virtualization clients to be handled by clinet/guest system instead of the host one. Sometimes (like in VirtualBox) applications explicitly map some special alternative keystroke to that special ones (like Ctrl+Alt+Del or Ctrl+Alt+Backspace in VirtualBox), but I want clean and universal solution.










share|improve this question
























  • The answer depends on which VNC client you're using; each has a different way of doing this. Which VNC client are you using?
    – Michael Hampton
    Jul 24 '12 at 16:13










  • I want universal solution for any X programs, not any VNC or virtual machine client -specific ones.
    – Vi.
    Jul 24 '12 at 19:59










  • I think you just need to run xte on the remote machine, rather than the local machine.
    – Michael Hampton
    Jul 24 '12 at 20:56










  • It's not about local or remote things at all (this is just one use case). It is about delivering arbitrary key presses to X applications in general.
    – Vi.
    Jul 24 '12 at 23:53










  • Perhaps you should clarify your question, then?
    – Michael Hampton
    Jul 24 '12 at 23:58













up vote
3
down vote

favorite









up vote
3
down vote

favorite











When I press Ctrl+Alt+F{1..12}, it switches me to other virtual terminal.



Even xte "keydown Control_L" "keydown Alt_L" "key F1" "keyup Alt_L" "keyup Control_L" leads to switching to vt instead of sending that keys to focused window.



Use cases of this includes (but not limits to) sending special keystrokes to VNC or virtualization clients to be handled by clinet/guest system instead of the host one. Sometimes (like in VirtualBox) applications explicitly map some special alternative keystroke to that special ones (like Ctrl+Alt+Del or Ctrl+Alt+Backspace in VirtualBox), but I want clean and universal solution.










share|improve this question















When I press Ctrl+Alt+F{1..12}, it switches me to other virtual terminal.



Even xte "keydown Control_L" "keydown Alt_L" "key F1" "keyup Alt_L" "keyup Control_L" leads to switching to vt instead of sending that keys to focused window.



Use cases of this includes (but not limits to) sending special keystrokes to VNC or virtualization clients to be handled by clinet/guest system instead of the host one. Sometimes (like in VirtualBox) applications explicitly map some special alternative keystroke to that special ones (like Ctrl+Alt+Del or Ctrl+Alt+Backspace in VirtualBox), but I want clean and universal solution.







linux keyboard-shortcuts xorg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 25 '12 at 22:33

























asked Jan 11 '11 at 14:31









Vi.

7,7121981163




7,7121981163












  • The answer depends on which VNC client you're using; each has a different way of doing this. Which VNC client are you using?
    – Michael Hampton
    Jul 24 '12 at 16:13










  • I want universal solution for any X programs, not any VNC or virtual machine client -specific ones.
    – Vi.
    Jul 24 '12 at 19:59










  • I think you just need to run xte on the remote machine, rather than the local machine.
    – Michael Hampton
    Jul 24 '12 at 20:56










  • It's not about local or remote things at all (this is just one use case). It is about delivering arbitrary key presses to X applications in general.
    – Vi.
    Jul 24 '12 at 23:53










  • Perhaps you should clarify your question, then?
    – Michael Hampton
    Jul 24 '12 at 23:58


















  • The answer depends on which VNC client you're using; each has a different way of doing this. Which VNC client are you using?
    – Michael Hampton
    Jul 24 '12 at 16:13










  • I want universal solution for any X programs, not any VNC or virtual machine client -specific ones.
    – Vi.
    Jul 24 '12 at 19:59










  • I think you just need to run xte on the remote machine, rather than the local machine.
    – Michael Hampton
    Jul 24 '12 at 20:56










  • It's not about local or remote things at all (this is just one use case). It is about delivering arbitrary key presses to X applications in general.
    – Vi.
    Jul 24 '12 at 23:53










  • Perhaps you should clarify your question, then?
    – Michael Hampton
    Jul 24 '12 at 23:58
















The answer depends on which VNC client you're using; each has a different way of doing this. Which VNC client are you using?
– Michael Hampton
Jul 24 '12 at 16:13




The answer depends on which VNC client you're using; each has a different way of doing this. Which VNC client are you using?
– Michael Hampton
Jul 24 '12 at 16:13












I want universal solution for any X programs, not any VNC or virtual machine client -specific ones.
– Vi.
Jul 24 '12 at 19:59




I want universal solution for any X programs, not any VNC or virtual machine client -specific ones.
– Vi.
Jul 24 '12 at 19:59












I think you just need to run xte on the remote machine, rather than the local machine.
– Michael Hampton
Jul 24 '12 at 20:56




I think you just need to run xte on the remote machine, rather than the local machine.
– Michael Hampton
Jul 24 '12 at 20:56












It's not about local or remote things at all (this is just one use case). It is about delivering arbitrary key presses to X applications in general.
– Vi.
Jul 24 '12 at 23:53




It's not about local or remote things at all (this is just one use case). It is about delivering arbitrary key presses to X applications in general.
– Vi.
Jul 24 '12 at 23:53












Perhaps you should clarify your question, then?
– Michael Hampton
Jul 24 '12 at 23:58




Perhaps you should clarify your question, then?
– Michael Hampton
Jul 24 '12 at 23:58










3 Answers
3






active

oldest

votes

















up vote
2
down vote



accepted










Let's call Ctrl+Alt+Fx (where Fx is one of function buttons: F1, F2, F3...) srvr keys.

There is a way to disable/enable srvr keys on the fly. By disabling I mean that X11 do not swallow them, but passes to window manager (kwin in kde).


For diabling srvr keys, you run setxkbmap -option srvrkeys:none

For enabling srvr keys, you run setxkbmap -option

To check if srvr_ctrl(no_srvr_keys) flag is enabled, run setxkbmap -print | grep xkb_symbols



In kde there is possibility to perform window actions (for example, execute some command when window gets or looses focus). So you can automatically disable srvr keys when your special application window is focused, and automatically enable them back when it looses focus. It is universal solution. Useful for such applications as TeamViewer, VirtualBox, Chrome Remote Desktop, ipkvm viewer, krdc and so on.

If you interested, here is my script that I use for this thing: https://github.com/Ashark/aten-ip8000/blob/master/srvrkeys






share|improve this answer




























    up vote
    1
    down vote













    For VirtualBox, try the key combination REL + F1. Here, REL is the key used to release the mouse grab in the VirtualBox window, usually right Ctrl or Alt key.






    share|improve this answer





















    • @diago better now?
      – maxelost
      Jan 11 '11 at 17:07










    • The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
      – Vi.
      Jan 12 '11 at 14:39










    • in virtualbox it's called Host key
      – phuclv
      Dec 7 '16 at 9:13


















    up vote
    0
    down vote













    It is not possible to send Ctrl+Alt+F[1..12] because the virtual terminals are seperate from the desktop that the VNC is connected to.






    share|improve this answer





















    • Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
      – Vi.
      Jan 18 '15 at 20:09











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    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: 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%2fsuperuser.com%2fquestions%2f231798%2fhow-to-send-ctrlaltf1-and-other-special-keystrokes-to-x-window%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








    up vote
    2
    down vote



    accepted










    Let's call Ctrl+Alt+Fx (where Fx is one of function buttons: F1, F2, F3...) srvr keys.

    There is a way to disable/enable srvr keys on the fly. By disabling I mean that X11 do not swallow them, but passes to window manager (kwin in kde).


    For diabling srvr keys, you run setxkbmap -option srvrkeys:none

    For enabling srvr keys, you run setxkbmap -option

    To check if srvr_ctrl(no_srvr_keys) flag is enabled, run setxkbmap -print | grep xkb_symbols



    In kde there is possibility to perform window actions (for example, execute some command when window gets or looses focus). So you can automatically disable srvr keys when your special application window is focused, and automatically enable them back when it looses focus. It is universal solution. Useful for such applications as TeamViewer, VirtualBox, Chrome Remote Desktop, ipkvm viewer, krdc and so on.

    If you interested, here is my script that I use for this thing: https://github.com/Ashark/aten-ip8000/blob/master/srvrkeys






    share|improve this answer

























      up vote
      2
      down vote



      accepted










      Let's call Ctrl+Alt+Fx (where Fx is one of function buttons: F1, F2, F3...) srvr keys.

      There is a way to disable/enable srvr keys on the fly. By disabling I mean that X11 do not swallow them, but passes to window manager (kwin in kde).


      For diabling srvr keys, you run setxkbmap -option srvrkeys:none

      For enabling srvr keys, you run setxkbmap -option

      To check if srvr_ctrl(no_srvr_keys) flag is enabled, run setxkbmap -print | grep xkb_symbols



      In kde there is possibility to perform window actions (for example, execute some command when window gets or looses focus). So you can automatically disable srvr keys when your special application window is focused, and automatically enable them back when it looses focus. It is universal solution. Useful for such applications as TeamViewer, VirtualBox, Chrome Remote Desktop, ipkvm viewer, krdc and so on.

      If you interested, here is my script that I use for this thing: https://github.com/Ashark/aten-ip8000/blob/master/srvrkeys






      share|improve this answer























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        Let's call Ctrl+Alt+Fx (where Fx is one of function buttons: F1, F2, F3...) srvr keys.

        There is a way to disable/enable srvr keys on the fly. By disabling I mean that X11 do not swallow them, but passes to window manager (kwin in kde).


        For diabling srvr keys, you run setxkbmap -option srvrkeys:none

        For enabling srvr keys, you run setxkbmap -option

        To check if srvr_ctrl(no_srvr_keys) flag is enabled, run setxkbmap -print | grep xkb_symbols



        In kde there is possibility to perform window actions (for example, execute some command when window gets or looses focus). So you can automatically disable srvr keys when your special application window is focused, and automatically enable them back when it looses focus. It is universal solution. Useful for such applications as TeamViewer, VirtualBox, Chrome Remote Desktop, ipkvm viewer, krdc and so on.

        If you interested, here is my script that I use for this thing: https://github.com/Ashark/aten-ip8000/blob/master/srvrkeys






        share|improve this answer












        Let's call Ctrl+Alt+Fx (where Fx is one of function buttons: F1, F2, F3...) srvr keys.

        There is a way to disable/enable srvr keys on the fly. By disabling I mean that X11 do not swallow them, but passes to window manager (kwin in kde).


        For diabling srvr keys, you run setxkbmap -option srvrkeys:none

        For enabling srvr keys, you run setxkbmap -option

        To check if srvr_ctrl(no_srvr_keys) flag is enabled, run setxkbmap -print | grep xkb_symbols



        In kde there is possibility to perform window actions (for example, execute some command when window gets or looses focus). So you can automatically disable srvr keys when your special application window is focused, and automatically enable them back when it looses focus. It is universal solution. Useful for such applications as TeamViewer, VirtualBox, Chrome Remote Desktop, ipkvm viewer, krdc and so on.

        If you interested, here is my script that I use for this thing: https://github.com/Ashark/aten-ip8000/blob/master/srvrkeys







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 2 at 16:47









        Ashark

        414




        414
























            up vote
            1
            down vote













            For VirtualBox, try the key combination REL + F1. Here, REL is the key used to release the mouse grab in the VirtualBox window, usually right Ctrl or Alt key.






            share|improve this answer





















            • @diago better now?
              – maxelost
              Jan 11 '11 at 17:07










            • The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
              – Vi.
              Jan 12 '11 at 14:39










            • in virtualbox it's called Host key
              – phuclv
              Dec 7 '16 at 9:13















            up vote
            1
            down vote













            For VirtualBox, try the key combination REL + F1. Here, REL is the key used to release the mouse grab in the VirtualBox window, usually right Ctrl or Alt key.






            share|improve this answer





















            • @diago better now?
              – maxelost
              Jan 11 '11 at 17:07










            • The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
              – Vi.
              Jan 12 '11 at 14:39










            • in virtualbox it's called Host key
              – phuclv
              Dec 7 '16 at 9:13













            up vote
            1
            down vote










            up vote
            1
            down vote









            For VirtualBox, try the key combination REL + F1. Here, REL is the key used to release the mouse grab in the VirtualBox window, usually right Ctrl or Alt key.






            share|improve this answer












            For VirtualBox, try the key combination REL + F1. Here, REL is the key used to release the mouse grab in the VirtualBox window, usually right Ctrl or Alt key.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 11 '11 at 17:06









            maxelost

            1,881148




            1,881148












            • @diago better now?
              – maxelost
              Jan 11 '11 at 17:07










            • The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
              – Vi.
              Jan 12 '11 at 14:39










            • in virtualbox it's called Host key
              – phuclv
              Dec 7 '16 at 9:13


















            • @diago better now?
              – maxelost
              Jan 11 '11 at 17:07










            • The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
              – Vi.
              Jan 12 '11 at 14:39










            • in virtualbox it's called Host key
              – phuclv
              Dec 7 '16 at 9:13
















            @diago better now?
            – maxelost
            Jan 11 '11 at 17:07




            @diago better now?
            – maxelost
            Jan 11 '11 at 17:07












            The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
            – Vi.
            Jan 12 '11 at 14:39




            The question is not about VirtualBox or VMWare (however the VMWare analogue of REL+F1 whould be interesting) or even about VNC clients, it's about "In general". /* trying to do it with xte */
            – Vi.
            Jan 12 '11 at 14:39












            in virtualbox it's called Host key
            – phuclv
            Dec 7 '16 at 9:13




            in virtualbox it's called Host key
            – phuclv
            Dec 7 '16 at 9:13










            up vote
            0
            down vote













            It is not possible to send Ctrl+Alt+F[1..12] because the virtual terminals are seperate from the desktop that the VNC is connected to.






            share|improve this answer





















            • Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
              – Vi.
              Jan 18 '15 at 20:09















            up vote
            0
            down vote













            It is not possible to send Ctrl+Alt+F[1..12] because the virtual terminals are seperate from the desktop that the VNC is connected to.






            share|improve this answer





















            • Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
              – Vi.
              Jan 18 '15 at 20:09













            up vote
            0
            down vote










            up vote
            0
            down vote









            It is not possible to send Ctrl+Alt+F[1..12] because the virtual terminals are seperate from the desktop that the VNC is connected to.






            share|improve this answer












            It is not possible to send Ctrl+Alt+F[1..12] because the virtual terminals are seperate from the desktop that the VNC is connected to.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 18 '15 at 19:52









            TheDoctor

            1012




            1012












            • Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
              – Vi.
              Jan 18 '15 at 20:09


















            • Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
              – Vi.
              Jan 18 '15 at 20:09
















            Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
            – Vi.
            Jan 18 '15 at 20:09




            Unclear. I expect if the "Ctrl+Alt+Fx" event goes into a VNC client then the client will cause VNC server to issue "Ctrl+Alt+Fx". The problematic part that "Ctrl+Alt+Fx" does not reach the client, being interpreted by Xorg.
            – Vi.
            Jan 18 '15 at 20:09


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • 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%2fsuperuser.com%2fquestions%2f231798%2fhow-to-send-ctrlaltf1-and-other-special-keystrokes-to-x-window%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

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?