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

#41 Post by SFR »

No problem, however I did implement it anyway, 'coz it might be useful too.
It's handled by TRANS_DELAY constant (by default it's set to 0).
FIRST_POS_DELAY remained untouched.
___________

I added another menu option - 'XVKBD-Mode'.
It's kinda implementation of your initial idea.
Works this way, after choosing 'XVKBD-Mode' option:
- if XVKBD is not installed - appropriate message will pop-up.
- if XVKBD is installed, but not running - it will be launched.
- XVKBD window will be focused, and then:
1. Relocate mouse cursor to the top-left corner of XVKBD window
2. Keep moving mouse cursor down (wrapping is enabled) until switch will be pressed.
3. Keep moving mouse cursor right
a) if cursor will reach the right edge of the window and switch won't be pressed until then - leave XVKBD-Mode.
b). If switch will be pressed - send 'left-click' and GOTO 1

I tested it only under Compiz/JWM (Slacko-5.5).
BTW, Compiz is so nice, that it's enough to click a window (eg. Geany) before entering into XVKBD-Mode and such window is ready to receive keystrokes.
In JWM the use of "Focus" button before is necessary...

I'll be grateful for info if this new option works correctly and if it's useful (or not) in the long run..?

Greetings!
Attachments
Radar-0.9+NavBar-0.5.tar.gz
(120.96 KiB) Downloaded 437 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

#42 Post by greengeek »

Hi SFR - for some reason my earlier post today has disappeared :-(

Anyway - I have been having problems with Precise55 and Slacko55 so I have gone back to THINSlacko for my testing.

xvkbd-mode is very interesting! However, at the moment it is problematic. When I clicked focus the mouse would continue to track over the keyboard only, so I could not select a window. Also, I could not find a way to get back into the "choose action" menu - it was locked into xvkbd mode.

I think it would be a great idea to develop the xvkbd mode a little more. It has good potential. However, at the moment I want to focus on finding what is causing my problems with Precise55 and Slacko55 because I need to identify a good base for radar and navbar to be recommended with.

More testing tonight!

EDIT : O.k, I see now that I can get out of xvkbd-mode by driving the cursor right off the right hand end of the keyboard. Works ok, but very slow to get that far... :-)

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

#43 Post by SFR »

EDIT : O.k, I see now that I can get out of xvkbd-mode by driving the cursor right off the right hand end of the keyboard. Works ok, but very slow to get that far... :)
No problem, we can add also vertical breakpoint (just replace both scripts with the attached ones).
Try and see which approach acts better.

Good luck with 5.5! :)

Greetings!
Attachments
Nav_Radar_scripts_only.tar.gz
(4.78 KiB) Downloaded 391 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

#44 Post by greengeek »

SFR wrote:No problem, we can add also vertical breakpoint (just replace both scripts with the attached ones)
Excellent idea. I hope to try these tonight.

Just had another thought - some experienced users might prefer to speed up the "choose action" menu - maybe this could be enhanced by allowing the "drag" and "xvkbd" options to be de-selected somehow?

eg:, at the beginning of the script where you define all the variables, maybe there could be variables called something like:

Display_DRAG_option_in_menu true/false
Display_XVKBD-MODE_option_in menu true/false

and then a user could strip the menu down to "move, click, doubleclick, rightclick" if they felt they wanted the extra speed and simplicity this would bring to cycling through the menu.

Or even if they were still displayed but just not included in the cycle...

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

#45 Post by greengeek »

I've noticed a few times that the radar screen obscures the scrollbar in many windows (especially browsers). Is it possible to move it approx 20 pixels or so to the left of the right hand screen boundary?

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

#46 Post by SFR »

I've noticed a few times that the radar screen obscures the scrollbar in many windows (especially browsers). Is it possible to move it approx 20 pixels or so to the left of the right hand screen boundary?
Done, controlled via OFFSET_H & OFFSET_V (horizontal & vertical) constants.
...allowing the "drag" and "xvkbd" options to be de-selected somehow?
Yeah, the "main" menu became a bit clogged. :wink:
I resolved this differently, mostly because I introduced new option.
Now the 'main' menu contains:
Move
L-Click
R-Click
Dbl-Click
more...


'Drag' & 'XVBD' have been moved to 'more...' submenu, as well as the new action: 'Cycle'.
'Cycle' allows to...cycle opened windows (simply - emulates Alt+Tab); delay is controlled by CYCLE_DELAY (default = 1.5 sec).

