PDA

View Full Version : [KDE] Heres how to right click in KDE


penguinbait
2008-01-18, 05:36
Well my friends,

Using xmodmap, I mapped a hardware key to "|"
Using xmodmap, I mapped a hardware key to "Tab"

USING xmodmap I NOW HAVE RIGHT CLICK........


I made a shortcut, in KDE, I use hardware keyboard, (CONTROL-Z) turrns on and off right click.

I can move the shortcut around, BUT IT WORKS, maybe a little clunky but it works

Oh I am so excited, I will be adding this to the update

It was oh so simple, after banging my head into a wall for hours, it was staring me in the face the whole time.

God, I want to take this moment to thank Linus Torvalds, I love linux....
~~~~~~~~~~~~~
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



I realize you will be looking here for some kind of way to do this, but I dont have a update yet, but I thought you would want to know, and also some people familar with KDE who already have xmodmap will find this info useful right now :)

mooler
2008-01-18, 06:05
I am assuming there is no way to use this Right Click workaround with the N800? Or can it be done using soft keyboard?

realcomix
2008-01-18, 06:43
Ha thanks!!!

Aisu
2008-01-18, 11:32
B-E-A-U-TIFUL! That is awesome, Pb! Genius :D

jaywhy13
2008-01-18, 12:37
Well my friends,

Using xmodmap, I mapped a hardware key to "|"
Using xmodmap, I mapped a hardware key to "Tab"

USING xmodmap I NOW HAVE RIGHT CLICK........


I made a shortcut, in KDE, I use hardware keyboard, (CONTROL-Z) turrns on and off right click.

I can move the shortcut around, BUT IT WORKS, maybe a little clunky but it works

Oh I am so excited, I will be adding this to the update

It was oh so simple, after banging my head into a wall for hours, it was staring me in the face the whole time.

God, I want to take this moment to thank Linus Torvalds, I love linux....
~~~~~~~~~~~~~
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



I realize you will be looking here for some kind of way to do this, but I dont have a update yet, but I thought you would want to know, and also some people familar with KDE who already have xmodmap will find this info useful right now :)

Would xmodmap allow you to do something like Ctrl+Click = Right Click?

penguinbait
2008-01-18, 12:50
I am assuming there is no way to use this Right Click workaround with the N800? Or can it be done using soft keyboard?

well actually I need to do some more testing, but you should be able to map a funtion key, an n800 hardware key to right click on/off.

debernardis
2008-01-18, 15:24
Please credit also apple2 for this breakthrough!
http://www.internettablettalk.com/forums/showthread.php?p=81608&styleid=1#post81608
He had seen the Light in October already, but the Revelation has been postponed 3 months...

penguinbait
2008-01-18, 16:17
Please credit also apple2 for this breakthrough!
http://www.internettablettalk.com/forums/showthread.php?p=81608&styleid=1#post81608
He had seen the Light in October already, but the Revelation has been postponed 3 months...


Yes he was definetly on the right track, but my question is how do you map F4 to that command? This seemed to be missing from the instructions?

Fortunately, KDE shortcuts come in handy? Not sure how you would do this is maemo?

So I created a KDE menu item to run a script,

swmb.sh
~~~~~~~~~~~~~~
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



Then I can map the menu Item to a key or series of keys, inside KDE.




I was originaly trying to skin this cat a different way, by enabling mousekeys and mapping a key to a pointer button.

But I can not enable mousekeys, xkbset -m, it just doesnt work, I think the keyboard layout missing a num_lock may be the reason it wont enable. If mousekeys works, we should be able to set a (CTRL)+left click = right. But its not working for me

So if someone can figure out why mousekeys wont enable, I would be appreciative, but for now, this works pretty well.


And as someone asked earlier, it will work with the N800, I just mapped right click to a single F5, so you can map it to any n800 F? hardware key, not the escape key though.

I originally had F5 on n810- mapped to "next desktop" I am changing it now to (Shift + F5) = "next desktop", F5 now is set to right click on/off

dubwise
2008-01-18, 17:02
I'm not seeing an F5 on my N810. Onscreen keyboard?
Or is that where the menu key or some such comes up?

I'm wanting to try KOrganizer, but haven't taken the KDE plunge yet.
Sounds like you're gearing up for an updated version.
Would you recommend that I hold off installing?

penguinbait
2008-01-18, 18:26
I'm not seeing an F5 on my N810. Onscreen keyboard?
Or is that where the menu key or some such comes up?

