Reply
Thread Tools
PinCushionQueen's Avatar
Posts: 538 | Thanked: 168 times | Joined on Dec 2007 @ Seattle
#21
Originally Posted by Machster View Post
I used Aquamacs text editor to create the file. The text does appear the same when viewed in Kwrite. Moving it to my home folder does not alter the results.
Sorry, then I'm at a loss - it works perfectly for me with several different shell scripts. Not one of them causes KWrite/KEdit to open. The only thing I did differently is actually use KWrite to make the file

Don't know if using the Aquamacs has anything to do with it - not even sure what that program is... you could try to Save As using KWrite - sometimes applications will automatically save files differently and shell scripts need to be simple text only without any formatting.
__________________
When you wish upon a star, your dreams really can come true... Unless it's an asteroid hurtling towards earth that will destroy all life.
 
Posts: 51 | Thanked: 2 times | Joined on Jan 2008
#22
Originally Posted by albright View Post
machster, apologies if this is too simple minded, but
did you make your script executable (chmod a+x swmb.sh)?
No apologies necessary. Thanks for the suggestion. I had not made it executable. However, after I did, now when I hit the menu shortcut key Kwrite no longer pops up. But now nothing seems to happen. Even saved the file with Kwrite.

Let me see if I understand the usage here. When I hit the specified shortcut key the mouse is supposed to emulate the right click? So if I were to then tap on the screen it would be a right click? Then if I hit shortcut again and click the screen I am back to the left click?

Just confirm, is this the script:

export CHANGE=`/usr/bin/xmodmap -pp | awk '{print $2}' | tail -n 33 | head -n 1`
if test 3 = $CHANGE
then
/usr/bin/xmodmap -e "pointer = 1 2 3"
else
/usr/bin/xmodmap -e "pointer = 3 2 1"
fi
 
PinCushionQueen's Avatar
Posts: 538 | Thanked: 168 times | Joined on Dec 2007 @ Seattle
#23
Yes the script should work so that when you press the button(s) you've assigned a screen tap should behave like a right click. Then when you press the same button(s) again - a screen tap goes back to being a left click. It's a toggle.

As for the script... I forgot that my husband rewrote the script for me using sed instead of awk but that really shouldn't matter. The script is correct except I think you need to add the following as the very first line:

#!/bin/sh

If that still doesn't work then you're welcome to try my version of the script:


Code:
#!/bin/sh
BTN=$(/usr/bin/xmodmap -pp | sed -ne 's/^\s\+1\s\+\([[:digit:]]\+\)\s*$/\1/p')
if [ $BTN == 3 ]; then
  MAP='1 2 3'
else
  MAP='3 2 1'
fi
/usr/bin/xmodmap -e "pointer = $MAP" 2>/dev/null
__________________
When you wish upon a star, your dreams really can come true... Unless it's an asteroid hurtling towards earth that will destroy all life.
 
Posts: 51 | Thanked: 2 times | Joined on Jan 2008
#24
Thanks to those who have tried to help, but unfortunately, I have not been able to get either script to work. No change is occuring when the shortcut key is pressed. Perhaps something is preventing the script from executing? I just don't know at this time.
 
PinCushionQueen's Avatar
Posts: 538 | Thanked: 168 times | Joined on Dec 2007 @ Seattle
#25
Originally Posted by Machster View Post
Thanks to those who have tried to help, but unfortunately, I have not been able to get either script to work. No change is occuring when the shortcut key is pressed. Perhaps something is preventing the script from executing? I just don't know at this time.
Here's one last thought... Do you have xmodmap installed? you can get it here: http://maemo.lancode.de/?path=./chinook/binary

Have you tried a different button assignment? Are you using a N800 or N810 - the N800 is quite limited in button selection and you can't use the "Escape" button for this.
__________________
When you wish upon a star, your dreams really can come true... Unless it's an asteroid hurtling towards earth that will destroy all life.
 
Posts: 51 | Thanked: 2 times | Joined on Jan 2008
#26
Originally Posted by PinCushionQueen View Post
Here's one last thought... Do you have xmodmap installed? you can get it here: http://maemo.lancode.de/?path=./chinook/binary

