+++ title = "Fvwm - day 2 (keyboard control)" author = ["MichaƂ Sapka"] date = 2024-09-03T22:29:00+02:00 categories = ["blog"] draft = false weight = 2002 image_dir = "blog/images" image_max_width = 600 abstract = "Adjusting Fvwm to my basic instincts" +++ I'm a day in Fvwm, and it's rock solid. Time to adjust it to my needs Let's start with keyboard control, as I prefer over using mouse. We can open `~/.fvwm/config` and make changes. The default one is _very_ nicely commented, so it's a pleasure to modify. Then, all we need is to `restart` the wm and we're ready. By default, you can use `C^F1` - `C^F2` to change active desktop. The problem is that I don't have F-keys on my keyboard and I want to relegate all WM bindings to `super` key (aka "windows" key). Ergo, I want `Super^1` to `Super^4`. First of all, I don't want my `Super` to star terminal - all I needed to do was to comment out ```shell Silent Key Super_R A A Exec exec $[infostore.terminal] ``` I will reassign it later on. The [bindings documentation](https://www.fvwm.org/Wiki/Config/Bindings/) inform us that the binding format is ```shell Key Name Context Modifier Command ``` So, what I want to achieve is ```shell Silent Key 1 A Super GotoDesk 0 0 ``` There is no super as modifier as default, but we can use any `mod` key. It varies between OSes, so we need to check: ```shell $ xmodmap # xmodmap: up to 4 keys per modifier, (keycodes in parentheses): shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Alt_R (0x6c), Alt_L (0xcc), Meta_L (0xcd) mod2 Num_Lock (0x4d) mod3 ISO_Level5_Shift (0xcb) mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf) mod5 ISO_Level3_Shift (0x5c) ``` Therefore, my `super` keys is `mod4` and the bindings will be ```shell Silent Key 1 A 4 GotoDesk 0 0 Silent Key 2 A 4 GotoDesk 0 1 Silent Key 3 A 4 GotoDesk 0 2 Silent Key 4 A 4 GotoDesk 0 3 ``` Now, back to the terminal. I want `Super+Shift+Enter` to open the terminal We can join multiple modifiers by simply putting all of them as the mod: ```shell Silent Key Return A 4S Exec exec $[infostore.terminal] ``` The terminal command is a variable (`infostore`) because it's used in multiple places. I'm still using the good, old st, so I modified to ```shell InfoStoreAdd terminal st ``` I also want to have a quick way to run emacs ```shell Silent Key E A 4 Exec exec emacs ``` And to mimic MacOS `Ctrl+shift+Q` to close active window ```shell Silent Key Q A CS Close ``` This makes Fvwm very much usable. My muscle memory is again in use. It's still far from where I want it to be, but it's getting there.