I'm wanting to try KOrganizer, but haven't taken the KDE plunge yet.
Sounds like you're gearing up for an updated version.
Would you recommend that I hold off installing?


Its up to you, it will probably be two weeks or more before updates are ready.

The F5 is the window select key, above the escape hardware key

dubwise
2008-01-18, 18:57
Coolio. I'm a dive in this weekend.

TabletKev
2008-01-19, 20:10
Is there an easy way to map the + button to make the stylus rightclick, as in VNCviewer? I'm 2 out of 10 in Linux experience, and would appreciate step by step instructions.

sgosnell
2008-01-19, 20:42
I've uninstalled KDE, but I have noticed that running Maemo you get the equivalent of a right-click (popup context menu) by tapping and holding. Just put the stylus down and hold it for a couple of seconds, and the menu pops up. You have to drag the stylus into it, because if you lift it the menu immediately goes away. Perhaps this works in KDE too, or could be made to work?

PinCushionQueen
2008-01-21, 14:54
Is there an easy way to map the + button to make the stylus rightclick, as in VNCviewer? I'm 2 out of 10 in Linux experience, and would appreciate step by step instructions.

I was able to set up the "Click Toggle" fairly easily by doing the following:

1. Grab the script provided on page 1 of this thread (basically copy and paste text provided into KEdit or KWrite) and save as swmb.sh

2. Open Control Center ->Regional & Accessibility -> Input Actions

3. Make a New Group (eg: Kev's Actions)

4. Click on Kev's Actions and then make a New Action
a) General Tab -> Action Name: Click Toggle (or whatever); Action Type: Keyboard Shortcut->Command/URL (simple)
b) Keyboard Shortcut Tab: Tap on the rectangle and then assign the keyboard presses you want to activate the action. If you assign this to the (+) you won't be able to use that character anymore in regular text input - but as long as you don't care. FWIW - I assigned "click toggle" to Ctrl+F4 (F4 is the Menu button) but you can choose pretty much whatever button(s) you want.
c) Command/URL Settings Tab: Command to execute = navigate to the path of the swmb.sh file

5. Click Apply and go try out your new "Hotkey"

6. Now that you know how to set up a Hotkey you can look at some of the examples and try to make some others. I've made some for XMMS (my current media player of choice - I love the EQ) such that I can Play/Pause; Next Track; Previous Track - without having to stop reading my pdf files or minimize my pdf viewer window at all :).

P.S. Many Thanks to Penquinbait for figuring this out!!! You ROCK!:D

Machster
2008-02-23, 14:09
I was able to set up the "Click Toggle" fairly easily by doing the following:

1. Grab the script provided on page 1 of this thread (basically copy and paste text provided into KEdit or KWrite) and save as swmb.sh

2. Open Control Center ->Regional & Accessibility -> Input Actions

3. Make a New Group (eg: Kev's Actions)

4. Click on Kev's Actions and then make a New Action
a) General Tab -> Action Name: Click Toggle (or whatever); Action Type: Keyboard Shortcut->Command/URL (simple)
b) Keyboard Shortcut Tab: Tap on the rectangle and then assign the keyboard presses you want to activate the action. If you assign this to the (+) you won't be able to use that character anymore in regular text input - but as long as you don't care. FWIW - I assigned "click toggle" to Ctrl+F4 (F4 is the Menu button) but you can choose pretty much whatever button(s) you want.
c) Command/URL Settings Tab: Command to execute = navigate to the path of the swmb.sh file

5. Click Apply and go try out your new "Hotkey"

6. Now that you know how to set up a Hotkey you can look at some of the examples and try to make some others. I've made some for XMMS (my current media player of choice - I love the EQ) such that I can Play/Pause; Next Track; Previous Track - without having to stop reading my pdf files or minimize my pdf viewer window at all :).

P.S. Many Thanks to Penquinbait for figuring this out!!! You ROCK!:D



I am not sure what I am missing here but after following your instructions, all that happens when I press the shortcut key is that Kwrite opens displaying the code. It doesn't execute it, I guess.

PinCushionQueen
2008-02-23, 15:27
I am not sure what I am missing here but after following your instructions, all that happens when I press the shortcut key is that Kwrite opens displaying the code. It doesn't execute it, I guess.

More details are needed... What exactly does your "Command to execute" say? Also when you saved the file using KWrite did you make sure that there wasn't any extension added to the end of the file name? KWrite shouldn't do that - but you never know - the file name must end in .sh and nothing else (no .txt)