Have you tried a different button assignment? Are you using a N800 or N810 - the N800 is quite limited in button selection and you can't use the "Escape" button for this.
YEEEESSS!! Installed xmodmap and right click now works with the menu button I had assigned it to on the n800. PCQ, you have earned your crown. This is cool, thanks!
 
penguinbait's Avatar
Posts: 3,096 | Thanked: 1,525 times | Joined on Jan 2006 @ Michigan, USA
#27
Originally Posted by Machster View Post
YEEEESSS!! Installed xmodmap and right click now works with the menu button I had assigned it to on the n800. PCQ, you have earned your crown. This is cool, thanks!
Its obvious, she earned that crown long ago!!
__________________
To all my Maemo friends. I will no longer be monitoring any of my threads here on a regular basis. I am no longer supporting anything I did under maemo at maemo.org. If you need some help with something you can reach me at tablethacker.com or www.facebook.com/penguinbait. I have disabled my PM's here, and removed myself from Council email and Community mailing list. There has been some fun times, see you around.
 
Posts: 16 | Thanked: 3 times | Joined on Feb 2008
#28
Ummm, I kinda got this working for a minute. My first problem was that I couldn't get either shell script to work. Playing around on the shell it kept giving me errors about unexpected EOF while looking for 'then'. I'm not very familiar with shell scripting and have never used awk or sed or whatever so I came at it from another direction:

Code:
#!/usr/bin/python
from subprocess import call, Popen, PIPE

xmodmap = Popen(['/usr/bin/xmodmap', '-pp'], stdout=PIPE)
for line in xmodmap.stdout:
  setting = line.split() # get a list of non-whitespace sequences
  if setting: # can't index a zero length list
    print setting
    setting = line.split()[-1] # Get last item in list (button)
		
  if setting == '1':
    print 'click set to lmb, switching'
    #/usr/bin/xmodmap -e "pointer = 3 2 1"
    call(['/usr/bin/xmodmap', '-e', 'pointer = 3 2 1'])
    break
  elif setting == '3':
    print 'click set to rmb, switching'
    #/usr/bin/xmodmap -e "pointer = 1 2 3"
    call(['/usr/bin/xmodmap', '-e', 'pointer = 1 2 3'])
    break
(Written in Kate )

So with the above (and Python) I got right click working. But while playing around it seemed that the RMB mapping would stick more and more. Then everything started slowing down. Then I started getting errors about failed thread creation. Finally the system froze and I had to do a hard reboot...

Looking at it this morning though I think I see where part of the problem came from. With Python I shouldn't need to explicitly close the subprocess, but my problem sure seems like I created a bunch of zombies somewhere. I'll do some more testing today, see if I can add some indication of current button state too.

Is the switch from LMB to RMB slow for people using the shell script? Running my script from the terminal it looks like it only takes a split second. Is the problem with the KDE "input actions" thing?

Last edited by kitsu; 2008-03-07 at 19:27.
 
Posts: 67 | Thanked: 6 times | Joined on Dec 2007
#29
OK, here's a headscratcher. I set up Penguinbait's awk script on a hotkey per PCQ's suggestion. Actually, I mapped it to the home key (F5) on my n800, after removing the KDE mapping for F5 to move to next window. After doing this, it toggles to right-click alright...but won't toggle back. Believe me, it's really hard to do anything on a n800 without a left-click tap!

I've checked and re-checked the script, and can't see any typos. I can't figure why it would work OK one time only. Seems like if there was a script error it wouldn't work the first time either....

Anybody have a bright idea?
 
Posts: 7 | Thanked: 0 times | Joined on Mar 2008
#30
Originally Posted by Machster View Post
YEEEESSS!! Installed xmodmap and right click now works with the menu button I had assigned it to on the n800. PCQ, you have earned your crown. This is cool, thanks!
Machster, what script did you use? And how do you assign a button?
 
Reply

Tags
deprecated, kde, kde35, mouse


 
Forum Jump


All times are GMT. The time now is 05:47.