Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Spacebar as Space and as Shift


  • Please log in to reply
8 replies to this topic
varsoil
  • Members
  • 5 posts
  • Last active: Aug 29 2010 11:36 PM
  • Joined: 26 Aug 2010
The standard keyboard requires reaching for the two shift keys. This is a
gesture that moves the fingers from the home row. (Left hand travels off
the 'A' and right off the ';') and is a different gesture for left vs.
right keys. The solution is a single shift key, under the spacebar, operated
by the thumbs. Since the keyboard is fixed, this script is an alternative.

The spacebar continues to behave normally for space key-presses.
When the spacebar is held down, it behaves as a shift key.
This also frees up the two shift keys for alternate uses.

Todo/Things I have not figured out yet:
I would like doubletap-then-hold-on-keydown to initiate a normal
space auto-repeat.

If spacebar was held for over a half second, then released
without shifting any key, it should not generate a space. That gesture
indicates an aborted shift operation, not a space.

;------------------------------------------------------------------------------
; 2010-08-27   Initial issuance.
; 
; INTRODUCTION
; 
; The standard keyboard requires reaching for the two shift keys. This is a 
; gesture that moves the fingers from the home row. (Left hand travels off 
; the 'A' and right off the ';') and is a different gesture for left vs. 
; right keys. The solution is a single shift key, under the spacebar, operated 
; by the thumbs. Since the keyboard is fixed, this script is an alternative. 
; 
; The spacebar continues to behave normally for space key-presses. 
; When the spacebar is held down, it behaves as a shift key. 
; This also frees up the two shift keys for alternate uses.
; 
; Todo/Things I have not figured out yet:
; I would like doubletap-then-hold-on-keydown to initiate a normal 
; space auto-repeat. 
;
; If spacebar was held for over a half second, then released 
; without shifting any key, it should not generate a space. That gesture 
; indicates an aborted shift operation, not a space. 
;------------------------------------------------------------------------------

; ----------------------------------------------------------------
; Abort spacekey if key was held down for more than 0.5 seconds
; before releasing. (not operational yet.)
; ----------------------------------------------------------------
;~space::
;KeyWait, space, U T1 ; Wait for the space button to be released.
;if  (ErrorLevel = 0) {  ; space was not held too long. A long press indicates an aborted shift, not a space, so ignore.
;   Send {space}
;}
;return 

; ----------------------------------------------------------------
; If spacebar didn't modify anything, send a real space keystroke 
; upon release.
; ----------------------------------------------------------------
space::
Send {space}
return