Machster
2008-02-23, 15:51
More details are needed... What exactly does your "Command to execute" say? Also when you saved the file using KWrite did you make sure that there wasn't any extension added to the end of the file name? KWrite shouldn't do that - but you never know - the file name must end in .sh and nothing else (no .txt)

The file does end in .sh. The command is "/media/mmc2/swmb.sh"

PinCushionQueen
2008-02-23, 16:03
The file does end in .sh. The command is "/media/mmc2/swmb.sh"

Hmmm... And you used KWrite or KEdit to make the file-Right? If so, then the only other thing I can think of is to try moving the swmb.sh file to /home/user/ and changing your command accordingly. That's where I've got my shell script stored and I know it works from there.

So your command would then read /home/user/swmb.sh

Machster
2008-02-23, 16:27
Hmmm... And you used KWrite or KEdit to make the file-Right? If so, then the only other thing I can think of is to try moving the swmb.sh file to /home/user/ and changing your command accordingly. That's where I've got my shell script stored and I know it works from there.

So your command would then read /home/user/swmb.sh

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.

albright
2008-02-23, 16:38
machster, apologies if this is too simple minded, but
did you make your script executable (chmod a+x swmb.sh)?

PinCushionQueen
2008-02-23, 16:40
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.

Machster
2008-02-23, 17:32
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
2008-02-23, 17:43
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:


#!/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

Machster
2008-02-25, 03:06
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
2008-02-25, 14:26
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.

Machster
2008-02-26, 01:57
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
2008-02-26, 17:15
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!!

kitsu
2008-03-07, 19:24
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:


#!/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?

ArgentSilver
2008-03-23, 00:51
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?

r0yalz
2008-03-23, 21:59
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?

Delphipgmr
2008-03-29, 23:18
i cant seem to get a button to assign either, it does work if i run it from a shell

PinCushionQueen
2008-03-30, 00:37
If the script works when you run it from the shell the just assign an Input Action (hotkey). I've posted detailed instructions on how to do the assignment before just search...

If you're having a different issue then please provide more details. :D

Delphipgmr
2008-03-30, 00:40
yes i got it, the problem was i didnt name it .sh at the end (even though i set it to 755).

r0yalz
2008-03-30, 20:52
i can get the script working but i dont know how to assign an input action to toggle it on and off. ive searched but i cant seem to find the thread.

PinCushionQueen
2008-03-30, 21:31
See this post earlier in this thread: http://www.internettablettalk.com/forums/showpost.php?p=131434&postcount=14

or here's an alternative: http://www.internettablettalk.com/forums/showpost.php?p=131018&postcount=6

r0yalz
2008-03-30, 21:38
im trying it right now, THANKS! =D

r0yalz
2008-03-31, 00:07
See this post earlier in this thread: http://www.internettablettalk.com/forums/showpost.php?p=131434&postcount=14

or here's an alternative: http://www.internettablettalk.com/forums/showpost.php?p=131018&postcount=6

Sorry, PinCushionQueen but it still doesn't seem to work. I've looked and someone else had the same problem but it was solved by installing xmodmap, which i have done. Ive followed the instruction earlier but instead of toggling the right click, it opens Kwrite with the script. Any suggestions?

PinCushionQueen
2008-03-31, 03:04
so when you run the script from xterm it works to toggle right click? if so what command are you using? Have you made sure the file name ends in .sh ? If you need more help you'll need to give me more details. Exactly which script , how you saved the file, how did you set up the hotkey etc...

r0yalz
2008-03-31, 21:48
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

I used the script above, yes the file ends in .sh and I saved the file in Kwrite (>save as> swmb.sh). I have no idea what i did wrong but it always opens up Kwrite instead of toggling. I set up the toggle by following your instructions (Input Actions>Command/URL) and set it to /home/user/swmb.sh where the file is.

PinCushionQueen
2008-03-31, 23:27
Ok last few things to try did you make your script executable? Do this in xterm as root:

chmod a+x swmb.sh

And/or you might try adding the following line to the very top of your script:

#!/bin/sh

Hope this helps :D

r0yalz
2008-04-01, 00:58
FINALLY IT WORKS! I remember i already did that but i guess im wrong. Thanks alot btw! =D

