[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.

Similar Messages

  • [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.

  • Caps lock with number not working for main password

    hello when I start my macbook pro I have a login with numbers in it so I use the caps lock to write it but it doesn't work I have to use shift instead!!! when I use the caps lock for writing mail or anything numbers work fine with it!!! Anyone have an idea??
    thk  sam

    If you used the Shift key to originally enter your password with the number keys the Caps Lock key does NOT do the same thing as Shift for the number keys.
    This is Shift and numbers,
    #^*)$@&
    This is Caps LOCK WITH NUMBER KEYS,
    1234455667788999
    As you see the Caps Lock only works for typing LETTERS Not Numbers or any other symbol found on the keyboard.
    To be able to use all the upper case symbols you need to use the Shift key.><?":{}+_)(*&^%$#@!~
    Even if the CAPS LOCK IS ON. ,./';\][=-0987654321`

  • Caps lock with shift key annoying symbol on desktop

    just started getting on my upper right corner of desktop a cap lock symbol , an upward pointing fat arrow. it is annoying.
    also got some non-response from my caps lock key.  i accidently hit shift key on the right, and it all cleared up.
    what's going on?

    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.

  • [SOLVED] Switch x displays with script instead of ctrl-alt fx

    Hi, I am looking for a way to switch x displays on a computer without using the keyboard. Is this possible with a bash script of some sort?
    EDIT: I found chvt but that only works from a tty, running sh chvt X doesn't work from a terminal emulator.
    EDIT2: SOLVED: read this http://superuser.com/questions/69807/wh … ot-under-x
    Last edited by RiceKills (2010-10-30 18:27:56)

    chvt command maybe what you need.

  • [SOLVED]Blinking Caps lock LED

    Hello,
    I'm a linux noobie and I've only been using Archlinux for less than a week, I'm quite liking it.
    The other day I was able to compile a xenomai patched and an unpatched 2.6.25 kernel that boots up.
    I restarted from scratch again,(to get familiar with the process) reinstalled Archlinux, and then tried to compile my own kernel again, but this time I only get a flashing capslock LED and a blank screen. I tried numerous reconfiguration and recomplie but I still get the same. What does the blinking LED indicates?
    I also get this with mkinitcpio:
    tho I think it's not needed since I configure the drivers to be in the kernel.
    :: Begin build
    ERROR: module 'pata[-_]sis' not found
    ERROR: module 'ata[-_]generic' not found
    ERROR: module 'scsi[-_]mod' not found
    ERROR: module 'ide[-_]disk' not found
    I added the ide_disk, the last time I was able to compile It couldn't see the disk.
    tia.
    EDIT:
    compilation is on P4 asus mobo.
    Last edited by lehm (2008-08-05 04:58:50)

    I did make use of mkinitcpio, I eliminated a couple of errors, but still got these:
    ERROR: module 'pata[-_]sis' not found
    ERROR: module 'ata[-_]generic' not found
    :: Parsing hook [base]
    :: Parsing hook [udev]
    :: Parsing hook [autodetect]
    :: Parsing hook [pata]
    ERROR: module 'sd[-_]mod' not found
    :: Parsing hook [scsi]
    ERROR: module 'sd[-_]mod' not found
    :: Parsing hook [keymap]
    :: Parsing hook [filesystems]
    :: Generating module dependencies
    :: Dry run complete, use -g IMAGE to generate a real image
    I generated the image anyway, and edited grub to add initrd.
    Is there a way to extrac the original Kconfig file from the CD, I think I may have corrupted the original, I mean it's not original anymore
    tia
    EDIT:
    btw, my disks are IDE's (pata?)
    Last edited by lehm (2008-08-04 19:51:42)

  • Caps lock always on-hp pavilion dv7-6195us​.the only way to get it off is with remote keyboard

    the caps lock is always on,it can be turned off with remote keyboard only.turn the comp off and restart and caps lock comes back on.unable to control caps lock with the comp keyboard

    Hello systemgvp,
    Your notebook is a Business model. Your issue would be best answered on the HP Enterprise Business Community Forums
    Good luck,
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Remaps Caps Lock to Mod4

    Hello all.
    I've been using Arch with xmonad/gnome and then xmonad/xfce for a while. Now xfce is bugging me, and I want to just switch to a lightweight xmobar setup.
    I use caps lock as my mod4 key for xmonad. In the past I've remapped this with the gnome/xfce control panels. Now I see there are a couple approaches to do this in just X, and none of them are working for me.
    xmodmap: I am trying to just run these commands from a terminal after starting x, just to see if I can get them to work.
    xmodmap -e "remove Lock = Caps_Lock"
    doesn't even disable caps lock for me.
    I was able to use setxkbmap to switch Caps lock to escape, but I have no idea how to switch it to mod4. What's the difference between "escape" and "swapescape"?
    Finally, I understand there are some methods that wouldn't even rely on commands in an .xinitrc file, but are systemd based? I would be interested in this if I could put the setup in my dotfiles.
    What are the advantages to each of these techniques? What's the canonical "right" way to switch the keys?

    Just beware that some DEs try to be "helpful" and use their own settings daemons.  What little i have done with DEs i have found the most usual culprits of this to be display managers. In particular, GDM is quite bad aboit tjis, ignoring just about everything in /etc/X11/xorg.conf.d. So if you end up making that setting permanent, just be aware of this.

  • Disabling my caps lock

    I would like to be able to disable my caps lock with a key command. I am using an Apple keyboard.

    Hello udougy22,
    Thanks for using Apple Support Communities.
    To turn Caps Lock on or off, all you need to do is press the Caps Lock button on the keyboard.  You may need to press it longer though, as it is designed to not be activated accidentally.
    Keyboard Caps Lock modified to reduce accidental activation - Apple Support
    Take care,
    Alex H.

  • Caps lock key gets stuck on

    We are using Sun Ray Software 5.2.1 and connecting to Citrix XenApp 6.5 servers running on windows server 2008R2. We have an issue where randomly the caps lock key is stuck On, and its not just the light, the actually caps lock is stuck and you can only type capital letters. The only solution we have found is to log off and then log back in for a new session and everything is good again. This doesn't work however if the users desktop is locked from the screensaver timeout, because then they can't type in their password correctly to log off the session. The only solution is for me to manually log them off within the Citrix XenApp console.
    Any ideas?

    Which citrix client are you using? Have you tried killing the sun ray session with CTRL+ALT+Backspace? The Session should restart after that and it would not involve administrative intervention.
    You could also try and disable caps lock with xmodmap if you don't need it.
    Just some ideas
    Bjoern

  • 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

  • I can't get a caps lock indicator on my monitor using win8 with a wireless kb on my new p7-1410PC

    How do I get the "caps lock" to appear?

    Hello Yucky1,
    I understand wanting to get the on screen caps lock to display.
    You could either access the ease of access center, and enable toggle keys and that will make your PC beep when the button is pressed. Click on this link and it will show you a video on how to do that.
    You can also check keyboard settings to see if the options Is available.
    How to check keyboard setting steps below:
    1.       Place mouse all the way down in the bottom left corner of screen and then left click, a column with a list of options should appear.
    2.      Click on control panel
    3.       Up in the top right corner type keyboard in the search box.
    4.       Then click keyboard.
    5.        A box will appear with the keyboard settings, check and see if that option is available.
    Please respond at your earliest convenience if this helps out.
    Thanks. 
    Clicking the White Kudos star on the left is a way to say Thanks!
    Clicking the 'Accept as Solution' button is a way to let others know which steps helped solve the problem!

  • [SOLVED] KDE: Remap Caps Lock

    Hi,
    I've mapped the Caps Lock key as keyboard layout switch; it works, but somehow I can't disable the Caps Lock function (I've got English in all caps, unless I lower them with Shift-Caps Lock). I suppose I should check some option in Keyboard Settings->Advanced->Caps Lock Key Behavior, but I can't find the right one.
    Last edited by Llama (2012-10-21 15:54:32)

    WonderWoofy wrote:So what is it you would like to achieve?  Is it the functionality that this checkbox apparently offers?  Or do you simply want to remap your caps lock key to something else like your title says?
    I'd like to achieve what I once had, even with KDE : CapsLock toggles the keyboard layout, Shift-CapsLock works as a substitute for Caps Lock.
    The first part I've got, but not the second one.
    Last edited by Llama (2012-10-21 04:08:30)

  • Toggle kbd layout with switched caps/ctrl

    hi!
    i used to have this in my xorg.conf to have capslock toggle layout for typing swedish chars
    Option "XkbLayout" "dvorak, se"
    Option "XkbOptions" "grp:caps_toggle"
    now, i've switched caps and ctrl with this in .xmodmap
    remove Lock = Caps_Lock
    remove Control = Control_L
    keysym Control_L = Caps_Lock
    keysym Caps_Lock = Control_L
    add Lock = Caps_Lock
    add Control = Control_L
    the problem is that it makes the new capslock, former ctrl, just a capslock, which doesn't toggle the keymap.
    and if i run
    setxkbmap "dvorak, se" -option grp:caps_toggle
    the caps/ctrl are switched back. so how can i bind caps to toggle layout without overriding this?

    https://wiki.archlinux.org/index.php/Xf … ings_issue
    Is this the "issue"?
    I don't know... I don't use Xfce, I use Openbox. This is how I switch my keyboard layout:
    /etc/X11/xorg.conf.d/10-keyboard.conf
    Section "InputClass"
    Identifier "Keyboard Defaults"
    MatchIsKeyboard "yes"
    Option "XkbLayout" "us, ro(std)"
    Option "XkbOptions" "grp:alt_shift_toggle, grp_led:scroll"
    EndSection
    Alt+Shift works and it even lights up my keyboard's "Scroll Lock" LED. I'm absolutely fine with this setup.

  • Blank Screen; Caps lock Blink Twice Every 2/3 Seconds with orange wireless button.

    Hi,
    I am using my HP Pavilion DV6 7023tx laptop. It is 1 year 3 months older(warrenty expired). It was working fine but one evening i found it start with black screen and caps lock blink twich every 2/3 seconds and after some times it's getting hot.
    I have tried to solve the issue accoroding to the following link
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&lc=en&dlc=en&docname=c01732674
    It looks like BIOS corruption failure. but it will not automatically recovering that mentioned in post.
    So what should i do now?
    Could you guys tell me what should i do?
    Thanks in advance.
    Product Information:
    ===============
    HP Pavilion DV6 7023tx
    Serial No : 2CE22927FG
    Product ID: B3J66PA
    This question was solved.
    View Solution.

    Hello SuperMario1,
    Thanks for your response.
    The last thing i did, remove CMOS battery and after a few minutes i plugged it.
    Then connect AC power adapter and press power button.
    Laptop starts but gives a error message
    "The CMOS checksum is invalid, The BIOS will be reset to the default configuration and will be rebooted."
    Finally laptop start normally. It works fine ...
    But same problem when i restart
    "blank screen caps lock blink 2 times every 3/4 sec"
    So finally
    1. remove CMOS battery and after a few minutes i plugged it again
    2. connect AC power adapter and press power button
    3. laptops starts normally (with a error msg same as previous)
    4. Upgrade bios to F.29(previously i had F.24)
    5. Everythings works fine (restart/shutdown have no effect)
    Nirupam Chandra Modak

Maybe you are looking for