itadded reddit comment to you-are-the-wm - monochromatic - monochromatic blog: http://blog.z3bra.org Err z3bra.org 70 hgit clone git://z3bra.org/monochromatic URL:git://z3bra.org/monochromatic z3bra.org 70 1Log /scm/monochromatic/log.gph z3bra.org 70 1Files /scm/monochromatic/files.gph z3bra.org 70 1Refs /scm/monochromatic/refs.gph z3bra.org 70 i--- Err z3bra.org 70 1commit 72388ff5d221cdce96b848ab99d0616a512727a4 /scm/monochromatic/commit/72388ff5d221cdce96b848ab99d0616a512727a4.gph z3bra.org 70 1parent af842b4df69bf440e73429c46c66a70da3021f65 /scm/monochromatic/commit/af842b4df69bf440e73429c46c66a70da3021f65.gph z3bra.org 70 hAuthor: z3bra URL:mailto:willy@mailoo.org z3bra.org 70 iDate: Thu, 6 Aug 2015 15:37:58 +0200 Err z3bra.org 70 i Err z3bra.org 70 iadded reddit comment to you-are-the-wm Err z3bra.org 70 i Err z3bra.org 70 iDiffstat: Err z3bra.org 70 i M 2015/01/you-are-the-wm.txt | 190 ++++++++++++++++++++++++++++++- Err z3bra.org 70 i Err z3bra.org 70 i1 file changed, 189 insertions(+), 1 deletion(-) Err z3bra.org 70 i--- Err z3bra.org 70 1diff --git a/2015/01/you-are-the-wm.txt b/2015/01/you-are-the-wm.txt /scm/monochromatic/file/2015/01/you-are-the-wm.txt.gph z3bra.org 70 it@@ -83,4 +83,192 @@ some nice scripts in there ! Err z3bra.org 70 i Now throw your window manager away, you don't need it anymore. **YOU ARE THE WM Err z3bra.org 70 i !** Err z3bra.org 70 i Err z3bra.org 70 i- Err z3bra.org 70 i+**EDIT:** I was asked on reddit to explain my wmutils setup. I gave a fairly Err z3bra.org 70 i+detailed answer which might also be useful for others, so I figured out I could Err z3bra.org 70 i+add it here (original comment [here](https://www.reddit.com/r/unixporn/comments/3b42zj/people_using_wmutils_how_do_you_use_it/csj8iq4) Err z3bra.org 70 i+ Err z3bra.org 70 i+I Have both `wmutils/core` and `wmutils/opt` installed. I need the latter for Err z3bra.org 70 i+`wew`, an X event watcher. Err z3bra.org 70 i+ Err z3bra.org 70 i+MANAGING WINDOWS Err z3bra.org 70 i+================ Err z3bra.org 70 i+ Err z3bra.org 70 i+The central piece of my workflow is `sxhkd`. This is a software one can use to Err z3bra.org 70 i+bind key combos to commands, or **scripts**. I use it both to start my Err z3bra.org 70 i+applications, but also to manage my windows via `wmutils` tools, and scripts. Err z3bra.org 70 i+For instance, here is the entry that let me move windows around the screen using Err z3bra.org 70 i+the keyboard (`pfw` returns the ID of the currently focused window. It's a Err z3bra.org 70 i+rather important piece of software!): Err z3bra.org 70 i+ Err z3bra.org 70 i+ # move windows around Err z3bra.org 70 i+ super + {left,down,up,right} Err z3bra.org 70 i+ wmv {-20 0, 0 20, 0 -20, 20, 0} $(pfw) Err z3bra.org 70 i+ Err z3bra.org 70 i+ # resize windows Err z3bra.org 70 i+ super + alt + {left,down,up,right} Err z3bra.org 70 i+ wrs {-20 0, 0 20, 0 -20, 20, 0} $(pfw) Err z3bra.org 70 i+ Err z3bra.org 70 i+That's for tools that can be bound "directly" via sxhkd. For more complex tasks, Err z3bra.org 70 i+I use a few scripts of my own: Err z3bra.org 70 i+ Err z3bra.org 70 i++ `vroum` - manage window focus Err z3bra.org 70 i++ `groaw` - manage window groups Err z3bra.org 70 i++ `focus` - finer way to focus windows Err z3bra.org 70 i++ `corner` - move windows to screen's corner Err z3bra.org 70 i++ `fullscreen` - put a window in fullscreen mode Err z3bra.org 70 i+ Err z3bra.org 70 i+`vroum` Err z3bra.org 70 i+------- Err z3bra.org 70 i+It can take 3 arguments: "next, prev, $wid". "next" will focus the next Err z3bra.org 70 i+window on the stack, previous will focus the previously focused window, and Err z3bra.org 70 i+every argument starting by `0x` will be considered a window ID to be focused Err z3bra.org 70 i+directly. It will also change the border of all the inactive windows, and the Err z3bra.org 70 i+active window. I use this script to cycle between them: Err z3bra.org 70 i+ Err z3bra.org 70 i+ # cycle through windows Err z3bra.org 70 i+ alt {, + shift} + tab Err z3bra.org 70 i+ vroum {next, prev} Err z3bra.org 70 i+ Err z3bra.org 70 i+`groaw` Err z3bra.org 70 i+------- Err z3bra.org 70 i+This is my "group" manager (think of it as workspaces on steroid). By Err z3bra.org 70 i+default, new windows are not assigned any groups. Without much explaning how Err z3bra.org 70 i+each flag works, I just need it to perform 3 tasks: Err z3bra.org 70 i+ Err z3bra.org 70 i+1. add the current window to a specific group Err z3bra.org 70 i+2. toggle visibility state of a specific group Err z3bra.org 70 i+3. remove current window from all groups Err z3bra.org 70 i+ Err z3bra.org 70 i+This result in the following entries: Err z3bra.org 70 i+ Err z3bra.org 70 i+ # add window to a group Err z3bra.org 70 i+ super + shift + {1,2,3,4,5} Err z3bra.org 70 i+ groaw -d all; \ Err z3bra.org 70 i+ groaw -a {1,2,3,4,5} Err z3bra.org 70 i+ Err z3bra.org 70 i+ # toggle groups' visibility Err z3bra.org 70 i+ super + {1,2,3,4,5} Err z3bra.org 70 i+ groaw -t {1,2,3,4,5} Err z3bra.org 70 i+ Err z3bra.org 70 i+ # remove window from all groups Err z3bra.org 70 i+ super + Backspace Err z3bra.org 70 i+ groaw -d all Err z3bra.org 70 i+ Err z3bra.org 70 i+`focus` Err z3bra.org 70 i+------- Err z3bra.org 70 i+A script I'm really proud of! It focus windows besed on their cardinal Err z3bra.org 70 i+positions. It takes exactly 4 different arguments: Err z3bra.org 70 i+ Err z3bra.org 70 i+ north Err z3bra.org 70 i+ ^ Err z3bra.org 70 i+ | Err z3bra.org 70 i+ west <---+---> east Err z3bra.org 70 i+ | Err z3bra.org 70 i+ v Err z3bra.org 70 i+ south Err z3bra.org 70 i+ Err z3bra.org 70 i+It will then focus the nearest window in the given direction (using top/left Err z3bra.org 70 i+edge of the window) It's bound like so Err z3bra.org 70 i+ Err z3bra.org 70 i+ # select windows using directions Err z3bra.org 70 i+ alt + {left,down,up,right} Err z3bra.org 70 i+ focus {west, south, north, east} $(pfw) Err z3bra.org 70 i+ Err z3bra.org 70 i+`corner` Err z3bra.org 70 i+-------- Err z3bra.org 70 i+There's nothing special about it. It put the window in the corner passed as Err z3bra.org 70 i+argument (Top-Left, Top-Right, Bottom-Left, Bottom-Right, MiDdle) Err z3bra.org 70 i+ Err z3bra.org 70 i+ # move windows to corners Err z3bra.org 70 i+ super + {y,u,b,n,g} Err z3bra.org 70 i+ corner {tl, tr, bl, br, md} $(pfw) Err z3bra.org 70 i+ Err z3bra.org 70 i+`fullscreen` Err z3bra.org 70 i+------------ Err z3bra.org 70 i+ Err z3bra.org 70 i+Set a window in fullscreen mode (change its size to the size of the monitor, and Err z3bra.org 70 i+remove borders. The previous position/size of the window is saved to a file, so Err z3bra.org 70 i+when you disable fullscreen mode, or move another window in fullscreen, the Err z3bra.org 70 i+window takes its old position back Err z3bra.org 70 i+ Err z3bra.org 70 i+ # set window fullscreen Err z3bra.org 70 i+ super + x Err z3bra.org 70 i+ fullscreen $(pfw) Err z3bra.org 70 i+ Err z3bra.org 70 i+DEALING WITH EVENTS Err z3bra.org 70 i+=================== Err z3bra.org 70 i+ Err z3bra.org 70 i+The above only applies to existing windows. But when a new window gets created, Err z3bra.org 70 i+I need to run a few commands against it, to integrate it to my workflow. This is Err z3bra.org 70 i+what `wew` is for. It prints X events to stdout, and the window ID the event Err z3bra.org 70 i+applies to. For example: Err z3bra.org 70 i+ Err z3bra.org 70 i+ 16:0x000c00ea Err z3bra.org 70 i+ 19:0x000c00ea Err z3bra.org 70 i+ Err z3bra.org 70 i+Event number 16 is "window creation", 19 is "mapping request". I have a parser Err z3bra.org 70 i+script that will perform different actions depending on the fired event (it's Err z3bra.org 70 i+called `yawee`, I like weird names): Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 i+ #!/bin/sh Err z3bra.org 70 i+ Err z3bra.org 70 i+ while IFS=: read ev wid; do Err z3bra.org 70 i+ case $ev in Err z3bra.org 70 i+ # window creation: center window on the screen (except docks, menus or similar) Err z3bra.org 70 i+ 16) wattr o $wid || corner md $wid ;; Err z3bra.org 70 i+ Err z3bra.org 70 i+ # mapping requests: just set a special border for docks, menus and Err z3bra.org 70 i+ # similar. Focus other windows Err z3bra.org 70 i+ 19) wattr o $wid \ Err z3bra.org 70 i+ && chwb -s 2 -c 0x323232 $wid \ Err z3bra.org 70 i+ || vroum $wid ;; Err z3bra.org 70 i+ Err z3bra.org 70 i+ # when a window gets deleted, focus another one Err z3bra.org 70 i+ 18) wattr $(pfw) || vroum prev 2>/dev/null;; Err z3bra.org 70 i+ Err z3bra.org 70 i+ # Focus windows when the mouse cursor enter them Err z3bra.org 70 i+ 7) wattr o $wid || vroum $wid ;; Err z3bra.org 70 i+ esac Err z3bra.org 70 i+ done Err z3bra.org 70 i+ Err z3bra.org 70 i+In my `$HOME/.xinitrc`, it's started as: Err z3bra.org 70 i+ Err z3bra.org 70 i+ wew | yawee & Err z3bra.org 70 i+ Err z3bra.org 70 i+Pretty straighforward :) Err z3bra.org 70 i+ Err z3bra.org 70 i+USING THE MOUSE Err z3bra.org 70 i+=============== Err z3bra.org 70 i+ Err z3bra.org 70 i+Nobody's perfect. I use the mouse from time to time to manage my windows. It is Err z3bra.org 70 i+sometimes more efficient to get a window out of your way quickly, or resize one Err z3bra.org 70 i+approximatively. Err z3bra.org 70 i+ Err z3bra.org 70 i+For this purpose, I STILL use sxhkd! Baskerville did an amazing job with this Err z3bra.org 70 i+software, as it support integer replacement of the mouse coordinate Err z3bra.org 70 i+ Err z3bra.org 70 i+ # move windows with the mouse: Err z3bra.org 70 i+ super + !button{1,3} Err z3bra.org 70 i+ {wmv, wrs} -a %i %i $(pfw) Err z3bra.org 70 i+ Err z3bra.org 70 i+As simple as that! Err z3bra.org 70 i+ Err z3bra.org 70 i+MISCELLANOUS Err z3bra.org 70 i+============ Err z3bra.org 70 i+ Err z3bra.org 70 i+For eye candy purpose, I wrote a `pulsar` script, to make my currently active Err z3bra.org 70 i+window standout. It make the window's border "pulse" like in the following Err z3bra.org 70 i+video: http://raw.z3bra.org/dev/random/wall-border.webm. It uses a `$HOME/.colors` Err z3bra.org 70 i+file containing the colors to be used for the gradient. It will then run `chwb` Err z3bra.org 70 i+at a regular interval to change the current window's borders. Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 i+That's pretty much it! If you have any question, do not hesitate to ask. Err z3bra.org 70 i+Also, sorry for the huge wall of text, I was trying to be as precise as Err z3bra.org 70 i+possible. Err z3bra.org 70 i+ Err z3bra.org 70 i+As a bonus, to congratulate you from reading it all, here is a video from my Err z3bra.org 70 i+actual workflow with this setup (writing my latest blogpost: Err z3bra.org 70 i+http://raw.z3bra.org/dev/random/monochromatic-0x0017-writeup.webm (grab some Err z3bra.org 70 i+popcorns, it's 57 minutes long) Err z3bra.org 70 .