I have a Macbook Pro that spends half the day connected to a large monitor and windows keyboard. I've been using the Keyboard modifers control panel to swap the option/command keys for this keyboard, but I have to invoke the control panel every time I swap back and forth (I need to unswap when the laptop is being used standalone).
It would be cool if a) there was a way for Double-click to autodetect these two states, and activate the correct mode or
(less desirable) b) there was a hotkey that could be used to enable/disable double-click.
Is there an existing way to accomplish this, so I don't have to go into the control panel twice a day?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I should add a bit more about the application keyboard shortcuts. For each application that I use frequently, I'm setting up keyboard shortcuts that use the control key. For example, I make "Copy" be "Control C" and "Paste" be "Control V". These shortcuts are in addition to the defaults, not a replacement. So, you can use both with out having to turn anything on and off.
One thing I noticed, though, is that you have to restart the apps after you add new shortcuts to see them work.
Let me know if you have any questions.
Adam
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a constant annoyance to me as well. As good as hotkeys and keyboard shortcut additions are, it would REALLY be nice to just have my external and my built-in keyboards just work when I use them.
Back in the old days with ADB and USB there was an app that could tell the difference between 2 keyboards, and could swap the keys needed whenever you switched to the alternate. Ever since the built-in has become USB, there hasn't been an app written that still allows this. I sorely miss this ability, and DoubleCommand seems to be the best place to ask for it.
I searched for hours a few months ago to find something that would allow it, but nothing seems to exist. A few older products claim to, until you notice they only work with ADB and USB, not 2 USB (all new MacBook and Powerbook built-in keyboards are USB.)
Please consider adding this sorely-missed feature into DoubleCommand. You're our only hope!
P.S. I just checked and found that the old software I could use in the ADB days was from Microsoft! Unsurprisingly, they have chosen not to update it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Doublecommand's current settings can be read and altered using the sysctl variable "dc.config" which contains the current settings (an integer number whose computation is explained in the documentation) for DC.
For example if I enable only "PC style home and end keys", the preference pane shows that the active setting is "65536", and I can see it with the following command typed in a Terminal:
$ sysctl dc.config
dc.config: 65536
Now if I want to also enable DEBUG mode, I can see in the preference pane that the corresponding settings should become 8454144.
I can set it from the Terminal by changing the value of the sysctl variable (you need to do this through sudo) :
If I reopen the prefpane I see that debug mode has become active!
So... an alternative way to achieve what you want would be to bind shortcuts to set the appropriate value for the dc.config.
As explained in previous posts, there are many ways to do that in OSX or with 3rd party applications.
Note that sysctl needs to be run through sudo to set the value of this variable, so it is annoying if you have to type your password everytime.
One workaround is to edit the /etc/sudoers file to allow your username to execute the sysctl command without typing a password.
For example I did it by adding the following line to my /etc/sudoers file:
%admin ALL= NOPASSWD: /usr/sbin/sysctl
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. First off do the NOPASSWD trick above in /etc/sudoers
2. Download the free sleepwatcher utility available here: http://www.bernhard-baehr.de/ and install the sleepwatcher and sleepwater StartupItem packages.
3. Use the ioreg utility to find your external keyboard. Mine is a Deck brand so I'm looking for the string "Deck". Substitute some string unique to your keyboard for "Deck" below.
4. Look at your DoubleCommand pref pane. The number next to "User Preferences" is the setting that should be activated when your external keyboard is attached. For my Deck keyboard the setting is 8388608.
5. Make a script in your homedir entitled .wakeup. Mine looks like this:
#!/bin/bash
if `ioreg |grep -q Deck`
then sudo sysctl -w dc.config=8388608
else sudo sysctl -w dc.config=1
fi
6. chmod 755 .wakeup
You can test that it's working by running sudo /etc/rc.wakeup from the command line. You should see feed back for the dc.config command.
In day to day use the .wakeup script will check and map your keyboard mapping every time you unsleep the system, which for me corresponds to dock/undocked events.
I've also disabled safe sleep so the sleep takes place instantaneously when I close the lid (when undocked) or remove monitor/usb/power (when docked) rather than in 15-20 seconds as it does with safe sleep. To disable safe sleep:
sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false
Cheers!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. I just upgraded to leopard and doublecommand causes a kernel panic.
2. I was apparently using a version of doublecommand modified explicitly to allow swap of the tilde and command keys, due to their relative positions on the desk 82 key keyboard. If anyone has the exact code for this mod I'd live to have it. Hopefully doublecommand will be fixed for leopard soon and I can reapply this patch to the new version to get tilde and command swapping working again for the deck 82 key.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a Macbook Pro that spends half the day connected to a large monitor and windows keyboard. I've been using the Keyboard modifers control panel to swap the option/command keys for this keyboard, but I have to invoke the control panel every time I swap back and forth (I need to unswap when the laptop is being used standalone).
It would be cool if a) there was a way for Double-click to autodetect these two states, and activate the correct mode or
(less desirable) b) there was a hotkey that could be used to enable/disable double-click.
Is there an existing way to accomplish this, so I don't have to go into the control panel twice a day?
I'm in the same boat. I'm getting around the problem mostly by creating application shortcut keys in the System Prefs. Here's a blog entry about it:
http://simon.incutio.com/archive/2004/06/08/remappingShortcuts
It doesnt cover everything, but I'm surprisingly comfortable after just setting up a few applications that i use the most frequently.
Also, I found an awesome alt-tab switcher program that is better than OS X's default tab switcher. It's called Witch and you can get it here:
http://www.petermaurer.de/nasi.php?section=witch
Adam
I should add a bit more about the application keyboard shortcuts. For each application that I use frequently, I'm setting up keyboard shortcuts that use the control key. For example, I make "Copy" be "Control C" and "Paste" be "Control V". These shortcuts are in addition to the defaults, not a replacement. So, you can use both with out having to turn anything on and off.
One thing I noticed, though, is that you have to restart the apps after you add new shortcuts to see them work.
Let me know if you have any questions.
Adam
Thanks Adam!
This is a constant annoyance to me as well. As good as hotkeys and keyboard shortcut additions are, it would REALLY be nice to just have my external and my built-in keyboards just work when I use them.
Back in the old days with ADB and USB there was an app that could tell the difference between 2 keyboards, and could swap the keys needed whenever you switched to the alternate. Ever since the built-in has become USB, there hasn't been an app written that still allows this. I sorely miss this ability, and DoubleCommand seems to be the best place to ask for it.
I searched for hours a few months ago to find something that would allow it, but nothing seems to exist. A few older products claim to, until you notice they only work with ADB and USB, not 2 USB (all new MacBook and Powerbook built-in keyboards are USB.)
Please consider adding this sorely-missed feature into DoubleCommand. You're our only hope!
P.S. I just checked and found that the old software I could use in the ADB days was from Microsoft! Unsurprisingly, they have chosen not to update it.
Doublecommand's current settings can be read and altered using the sysctl variable "dc.config" which contains the current settings (an integer number whose computation is explained in the documentation) for DC.
For example if I enable only "PC style home and end keys", the preference pane shows that the active setting is "65536", and I can see it with the following command typed in a Terminal:
$ sysctl dc.config
dc.config: 65536
Now if I want to also enable DEBUG mode, I can see in the preference pane that the corresponding settings should become 8454144.
I can set it from the Terminal by changing the value of the sysctl variable (you need to do this through sudo) :
$ sudo sysctl -w dc.config=8454144
dc.config: 65536 -> 8454144
If I reopen the prefpane I see that debug mode has become active!
So... an alternative way to achieve what you want would be to bind shortcuts to set the appropriate value for the dc.config.
As explained in previous posts, there are many ways to do that in OSX or with 3rd party applications.
Note that sysctl needs to be run through sudo to set the value of this variable, so it is annoying if you have to type your password everytime.
One workaround is to edit the /etc/sudoers file to allow your username to execute the sysctl command without typing a password.
For example I did it by adding the following line to my /etc/sudoers file:
%admin ALL= NOPASSWD: /usr/sbin/sysctl
Here's how I got this working:
1. First off do the NOPASSWD trick above in /etc/sudoers
2. Download the free sleepwatcher utility available here: http://www.bernhard-baehr.de/ and install the sleepwatcher and sleepwater StartupItem packages.
3. Use the ioreg utility to find your external keyboard. Mine is a Deck brand so I'm looking for the string "Deck". Substitute some string unique to your keyboard for "Deck" below.
4. Look at your DoubleCommand pref pane. The number next to "User Preferences" is the setting that should be activated when your external keyboard is attached. For my Deck keyboard the setting is 8388608.
5. Make a script in your homedir entitled .wakeup. Mine looks like this:
#!/bin/bash
if `ioreg |grep -q Deck`
then sudo sysctl -w dc.config=8388608
else sudo sysctl -w dc.config=1
fi
6. chmod 755 .wakeup
You can test that it's working by running sudo /etc/rc.wakeup from the command line. You should see feed back for the dc.config command.
In day to day use the .wakeup script will check and map your keyboard mapping every time you unsleep the system, which for me corresponds to dock/undocked events.
I've also disabled safe sleep so the sleep takes place instantaneously when I close the lid (when undocked) or remove monitor/usb/power (when docked) rather than in 15-20 seconds as it does with safe sleep. To disable safe sleep:
sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false
Cheers!
Two additional notes:
1. I just upgraded to leopard and doublecommand causes a kernel panic.
2. I was apparently using a version of doublecommand modified explicitly to allow swap of the tilde and command keys, due to their relative positions on the desk 82 key keyboard. If anyone has the exact code for this mod I'd live to have it. Hopefully doublecommand will be fixed for leopard soon and I can reapply this patch to the new version to get tilde and command swapping working again for the deck 82 key.