Index | Thread | Search

From:
ZenitDS <zenitds@proton.me>
Subject:
Re: New 'swap-mods' option patch for cwm to swap modifier keys
To:
Omar Polo <op@omarpolo.com>
Cc:
Okan Demirmen <okan@demirmen.com>, "tech@openbsd.org" <tech@openbsd.org>
Date:
Thu, 11 Apr 2024 10:39:11 +0000

Download raw body.

Thread
On Thursday, April 11th, 2024 at 10:57 AM, Omar Polo <op@omarpolo.com> wrote:

> On 2024/04/10 15:55:31 -0400, Okan Demirmen okan@demirmen.com wrote:
> 
> > On Wed 2024.04.10 at 19:13 +0000, ZenitDS wrote:
> > 
> > > Hello,
> > > 
> > > I believe currently there is no possibility to change the modifier keys used
> > > for the default keybindings. This means that if you want to use the Mod4 key
> > > instead of Meta, you must unbind all the respective keys and remap them. With
> > > this new option you can achieve it in a simple way. Use case for this arrives
> > > when you want to use the Alt key for your applications, and move the default
> > > Meta modifier to Mod4 for example.
> > > 
> > > Example of configuration:
> > > # Swap Meta with Mod4 and Control with Shift
> > > swap-mods MC 4S
> > 
> > Something like this has been proposed in the past, but why do this at the
> > window manager layer and not in your x session (i.e. via xmodmap)?
> 
> 
> I don't think something like this is possible via xmodmap since the goal
> of the diff is to rebind the default keybindings to use mod4 instead of
> Meta, but only for cwm.

I have also had problems removing the Mod1 modifier from the Alt key. In my case, I tried doing
$ setxkbmap es && xmodmap -e "clear Mod1"
but had no success. After that command, in xev, only on the KeyRelease event, the state field has 
a value of 0x8, which corresponds to Mod1Mask. However, xmodmap shows mod1 as having no keys 
active. The problem is not exclusive to cwm, so it might have to do with X.

> 
> So that for example, instead of M-Right cwm would implicitly use
> 4-Right, without having to `unbind-key all' and rebinding all after. (Which is what I currently do to avoid having conflicts with the default cwm keybindings and emacs' ones -- but I also use a 'weird' keyboard layout so I'd have to do something like this anyway.) The proposed swap-mods seems a bit overkill to me however.
> Could just a` default-prefix 4' be enough?

I dont see how to implement it in a simple way. But if so, then it might be better, though less flexible.

> IME the most annoying thing of the
> default keybinding is the wide use of Meta/Alt which may conflict with
> some programs.
> 
> by the way, some nits below on the manpage bits.

Thanks for the tips, first time writing inside a man page.

> 
> > > Here is the patch:
> > > 
> > > Index: cwmrc.5
> > > ===================================================================
> > > RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v
> > > retrieving revision 1.78
> > > diff -u -p -r1.78 cwmrc.5
> > > --- cwmrc.5 20 Jul 2023 14:39:34 -0000 1.78
> > > +++ cwmrc.5 10 Apr 2024 19:02:53 -0000
> > > @@ -207,6 +207,16 @@ The default behavior for new windows is
> > > By enabling sticky group mode,
> > > .Xr cwm 1
> > > will assign new windows to the currently selected group.
> > > +.It Ic swap-mods Ar mods1 mods2
> > > +Swap modifiers for mouse and keyboard. Modifiers in
> 
> 
> new sentence, new line
> 
> > > +.Ar mods1
> > > +are swapped with
> > > +.Ar mods2
> > > +in order. The same modifiers are recognised as for
> 
> 
> same
> 
> > > +.Ar key
> > > +in
> > > +.Nm bind-key .
> > > +.Pp
> 
> 
> no need for .Pp here.
> 
> `man -Tlint -l cwm.1' would help you spotting these nits while editing a
> mandoc file.