OneSwitch pet - control a PC using a single switch

A home for all kinds of Puppy related projects
Message
Author
User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

OneSwitch pet - control a PC using a single switch

#1 Post by SFR »

[AMENDMENT: 2013-07-16]

This thread concerns developing a tool to control mouse cursor movement using only single key/switch.
It was a part of another thread initially, but it has been split.

Original idea came from Will (standard7452) in this thread: Need on-screen keyboard with mouse functions

The latest OneSwitch package is attached to this post.
________________

Update, version-1.2:
Added "Scan" button to Radar/NavBar GUIs (thanks to Greengeek for the idea), what makes possible to automatically configure proper input device and a switch keycode.
The 'keyhunter' script will be also launched right after installing the .pet.

Update, version 1.3:
- a small correction in keyhunter script (sometimes Radar/NavBar wasn't restarted properly, hope it'll be ok now);
- added circular mode of scanning in XVKBD mode (only in Radar).
This feature has been done some time ago as a separate Radar version for use with Mike's custom Xvkbd layouts.
So now it's been merged into the main OneSwitch package.

Image
________________________________

(original/previous content)
greengeek wrote:BTW - My reason for wanting these scripts to help with mouse movement is to allow an inexperienced or physically challenged user to easily select between a limited number of mousepointer_position_choices. That way they can have some degree of functionality by having a "mouseclick" button, but no actual ability to move the mouse anywhere I don't want it to go.
I saw that thread.
Been thinking a while about that and about how you want to employ xdotool and came up with this; perhaps it will help you a bit with the task, somehow..?

First, using xbindkeys (it's OOTB in Slacko) bind, for example, "pause/break" key (OP has mentioned about this key) with echo true > /tmp/button_press_signal command (see screenshot, I also use xbindkeys-config GUI).

And the script works this way:
1. It moves cursor right until pause/break key is pressed.
2. Then stops for a while (0.5s) and starts moving cursor down until pause/break key is pressed.
3. Then "left-click" signal is sent and cursor stays in place until pause/break key is pressed again - and the loop continues.

Maybe this description is a bit fuzzy, but when you see how it works everything will be clear. 8)
BTW, launch this script from a terminal window to have fast and easy way to terminate it (CTRL+C).

Code: Select all

#!/bin/bash

# Req.: xdotool and xbindkeys
# Note: bind a dead key, for exmample 'pause/break' with the following command:
# echo true > /tmp/button_press_signal

# -----------------------------------------------------------------------------
STEP=5				# X/Y leap
SPEED=0.1			# speed (0.1s)
# -----------------------------------------------------------------------------

# Temporary file for inter-communication 
PRESS=/tmp/button_press_signal
# Make this file empty initially
: > $PRESS

# Read current screen resolution
read MAXX MAXY <<< `xwininfo -root | awk 'NR>=8&&NR<=9 {print $2}'`

# Infinite loop
while :; do
  X=0
  Y=10
  
  # Loop: If tempfile is empty - move cursor right
  until [ -s $PRESS ]; do
    X=$(($X+$STEP)); [ "$X" -ge "$MAXX" ] && X=0	# increase X coordinate
    xdotool mousemove $X $Y
    sleep $SPEED
  done
  
  : > $PRESS		# reset tempfile
  sleep 0.5
  
  # Loop: If tempfile is empty - move cursor down
  until [ -s $PRESS ]; do
    Y=$(($Y+$STEP)); [ "$Y" -ge "$MAXY" ] && Y=10	# increase Y coordinate
    xdotool mousemove $X $Y
    sleep $SPEED
  done
  
  : > $PRESS		# reset tempfile
  Y=$(($Y-$STEP))	# needed to refine coordinates
  
  xdotool click 1	# left-click
  
  # If tempfile is empty - do nothing
  until [ -s $PRESS ]; do
    sleep $SPEED
  done
  
  : > $PRESS		# reset tempfile

done
PS. Of course you can modify initial coordinates, max. range and step, to limit the mouse movement to given area.

Greetings![/img]
Attachments
OneSwitch-1.3.pet
(94.66 KiB) Downloaded 664 times
Screenshot.png
(71.57 KiB) Downloaded 930 times
Last edited by SFR on Thu 25 Jul 2013, 18:21, edited 4 times in total.
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#2 Post by greengeek »