Just let me know if this approach is efficient, so I'll roll it back, if not.

____________

UPDATE: version 1.0alpha2 with added GUI for configuration purposes and to start/stop the scripts in a bit easier way.
Important change - now the main scripts are named "navbar-main" and "radar-main".
GUI is launched via "navbar-config" and "radar-config" scripts, settings will be saved inside app's directory ("radar_settings" & "navbar_settings") and if anything goes wrong, it's enough to delete those files, what will revert default settings.


Greetings!
Attachments
Radar-1.0a2+NavBar-1.0a2.tar.gz
(123.8 KiB) Downloaded 604 times
Radar-1.0a+NavBar-1.0a.tar.gz
(121.17 KiB) Downloaded 586 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
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

Radar-1.0a2

#47 Post by ETP »

Hi SFR/Greengeek,

I have just tried 1.0alpha2 with added GUI and must say that it is very impressive.

The biggest issue remaining in the project is that of navigation which remains tedious and calls for too much precision. Try for example navigating to the mike icon in Google voice. The same applies to the keys on Xvkbd even when it is launched at a slightly larger size as in my beta.

My eyes were drawn however to the free line beneath Xvkbd on your Radar menu. It cries out for one last additional menu which could provide 4 further choices plus BACK. Some possibilities may be as follows:
1. ALT+F10
This toggles and can therefore give you a full screen keyboard with easier to navigate icons that require less precision. I tried it and text does indeed go to the browser or document beneath. Your cycle function is then very handy.

2 & 3. Page Up and Page Down.

Very handy for scrolling a web page/thread and documents/pdfs.

4. Return.
“Press enter to continue
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

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

#48 Post by greengeek »

I have not had a chance to get my teeth into the latest version yet, but am hung up on an issue with NAVBAR versions 0.4 and 0.5 (which may be well suited to some of my needs because of their simplicity)

The problem is this: if I do not choose the direction quickly enough, navbar will cycle through all the arrows, then display a "blank" period for 11 seconds, then go back to displaying the arrows. This is happening on the "SwitchPup" that I have based on racyNOP532. (I have not investigated this further on other puppies yet - very little PC access at present)

NAVBAR 0.3 does not exhibit this problem so I will probably use that for further testing at the moment.

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

#49 Post by SFR »

@ETP:
Done.
Custom options can be changed via GUI (by default - options proposed by you).

@Greengeek:
IIRC it's been fixed a couple of versions before.
If you'd like to apply the fix to an older version (eg. 0.5), just find this line:

Code: Select all

((DIRECTION_POS++)); [ $DIRECTION_POS -ge ${#DIRECTIONS} ] && DIRECTION_POS=0
and replace it with:

Code: Select all

((DIRECTION_POS++)); [ $DIRECTION_POS -ge $ARROWS ] && DIRECTION_POS=0
Greetings!
Attachments
Radar-1.0b+NavBar-1.0b.tar.gz
(125.55 KiB) Downloaded 611 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
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

Radar - new version

#50 Post by ETP »

Hi SFR,

That was quick! Many thanks, I will give it a try.
It should enable me to then produce a screen resolution agnostic remaster. :)
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

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

#51 Post by SFR »

mikeslr/the_other_thread wrote:Tried switching to a second desktop. Neither xvkbd nor radar were present.
Hmm, I've never thought about it before.
But it's easy to implement using wmctrl, so:

Added:
- ability to display Radar on all workspaces (NavBar already acts this way)
- ability to display xvkbd on all workspaces (only if launched/raised from within Radar/NavBar)

Changed:
- both scripts are now in one single dir, all additional tools were moved to ./tools subdirectory (see /usr/local/OneSwitch/).
- I combined both apps into one .pet package named (as once) OneSwitch. Menu entries for Radar-config and NavBar-config will appear under Personal.

Greetings!
Attachments
OneSwitch-1.0.pet
(91.19 KiB) Downloaded 584 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

#52 Post by greengeek »

Wow - just trialled radar1b - nice work with the gui SFR!! You've done amazing work with this whole project.

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

Adaption for use with a Game Controller?

#53 Post by mikeslr »

Hi SFR,

Phenomenal work! There's a mystical tradition which teaches that the true purpose of Man is to mend the world. In the rare moments when life and distractions don't get in the way, it's that closest I feel to makng sense of it all. But then the cynic in me retorts, "No good deed goes unpunished."
So I'll pass on darkcity's post:

"I have a friend who has limited upper body strength. He can't sit up to use a keyboard but can use a game controller. Could this pup be adapted to work with a game controller. Also, is there a program for zooming in to the part of the screen? the best I've seen is a hack using xrandr modes.

Currently he can uses the PS3 browser interface well. But his computer is sitting unused."
http://murga-linux.com/puppy/viewtopic. ... 665#697665

As far as I can speculate, it wouldn't actually be an adaption of either NavBar or radar, but rather involve an employment of many of their subroutines, substituting the impulses from the joystick for the directional routines built into the NavBar/radar made necessary in a single-stick environment.

The following might be of value in such project:
http://linuxjoymap.sourceforge.net/
http://ubuntuforums.org/showthread.php?t=903858
http://www.epanorama.net/documents/joys ... rogramming
http://www.mjmwired.net/kernel/Document ... arport.txt

Don't know if all joysticks generate the same signals. Might make sense to include a config app.

mikesLr

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

#54 Post by SFR »

Since I don't have a joystick/gamepad I, too, can only speculate, but if he (Darkcity's friend) is able use all buttons/directions, it would be just a matter of simple script that reads state of a button and "redirects" it into xdotool, eg.:

