diff --git a/README.md b/README.md index ae29898..6529799 100644 --- a/README.md +++ b/README.md @@ -3,38 +3,38 @@ Saving, loading and managing layouts for i3wm. [![Play video](https://img.youtube.com/vi/Q0qlUfG_lZ0/0.jpg)](https://www.youtube.com/watch?v=Q0qlUfG_lZ0) -## Preamble - dont worry, I solved all of this +## Preamble - don't worry, I solved all of this i3 window manager supports saving and loading of window layouts, however, the features are bare-bone and partially missing. -According to the [manual](https://i3wm.org/docs/layout-saving.html), the layout tree can be exported into a json file. +According to the [manual](https://i3wm.org/docs/layout-saving.html), the layout tree can be exported into a JSON file. The file contains a description of the containers of a workspace with prefilled (and commented) potential matching rules for the windows. -User is supposed to uncomment the desierd one (and/or modify them) and delete the unsused ones. -Moreover, user should add a surrouding root container which is missing in the file (this baffles me, why cant they save it too?). +The user is supposed to uncomment the desired one (and modify them) and delete the unused ones. +Moreover, the user should add a surrounding root container which is missing in the file (this baffles me, why can't they save it too?). -So doing it manually (which I dont want) consists of following steps, as described at [i3wm.org](https://i3wm.org/docs/layout-saving.html): -1. export the workspace into json using ```i3-save-tree --workspace ...``` -2. edit the json to match your desired matching rules for the windows +So doing it manually (which I don't want) consists of following steps, as described at [i3wm.org](https://i3wm.org/docs/layout-saving.html): +1. export the workspace into JSON using ```i3-save-tree --workspace ...``` +2. edit the JSON to match your desired matching rules for the windows 3. wrap the file in a root node, which defines the root split. 4. when needed, load the layout using ```i3-append ...``` However, this plan has flaws. -Its not scalable, its not automated and loading a layout does not work when windows are already present in the current workspace. +It's not scalable, it's not automated and loading a layout does not work when windows are already present in the current workspace. To fix it, I built this **i3-layout-manager**. Currently, its a hacky-type of a shell script, but feel free to contribute :-). ## How does it work? -1. The workspace tree is exported usin ```i3-save-tree --workspace ...``` +1. The workspace tree is exported using ```i3-save-tree --workspace ...``` 2. The tree for all workspaces on the currently focused monitor exported using ```i3-save-tree --output ...``` 3. The location of the current workspace in the all-tree is found by matching the workspace-tree file on the monitor-tree file. -4. The parameters of the root split are extracted and the workspace tree is wrapped in a new split. -5. User is then asked about how should the windows be matched. The options are: +4. The parameters of the root split are extracted, and the workspace tree is wrapped in a new split. +5. The user is then asked about how should the windows be matched. The options are: * All by _instance_ (instance will be uncommented for all windows) * Match any window to any placeholder * Choose an option for each window. The user will be asked to choose between the _class_, _instance_ and _title_ for each window. The tree file will be modified according to the selected options automatically. -6. After that the tree is save and ready to be loaded. -7. User can load the layout either before opening windows, which creates placeholders, or after windows have been already created in a workspace. The second part normally does not work. -8. To apply a layout, we first move all windows containing a process from the workspace using `xdotool`, which leaves only placeholders. Then we kill all the old placeholders, before we apply the layout, which spawns new placeholders in the correct places. Lastly we move the windows back, which triggers the _swallow_ mechanicm in the same way, as newly create windows do. +6. After that, the tree is saved and ready to be loaded. +7. The user can load the layout either before opening windows, which creates placeholders, or after, which adds the existing windows to the layout. The second part normally does not work. +8. To apply a layout, we first move all windows containing a process from the workspace using `xdotool`, which leaves only placeholders. Then we kill all the old placeholders before we apply the layout, which spawns new placeholders in the correct places. Lastly, we move the windows back, which triggers the _swallow_ mechanism in the same way, as newly create windows do. ## How to use it? @@ -43,7 +43,7 @@ Currently, its a hacky-type of a shell script, but feel free to contribute :-). ./layout_manager.sh ``` It uses *rofi* to interact with the user, no file editing or coding is required. -You can bind the script to an i3 key kombination. +You can bind the script to an i3 key combination. * The layout manager can load a layout by running ```bssh ./layout_manager.sh @@ -52,7 +52,7 @@ which is useful for automation. ## Layout files -The layout files are store by default in `~/.layouts`. +The layout files are stored by default in `~/.layouts`. Feel free to tinker with the matching rules by hand. ## Dependencies @@ -72,5 +72,5 @@ sudo apt-install jq vim rofi xdotool x11-xserver-utils * Why do you use vim for the automated file editing? -`Vim is great for this kind of work. A simple oneliner can do complex edits which would be difficult to program even using, e.g., python. Thanks to this, the layout manager was hacked up in single day.` +`Vim is great for this kind of work. A simple one-liner can do complex edits which would be difficult to program even using, e.g., python. Thanks to this, the layout manager was hacked up in a single day.`