Running xmodmap when new keyboard is plugged inHow can I change the function of the caps lock key within the Colemak keyboard layout?keybinding issues with xmodmap across synergyRemapping Caps Lock to Control and Escape (not the usual way)After swapping Ctrl and caps in xmodmap, how can I make Ctrl work properly for multi-modifier combinations?Map CapsLock key to ReturnXmodmap remapping modifiers not working?How do I remap the caps lock key to the backspace key?Xmodmap keymap on Bluetooth keyboard

Problem with a commutative diagram

Foiled Bank Robbery

Why would shrinking TEMPDB log lead to slowness?

Do European politicians typically put their pronouns on their social media pages?

How does Berkeley justify existence of other minds?

What would you do? Different results than what is reported

How can I increase the rate of regeneration in humans without the possibility of tumors developing?

How are astronauts in the ISS protected from electric shock?

Is it safe to plug one travel adapter into another?

Copying files: Does Windows write to disk if files are identical

How to handle a player wanting to use the (UA) Remote Access spell on an android player character?

Why do the Romance languages use definite articles, when Latin doesn't?

Natural Metre Bar

Why is Microwaved mac & cheese burnt where they touch?

Are homeless people protected by antidiscrimination laws?

Why are Buddhist concepts so difficult?

Why is Robin Hood French in Shrek?

Why are one-word titles so dominant in books, film, and games?

What does "crank old Sabbath" refer to?

Mutate my DNA sequence

Are these 2 resistors in parallel?

How to select pairs in a list of pairs where the second pair element is within a specified range?

What does "Summoned creature has maximum hit points" actually mean?

How do journals gain and lose reputation?



Running xmodmap when new keyboard is plugged in


How can I change the function of the caps lock key within the Colemak keyboard layout?keybinding issues with xmodmap across synergyRemapping Caps Lock to Control and Escape (not the usual way)After swapping Ctrl and caps in xmodmap, how can I make Ctrl work properly for multi-modifier combinations?Map CapsLock key to ReturnXmodmap remapping modifiers not working?How do I remap the caps lock key to the backspace key?Xmodmap keymap on Bluetooth keyboard






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









1

















When I plug an external keyboard into my laptop (which runs Xubuntu 18.04), I have to run xmodmap ~/.Xmodmap to apply the changes to the second keyboard also. This bothers me.



Here is my .Xmodmap:



! change CapsLock to Escape
clear Lock
keycode 0x42 = Escape


This is supposed to make Caps Lock work like Escape, and works well for the attached keyboard. But when I plug in my USB keyboard in the live system, its Caps Lock does not act like Escape, but still like Caps Lock. I have to run xmodmap ~/.Xmodmap again, to also change the Caps Lock key of the USB keyboard.



If the USB keyboard is plugged in at boot time, there is no problem.



Is there a way to do this automatically, when a keyboard is plugged in?










share|improve this question




























  • It might be possible with udev.

    – Arkadiusz Drabczyk
    May 29 at 15:35











  • @red_trumpet so when you connect your externel keyboard..the physical kyes and its functions are same? Even though you have swapped Caps Lock and Esc?? do you want solution for this swapping case or really need to run a command when external keyboard is plugged in? What is your Ubuntu Version?

    – PRATAP
    May 29 at 16:16











  • @PRATAP I added more information to the question.

    – red_trumpet
    May 30 at 18:53











  • in that case temporarily remove .Xmodmap file reboot and run this command gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" and then attach your external keyboard

    – PRATAP
    May 30 at 19:01

















1

















When I plug an external keyboard into my laptop (which runs Xubuntu 18.04), I have to run xmodmap ~/.Xmodmap to apply the changes to the second keyboard also. This bothers me.



Here is my .Xmodmap:



! change CapsLock to Escape
clear Lock
keycode 0x42 = Escape


This is supposed to make Caps Lock work like Escape, and works well for the attached keyboard. But when I plug in my USB keyboard in the live system, its Caps Lock does not act like Escape, but still like Caps Lock. I have to run xmodmap ~/.Xmodmap again, to also change the Caps Lock key of the USB keyboard.



If the USB keyboard is plugged in at boot time, there is no problem.



Is there a way to do this automatically, when a keyboard is plugged in?










share|improve this question




























  • It might be possible with udev.

    – Arkadiusz Drabczyk
    May 29 at 15:35











  • @red_trumpet so when you connect your externel keyboard..the physical kyes and its functions are same? Even though you have swapped Caps Lock and Esc?? do you want solution for this swapping case or really need to run a command when external keyboard is plugged in? What is your Ubuntu Version?

    – PRATAP
    May 29 at 16:16











  • @PRATAP I added more information to the question.

    – red_trumpet
    May 30 at 18:53











  • in that case temporarily remove .Xmodmap file reboot and run this command gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" and then attach your external keyboard

    – PRATAP
    May 30 at 19:01