until button 'left' is pressed; do
xdotool mousemove_relative -- -5 0
sleep 0.1
done


...something like that.

Best if someone who have such a device could review the links you gave and see if/how those methods work.

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
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#55 Post by darkcity »

Hi all,

Great work with Radar Navbar and One Switch.

---

Is there a simple description of these programs and how to use? I installed Radar and NavBar but could not figure them?

For example which key is 119?

Is the keycode the same as the command xev returns?

---

This thread maybe needs renaming or new thread for Radar NavBar and OneSwitch

To make them easier to find?

---
BTW - I'm going to look into using the sixaxis joypad now I have acquired one.

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

#56 Post by SFR »

Hey Darkcity
darkcity wrote:For example which key is 119?

Is the keycode the same as the command xev returns?
It's Pause/Break, but xev displays this key as 'keycode 110'.
I'm using this (slightly modified) piece of code written in C to detect keystrokes in Radar/NavBar.
Type:

Code: Select all

/usr/local/OneSwitch/tools/detect_key /dev/input/event0
and press some keys to see their codes.
BTW, in my case it was always /dev/input/event0, but if no codes will appear, try to change to event1, event2 and so on...

The idea of utilizing that key came from Will/standard7452 in this thread.
standard7452 wrote:What I did, was disassembled the keyboard to find the ic that runs let's say the pause/break key...a key that I doubt would come into conflict with normal internet surfing or email and connect the switch across the appropriate terminals to make essentially a "one button Keyboard"
darkcity wrote:Is there a simple description of these programs and how to use? I installed Radar and NavBar but could not figure them?
To launch Radar/Navbar - press Start button in settings window.
When the action you want to perform is highlighted - simply hit Pause/Break key.
In short (in example of Radar, but NavBar works similarly):
- image of rotating radar: move mouse cursor in shown direction
- Move: go back to 'radar' mode
- L-click: left-click
- R-click: right-click
- Dbl-click: double-click
- Drag: drag (icon or window (<- by its titlebar!)) or select text
- Cycle: cycle opened windows
- XVKBD: launch/raise xvkbd (if installed); this will also initiate, so-called, "xvkbd-mode", which work this way:
Mouse cursor moves down until the chosen "switch-key" (Pause/Break by default) will be pressed, then cursor moves right until the key will be pressed again and the letter underneath the cursor will be left-clicked.
To leave xvkbd-mode simply let the cursor cross the boundary of xvkbd window (vertically or horizontally)
- and finally there are four custom actions that can be personalized in settings.
- and of course ..back to go back to previous menu, and more../custom.. to enter submenus.

I'm not too good in describing things, but I hope it's clear enough. :wink:

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
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#57 Post by darkcity »

thanks for the description, I think one problem was not knowing the break key. hopefully i'll get chance to test later today.

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

Would it be possible to build in a Select Text Routine

#58 Post by mikeslr »

Hi SFR and All,

