twm.org (6339B)
1 #+TITLE: TWM - Tabbed Window Manager 2 #+PROPERTY: header-args :tangle xdg-config/twm/config :mkdirp yes 3 4 * Aesthetics 5 6 ** Fonts 7 8 #+begin_src conf 9 TitleFont "fixed" 10 ResizeFont "fixed" 11 MenuFont "fixed" 12 IconFont "fixed" 13 IconManagerFont "fixed" 14 #+end_src 15 16 ** Colours 17 18 Start a Color block 19 20 #+begin_src conf 21 Color 22 { 23 #+end_src 24 25 *** List of colours 26 27 I set different colours for commonly used programs. These are defined 28 both for titlebar and border, so I use noweb. 29 30 #+NAME: colours 31 #+begin_src conf :tangle no 32 { 33 "emacs" "skyblue" 34 "st-256color" "darkred" 35 "vimb" "black" 36 "mpv" "thistle" 37 "mg" "forestgreen" 38 "info" "honeydew" 39 } 40 #+end_src 41 42 *** Title 43 44 Background Colours 45 46 #+begin_src conf :noweb yes 47 TitleBackground "darkslateblue" 48 <<colours>> 49 #+end_src 50 51 Foreground Colours - Default is white, which doesn't work well with 52 programs for which I set a light background colour. 53 54 #+begin_src conf 55 TitleForeground "white" 56 { 57 "emacs" "black" 58 "mpv" "black" 59 "info" "black" 60 } 61 #+end_src 62 63 *** Border 64 #+begin_src conf :noweb yes 65 BorderColor "darkslateblue" 66 <<colours>> 67 #+end_src 68 69 *** Menu 70 71 #+begin_src conf 72 MenuBackground "white" 73 MenuForeground "black" 74 MenuBorderColor "black" 75 MenuTitleBackground "gray70" 76 MenuTitleForeground "darkslateblue" 77 #+end_src 78 79 *** Icon 80 81 #+begin_src conf 82 IconBackground "darkslateblue" 83 IconForeground "white" 84 IconBorderColor "white" 85 IconManagerBackground "darkslateblue" 86 IconManagerForeground "white" 87 #+end_src 88 89 *** finish the Color block 90 91 #+begin_src conf 92 } 93 #+end_src 94 95 ** Border 96 97 Don't highlight inactive windows with an ugly border, and make the 98 width a bit bigger. 99 100 #+begin_src conf 101 NoHighlight 102 BorderWidth 3 103 #+end_src 104 105 * COMMENT Autoraise 106 107 #+begin_src conf 108 AutoRaise { "vimb" "emacs" "st-256color" "mpv" "mg" } 109 #+end_src 110 111 * Functions 112 113 #+begin_src conf 114 Function "move-or-lower" { f.move f.deltastop f.lower } 115 Function "move-or-raise" { f.move f.deltastop f.raise } 116 Function "move-or-iconify" { f.move f.deltastop f.iconify } 117 #+end_src 118 119 * Menus 120 121 ** Left menu - TWM interaction. 122 123 #+begin_src conf 124 menu "defops" 125 { 126 "Twm" f.title 127 "Iconify" f.iconify 128 "Resize" f.resize 129 "Move" f.move 130 "" f.nop 131 "Show Iconmgr" f.showiconmgr 132 "Hide Iconmgr" f.hideiconmgr 133 "" f.nop 134 "Kill" f.destroy 135 "Delete" f.delete 136 "" f.nop 137 "Restart" f.restart 138 "Exit" f.quit 139 } 140 #+end_src 141 142 ** Launch programs 143 144 This menu has a direct link to a terminal and browser, as well as 145 menus for editors, dmenu scripts, and other window managers. 146 147 #+begin_src conf 148 menu "exec" 149 { 150 "Terminal" f.exec "exec st &" 151 "Terminal..." f.menu "term" 152 "Dmenu" f.menu "dmenu" 153 "Editors" f.menu "editors" 154 "Browser" f.exec "vimb &" 155 "Calculator" f.exec "xcalc -rpn &" 156 "Window Managers" f.menu "startwm" 157 "Audio" f.menu "audio" 158 } 159 #+end_src 160 161 *** Terminal programs 162 163 A bunch of terminal programs. Mainly here so that I can change the 164 window title. 165 166 #+begin_src conf 167 menu "term" 168 { 169 "htop" f.exec "st -t htop -e htop &" 170 "screen" f.exec "st -t screen -e screen &" 171 "ncmpcpp" f.exec "st -t ncmpcpp -e ncmpcpp &" 172 "nethack" f.menu "nethack" 173 } 174 #+end_src 175 176 **** nethack 177 178 A menu to access all my nethack saves. These are shell scripts from 179 [[file:nethack.org][nethack.org]]. 180 181 #+begin_src conf 182 menu "nethack" 183 { 184 "knight" f.exec "nh kni &" 185 "samurai" f.exec "nh sam &" 186 "ranger" f.exec "nh ran &" 187 } 188 #+end_src 189 190 *** Editors 191 192 #+begin_src conf 193 menu "editors" 194 { 195 "Emacs" f.exec "emacsclient -c -a '' &" 196 "QEmacs" f.exec "qemacs -fs 12 -geometry '100x40' &" 197 "Micro Emacs" f.exec "st -g 100x40 -t mg -e mg &" 198 "Neovim" f.exec "st -g 100x40 -t neovim -e nvim &" 199 } 200 #+end_src 201 202 *** Dmenu 203 204 #+begin_src conf 205 menu "dmenu" 206 { 207 "Dmenu" f.exec "dmenu_recency &" 208 "Videos" f.exec "video-opener &" 209 "Documents" f.exec "pdf-opener &" 210 } 211 #+end_src 212 213 *** Window Managers 214 215 #+begin_src conf 216 menu "startwm" 217 { 218 "EXWM" f.startwm "exec exwm" 219 "ratpoison" f.startwm "ratpoisonrc; exec twmrc" 220 "dwm" f.startwm "dwm; exec twmrc" 221 } 222 #+end_src 223 224 *** Audio Programs 225 226 #+begin_src conf 227 menu "audio" 228 { 229 "Ardour" f.exec "ardour6 &" 230 "Calf Tools" f.exec "calfjackhost &" 231 "Patchbay" f.exec "patchmatrix &" 232 "qjackctl" f.exec "qjackctl &" 233 "Helm" f.exec "helm-synth &" 234 "Guitarix" f.exec "guitarix &" 235 } 236 #+end_src 237 238 * Icons 239 240 ** Icon Managers 241 242 Create a two-column icon manager for emacs frames, and don't iconify 243 emacs frames. 244 245 #+begin_src conf 246 IconManagers 247 { 248 "emacs" "=400x5+0+0" 2 249 "st-256color" "st" "=400x5+0+100" 2 250 "mpv" "=400x5+0+200" 1 251 } 252 #+end_src 253 254 ** Disabling icons 255 256 Disable icons for windows with their own icon manager. 257 258 #+begin_src conf 259 IconifyByUnmapping 260 { 261 "emacs" 262 "st-256color" 263 "mpv" 264 } 265 #+end_src 266 267 * Mouse bindings 268 ** Root window 269 270 Bind left-click to open TWM menu, right-click for programs. 271 272 #+begin_src conf 273 Button1 = : root : f.menu "defops" 274 Button3 = : root : f.menu "exec" 275 #+end_src 276 277 ** Super key 278 279 These bindings all use the super (AKA Windows) key, and are used on a 280 window or icon. 281 282 | 1 (left) | Move or raise window | 283 | 2 (middle) | Iconify/minimise window | 284 | 3 (right) | Resize window | 285 286 #+begin_src conf 287 Button1 = Mod4 : window|icon : f.function "move-or-raise" 288 Button2 = Mod4 : window|icon : f.iconify 289 Button3 = Mod4 : window|icon : f.resize 290 #+end_src 291 292 ** Titlebar 293 294 I hardly use these ones, it's kind of annoying to get the cursor on 295 the title bar. 296 297 | 1 (left) | Move or raise window | 298 | 2 (middle) | Raise or lower window | 299 300 #+begin_src conf 301 Button1 = : title : f.function "move-or-raise" 302 Button2 = : title : f.raiselower 303 #+end_src 304 305 ** Icons 306 307 Left button can move the icon, all buttons toggle iconification. 308 309 #+begin_src conf 310 Button1 = : icon : f.function "move-or-iconify" 311 Button2 = : icon : f.iconify 312 Button3 = : icon : f.iconify 313 #+end_src 314 315 ** Icon Manager 316 317 All buttons toggle iconification. 318 319 #+begin_src conf 320 Button1 = : iconmgr : f.iconify 321 Button2 = : iconmgr : f.iconify 322 Button3 = : iconmgr : f.iconify 323 #+end_src 324 325 * Key bindings 326 327 ** fullscreen 328 329 Bind =s-f= to the function =fullzoom=, which toggles fullscreen mode. 330 331 #+begin_src conf 332 "f" = mod4 : all : f.fullzoom 333 #+end_src 334 335 ** dmenu 336 337 Bind =s-&= to execute dmenu_run, similarly to exwm. 338 339 #+begin_src conf 340 "7" = mod4|s : all : f.exec "dmenu_run" 341 #+end_src 342 343 * Miscellaneous 344 345 #+begin_src conf 346 NoGrabServer 347 #+end_src