dan
2008-04-02, 01:31
Guys,
If you want an easy right click I discovered using otg adapter by Jolouis with mouse you get instant right click on any menu.The mouse works on all apps I've tried so far on KDE. Also the cjk keyboard for foreign text is the best keyboard I have used on KDE thus far. Does numbers and text easily. If someone can how me how to do a screen shot in KDE I will take some screen shots to show right and keyboard. Hope this helps. Dan

PinCushionQueen
2008-04-03, 15:53
Guys,
If you want an easy right click I discovered using otg adapter by Jolouis with mouse you get instant right click on any menu.The mouse works on all apps I've tried so far on KDE. Also the cjk keyboard for foreign text is the best keyboard I have used on KDE thus far. Does numbers and text easily. If someone can how me how to do a screen shot in KDE I will take some screen shots to show right and keyboard. Hope this helps. Dan

I'd love to see some screen shots of your mouse usage :D

To get a screen shot in KDE use MH Shot Tool (a Maemo app that works in KDE) or KSnapshot (included in KDE install)

dan
2008-04-05, 18:10
Here are some screens shots of KDE using right click on mouse and the cjk keyboard. The mouse does not show in screen shots but the pointer is the size of a pc mouse pointer. On screen very fast and right clicking, left/right mouse and scroll wheel all work. Thanks to Penguinbait on KDE, and Jolouis and Benson on otg adapter and mouse and the guys who did the work on the cjk keyboard for all their hard work. Dan

Deaj
2008-04-18, 20:43
Right-click working in KDE for me - WooHoo!!! Thanks all - especially PCQ and PB! :)

vect0r
2008-06-23, 14:31
Hello!
Please explain what should I do, to make it work - I mean the right-click on n800.
Here is what I have already done:
1) I have installed xmodmap-1.02-1_armel.deb
2) I have created a script, called: rk.sh:
#!/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

But no matter what I do, as root, after sudo gainroot, or just as user, I can not run the script, or even change permissions.
So I am asking for an advise how to change permissions and of course - what to do next? Is it enought to get a right click? Just run that script and press "menu" buton, as Machster did?

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!

Thanks very much
Vect0r.

penguinbait
2008-06-23, 16:08
Hello!
Please explain what should I do, to make it work - I mean the right-click on n800.
Here is what I have already done:
1) I have installed xmodmap-1.02-1_armel.deb
2) I have created a script, called: rk.sh:


But no matter what I do, as root, after sudo gainroot, or just as user, I can not run the script, or even change permissions.
So I am asking for an advise how to change permissions and of course - what to do next? Is it enought to get a right click? Just run that script and press "menu" buton, as Machster did?


Thanks very much
Vect0r.


KDE v2 and v3 comes with this...


chown user.users rk.sh (change user and group)
chmod +x rk.sh (add executable flag)

Then you would need to map it using the shortcuts

iceman600
2008-08-13, 01:02
i did follow PCQ tutorial and it works for me... thank you so mch PCQ and PB. im new at using linux cammands and im beginning to fall in love with my tablet with KDE as my primary playing ground.


OMG... AFTER instaling the xmodmap and having my right click working. my FN key is not working... pls help. i cant function on KDE without the FN key working.

HEEEEEEELP!!!

dont know where to start...

Anunakin
2008-09-25, 14:06
I made a port of keylaunch apps from openzaurus project... this working nice on maemo and with kde loading from SD.
Right and Middle Mouse on KDE/Maemo (http://anunakin.blogspot.com/2008/09/right-and-middle-click-no-kde-no-n810.html)

% on KDE/Maemo[/URL]

Right and Middle Mouse on KDE/Maemo Translated (http://translate.google.com.br/translate?u=http%3A%2F%2Fanunakin.blogspot.com%2F2 008%2F09%2Fright-and-middle-click-no-kde-no-n810.html&sl=pt&tl=en&hl=pt-BR&ie=UTF-8)

This%

Permetrina
2008-12-16, 14:29
I made a port of keylaunch apps from openzaurus project... this working nice on maemo and with kde loading from SD.
Right and Middle Mouse on KDE/Maemo (http://anunakin.blogspot.com/2008/09/right-and-middle-click-no-kde-no-n810.html)

% on KDE/Maemo[/URL]

Right and Middle Mouse on KDE/Maemo Translated (http://translate.google.com.br/translate?u=http%3A%2F%2Fanunakin.blogspot.com%2F2 008%2F09%2Fright-and-middle-click-no-kde-no-n810.html&sl=pt&tl=en&hl=pt-BR&ie=UTF-8)

This%

Working with OS2008 different to Diablo?
Thanks