oooooh, that looks tasty! Thanks for that. It's a different way of achieving what I had in mind, but probably more useful than the way I'm currently going about it.

I will get my teeth into your script at some stage and see how I can graft it into my proposed system. Thanks!

EDIT:
SFR wrote:BTW, launch this script from a terminal window to have fast and easy way to terminate it (CTRL+C).
Good idea. I'm getting tired of having to try and launch Htop to identify and kill my mousebouncing script while my mouse is bouncing up and down :-)

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#3 Post by technosaurus »

SFR wrote:

Code: Select all

read MAXX MAXY <<< `xwininfo -root | awk 'NR>=8&&NR<=9 {print $2}'`
I see you've been honing your scripting 5|<I|_|_2 - nice work
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#4 Post by SFR »

technosaurus wrote:
SFR wrote:

Code: Select all

read MAXX MAXY <<< `xwininfo -root | awk 'NR>=8&&NR<=9 {print $2}'`
I see you've been honing your scripting 5|<I|_|_2 - nice work
I'm trying indeed, thanks for noticing that!
6R3372 :wink:

@ Greengeek
Just another idea that you may find useful.
I just saw this video and wondered if it would be possible to implemet something similar (I'm talking about cursor movement) in Bash/Gtkdialog.
This crude script only moves cursor and does nothing more, but it shows that it's possible indeed.

Usage:
1. Wait for desired direction and press Pause/Break
2. Cursor will be moving until you press Pause/Break again and we're going back to 1.

Code: Select all

#!/bin/bash

# Req.: Gtkdialog >= 0.8.0, xdotool, xbindkeys, xwininfo, getcurpos, bc, awk
# Note: bind a dead key, for exmample 'pause/break' with the following command:
# echo true > /tmp/button_press_signal

TEMPDIR=/dev/shm/one_switch_temp
mkdir $TEMPDIR

# Delete tempdir or exit
trap 'rm -rf $TEMPDIR' EXIT

PRESS=/tmp/button_press_signal
: > $PRESS

export PIC=$TEMPDIR/cursor_pic
export ROTATION=$TEMPDIR/cursor_rotate
echo 0 > $ROTATION

rotate_line () {
read DEG < $ROTATION
RAD="`echo 'scale=2; '$DEG' * 3.14 / 180' | bc -l`"
LX="`echo 'scale=2; 32 + 24 * c('$RAD')' | bc -l`"
LY="`echo 'scale=2; 32 + 24 * s('$RAD')' | bc -l`"

DEG=$(($DEG+5))
[ "$DEG" -ge 360 ] && DEG=0
echo $DEG > $ROTATION

# Create svg pic
echo '<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="32" cy="32" r="24" stroke="red" fill="none" stroke-width="3" />
<line x1="32" y1="32" x2="'$LX'" y2="'$LY'" stroke="black" stroke-width="3" />
</svg>' > $PIC
}
export -f rotate_line

# First call just to make a picture
rotate_line

# Read current screen resolution
read MAXX MAXY <<< `xwininfo -root | awk 'NR>=8&&NR<=9 {print $2}'`

# Gtkdialog window
export PREVIEW='
<window decorated="false" skip-pager-hint="true" skip-taskbar-hint="true" resizable="false">
  <pixmap>
    <variable>PICTURE</variable>
    <input file>'"$PIC"'</input>
  </pixmap>
  <timer visible="false" milliseconds="true" interval="100">
    <action>rotate_line</action>
    <action>refresh:PICTURE</action>
  </timer>
</window>
'

# Infinite loop
while :; do
  
  # Current cursor position
  read CX CY <<< `getcurpos` 
  CX=$(($CX-32)); [ $CX -lt 0 ] && CX=0
  CY=$(($CY-32)); [ $CY -lt 0 ] && CY=0
  
  # Show window
  gtkdialog -G 64x64+$CX+$CY -p PREVIEW & GTKPID=$!
  
  # Wait for switch signal
  until [ -s $PRESS ]; do
    sleep 0.1
  done
  
  # Kill Gtkdialog window
  kill $GTKPID

  : > $PRESS
  
  read DEG < $ROTATION
  DEG=$(($DEG+85))
  
  # Move cursor until switch signal will appear again
  until [ -s $PRESS ]; do
    xdotool mousemove_relative --polar $DEG 5
    sleep 0.1
  done
  
  : > $PRESS
  
done
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#5 Post by greengeek »

EDIT : I was posting this when you made your newer post... I am referring here to your first script...
SFR wrote:And the script works this way:..
I think this has a lot of potential. Do you think it would be possible to modify that script so that it has a coarse mode and a fine mode? By this I mean it would scroll quite fast initially ("coarse mode") in order to pinpoint the general area of the screen you wanted to click on, then drop immediately into "fine" mode where the scroll speed would be much slower, and limited to, say, a 2cm square around the "coarse select" point?

(My thinking is that your script would be the "default mode" that the PC would drop back to every time there was no "mouseclick" input for, say, 20 seconds - which would then allow the user to zone in on any part of the screen (not just the onscreen keyboard) and begin whatever task they wanted. The onscreen keyboard would then be only one of several input modes available to the user, all controlled by your SFRmouse script as the default)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#6 Post by greengeek »

Yeah, that Tilvus line cursor is a good idea. Not necessary to have a line though - although that obviously does help clarity (and their nudge function is well thought out..).

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#7 Post by SFR »

greengeek wrote:EDIT : I was posting this when you made your newer post... I am referring here to your first script...
SFR wrote:And the script works this way:..
I think this has a lot of potential. Do you think it would be possible to modify that script so that it has a coarse mode and a fine mode? By this I mean it would scroll quite fast initially ("coarse mode") in order to pinpoint the general area of the screen you wanted to click on, then drop immediately into "fine" mode where the scroll speed would be much slower, and limited to, say, a 2cm square around the "coarse select" point?
You mean something like:
1. Looped cursor movement right (coarse) within fullscreen
2. Looped cursor movement down (coarse) within fullscreen
3. Looped cursor movement right (fine) within reduced area
4. Looped cursor movement down (fine) within reduced area
5. Left-click
6. GOTO 1
?
If so, it's just a matter of two additional loops; could be like this:

Code: Select all

#!/bin/bash

# Req.: xdotool and xbindkeys
# Note: bind a dead key, for exmample 'pause/break' with the following command:
# echo true > /tmp/button_press_signal

# -----------------------------------------------------------------------------
STEP_COARSE=64
STEP_FINE=4		
SPEED_COARSE=0.5
SPEED_FINE=0.1
# -----------------------------------------------------------------------------

# Temporary file for inter-communication 
PRESS=/tmp/button_press_signal
# Make this file empty initially
: > $PRESS

# Read current screen resolution
read MAXX MAXY <<< `xwininfo -root | awk 'NR>=8&&NR<=9 {print $2}'`  

# Infinite loop
while :; do
  X=0
  Y=10
  
  # ======
  # COARSE
  # ======
  until [ -s $PRESS ]; do
    X=$(($X+$STEP_COARSE)); [ $X -ge $MAXX ] && X=0
    xdotool mousemove $X $Y
    sleep $SPEED_COARSE
  done
  : > $PRESS
  sleep 0.5
  until [ -s $PRESS ]; do
    Y=$(($Y+$STEP_COARSE)); [ $Y -ge $MAXY ] && Y=10
    xdotool mousemove $X $Y
    sleep $SPEED_COARSE
  done
  : > $PRESS
  
  # Reduce area to 64x64
  X1=$(($X-32)); [ $X1 -lt 0 ] && X1=0
  Y1=$(($Y-32)); [ $Y1 -lt 0 ] && Y1=0
  X2=$(($X+32)); [ $X2 -gt $MAXX ] && X2=$MAXX
  Y2=$(($Y+32)); [ $Y2 -gt $MAXY ] && Y2=$MAXY
  
  # ====
  # FINE
  # ====
  until [ -s $PRESS ]; do
    X=$(($X+$STEP_FINE)); [ $X -ge $X2 ] && X=$X1
    xdotool mousemove $X $Y
    sleep $SPEED_FINE
  done
  : > $PRESS
  sleep 0.5
  until [ -s $PRESS ]; do
    Y=$(($Y+$STEP_FINE)); [ $Y -ge $Y2 ] && Y=$Y1
    xdotool mousemove $X $Y
    sleep $SPEED_FINE
  done
  : > $PRESS
  
  xdotool click 1	# left-click
  
  # If tempfile is empty - do nothing
  until [ -s $PRESS ]; do
    sleep 0.1
  done
  
  : > $PRESS		# reset tempfile

done
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#8 Post by greengeek »

SFR wrote:You mean something like:
1. Looped cursor movement right (coarse) within fullscreen
2. Looped cursor movement down (coarse) within fullscreen
3. Looped cursor movement right (fine) within reduced area
4. Looped cursor movement down (fine) within reduced area
5. Left-click
6. GOTO 1
?
Yes, that's the concept. I hope to try your script after work tonight. I'm hoping to handle everything with a mousebutton only (instead of the pause/break) but getting the cursor movement right is the first major step.

You are redundifying my initial "xdotool mousemove" plan, but that's probably a good thing :-)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#9 Post by greengeek »

I think I must be doing something wrong with my manual keybinding method. I can't get the script to respond to the pause key. The end paragraph of my /root/.jwm/jwm-personal looks like this:

Code: Select all

<Key keycode="160">exec:amixer sset Master toggle</Key>
<Key keycode="176">exec:amixer sset Master 1+,1+</Key>
<Key keycode="174">exec:amixer sset Master 1-,1-</Key>
<Key keycode="178">exec:defaultbrowser</Key>
<Key keycode="236">exec:defaultbrowser</Key>
<Key keycode="111">exec:mtpaintsnapshot.sh</Key>
<Key keycode="75">exec:doubleclick_xdotool</Key>
<Key keycode="110">echo true > /tmp/button_press_signal</Key>
</JWM>
I'm running Slacko53 so maybe I do already have xbindkeys as you suggested. I just need to do a bit of research to find out how to drive xbindkeys. I probably should load the gui.

EDIT : I just tried xbindkeys -k and it works so I definitely have xbindkeys. That cmd gave me some info which I am apparently supposed to graft into my /root/.xbindkeysrc file, which now has this:

Code: Select all

# Task manager
"/usr/local/bin/pprocess"
   Control+Alt + Delete
   
#Added by greengeek to allow pause button to work with SFR mousemove script
"echo true > /tmp/button_press_signal"
	m:0x0 + c:110
	Pause
##################################
# End of xbindkeys configuration #
##################################
but still no joy yet.

EDIT : Maybe I need to restart Xserver instead of just jwm each time.

EDIT : Yes! that's what was wrong - I needed to resatrt X.

SFR - This script is fantastic!!! It's giving me really good control over focus and positioning. I think I can use this to really good advantage. Thanks!!

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#10 Post by greengeek »

Hi SFR: the parameters that I think suit my needs perfectly are:

Code: Select all

STEP_COARSE=2
STEP_FINE=1      
SPEED_COARSE=0.01
SPEED_FINE=0.1
If it is possible I would like the cursor to pause momentarily as it loops horizontally back through X=0 so that it is easier to line the pointer up with the menu button without overshooting (or maybe pause at x=15), and also pause momentarily as it loops vertically through y=10.

My guess is it would need to be something like:

Code: Select all

  # ======
  # COARSE
  # ======
  until [ -s $PRESS ]; do
    X=$(($X+$STEP_COARSE)); [ $X -ge $MAXX ] && X=0
    xdotool mousemove $X $Y
#greengeek mod for pause momentarily at x=15
#if x=15
#sleep 2
#fi
    sleep $SPEED_COARSE
  done
  : > $PRESS
  sleep 0.5
  until [ -s $PRESS ]; do
    Y=$(($Y+$STEP_COARSE)); [ $Y -ge $MAXY ] && Y=10
    xdotool mousemove $X $Y
#greengeek mod for pause momentarily at y=10
#if y=10
#sleep 2
#fi
    sleep $SPEED_COARSE
  done
  : > $PRESS
But of course it's a stab in the dark as usual. Can you help?? (P_l_e_e_e_a_s_e..) Thanks!

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#11 Post by greengeek »

test post using sfr2

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#12 Post by SFR »

Hey Greengeek

Code: Select all

  # ======
  # COARSE
  # ======
  until [ -s $PRESS ]; do
    X=$(($X+$STEP_COARSE)); [ $X -ge $MAXX ] && X=0
    xdotool mousemove $X $Y
    [ $X = 16 ] && sleep 2 || sleep $SPEED_COARSE    # X must be even, since STEP_COARSE=2
  done
  : > $PRESS
  sleep 0.5
  until [ -s $PRESS ]; do
    Y=$(($Y+$STEP_COARSE)); [ $Y -ge $MAXY ] && Y=10
    xdotool mousemove $X $Y
    [ $Y = 10 ] && sleep 2 || sleep $SPEED_COARSE    # Y must be even, since STEP_COARSE=2
  done
  : > $PRESS
However, I just noticed that while Menu (also pull-down menus) is opened, xbindkeys are off for some reason (tried under Compiz & JWM). :?
Do you have the same problem with this?

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#13 Post by greengeek »

Yes, same problem here. Still trying to nut out a way around that. Also been seeing a couple of oddities that seem to be interactions between certain open windows. For example sometimes I hit the print scrn key by mistake and the screenshot timer opens up, and I get several mousepointers on screen at once, all doing their own thing (aaaaarrrgggh!).

With regard to the lockout of xbindkeys I thought about the possibility of having a separate script running in the background which waited till it detected a period of 10 or fifteen seconds where there was no mouse or key action, then automatically generated an "arrow down one" keystroke (slowly repeated until the pause break key was hit again). Sorry that this description is not that clear - what I mean is that I found that when I selected something like the "File" tab in a window, and the dropdown menu appeared, I was not able to use the pause key, but WAS able to tap the arrow down key to scroll down through the menu choices. I have it in mind that the pause key then came back active but I'm going to have to confirm that.

In trying to find a way around these issues I did note a couple of times that I got the focus back onto the sfr2 script, and was able to carry on, but had no idea exactly how/why.

In particular I noticed different window interactions depending on whether I started sfr2 by clicking the script icon, or by opening a terminal there and using the ./sfr2 syntax.

EDIT : Also I noticed that behaviours were slightly altered when I was using xvkbd onscreen at the same time. It has it's own "focus" button so that was adding extra confusion to my trials. I can't yet pin down all the symptoms/variations I'm getting.

Lots more testing for me to do.

EDIT : BTW - the delay that you added for low values of X and Y is excellent. Perfect. Well done adjusting for even values. I wonder if I should have gone to step=1 and just doubled the speed? (Maybe the script should always be set for a step size of 1 only, and just use the speed control to get the desired effect...? I'll come back to that thought after further testing).

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#14 Post by SFR »

greengeek wrote:With regard to the lockout of xbindkeys I thought about the possibility of having a separate script running in the background which waited till it detected a period of 10 or fifteen seconds where there was no mouse or key action, then automatically generated an "arrow down one" keystroke (slowly repeated until the pause break key was hit again). Sorry that this description is not that clear - what I mean is that I found that when I selected something like the "File" tab in a window, and the dropdown menu appeared, I was not able to use the pause key, but WAS able to tap the arrow down key to scroll down through the menu choices. I have it in mind that the pause key then came back active but I'm going to have to confirm that.
I think I know what you mean, but the problem is that (at least in my tests), Pause key stays unresponsive, no matter if I tap arrow down key to scroll through menu options or not...

More oddities: xbindkeys works fine when I have a pull-down menu opened in Firefox, but not, eg. DeaDBeeF, Geany...

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#15 Post by greengeek »

I wonder if the relative cpu priorities of each process could have such an effect?

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#16 Post by greengeek »

I'm thinking it would be interesting to modify the script to recognise a mouse leftclick or centreclick as an alternative to a bound key to trigger the direction change etc. (and might continue to be recognised when dropdown menus are expanded..)

I need to have a deeper look at this link and evaluate what's possible:
http://stackoverflow.com/questions/8361 ... ash-script

("xdotool --search" answer....)

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#17 Post by SFR »

I need to have a deeper look at this link and evaluate what's possible:
http://stackoverflow.com/questions/8361 ... ash-script
Tried this, but unfortunately mouse-click is detected only when mouse is directly over desktop.
Besides, perhaps I don't fully understand your conception, but if mouse-click would be utilized to trigger movement events, the "click" itself also would interact with everything what lies beneath the cursor, each time...
I wonder if the relative cpu priorities of each process could have such an effect?
I'm afraid it's a deeper issue.
Googling around has revealed quite similar behaviors (though rather old and not directly related to xbindkeys app):
https://bugs.kde.org/show_bug.cgi?id=145732
https://bugs.launchpad.net/ubuntu/+sour ... +bug/32860

I guess xbindkeys intercepts keystrokes on too high level, because, for example: logkeys-0.1.0 has no problems with detecting Pause key in any circumstances...but it would be a huge overkill to utilize a keylogger to monitor state of only one key.

Anyway, I found an app in C that acts similarily, but at least is much smaller:
http://stackoverflow.com/questions/1485 ... linux-in-c

I have compiled it directly in Geany (Compile/Build) and modified both scripts ("horizontal/vertical" & "radar").
However I'm not sure if in all cases '/dev/input/event0' will be the proper input device and if "key 119" will be Pause key...

Source, binary and both scripts are in attached tar.gz.
Just unpack it and launch 'horizontal_vertical' or 'radar'...and see if it works at all in your case..? :wink:

Greetings!
Attachments
one_switch.tar.gz
(5.19 KiB) Downloaded 477 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#18 Post by greengeek »

Amazing. That is a huge step.

Let me just describe what my testing showed up (because it has left me a little confused...)

I downloaded the attachment and unzipped it. I trialled the horizontal_vertical script and it is much improved (almost perfect but still a couple of issues which I will try to describe better after some further testing later).

Then, when I looked at the "radar" file I realised it was probably based on one of your earlier scripts that I had not tested (the "rotate svg" one). I had not tested that first rotate script as I had been concentrating only on the horiz_vert one. So I went back to the rotate script and started it from a terminal (just to try and understand it before touching the new file called radar) and ended up with two "radars", and one of them kept turning into a MOVE, CLICK option. I lost control of the cursor and could not figure out how I should be controlling it.

However, when I look at the first rotate script I do not see any "MOVE" or "CLICK" anywhere within it. Obviously the MOVE CLICK is part of the new radar script so I have no idea how that started running (unless triggered somehow by my test of the horizontal_vertical).

So - at this point I'm thinking that I have got rotate1 and radar tangled up and somehow running at the same time.

Anyway - sorry to be confusing - I am just going to have another try and will aim to detail more clearly the horiz_vert issues.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#19 Post by SFR »

Yes, I introduced MOVE&CLICK in the second version of "radar".
I've no idea how "radar_old" has launched "radar_new"? :shock:

BTW, xbindkeys are no longer needed for both "horiz/vert" & "radar", so unbind the Pause key - maybe this was the culprit..?

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#20 Post by greengeek »

I didn't get a lot of testing time today unfortunately, but so far I'm very impressed with radar. I was able to do pretty much everything I wanted. The lack of a doubleclick was sometimes problematic, but I found ways around it each time. I think I could make a useful system out of it as is, with radar working together with xvkbd, but if I was to look for any further improvements it would be these:

1) Biggest problem was that the radar disappeared underneath the main system menu, so you could not see the direction it was pointing. Maybe the radar screen could be blocked from entering bottom left or top left airspace, so as to avoid conflict with menus?

2) Sometimes I thought it would be nice for the cursor to be allowed to wrap around the edges of the desktop to allow a shortcut to the other side. Not a biggie though - just a timesaver.

3) It would be helpful at times if the radar screen was partly transparent.

4) It would be great to add "doubleclick" to the Move/click menu

5) Occasionally I thought it would be handy for the radar to pause for half a second at 90, 180, 270 and 360 degrees to make it easier to travel along a line of xvkbd keyboard keys, or a horizontal menu etc, but I'm not sure it's worth the effort as it might be frustrating that it slows down the process at other times.


All in all I think you've done an utterly fantastic job and in such a short time!

Initially I was planning to add the horiz_vert script into a system with the menu and taskbar along the top edge (rather than along the bottom of the screen) so that the control functions were within easy reach of the origin (x=y=0) but I think radar makes that unnecessary. I think it could plug into pretty much any puppy and be useful as is. Really impressive!

I hope to get some more time for more indepth testing tomorrow.

Post Reply