Hold off on the following for the moment. After posting and taking a break for dinner, I went back to the xvkbd site for other reasons but stumbled on a passage indicating that thru the property panel what it refers to as "quick modifiiers" --Shift, Ctl, etc-- can be set to locked mode. Doing so enables Shift + arrow keys (as discussed below) to function as desired. I haven't had sufficient time as yet to determine whether setting shift to locked mode interferes with anything else.
I've been exploring the possibility of putting together an environment where the user would almost never have to personally direct mouse-movements relying on radar (or NavBar) and the use of keyboard commands running under radar/NavBar's xvkbd mode. [For example, running radar in xvkbd mode, many applications respond to Alt+F to drop down their Files menu, after which selections --still using radar in xvkbd mode-- can be made with the arrow/direction keys, and such selections effectuated by generating an “Enter/Return." Similarly, an application’s routine bound to Ctl+s --usually to generate a Save--can be effectuated under radar’s xvkbd mode. But I've run into one stumbling block.
Using a standard keyboard, there's a fairly easy way to select text to be copied or cut and subsequently pasted either to somewhere else into the application where the text first appeared or into a different application. You hold down the shift key and use the arrow/directional keys to select the text and then press Ctl+c or Ctl+x to copy or cut [into clipboard/memory]; then Ctl+v to paste. That facility --indeed those keyboard commands-- appears to be almost universal in applications which permit manipulation of text. It, or something like it, would be of value to those in a One-Switch environment while composing emails, documents, working on spreadsheets, or adding words or phrases to the "words" file used in xvkbd's word-completion mode.
Unless I've missed something, as currently structured while radar (and I assume NavBar as I think they employ the same routines) enables selection via CtL+ Arrow Key while in xvkbd mode, it only permits the selection of one letter using the left or right arrows, and with great difficulty the entire line using the up arrow, or --having backspaced-- the last word by using the down arrow. I’m not even certain that Ctl+c can be used after a selection as I gave up in frustration. That’s not the fault of radar, but rather of the layout of the keyboard [which I hope to solve]. It may be possible to leave xvkbd mode, reposition the mouse and make a selection, but that abandons my objective.
So I was wondering if it were possible to devise a selection routine which either preferably remains in xvkbd mode while a selection of text was made or returns to xvkbd mode after Ctl+x. c or v are pressed. [If I understand the mechanism now employed, when Ctl or Alt or Shift is pressed radar, although returning to the scrolling routine, permits xvkbd to register the “press

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

#59 Post by SFR »

Hi MikesLr

How about this:

1. As you already know there's an option in XVKBD: Main Menu -> Property... -> Lock Shift? which makes SHIFT key locked until it's pressed again.
2. I made small change in both apps: now when you're in XVKBD-mode and you're about to press Pause/Break key (in second phase - in order to "touch" a key underneath) you have an opportunity to make it more than one time.
Simply - Radar/NavBar suspends cursor movement and waits certain amount of time (adjustable via "XVKBD mode" delay option) for next signal, so repeating keystrokes is way easier and faster now.

In summary, 1+2 allows selecting text directly through XVKBD.


Note: Since previous version of NavBar uses float value in XVKBD_MODE_DELAY variable and current one uses integer, it's necessary to adjust settings in /usr/local/OneSwitch/navbar_settings file.
It must be integer, eg. if there's:
XVKBD_MODE_DELAY=1.0
it needs to be changed to, eg.:
XVKBD_MODE_DELAY=1
...or delete the old config file and create new one via GUI.
________________

EDITS:

I introduced a bug in OneSwitch-1.1 (malfunctioning "Cycle-mode" in Radar). Fixed in v1.1.1.

Version 1.1.2 - another fix, see here for details.

Version 1.1.3:
- added "Auto-restart" checkbox - if it's checked, after pressing "Stop" button in config GUI, Radar/NavBar will auto-restart in 60 seconds, unless mouse cursor movement will be detected within this time.

Greetings!
Attachments
OneSwitch-1.1.3.pet
(91.95 KiB) Downloaded 515 times
OneSwitch-1.1.2.pet
(91.67 KiB) Downloaded 556 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

#60 Post by greengeek »

Thanks SFR - I just want to add a note to clarify this for anyone else who wants to use 1.1.3:

The purpose of the 60 second timer is so that a user who can only operate the cursor by using the Pause/Break key will not have the ability to "STOP" the radar gui permanently. If they were permitted to stop radar it would leave them unable to have any further interaction.

They can still "save and close" in order to make changes, but they just can't "stop" radar. However, radar can still be stopped as normal if this action is performed using the normal mouse.

Just another thought - if the radar user wanted to switch between radar and navbar - would they be able to do that? I can't see any way they could do so without ending up with radar still running while they tried to start navbar. Would it be possible to add another checkbox to enable "switch between radar and navbar" ? (or at least a button to trigger such a switch/toggle)

Post Reply