geekhack

geekhack Community => Keyboards => Topic started by: hoggy on Mon, 30 January 2012, 13:42:33

Title: Shift and space
Post by: hoggy on Mon, 30 January 2012, 13:42:33
I think emacs has had this little gem for a while, but it's fairly new to me.

I want to remap the space bar to shift, but only when another key is pressed.  If the space bar is pressed by itself, I'd like the space.  

Does anyone know how I could achieve this?  Using windows 7.
Title: Shift and space
Post by: Gawkbasher on Mon, 30 January 2012, 13:46:18
Good luck with this.  I know you can't make a custom keyboard layout with Microsoft Keyboard Layout Creator to do this; I just tried.

Edit: Maybe AutoHotKey?  Anyone?
Title: Shift and space
Post by: shogrran on Mon, 30 January 2012, 13:53:08
Hmmm... im thinking autohotkey... doesn't autohotkey support IF statements?
Title: Shift and space
Post by: rodya on Mon, 30 January 2012, 13:54:57
I don't know how, but you can probably do it using AutoHotkey (http://www.autohotkey.com/).
Title: Shift and space
Post by: alaricljs on Mon, 30 January 2012, 13:56:29
A specific other key, or any key?
Title: Shift and space
Post by: hoggy on Mon, 30 January 2012, 13:58:37
by other key, I mean 0-9, a-z, etc...
Title: Shift and space
Post by: hoggy on Mon, 30 January 2012, 14:42:55
Found it

Space Up:: Send, % "{Shift Up}" (A_TimeSincePriorHotkey < 200 ? " " : "")
+Space:: Send, +{Space}
Space:: RShift

nabbed it from http://shi-ra-be.blogspot.com/2009/09/autohotkey1sands.html
Title: Shift and space
Post by: pyro on Mon, 30 January 2012, 15:54:44
What you want is

Code: [Select]
Space UP::
if (A_PriorKey = &quot;space&quot;)
SendInput {Space}
SendInput {Shift Up}
return
Space::Shift

(Autohotkey_L required)

I can't type fluently like that, though, because whitespaces are only produced when space is released and not when it's pressed.

There's also another interesting script:

Code: [Select]
~space::shift

~ means the original key isn't hidden from the system, so the whitespace is produced immediately, but if you hold space afterwards it acts like shift.

I use neither.