Re: what is wrong with my ".sawfishrc" file?



On date Friday 2007-02-02 00:05:32 -0800, arnuld opened this window:
> >> (bind-keys global-keymap
> >>  "C-m"       (system "xmms &")
> >>  "C-t"       (system "terminal &")
> >>  "C-M-g      'emacs)
> >
> > (bind-keys global-keymap
> >   "C-m"       '(system "xmms &")
> >   "C-t"       '(system "terminal &")
> >   "C-M-g"     'emacs))
> >
> >Here I suppose emacs is the name of some sawfish function you've
> >already defined (something as '(system "emacs &")).
> 
> OK
> 
> >Note that you need to escape the command to bind to avoid evaluation:
> 
> what does that mean?
> 
> >if you don't the expression value will be put in the binding (and not
> >the function you want to execute).
> 
> swept above my head

'(+ 1 1) is different from (+ 1 1).

The first is the list corresponding to (list '+ 1 1), which can be
eventually evaluated later to return a value (2 in this case).
But if you write (+ 1 1) the interpreter evaluates it.

So: 
(bind-keys global-keymap
   "C-m"       (system "xmms &"))

it's the same as:
(bind-keys global-keymap
   "C-m"      <result of (system "xmms &") evaluation, usually 0>)

so every time sawfish catch the "C-m" event it will evaluate 0, while
you want sawfish to evaluate a command corresponding to (system "xmms
&"), so you have to escape it with "'". 

In this way when the interpreter reads:
'(system "xmms &")

it won't evaluate this form immediately, but will bind the list
(system "xmms &") to the event "C-m" that will be evaluated when the
event is catched.

> >Another suggestion: "C-m", "C-t" and similiar command will easily
> >conflict with other application keybindings (such as emacs) so you
> >should avoid to use control as modifier for the WM/DE: you can use
> >instead some combination of super.
> 
> i agree. i used "Super key" earlier but as i told you nothing works. i
> used this:
> 
> (bind-keys global-keymap
>  "Super_L-m"       (system "xmms &"))
> 
> i have 2 Super keys on both sides of "space" button of my keyboard
> (when i press those keys on Windows, i get Windows menu)

You have to look at xmodmap.

For example in my ~/.Xmodmap I have:

...
keycode 115 = Super_L
...
clear control
clear shift
clear mod1
clear mod2
clear mod3
clear mod4
clear mod5

add control = Control_R
add shift = Shift_L
add shift = Shift_R
add mod1 = Alt_L
add mod1 = Alt_R
add mod2 = Super_L
add mod3 = Menu
--- END

With:
keycode 115 = Super_L

I bind the keycode 115 corresponding to the "Windows" key (launch xev
and press the "Windows" key to look at the output to see the
corresponding keycode), to the "Super_L" keysymbol (keysim for the
friends).

Then with:
add mod2 = Super_L

I tell X to treat the key corresponding to the Super_L keysym as the
mod2 (one of the X modifier keys). 

Apparently "super" is what sawfish (and gnome as well) means for the
mod2 so now you have to do: 

(bind-keys global-keymap
  "super-m"       (system "xmms &"))

Summing all this up:
X keycode(115) -> X keysym(Super_L) -> X modifier (mod2) -> sawfish event (super) 

HTH
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]