space & 1:: Send !
space & 2:: Send @
space & 3:: Send #
space & 4:: Send $
space & 5:: Send {`%}
space & 6:: Send ^
space & 7:: Send &
space & 8:: Send *
space & 9:: Send (
space & 0:: Send )
space & -:: Send _
space & =:: Send +
space & q:: Send Q
space & w:: Send W
space & e:: Send E
space & r:: Send R
space & t:: Send T
space & y:: Send Y
space & u:: Send U
space & i:: Send I
space & o:: Send O
space & p:: Send P
space & [:: Send {`{}
space & ]:: Send {`}}
space & a:: Send A
space & s:: Send S
space & d:: Send D
space & f:: Send F
space & g:: Send G
space & h:: Send H
space & j:: Send J
space & k:: Send K
space & l:: Send L
space & `;:: Send :
space & ':: Send "
space & z:: Send Z
space & x:: Send X
space & c:: Send C 
space & v:: Send V
space & b:: Send B
space & n:: Send N
space & m:: Send M 
space & ,:: Send <
space & .:: Send >
space & /:: Send ?
space & \:: Send |
return


kittu
  • Members
  • 3 posts
  • Last active: Aug 30 2010 12:46 PM
  • Joined: 27 Aug 2010
The dots and arrows certainly are a nuisance, but those strange ¶ symbols are really your friends. They show exactly where each paragraph ends. Since all paragraph formatting (tabs, indents, margins, line spacing, before and after paragraph spacing, ...) is attached to them, accidentally deleting one can cause mysterious reformatting problems. I've found it's nice to know where they are.

If you still want to get rid of everything, press CTRL/SHIFT/8 (the 8 above the alphabetic keypad).

emmanuel d
  • Members
  • 519 posts
  • Last active: Jul 15 2017 12:04 PM
  • Joined: 29 Jan 2009
how about this:
$space::

	if !Spacedown

		SendInput,{Shift down}

	Spacedown := Spacedown ? Spacedown : A_TickCount	; GET THE TIME WE PRESSED THE BUTTON

	return

$space up::

	TimeSidsSpacedown:=A_TickCount-Spacedown

	SendInput,{Shift Up}

	if TimeSidsSpacedown<200

		SendInput,{space}

	Spacedown:=""

	return

It only messes up when repeating starts, then its like shift is on, and its not me sending the space, it is like ahk is not catching all spaces

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license

http://www.ahkscript.org/ the new forum


emmanuel d
  • Members
  • 519 posts
  • Last active: Jul 15 2017 12:04 PM
  • Joined: 29 Jan 2009
this one has no errors, but doesnt support repeat:
$space::

	if !Spacedown										; if its the first press, no repeat

		SetCapsLockState , On							; turn on caps lock

	Spacedown := Spacedown ? Spacedown : A_TickCount	; GET THE TIME WE PRESSED THE BUTTON

	return

$space up::

	if (A_TickCount-Spacedown<200)					; if we pressed verry short

		Send,{space}									; send the space

	SetCapsLockState , Off							; turn capslock back off

	Spacedown:=""

	return

i like this one, i can see the light of my key turning on and off

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license

http://www.ahkscript.org/ the new forum


varsoil
  • Members
  • 5 posts
  • Last active: Aug 29 2010 11:36 PM
  • Joined: 26 Aug 2010
That is an amazing improvement! So much cleaner and it works completely and reliably. I swiched the interval from 200 to 150 as that seems to work best for fast shifting. Not implementing space auto-repeat is probably best. That could too easily be misinterpreted. Also, as long as you have not reassigned both real shift keys, you can space auto-repeat with shift+space.

emmanuel d
  • Members
  • 519 posts
  • Last active: Jul 15 2017 12:04 PM
  • Joined: 29 Jan 2009
Also windows+space works to autorepeat the space, as they are next to each other they are easy to press

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license

http://www.ahkscript.org/ the new forum


varsoil
  • Members
  • 5 posts
  • Last active: Aug 29 2010 11:36 PM
  • Joined: 26 Aug 2010
I got some great ideas from emmanuel d. Yet Caps-lock only goes so far. It does not shift the number keys, function keys, slash key, etc. Range selects (shift-click in Explorer) also do not work. I started to use the following which seems to be efficient and effective.

$space::
   send {LShift down} 
   Spacedown := A_TickCount 
   Return    
$+space up::
   ; The space-down set the shift-key, so the space-up event is now shift+space-up
   send {LShift up}   
   if (A_TickCount - Spacedown <200) 
      ; If short time between space-down and space-up...  
      Send {Space}
   Return


omnia
  • Members
  • 25 posts
  • Last active: Dec 27 2016 06:43 PM
  • Joined: 23 Mar 2014

Hi! I like the idea of "spaceshift". What I don't like is the idea of sending a space character when the space key is released (space up). Additionally, I would like auto-repeat when the space key is hold, as we are used to. So I wrote a script to implement this. Basically it works the way intended, but misbehaves now and then when typing fast. Can someone help fixing this? And with another value than T0.2 it goes crazy, why?
 

$space::
	done := 0							; initiates variable to "0", which means "user hasn't used the shift functionality yet"
	while GetKeyState("space", "P")	
	{
		string := " "
		if done = 0
			send, %string%					; this space character may become undone with backspace in line "send, {BS}%_anykey%"
		Input, anykey, L1 T0.2					; script misbehaves when another value than T0.2 is used(?)
		if anykey && done = 1					; it's not the first shifted character the user types, so no maneuvers needed
		{
			send, +%anykey%
		}
		if anykey && done = 0					; prior to the first shifted character, this sends backspace to delete the space character sent before
		{
			send, {BS}+%anykey%
			done := 1					; now we are "done", i. e. the first shifted character has been sent
		}
		while done = 0 && GetKeyState("space", "P")		; after timeout of "Input, anykey, L1 T0.2" this repeats the space character rapidly
		{
			send, %string%
			sleep, 50
		}
	}
	return


omnia
  • Members
  • 25 posts
  • Last active: Dec 27 2016 06:43 PM
  • Joined: 23 Mar 2014

I’ve spent alot of time optimizing the idea of “SpaceShift”. But finally I came to grief and discarded the idea of “SpaceShift”, since I recognized an inherent flaw, which ruins the idea. This flaw is basically this: if you write fast, for example “John”, then you type the “o” even before you release space. You can’t avoid that, it is how we type fast. With “SpaceShift” this will never work, you’ll get “JOhn”. And that is why I think Spaceshift will never succeed. The idea is born to fail. Sorry. Just wanted to tell you this.