1












1








1








When I plug an external keyboard into my laptop (which runs Xubuntu 18.04), I have to run xmodmap ~/.Xmodmap to apply the changes to the second keyboard also. This bothers me.



Here is my .Xmodmap:



! change CapsLock to Escape
clear Lock
keycode 0x42 = Escape


This is supposed to make Caps Lock work like Escape, and works well for the attached keyboard. But when I plug in my USB keyboard in the live system, its Caps Lock does not act like Escape, but still like Caps Lock. I have to run xmodmap ~/.Xmodmap again, to also change the Caps Lock key of the USB keyboard.



If the USB keyboard is plugged in at boot time, there is no problem.



Is there a way to do this automatically, when a keyboard is plugged in?










share|improve this question

















When I plug an external keyboard into my laptop (which runs Xubuntu 18.04), I have to run xmodmap ~/.Xmodmap to apply the changes to the second keyboard also. This bothers me.



Here is my .Xmodmap:



! change CapsLock to Escape
clear Lock
keycode 0x42 = Escape


This is supposed to make Caps Lock work like Escape, and works well for the attached keyboard. But when I plug in my USB keyboard in the live system, its Caps Lock does not act like Escape, but still like Caps Lock. I have to run xmodmap ~/.Xmodmap again, to also change the Caps Lock key of the USB keyboard.



If the USB keyboard is plugged in at boot time, there is no problem.



Is there a way to do this automatically, when a keyboard is plugged in?







18.04 keyboard xmodmap hotplug






share|improve this question
















share|improve this question













share|improve this question




share|improve this question








edited May 30 at 18:51







red_trumpet

















asked May 29 at 14:54









red_trumpetred_trumpet

7261 gold badge9 silver badges28 bronze badges




7261 gold badge9 silver badges28 bronze badges















  • It might be possible with udev.

    – Arkadiusz Drabczyk
    May 29 at 15:35











  • @red_trumpet so when you connect your externel keyboard..the physical kyes and its functions are same? Even though you have swapped Caps Lock and Esc?? do you want solution for this swapping case or really need to run a command when external keyboard is plugged in? What is your Ubuntu Version?

    – PRATAP
    May 29 at 16:16











  • @PRATAP I added more information to the question.

    – red_trumpet
    May 30 at 18:53











  • in that case temporarily remove .Xmodmap file reboot and run this command gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" and then attach your external keyboard

    – PRATAP
    May 30 at 19:01

















  • It might be possible with udev.

    – Arkadiusz Drabczyk
    May 29 at 15:35











  • @red_trumpet so when you connect your externel keyboard..the physical kyes and its functions are same? Even though you have swapped Caps Lock and Esc?? do you want solution for this swapping case or really need to run a command when external keyboard is plugged in? What is your Ubuntu Version?

    – PRATAP
    May 29 at 16:16











  • @PRATAP I added more information to the question.

    – red_trumpet
    May 30 at 18:53











  • in that case temporarily remove .Xmodmap file reboot and run this command gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" and then attach your external keyboard

    – PRATAP
    May 30 at 19:01
















It might be possible with udev.

– Arkadiusz Drabczyk
May 29 at 15:35





It might be possible with udev.

– Arkadiusz Drabczyk
May 29 at 15:35













@red_trumpet so when you connect your externel keyboard..the physical kyes and its functions are same? Even though you have swapped Caps Lock and Esc?? do you want solution for this swapping case or really need to run a command when external keyboard is plugged in? What is your Ubuntu Version?

– PRATAP
May 29 at 16:16





@red_trumpet so when you connect your externel keyboard..the physical kyes and its functions are same? Even though you have swapped Caps Lock and Esc?? do you want solution for this swapping case or really need to run a command when external keyboard is plugged in? What is your Ubuntu Version?

– PRATAP
May 29 at 16:16













@PRATAP I added more information to the question.

– red_trumpet
May 30 at 18:53





@PRATAP I added more information to the question.

– red_trumpet
May 30 at 18:53













in that case temporarily remove .Xmodmap file reboot and run this command gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" and then attach your external keyboard

– PRATAP
May 30 at 19:01





in that case temporarily remove .Xmodmap file reboot and run this command gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" and then attach your external keyboard

– PRATAP
May 30 at 19:01










0






active

oldest

votes













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/4.0/"u003ecc by-sa 4.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%2f1147151%2frunning-xmodmap-when-new-keyboard-is-plugged-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown


























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded















































Thanks for contributing an answer to Ask Ubuntu!


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

But avoid


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

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

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




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1147151%2frunning-xmodmap-when-new-keyboard-is-plugged-in%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

Tamil (spriik) Luke uk diar | Nawigatjuun

Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?