[SOLVED] Switching Caps Lock and Escape

I know this has been asked before, but none of the solutions proposed work for me.
I can currently think of four solutions for this:
* Using xmodmap
* Using setxbmap
* Playing around with udev
* Using DE specific setting
I would like my setting to DE agnostic and as far as possible changing only user config files, so I'm looking for a solution with one of the first two approaches. Referring to previous discussions [1], I tried the following:
* /usr/bin/setxkbmap -option "caps:swapescape"
* Setting caps lock and esc values in .xmodmap file and invoking using /usr/bin/xmodmap ~/.xmodmap
I tried all possible variations, by putting the above in .profile and .xinitrc separately. But, nothing seems to work. How do I solve this problem?
[1] https://bbs.archlinux.org/viewtopic.php?pid=1104840
Last edited by hashken (2014-10-12 13:48:35)

I also use and recommend the first method.
xinitrc is not always read - there isn't a simple way to 'check' but you should know.  How do you start X?  If you are using a DE (as indicated in the first post) many DE's come with their own display managers (DMs) and often these do not read xinitrc.

Similar Messages

  • [SOLVED]Switching Caps Lock with Shift_L

    I have a broken left shift key, and it's a bit of a pain to type with. I often use an external keyboard, so this doesn't always bother me, but when I take my laptop with me somewhere, I would like to be able to quickly swap Caps and Left Shift. For a while, I've done that like this:
    xmodmap -e "keycode 66 = Shift_L NoSymbol Shift_L"
    But xmodmap is deprecated, and causing problems with qt5 applications, so I want to ditch it and do the same thing with setxbmap instead. Now, xkb is really nice, it is full of built in options for common remaps, and a quick look around shows my I can use any one of these to change how caps lock works:
    grp:caps_switch Caps Lock (while pressed), Alt+Caps Lock does the original capslock action
    grp:caps_toggle Caps Lock
    grp:shift_caps_toggle Shift+Caps Lock
    grp:shift_caps_switch Caps Lock (to first layout), Shift+Caps Lock (to last layout)
    grp:alt_caps_toggle Alt+Caps Lock
    lv3:caps_switch Caps Lock
    lv3:caps_switch_latch Caps Lock chooses 3rd level, acts as onetime lock when pressed together with another 3rd-level-chooser
    ctrl:nocaps Caps Lock as Ctrl
    ctrl:swapcaps Swap Ctrl and Caps Lock
    grp_led:caps Caps Lock
    caps Caps Lock key behavior
    caps:internal Caps Lock uses internal capitalization. Shift "pauses" Caps Lock
    caps:internal_nocancel Caps Lock uses internal capitalization. Shift doesn't affect Caps Lock
    caps:shift Caps Lock acts as Shift with locking. Shift "pauses" Caps Lock
    caps:shift_nocancel Caps Lock acts as Shift with locking. Shift doesn't affect Caps Lock
    caps:capslock Caps Lock toggles normal capitalization of alphabetic characters
    caps:numlock Make Caps Lock an additional Num Lock
    caps:swapescape Swap ESC and Caps Lock
    caps:escape Make Caps Lock an additional ESC
    caps:backspace Make Caps Lock an additional Backspace
    caps:super Make Caps Lock an additional Super
    caps:hyper Make Caps Lock an additional Hyper
    caps:shiftlock Caps Lock toggles Shift so all keys are affected
    caps:none Caps Lock is disabled
    caps:ctrl_modifier Make Caps Lock an additional Control but keep the Caps_Lock keysym
    compose:caps Caps Lock
    compose:caps-altgr 3rd level of Caps Lock
    shift:breaks_caps Shift cancels Caps Lock
    shift:both_capslock Both Shift-Keys together toggle Caps Lock
    shift:both_capslock_cancel Both Shift-Keys together activate Caps Lock, one Shift-Key deactivates
    None of those allow me to use caps lock as a normal shift. I'm trying to figure out how to rebind caps to work as a shift, but I want to have this in a script so that my external keyboard will stick with its default behavior, and I can just type "fixshift" when I unplug it. Basically, just manually switch the two with setxkbmap the way I did with xmodmap. Out of a long while searching, and /only/ finding advice to use one of the default options, and none on making my own, I've decided to come here.
    Any help, Arch-friends?
    Last edited by Kebertx (2013-10-31 09:10:14)

    For the record, here's my solution:
    This creates a custom key symbol to swap Caps and Shift:
    /usr/share/X11/xkb/symbols/custom
    partial modifier_keys
    xkb_symbols "swapcaps" {
    replace key <CAPS> { [ Shift_L ] };
    replace key <LFSH> { [ Caps_Lock ] };
    This script prints a description of the keymap, adds the symbol to swap the two keys from that other file to the right line, and writes the new description to a temporary file... then compiles it!
    /usr/local/bin/fixshift
    #!/usr/bin/bash
    setxkbmap -print | sed '/xkb_symbols/ { s/"/+custom(swapcaps)"/2 }' > /tmp/fixshift
    xkbcomp /tmp/fixshift $DISPLAY > /dev/null 2>&1 &
    Then I just set that program to run every time lightdm starts a session:
    /etc/lightdm/lightdm.conf
    display-setup-script=/usr/local/bin/fixshift
    greeter-setup-script=/usr/local/bin/fixshift
    session-setup-script=/usr/local/bin/fixshift
    And nothing more to it. Life is grand again.

  • Pavilion dv4-1275mx notebook - once-flashing leds @ caps lock and scroll keys @ start-up

    My HP Pavilion dv4-1275mx notebook runs Windows Vista Home Premium service pack 1 for 64x-based systems.  
    Recently, when I turn it on, the led lights @ the caps lock and scroll keys repeatedly flash once.
    I'm not sure what, if anything, happened prior to this starting.  It's possible that there was a power surge when it was shut off, or it may be related to doing a McAfee virus scan or installing the latest version of a software, e.g., Adobe Reader.
    I was able to use my System Recovery disks to reinstall the Vista software, thinking this might "kickstart" my computer into working, e.g., as part of the restart process.  After the reinstallation, I was able to use my computer, although the led lights continued to flash.  However, once I shut down my computer, I have been unable to restart it.  The leds continue to flash upon start-up, and I have not been successful in again reinstalling the Vista software.  (I thought if could get my computer to work again that way, it might stay accessible if I used hiberate mode instead of shutting it down.)
    The computer's about 4-1/2 years old.  The screen has a short of some kind (only turning on when the screen is low to the keyboard, so I use an external monitor. 

    Try the steps in the following weblink:
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&lc=en&docname=c00372748
    If the issue persists, please read the following document, understand the LED blink code, identify the root cause and try troubleshooting appropriately:
    http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/kb/docDisplay/?javax.portlet.begCach...
    I am an HP employee.
    Regards,
    Vidya
    Make it easier for other people to find solutions, by marking my answer “Accept as Solution” if it solves your problem.
    ***Click on "Thumbs up" button to the bottom right side of my post to say thanks!***

  • Pavilion Dv5-1009el - Black screen and blink caps lock and block scorr

    Hi,
    I just replaced the motherboard of my pavilion that reported an error as object. The purchased motherboard is new and hp original.
    After having changed, I turn on the pc and work fine, i see the hp logo and enter to bios, after I turned off the pc without starting windows.
    I inserted the battery and powered on the pc and returns to the old error, the LED of caps lock and block Lock blinks...
    So I tried to update the bios from USB using winkey + B. The computer emits two beeps but does not read from any USB port and the LEDs go out for a while and then blink again.
    What can I do?
    Greetings,
    Enzo.

    Hi @shmurray,
    Welcome to the HP Support Forums!
    I understand you are getting a blink pattern on the Caps lock LED, when you turn on the notebook. I am happy to help you with this.
    I am including the page on the error codes for your reference: Blank Screen LED Error Codes
    From that document the pattern you are getting indicates a memory problem. You said that you have tested the memory. What exactly did you try?
    The document suggests reseating the RAM or trying a new set of RAM and then restarting the notebook. If you are still getting a memory problem after trying both of those things, ie a 3 blink code again, then it would likely suggest that there is a problem with the motherboard itself, either with the memory slot or one of the controllers related to memory.
    In that case I would suggest contacting the technical phone support number at 800-474-6836. If you live outside the US/Canada Region, please click the link below to get the support number for your region.
    http://www8.hp.com/us/en/contact-hp/ww-phone-assist.html
    If however reseating the memory or replacing it leads to a different error code or message please let me know, Although in that case the following may be helpful if you still have a blank screen.
    Troubleshooting Black Screen Displays with No Error Messages During Startup or Boot
    Here are some other sources I found that may be helpful to you.
    Resolving Problems with Notebook Displays (Windows 7 and Windows 8)
    I hope that this is helpful to you.
    Regards,
    Malygris1
    I work on behalf of HP
    Please click Accept as Solution if you feel my post solved your issue, it will help others find the solution.
    Click Kudos Thumbs Up on the right to say “Thanks” for helping!

  • CAPS Lock and Scroll Lock blinking / Display is Black

    Hi,
    I am using DV5 with processor AMD Turion X2 RM70. CAPS Lock and Scroll Lock blinking once every 4 secs.
    Is it Blink Code Error? Is my CPU dead? Should i take to service centre(No Warranty)? If CPU failure, how much the CPU costs?
    Please help me.
    Thanks,
    Rahul

    Hi 3dogtim,
    Which computer is this? If you don't know click on Guide to finding your product number. I can look up some information to help answer your questions.
    I look forward to hearing fro you.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • Satellite C55-A and Ubuntu - Caps Lock and Num Lock key leds always off

    I use Ubuntu Desktop 14.04 and Mate Desktop and LightDM. My Toshiba Laptop is Satellite C55-A-1JH (PSCG6E) model.
    Cap Lock and Num Lock is working , but their leds always is off.
    I don't find any Linux driver in Toshiba support web site.How I solve this problem?

    Hi. Are you sure this is a Linux-issue? Please try this: reboot the unit and press F12 several times when the Toshiba logo is shown. When the boot menu is shown try Caps and Num lock again.
    Same issue or not?
    Br Tom

  • HP Pavilion tx2500 - Caps Lock and Num Lock lights blink once

    I turn on my HP Pavilion tx2500 and I hear the fan spinning but nothing else happens.  The lights next to the Caps Lock and above the Num Lock keys blink (a repeating single blink).  According to some HP technical support documents I found online, the repeating single blink indicates a CPU problem.  My laptop is out of warranty and the $400 to send it to HP to have it fixed is practically the same price I paid for the laptop 2 years ago. 
    Do the blinking lights mean the CPU is fried?  And is there anything I can do to fix the laptop?
    Thanks,
    -Jeff
    This question was solved.
    View Solution.

    I have the same problem. I called HP they said the same thing. But, I am BIOS engineer myself and has worked with lot of motherboards, So I felt there is no point in sending a 399$ to find what happend and on top of that fixing charges.
    I noticed the problem started when I installed Win 7 Ultimate edition to the board and let tbe board Idle for a long time and it went into sleep mode and when I hit the button for resume it would not resume, the blinking started.
    I have seen the same thing happend to my friend laptop, luckily for him it recovered and he removed the Sleep Option. SO his laptop is shutdown or running in full power.
    I thought this is not coincidence, there is defenitely a bug in HW or SW that is causing it. remove battery. I replaced the memory and removed the cmos battery and left for a long time (short the battery terminals to discharge quickly). Then I rebooted the machine, Luckuly for me it went to windows, I tht of replacing the BIOS firmware, bcos they ahve some latest on by that time I had a visitor and I was talking to him the system went into sleep mode and will never recover. The system started blinking. I dont see this as a CPU problem.
    I still evaluating this. I will try to post my findings. I have aclip to read the BIOS chip but everytime i get different read. SO I am planning to remove the BIOS chip and put a socket so that I can play with the BIOS.

  • Quick flash of the Num Lock, Caps Lock and Scroll lock, and keyboard freezes temporarily

    I have experienced a Quick flash of the Num Lock, Caps Lock and Scroll lock, and keyboard freezes temporarily.  This occurs a few times a day.  When the Num Lock, Caps Lock and Scroll lock flash i cant typ for a second the keyboard doesnt register the strokes. Is thsi just a hardware clitch or coudl I have a virus?  What is teh solution?

    Hello Razm14,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand that you are experiencing an issue where your computer freezes and the Scroll Lock, Caps Lock and Num Locks keys flash and you are unable to work until they stop. I would be happy to assist you, but first I would encourage you to post your product number for your computer. I am linking an HP Support document below that will show you how to find your product number. As well, if you could indicate which operating system you are using. And whether your operating system is 32-bit or 64-bit as with this and the product number I can provide you with accurate information.
    How Do I Find My Model Number or Product Number?
    Which Windows operating system am I running?
    Is the Windows Version on My Computer 32-bit or 64-bit?
    Please re-post with the requested information and I would be happy to provide you with assistance. Thank you for posting on the HP Forums. Have a great day!
    Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
    Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
    Dunidar
    I work on behalf of HP
    Find out a bit more about me by checking out my profile!
    "Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

  • QtCreator doesn't understand that I have Caps Lock and Esc swapped...

    I use xmodmap to switch Caps Lock ans Esc, but in QtCreator, I still have to hit the actual escape button to trigger that key, for example I set the editor to use Vim-style editing. If I hit Caps Lock, nothing happens. If I hit escape, it will exist whatever mode the editor is in. It will also toggle Caps Lock because the rest of the DE knows that I have them swapped.

    try
    setxkbmap -option caps:swapescape
    If it works add it to your .xinitrc/.xprofile/whatever.
    Another option is adding this line to /etc/X11/xorg.conf.d/10-keyboard.conf:
    Option "XkbOptions" "caps:swapescape"
    Further reading: https://wiki.archlinux.org/index.php/Ke … on_in_Xorg

  • Dv7-1261 shut off and now caps lock and number lock lights flash

    i have a dv7-1261 nm295ua#a8a.  the computer shut off and now when i try to power it on the caps lock and number lock lights flash.

    Hi,
    Can you match the sequence of 'blinks' to those shown in the table below.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • How do I get my macbook off CAPS lock and safe boot?

    My macbook is stuck on caps lock and only comes up on safeboot? what should I do? It was only on sleep and playing music but when I wanted to log back I was unable to do so

    Open the terminal app. (Applications => Utilities => Terminal)
    Copy and paste the following code.
    sudo nvram boot-args=""
    then restart your mac.
    if you will want to stick with the safe boot again use the following code.
    sudo nvram boot-args="-x"

  • How do I get my caps lock and tab keys to work again?

    how do I get my caps lock and tab keys to work again?

    Have a look at > One or more keys on the keyboard do not respond

  • Why does Caps Lock and F keys log me out of websites?

    MacBook Air 11" Core i5, OS X 10.7.2, Safari 5.1.2.
    Caps Lock and F keys seem to log me out of websites like Jimdo and stop BBC iPlayer from playing video, why? Most annoying. As you can't turn up the volume with out stopping the video and the system going back to the beginning of the video.

    On a Mac OS X system: System Preferences->Keyboard and Mouse->Keyboard(tab)->Modifier Keys(button): set Caps Lock to No Action (or to plain Shift if you prefer). Some people like Caps Lock. They can keep it. Others (like me) keep pressing it by mistake. We disable it. Everybody's happy. And if you're a No Caps Lock type of person, but really want it on rare occasion, just map it back temporarily. Takes 5 seconds.

  • DV4 flashing caps lock and num lock lights

    My laptop, an HP Pavilion DV4-2040US, has stopped booting up recently. The day before this problem come about I was using the laptop perfectly fine. I then went one day without using. When I turn on the laptop it booted up but nothing showed up on the screen. Then the CAPS LOCK and NUM LOCK lights started to blink on and off.
    I did some researching about the blinking lights and what they mean but I don't think mine is listed on there. It says the pattern will repeat a couple of times then shut off, but mine doesn't. The pattern is the CAPS LOCK and NUM LOCK both blink once every 3 seconds (about) and keeps blinking every 3 seconds forever. The only time they stop blinking is when I shut I down by holding the power button on the laptop.
    I've tried disconnecting everything and holding for 15 seconds and even tried holding it for 30 seconds and that still didn't fix the problem. I called HP support and the guy who I talked to told me it sounded like a motherboard issue, but he wasn't sure exactly and told me to ask here for help.
    If it matters, I can hear the fan turn on for about 2 seconds then stop. Also all the touch sensitive buttons light up too$

    Please, someone, anyone help me. I am having this exact same problem as we speak It happened after i put the laptop to sleep overnight. The LEDs for capslock and numlock blink consistently but slowly-approximatelt 2-3 seconds. When started up, i hear the fan come on for maybe a second or two and then comes off.I've tried all the mentioned solutions - i removed the battery for a while and put it back in-i tried the four arrows-i tried started up with AC adapted but without battery - and still no fix. What i am worried about is the documents and files on the laptop. Are they recoverable? Please help me on this someone. Please. Thank You.

  • Using caps lock key as caps lock and control key

    I'd like to use the caps lock key as caps lock and control key. While I can convert the caps lock to control key very easily, there seems no way to make it both caps lock and control. Is there any way to do this? I use emacs and it'd be really useful to be able to do this.
    Thanks.

    Finally found something that worked for me. See this thread and look for the post about removing the Hitoolbox plist files.
    http://discussions.apple.com/thread.jspa?messageID=10765093&#10765093
    I removed all of them. (Had multiples) Also make sure you empty the trash afterwards.
    Then restart.
    Then I used the modifier key trick in this thread. Turned off the caps lock key. Then restart.
    Then use the modifier key trick and turn the caps lock key back on. Test to see if your lights come back on for the caps lock key.
    If so, next time you restart it should still work. Finally. This thing has been dogging me for a long time.

Maybe you are looking for

  • How to deal with two tables in the Data Base

    Hi Experts, IF WE WANT TO GET THE DATA FROM THE TWO TABLES, WHAT QUERY SQL STATEMNET SHOULD HAVE TO WRITE AND ANY CONFIGURATION CHANGES NEED TO BE DONE AND WHAT SETTINGS NEED TO BE DONE IN THE ESR . PLEASE EXPLAIN ME ON THIS . THANKS IN ADVANCE. RAM

  • Making a Menu from Scratch

    As far as I can tell, there is absolutely no way to create a menu from scratch. Allowing you to make your own back ground, music and links to videos. You think that we this "advanced" software, they would also have the option to make your own menu fr

  • Will substr + not function ignore null values ?

    hi guys i have a table test with 1 column named (value) of varchar2 type. inside this table, i have 3 rows. 1) 2255 2) null 3) 5522 when i do select * from test where substr(value,1,1) not in ('3'), it only returns me row 1) 2255 row 3) 5522 but why

  • I recently had to re-install photoshop CS5 - Now problem

    Due to an issue with my OS - I had to re-install Photoshop CS-5. Now when I try to crop an image, the image flickers between black & the image. Often remains blacked out till I click on the image. Never did this before. Is there a setting that needs

  • How do I permanently delete this U2 album off my iphone?

    Apple does this without our permission and just randomly added this album. Not everyone likes U2! I delete it and the the whole album including the songs stay on my iphone HOW DO I FIX THIS Really annoyed apple customer