LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   wmii: problems with keybindings (http://www.linuxquestions.org/questions/linux-desktop-74/wmii-problems-with-keybindings-909571/)

TobiSGD 10-22-2011 01:21 PM

wmii: problems with keybindings
 
I started to replace Xmonad with wmii and I really love wmii, fast and easy to configure. And no need for ghc.

I works very good, I have only two minor problems with the keybindings.

1. It was no problem to setup keybindings to start my favorite applications. But I have serious problems to control the backlight of my laptop and the volume. I use xbacklight for the former and amixer for the latter. Both programs work fine from the command line, but they won't work if I bind the to key-combinations. Here is the part for this in my ~/.wmii-hg/wmiirc
Code:

Key $MODKEY-, # Decrease backlight 5%
        eval wmiir setsid "xbacklight -5" &

Key $MODKEY-. # Increase backlight 5%
        eval wmiir setsid "xbacklight +5" &

Key $MODKEY- # Decrease volume 3%
        eval wmiir setsid "amixer sset Master 3%-" &

Key $MODKEY-+ # Increase volume 3%
        eval wmiir setsid "amixer sset Master 3%+" &

I don't get any error-messages on the virtual terminal I launched startx from and don't have any clue what is going on.


2. I want to resize the tiles with key-combinations and luckily the wmii-website offers a solution for that under the point "Resize windows with the keyboard".
Unluckily it doesn't work. I pasted that code-snippet in my configuration file into the part with the other keybindings. I restarted X, tried it and it didn't work. All I get is "cat: s/^ /: No such file or directory" on the virtual terminal where I launched startx. Sadly I don't know how to fix that.

I hope some one can help me here. Those are rather minor problems, but for me they are showstoppers.

Thanks in advance.

TobiSGD 10-23-2011 05:17 AM

Update: I could solve the second issue with switching from the developing version (wmii-hg) to the stable version (3.9.2 from the Arch repositories) and use the Python configuration file instead of Dash.
But the first issue still is not solved, I just can't get it to work. The commands work from the command-line, but not from the configuration file. This is what is looking like now:
Code:

# MY Key-Bindings
223    ##################
224        ('%(mod)s-Control-f', "Launch Firefox",
225                lambda k: call('firefox', background=True)),
226        ('%(mod)s-Control-m', "Launch Thunar",
227                lambda k: call('thunar', background=True)),
228        ('%(mod)s-Control-C', "Launch Claws-Mail",
229                lambda k: call('claws-mail', background=True)),
230        ('%(mod)s-Shift-,', "Backlight -5%",
231                lambda k: call('xbacklight -d :0 -5', background=True)),
232        ('%(mod)s-Shift--', "Backlight +5%",
233                lambda k: call('xbacklight -d :0 +5', background=True)),
234        ('%(mod)s-Shift-#', "Volume -3%",
235                lambda k: call('amixer sset Master 3%-', background=True)),
236        ('%(mod)s-Shift-+', "Volume +3%",
237                lambda k: call('amixer sset Master 3%+', background=True)),

Launching Firefox, Thunar and Claws-Mail works, the rest not.

Any suggestions?

Ian John Locke II 10-23-2011 02:33 PM

The reason the call does not work is because call works like execvp() in C. What you need to do is:
Code:

lambda k: call('amixer', 'sset', 'Master', '3%+', background=True)
As an example.

If you wanted to be lazy, you might do something like
Code:

lambda k: call('amixer sset Master 3%+'.split(), background=True)

TobiSGD 10-23-2011 03:21 PM

Thanks for your answer, I really need a refresh on my (rather poor) Python skills.

I tried your suggestions, but it still doesn't work. If I only would get any error-message, that would be very helpful, but si I don't even have a clue for what I have to search to fix that.

Ian John Locke II 10-23-2011 03:26 PM

If you want output somewhere, you might need to set background to False.

Ian John Locke II 10-23-2011 03:32 PM

Quote:

Originally Posted by TobiSGD (Post 4505736)
Update: I could solve the second issue with switching from the developing version (wmii-hg) to the stable version (3.9.2 from the Arch repositories) and use the Python configuration file instead of Dash.
But the first issue still is not solved, I just can't get it to work. The commands work from the command-line, but not from the configuration file. This is what is looking like now:
Code:

# MY Key-Bindings
223    ##################
224        ('%(mod)s-Control-f', "Launch Firefox",
225                lambda k: call('firefox', background=True)),
226        ('%(mod)s-Control-m', "Launch Thunar",
227                lambda k: call('thunar', background=True)),
228        ('%(mod)s-Control-C', "Launch Claws-Mail",
229                lambda k: call('claws-mail', background=True)),
230        ('%(mod)s-Shift-,', "Backlight -5%",
231                lambda k: call('xbacklight -d :0 -5', background=True)),
232        ('%(mod)s-Shift--', "Backlight +5%",
233                lambda k: call('xbacklight -d :0 +5', background=True)),
234        ('%(mod)s-Shift-#', "Volume -3%",
235                lambda k: call('amixer sset Master 3%-', background=True)),
236        ('%(mod)s-Shift-+', "Volume +3%",
237                lambda k: call('amixer sset Master 3%+', background=True)),

Launching Firefox, Thunar and Claws-Mail works, the rest not.

Any suggestions?

I hadn't looked too closely before at what you were trying to map them to.
'%(mod)s-Shift-,' should work I guess but I can guess that trying to map
'%(mod)s-Shift--', '%(mod)s-Shift-#', and '%(mod)s-Shift-+' will not work. Most likely in the first case, the interpreter is reading it as the modkey and shift and some illegal combination.
It may accept %(mod)s-Shift-# but it's probably receiving it as modkey-shift-3, same for + except it's probably seeing it as =. I'm not 100% certain but that's my best guess.

Edit:
The best way to check the first one is to press %(modkey)-a and then run showkeys. It'll show yours as they appear to have been interpreted by wmii from your wmiirc.

TobiSGD 10-23-2011 03:42 PM

Quote:

Originally Posted by Ian John Locke II (Post 4506018)
The best way to check the first one is to press %(modkey)-a and then run showkeys. It'll show yours as they appear to have been interpreted by wmii from your wmiirc.

showkeys is showing the bindings exactly the way I have set them up. May be it is confusing that I am using a German keyboard, where those keys are not at the same place like on a US keyboard. Since using the keys , , and are giving me error-messages about encoding (really have to learn more about Python) I used some unused keys that don't gave error messages.

Will try the suggestion to set background to false.

Ian John Locke II 10-23-2011 03:52 PM

Quote:

Originally Posted by TobiSGD (Post 4506027)
showkeys is showing the bindings exactly the way I have set them up. May be it is confusing that I am using a German keyboard, where those keys are not at the same place like on a US keyboard. Since using the keys , , and are giving me error-messages about encoding (really have to learn more about Python) I used some unused keys that don't gave error messages.

Will try the suggestion to set background to false.

Ah, I didn't realize you were from Germany (heh stupid American assuming everyone else on the internet is from America :P). For those keys in Python you might have to prefix the string with a 'u' like:
Code:

u'unicode string'
But I'm not sure if that'll fix that problem.

TobiSGD 10-23-2011 03:57 PM

I changed the bindings to some unused letters (not symbols, like before) and it works.

Hadn't thought that wmii can't parse those symbols.

Thanks for your help, all problems solved (besides a conky problem that is unsolvable), so I can totally ditch Xmonad and have fun with wmii.

Ian John Locke II 10-23-2011 04:28 PM

Quote:

Originally Posted by TobiSGD (Post 4506035)
I changed the bindings to some unused letters (not symbols, like before) and it works.

Hadn't thought that wmii can't parse those symbols.

Thanks for your help, all problems solved (besides a conky problem that is unsolvable), so I can totally ditch Xmonad and have fun with wmii.

Yeah, I was a bit ticked when I found out conky and wmii did not mix well which is why I used dwm for so long... but wmii is just a far more convenient wm. It does exactly what I want and is damned logical.

Now all I have to do is get you to switch from Vimperator to Pentadactyl :P

TobiSGD 10-23-2011 04:50 PM

Quote:

Originally Posted by Ian John Locke II (Post 4506063)
Now all I have to do is get you to switch from Vimperator to Pentadactyl :P

I tried that, and it doesn't seem to be that different. What are the advantages of Pentadactyl (that I am obviously missing, I would think)?

Ian John Locke II 10-24-2011 06:45 PM

Quote:

Originally Posted by TobiSGD (Post 4506076)
I tried that, and it doesn't seem to be that different. What are the advantages of Pentadactyl (that I am obviously missing, I would think)?

Well it's been trying to keep more in line with the vim ideology rather than having started from there and gone off the deep end. It's faster in terms of start-up speed. It doesn't use so much hackish CSS to make it look "pretty" which further slows it down. Kris recently revamped completions so it's even faster and I think he's doing some part of it in C++ now to further optimize the speed of the code (although I'm not entirely certain what the purpose is).

There are also some more logical keybindings and less "add-ons" required to accomplish some things I wanted in Vimperator (like using the homerow for hints instead of numbers).

TobiSGD 10-24-2011 10:46 PM

Thanks for clarification. I think I will try that a little bit more and see if I like it.

Ian John Locke II 10-25-2011 02:19 PM

Quote:

Originally Posted by TobiSGD (Post 4507253)
Thanks for clarification. I think I will try that a little bit more and see if I like it.

Also, even though there hasn't been a release like "1.0", the development branch is extraordinarily stable.

TobiSGD 10-25-2011 02:29 PM

Switched to it this evening. Let's see how it works for me, but currently I can't see any differences to vimperator, but I was fairly new to that, too.


All times are GMT -5. The time now is 01:30 AM.