General :: How To Swap Alt And Windows Keys With Xmodmap
May 2, 2011
I have a Mac keyboard where the Alt/Win (i.e. Option/Command) keys are inverted compared to a regular PC keyboard, and I'd like to swap them. I haven't had any luck with xmodmap so far. The standard configuration is as follows:
I am using an Apple Keyboard (DK-layout) on my PC running Ubuntu 10.4. The problem: My key used to type <, > and is swapped with the key used to type and If I connect a standard PC-keyboard with DK-layout using USB, it works just fine. The problem exists both in the console and X. I solved the problem in the console by installing the console-keymaps package, made a copy of dk-latin1.kmap.gz and swapping keycode 86 with keycode 41 and loading the new keymap with the loadkeys command. I only need to figure out how to load the new keymap at boot time.
However, in X, I want to do exactly the same. I suppose I have to use Xmodmap. I simply can't figure out how to do it.
In Fedora 10 they decided to change to "evdev", so if you used xmodmap in F9, these mapping have changed in F10 and F11 for that matter. In order to find the new key values start
xev and press a button you would like to know the keycode for. Write this value down. When done, make a file ".xmodmap" and put in the values. "man xmodmap" explains the format. Not easy to understand! So here is how mine looks like.
This layout is MUCH more logical than the original. Now Delete is the key just to the right of the Backspace key. Back spaces deletes to the left, and Delete deletes to the right, so these keys shoudl of course be next to each other Page Up, Page Down, Home, and End now have the same structure as the arrow keys below. This layout makes it much easier to navigate without looking at the keys, because now the layout makes sense And why shouldn't 0 be to the left of 1? of course it should. 0 is lower than 1.
I don't care if this is done in the bios or a kernel module or software. Is there any way at all to do make the 'fn' key act as 'control' and the 'control' key act as 'fn' in linux running on a macbook pro?
PS. You can do this with software in OSX with the application KeyRemap4MacBook.
I recently got a Logitech G11-keyboard for my Ubuntu 9.10 64-bit box. My question is xmodmap related and not restricted to this particular keyboard, nor to the distro I am using. The keyboard has a.o. 18 G-keys. These have been successfully defined in /usr/share/X11/XKeysymDB as per [URL] and I have a ~/.Xmodmap file that matches keycodes to the names in XKeysymDB.
My .Xmodmap definitions are rather simple, e.g. 'keycode 175 = G1'. So I do not define any value for modifier combinations, nor do I know how to do this.
And here's my real question. How should I define these keys so that the Crl-, Alt-, Meta-, Super- etc modifiers work with these keys?
With the current setup, the modifier versions of these keys do only work for the second keypress, e.g. the first Ctrl-G17 is perceived as a G17 keypress, and the second and remaining Ctrl-G17 presses are correctly received as a Ctrl-G17.
I would be happy to read an explanation of this behaviour, and even more so, about how to properly define them so that the base key as well as the modifier versions would be available.
If the odds are a million to one against something occurring, chances are 50-50 it will.
I don't know if this is a configuration issue or a hardware issue, but I have a Kinesis Advantage USB keyboard and for some reason the F3-F5 keys aren't responding as they used to. They don't respond to anything and, when I tried using F5 on Emacs, it said <XF86AudioNext> is undefined, so I guess it's a weird mapping problem.
Any idea how I could remap them to the original meaning?
I'm running Debian (Squeeze) and I have a toshiba portege m700. It has five buttons on the front just under the screen, which are the only ones accessible when you flip the screen over into tablet mode. One of them is for rotating the screen, and another is for switching to external display. I want to remap the remaining three to control, alt and super so that I can use shortcuts with the stylusThe problem is, when I used showkey to find out the key codes, I found out that each button generates more than one key code:Button 1:
key 126 press >> super_r, although this is distinct from the actual super key (125) key 7 press >> 6 key 7 release key 126 release
I need to use bluetooth, but for some yet unknown reason I don't seem to be able to switch on the bluetooth-card (it should be as simple as to press the Fn+F6 buttons on the keyboard to switch it on though and then the bluetooth indicator should light up, which is not happening, but I don't know if this is because of (X)ubuntu) and Ubuntu says it can't find the bluetooth card. That's not what I wanted to discuss now, but I think some history is always welcome when trying to do fault-finding I thought I maybe might be able to do it from Win7 . So after months of not having booted Win7 I thought to give it a try, but I get stuck right after the grub boot-screen. All I get is a blinking cursor for minutes and there's no HD activity. Then I booted Xubuntu again and it needed to do some check, which I passed and Xubuntu started as normal. This check was done by "Keys". I don't really know what this Keys is, but since a couple of days I always get this word below the word Xubuntu in the boot-splash-screen. This is only after I installed WinFF or DVD::RIP. There was some error during install telling me that it needed something with 'keys', so I entered the command quoted, something was installed and then the rest of the installation went okay. I've been looking in the bash_history files (user and root) but I can't find the command which I entered to install this keys-thing anymore, which is of course strange on itself.
Now I've got the idea (I'm not sure though) that I can't boot Windows because of this keys thing, but I have no clue how to get rid of it. Or could there be other problems causing Windows not to boot?
I really hope someone can help me getting back in Windows again, because losing the Windows partition really is not fun, even though I hardly use it. I can enter the Windows partition from Linux with a file manager though, so it's not vanished. Just wish to be able to boot Win7 when I need it.
I recently installed Debian 8.1 on an old (2008 maybe?) macbook. I would like to use the right hand side apple/command key as a right click. I've been using xmodmap commands in the terminal, but I'd like to write a shell script to do it automatically on boot or on login.
The xmodmap commands I am calling are Code: Select allxmodmap -e "keycode 134 = Pointer_Button3" and then Code: Select allxkbset m
my shell script is as follows /usr/keymap Code: Select all#!/bin/bash xmodmap -e "keycode 134 = Pointer_Button3" xkbset m
I've modified keymap to be executable, just typing /usr/keymap into the terminal will map the keys correctly. I've tried with and without the .sh suffix. I've tried adding sh before the file path in crontab. I've also tried adding sleep 20 inside the shell script as well as inside crontab joining the two commands with &&
It works. However if you map keys with xmodmap, it's gone. In whatever order you use them, setxkbmap and xmodmap are always conflicting. Running xmodmap immediately disables CTRL-ALT-BKSP, while running setxbbmap reverses key mappings to their default.
So I run "xmodmap" in my xinitrc to make caps lock a second control button, but for some reason its not sticking. I'm not using a desktop environment, just running xmonad.If I run "xmodmap ~/.Xmodmap" once X is started, it works fine, but it won't run in my xinitrc.
When working in an XP VirtualBox I can't use Alt-Tab to switch to my Linux Apps as VirtualBox captures the keys for Windows. So I tended to make a lot of use on the Application list on the old System Tray/Taskbar. I could click on the application's entry in the taskbar and that application would come up. When I needed to return to the Windows App, I clicked again and the application would then minimise so I can see the Windows app. Also I have been using the SUPER button in conjunction with 'E' to raise the Home Directory (just to keep it consistent with Windows).
I have a custom .Xmodmap file to change the keyboard layout. The problem is that sometimes the keyboard layout changes back to the default. I have seen the lights on the keyboard blink at times, so I tried unplugging and reconnecting the keyboard and yes - that reset the layout. I can see keyboard removed/detected entries in the logs as well, so I guess my keyboard reconnects sometimes, I don't know why. However the solution from the post earlier (to rename the xmodmap file to ~/.Xmodmap) did not work. So is there another default filename I should use? Or do I have to enable xmodmap to run when a keyboard is plugged in somehow?
The only thing I can think of right now is to monitor /var/log/Xorg.0.log for "Adding input device USB Keyboard" and running xmodmap when that happens... but I'm really hoping for a better solution.If I can't fix the xmodmap problem, maybe I can fix the usb disconnects.I read something about power saving settings for usb. After some digging, I found that those settings are in /sys/bus/usb/devices/.../power/. However, disabling autosuspend for the hub did not seem to work (it was already disabled for the keyboard).
But I found something else in kern.log. Perhaps the keyboard disconnects has something to do with static electricity?
Code: Select all[ 7078.175830] usb 1-10-port3: disabled by hub (EMI?), re-enabling... [ 7078.175888] usb 1-10.3: USB disconnect, device number 4 [ 7078.624349] usb 1-10.3: new full-speed USB device number 6 using xhci_hcd [ 7078.729012] usb 1-10.3: New USB device found, idVendor=04d9, idProduct=0125 [ 7078.729014] usb 1-10.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [ 7078.729016] usb 1-10.3: Product: USB Keyboard
RAM for older machines like I use is fairly cheap these days. But flash memory is just as cheap or cheaper. So I'd like to ask about the feasibility of expanding my system's memory using flash memory. And about whether creating a partition for swap on the flash memory, or whether a swap file on the flash device, is the better way to go.
By flash memory I have in mind mainly USB sticks or what are sometimes called "pen drives." But I do also have CF and SD cards that, with the proper cheap adapter (one of which I already own for adapting CF) could be used to create extra swap space. So, what is the current consensus on the feasibility/advisability of using flash memory for swap? I've read about the limited write cycles of flash being an argument against using it for swap. But recent reading indicates to me that the limited write cycles problem applies mostly to older, smaller-capacity flash memory. Some will come out and say that, for larger-capacity flash memory, the life of the device is likely to exceed the amount of time your current computer will be useful (I think I've seen estimates in the range of 3-4 years life--minimum--for newer, higher-capacity flash memory).
A more persuasive argument I've heard against using flash memory for swap is that access times for these devices can be much slower than SATA, and maybe even IDE, hard drives. That would certainly dictate against using flash memory for swap.
So, how about some input on this issue? Anyone using flash memory for swap? If so, what kind (e.g., usb stick or SD/CF)? Are you using a swap file or a swap partition? How's system performance? Likewise, has anyone had flash-memory-used-as-swap die on them? The consequences would undoubtedly be dire. Also, has anyone measured flash memory access times to confirm or refute claims about slow access times? Are some types of flash memory better/worse than others in terms of access times?
In previous versions of ubuntu I used to reshuffle the ALT, SHIFT, and TAB keys using xmodmap.
Specifically, I had a file called ~/.xmodmap-mejia which reshuffled the keyboard, and I called that file from the startup applications (I had added it to system>preferences>Startup Applications).
However, in Ubuntu 10.4 it does not work. If I call the script after the computer has loaded, it works perfectly, but it does not have any effect as a startup application. It is as though changes effected by the script that calls ~/.xmodmap-mejia gets overwritten later on by the default keyboard binding.
As things stand right now, I have to run the script manually every time I turn on my laptop. Which, of course, is very annoying.
I just upgraded machine to natty, after which the xmodmap configuration remapping capslock stopped working (as in not doing anything at all). Running xmodmap manually (-e "clear Lock") doesn't have any visible effect either. I haven't tried doing this on another machine (I'm only close to one machine running ubuntu and reinstalling seems rather overkill), but the same config worked before the upgrade, and is working on another machine running arch.
Is anyone else having these issues and, if so, has anybody found a solution? The line of interest is, simply, "clear Lock".
I have slackware 13.37-64 bit with xfce. I have a "microsoft wired keyboard 600" keyboard and want to remap it to use the right win key as ctrl. With xev i see that the keycode for the specific win key is 134.
Then i run:
But nothing changes. Even if i manually configure the .Xmodmap file in my /home i see no change at all.
Q1) I was wondering if it is possible to Dual boot Ubuntu with Windows XP on a 1TB RAID-0 setup ?
Q2) Also, is it possible to create a SWAP partition (for Ubuntu) on a NON RAID-0 HDD ?
Q3) Lastly... I read GRUB2 is the default boot manager... should I use that, or GRUB / Lio ?
I have a total of 3 HDDs on this system: -- 2x 500GB WDD HDDs (non-advanced format) ... RAID-0 setup -- 1x 320GB WDD HDD (non RAID setup) (The non RAID HDD is intended to be a SWAP drive for both XP and Ubuntu = 2 partitions)
I plan on making multiple partitions... and reserve partition space for Ubuntu (of course).
I have the latest version of the LiveCD created already.
Q4) Do I need the Alternate CD for this setup?
I plan on installing XP before Ubuntu.
This is my 1st time dual booting XP with Ubuntu.
I'm using these as my resources: - [url] - [url]
Q5) Anything else I should be aware of (possible issues during install)?
Q6) Lastly... is there anything like the AHCI (advanced host controller interface) like in Windows for Ubuntu?
(Since I need a special floppy during Windows Install...) I want to be able to use the Advanced Queuing capabilities of my SATA drives in Ubuntu.
I am about to get a new laptop here soon and I was planning a dual boot like I have on my current laptop (Win7 and Ubuntu), but I have something special in mind. I looked around the forum to see if there was anything like what I had or if it was even possible but I didn't see anything quite like this.I was wondering if this was even possible, and if so, would anyone be able to tell me what filesystem I should use for my windows swap partition?