Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can the Ctrl+Q key combination be mapped to the Ctrl+C event?

My keyboard is mapped to programmer-dvorak and I would like to have the Ctrl+X , Ctrl+C and Ctrl+V events to be mapped to Ctrl+' , Ctrl+Q , Ctrl+J key presses respectively.

Mac OSX has something called Dvorak - Qwerty that does this.

You may also want to try Dvorak - Qwerty which uses Dvorak for typing but Qwerty for keyboard shortcuts like ⌘ (command) A. This can be handy if you've memorized common command combinations like ⌘X,C,V (for cut, copy, paste), etc by location on your keyboard,

So far, I've tried a combination of xbindkeys with xdotool without any luck.

#Dvorak Cut
"xdotool key --delay 0 --clearmodifiers ctrl+x"
    m:0x4 + c:52
    Control + apostrophe 

#Dvorak Copy
"xdotool key --delay 0 --clearmodifiers ctrl+c"
    m:0x4 + c:53
    Control + q 

#Dvorak Paste
"xdotool key --delay 0 --clearmodifiers ctrl+v"
    m:0x4 + c:54
    Control + j

I've also tried via XKB with the following entries.

// Ctrl+' for Cut
interpret apostrophe + Ctrl {action = Redirect(Key=<AB05>, modifiers=Control);};

// Ctrl+q for Copy
interpret q + Ctrl {action = Redirect(Key=<AD08>, modifiers=Control);};

// Ctrl+j for Paste
interpret j + Ctrl {action = Redirect(Key=<AB09>, modifiers=Control);};

But that doesn't work either.

share|improve this question

2 Answers 2

up vote 3 down vote accepted
+50

You can accomplish this by using autokey-gtk You can set Autokey to run at login and it will sit in the background and monitor input from the keyboard and mouse and interact accordingly by whatever hotkeys you have provided it to interact with.

Example: You stated you would like to make Ctrl+q act like Ctrl+c. This can be accomplished very easily utilizing this program.

To install autokey-gtk issue the following command in a terminal

sudo apt-get install autokey-gtk

After you have this installed you can access it through the Dash or by typing auto-gtk in a terminal. To set the key combinations that you stated above, do the following:

Step 1

Run autokey-gtk

Step 2

Create a New Top-Level Folder from File -> create -> New Top-Level Folder

Step 3

Select Folder and create New Script from File -> create -> New Script

Step 4

in the "# Enter script code box" enter "keyboard.send_keys(shortcut you desire to imitate)"

Examples:

1. keyboard.send_keys("<ctrl>+c")

2. keyboard.send_keys("<ctrl>+v")

3. keyboard.send_keys("<ctrl>+x")

NOTE: repeat Step 3-4 for each hotkey you want to add

Step 5

For each Script you made click on the second "set button" next to Hotkey and enter your key combination that you will use to imitate.

In your case for the keyboard.send_keys("<ctrl>+c") script you would type q in the text box and click on the Control button and then click ok.

*Do this for each script, being sure to modify your hotkey of course.

Step 6

Click on Edit -> Preferences

Select the check box next to Automatically start Autokey at Login

This should accomplish what your asking for :)

share|improve this answer
    
Works perfect. Thank you! –  Richard Ayotte Feb 23 '12 at 15:24
"xdotool key --delay 0 --clearmodifiers ctrl+c"
    Control + q + Release

Source: http://www.ict.griffith.edu.au/anthony/info/X/event_handling.txt (search for 'Generating X Keyboard Events')

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.