|
1 | | -# newm |
| 1 | +# newm v0.1 |
| 2 | +[](https://youtu.be/otMEC03ie0g) |
| 3 | +(Wayland compositor) |
2 | 4 |
|
3 | | -Wayland compositor. Check out branch `v0.1` |
| 5 | +## Idea |
| 6 | + |
| 7 | +**newm** is a Wayland compositor written with laptops and touchpads in mind. The idea is, instead of placing windows inside the small viewport (that is, the monitor) to arrange them along an arbitrarily large two-dimensional wall (generally without windows overlapping) and focus the compositors job on moving around along this wall efficiently and providing ways to the user to rearrange the wall such that he finds the overall layout intuitive. |
| 8 | + |
| 9 | +So, windows are placed on a two-dimensional grid of tiles taking either one by one, one by two, two by one, ... tiles of that grid. The compositor shows a one by one, two by two, ... view of that grid but scales the windows so they are usable on any zoom level (that is, zooming out the compositor actually changes the windows sizes). This makes switching between a couple of fullscreen applications very easy - place them in adjacent one by one tiles and have the compositor show a one by one view. And so on... |
| 10 | + |
| 11 | +The basic commands therefore are navigation (left, right, top, bottom) and zoom-in and -out. These commands can be handled very intuitively on the touchpad (one- and two-finger gestures are reserved for interacting with the apps): |
| 12 | +- Use three fingers to move around the wall |
| 13 | +- Use four fingers to zoom out (move them upward) or in (downward) |
| 14 | + |
| 15 | +To be able to arange the windows in a useful manner, use |
| 16 | +- Logo (unless configured otherwise) plus one finger on the touchpad to move windows |
| 17 | +- Logo (unless configured otherwise) plus two fingers on the touchpad to change the extent of a window |
| 18 | + |
| 19 | +To get a quick overview of all windows, just hit the Mod (that is, unless configured otherwise, the Logo) key. |
| 20 | + |
| 21 | +These behaviours can (partly) be configured (see below for setup). By default (check [default_config.py](newm/default_config.py)), for example the following key bindings are in place |
| 22 | +- `Logo-hjkl`: Move around |
| 23 | +- `Logo-HJKL`: Move windows around |
| 24 | +- `Logo-Ctrl-hjkl`: Resize windows |
| 25 | +- `Logo-f`: Toggle a fullscreen view of the focused window (possibly resizing it) |
| 26 | +- ... |
| 27 | + |
| 28 | +## Status and limitations |
| 29 | + |
| 30 | +This is the first release of newm. Therefore a lot of configurable behaviour, quality of documentation and the like is still missing. However the basic building blocks have been in use on my machine from the beginning (2018) continuously. |
| 31 | + |
| 32 | +The most relevant functional limitation at the moment is missing support for multi-monitor setups. Apart from that see [pywm](https://github.com/jbuchermn/pywm) for known issues concerning certain applications. |
| 33 | + |
| 34 | +## Installing |
| 35 | + |
| 36 | +### Arch Linux |
| 37 | + |
| 38 | +For Arch Linux users, a `PKGBUILD` is provided (will be on the AUR). Currently this installation requires the python package `imageio` to be installed via the AUR or vie `pip`. |
| 39 | + |
| 40 | +Alternatively, the installation procedure below is powered by pip. |
| 41 | + |
| 42 | +### Prerequisites and pywm |
| 43 | + |
| 44 | +[pywm](https://github.com/jbuchermn/pywm) is the abstraction layer for and main dependency of newm. If all prerequisites are installed, the command: |
| 45 | + |
| 46 | +``` sh |
| 47 | +pip3 install git+https://github.com/jbuchermn/pywm@v0.1 |
| 48 | +``` |
| 49 | + |
| 50 | +should suffice. |
| 51 | + |
| 52 | +Additionally, unless configured otherwise, newm depends on alacritty for a default terminal emulator. |
| 53 | + |
| 54 | +### Single-user installation (without newm-login, preferred) |
| 55 | + |
| 56 | +To install newm: |
| 57 | + |
| 58 | +``` sh |
| 59 | +pip3 install git+https://github.com/jbuchermn/newm@v0.1 |
| 60 | +``` |
| 61 | + |
| 62 | +Start it using |
| 63 | + |
| 64 | +``` sh |
| 65 | +start-newm |
| 66 | +``` |
| 67 | + |
| 68 | +See also [pywm](https://github.com/jbuchermn/pywm) for troubleshooting. |
| 69 | + |
| 70 | +### Configuring |
| 71 | + |
| 72 | +#### Setting up the config file |
| 73 | + |
| 74 | +Configuring is handled via Python and read from either `$HOME/.config/newm/config.py` or (lower precedence) `/etc/config.py`. Take `default_config.py` as a basis and check the source code for usages of `configured_value` to get more details about the different keys. |
| 75 | + |
| 76 | +For example, copy: |
| 77 | + |
| 78 | +``` sh |
| 79 | +cd |
| 80 | +mkdir -p .config/newm |
| 81 | +cp .local/lib/pythonX.Y/site-packages/newm/default_config.py .config/newm/config.py |
| 82 | +vim .config/newm/config.py |
| 83 | +``` |
| 84 | + |
| 85 | +and adjust: |
| 86 | + |
| 87 | +``` py |
| 88 | +import os |
| 89 | +from pywm import ( |
| 90 | + PYWM_MOD_LOGO, |
| 91 | + PYWM_MOD_ALT |
| 92 | +) |
| 93 | + |
| 94 | +mod = PYWM_MOD_ALT |
| 95 | +wallpaper = os.environ['HOME'] + '/wallpaper.jpg' |
| 96 | +``` |
| 97 | + |
| 98 | + |
| 99 | +#### Lock on hibernate |
| 100 | + |
| 101 | +This can be achieved for example by placing the following in `/lib/systemd/system-sleep/00-lock.sh` |
| 102 | + |
| 103 | +``` sh |
| 104 | +#!/bin/sh |
| 105 | +newm-cmd lock-$1 |
| 106 | +``` |
| 107 | + |
| 108 | +### Multi-user installation (to use newm for login) |
| 109 | + |
| 110 | +This setup depends on [greetd](https://git.sr.ht/~kennylevinsen/greetd). Make sure to install newm as well as pywm in a way in which the greeter-user has access, e.g.: |
| 111 | + |
| 112 | +``` sh |
| 113 | +sudo pip3 install git+https://github.com/jbuchermn/pywm@v0.1 |
| 114 | +sudo pip3 install git+https://github.com/jbuchermn/newm@v0.1 |
| 115 | +``` |
| 116 | + |
| 117 | +Place configuration in `/etc/newm/config.py` and check, after logging in as `greeter`, that `start-newm` works and shows the login panel (login itself should not work). If it works, set |
| 118 | + |
| 119 | +``` toml |
| 120 | +command = "start-newm" |
| 121 | +``` |
| 122 | + |
| 123 | +in `/etc/greetd/config.toml`. |
| 124 | + |
| 125 | +## Panel |
| 126 | + |
| 127 | +See [newm-panel-nwjs](https://github.com/jbuchermn/newm-panel-nwjs) for a different panel implementation (launcher, locker, notifiers) based on NW.js. |
0 commit comments