Skip to content

Commit e450860

Browse files
committed
Merge branch 'v0.1'
2 parents 3607d3d + 7ab7b90 commit e450860

30 files changed

+425
-72
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
newm.egg-info
22
**/__pycache__
33
.mypy_cache
4+
newm/resources/*.mp4

DEV.org

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#+TITLE: newm developer information
2+
3+
* Current
4+
** STRT Install process
5+
*** STRT Setup standard procedure for VM-based install testing
6+
- [ ] Proper seatd setup in virtual machine
7+
- [X] Setup below has virtio not working
8+
*** STRT AUR package
9+
- [X] Include imageio
10+
- [ ] Fix commit
11+
- [ ] Test
12+
** DONE README Idea
13+
14+
* Backlog / Ideas
15+
** Titles during OverviewOverlay
16+
** Move / Resize during OverviewOverlay
17+
** Allow certain overlays to start during animations (e.g. 3/4-Finger-Swipe during animation one view)
18+
** Autoplace the first couple of windows more like i3 (i.e. resizing existing windows / tiling)
19+
** Bars as panels not as widgets
20+
** Create newm-panel-flutter
21+
22+
* Setup clean arch chroot / qemu for testing
23+
24+
** Setup chroot
25+
26+
Following https://www.collabora.com/news-and-blog/blog/2019/03/20/bootstraping-a-minimal-arch-linux-image/
27+
28+
#+BEGIN_SRC sh
29+
truncate -s 20G arch_disk.raw
30+
mkfs.ext4 arch_disk.raw
31+
mkdir mnt
32+
sudo mount arch_disk.raw mnt
33+
sudo pacstrap mnt base base-devel linux linux-firmware
34+
sudo arch-chroot mnt
35+
#+END_SRC
36+
37+
Now we are inside the chroot, very basic setup:
38+
39+
#+BEGIN_SRC sh
40+
passwd
41+
pacman -S dhcpcd
42+
43+
useradd --create-home test
44+
passwd test
45+
usermod -aG wheel test
46+
vim /etc/sudoers # add wheel
47+
su test
48+
#+END_SRC
49+
50+
Finally clean up
51+
52+
#+BEGIN_SRC sh
53+
exit
54+
sudo umount mnt
55+
#+END_SRC
56+
57+
** VSetup virtual machine
58+
59+
To use the disk in a virtual machine (not incredibly nice...)
60+
61+
#+BEGIN_SRC sh
62+
sudo mount arch_disk.raw mnt
63+
cp -r mnt/boot mnt_boot
64+
sudo umount mnt
65+
#+END_SRC
66+
67+
and start using
68+
69+
#+BEGIN_SRC sh
70+
qemu-system-x86_64 --enable-kvm -hda arch_disk.raw -m 4G -kernel mnt_boot/vmlinuz-linux -initrd mnt_boot/initramfs-linux[-fallback].img -append "root=/dev/sda rw" -vga virtio
71+
#+END_SRC
72+
73+
To enable internet access, probably
74+
75+
#+BEGIN_SRC sh
76+
systemctl enable dhcpcd
77+
systemctl start dhcpcd
78+
#+END_SRC
79+
80+
is necessary

README.md

Lines changed: 126 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,127 @@
1-
# newm
1+
# newm v0.1
2+
[![IMAGE](https://github.com/jbuchermn/newm/blob/v0.1/newm/resources/screenshot.png)](https://youtu.be/otMEC03ie0g)
3+
(Wayland compositor)
24

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.

TODO.org

Lines changed: 0 additions & 17 deletions
This file was deleted.

dist/aur/.SRCINFO

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
pkgbase = newm
2+
pkgdesc = Wayland compositor
3+
pkgver = 0
4+
pkgrel = 1
5+
url = https://github.com/jbuchermn/newm
6+
arch = any
7+
license = MIT
8+
makedepends = git
9+
makedepends = sed
10+
makedepends = python3
11+
makedepends = meson
12+
makedepends = wayland-protocols
13+
makedepends = xorgproto
14+
depends = python3
15+
depends = wayland
16+
depends = libinput
17+
depends = libxcb
18+
depends = libxkbcommon
19+
depends = opengl-driver
20+
depends = pixman
21+
depends = xcb-util-errors
22+
depends = xcb-util-renderutil
23+
depends = xcb-util-wm
24+
depends = seatd
25+
depends = xorg-xwayland
26+
depends = python-evdev
27+
depends = python-numpy
28+
depends = python-imageio
29+
depends = python-cairo
30+
depends = python-psutil
31+
depends = python-websockets
32+
depends = python-pam
33+
depends = python-pyfiglet
34+
depends = python-fuzzywuzzy
35+
provides = newm
36+
conflicts = newm
37+
source = git://github.com/jbuchermn/pywm.git#branch=v0.1
38+
source = git://github.com/jbuchermn/newm.git#branch=v0.1
39+
md5sums = SKIP
40+
md5sums = SKIP
41+
42+
pkgname = newm

dist/aur/PKGBUILD

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# newm - Wayland compositor
2+
# Maintainer: Jonas Bucher <j.bucher.mn at gmail>
3+
4+
pkgname=newm
5+
pkgver=0.1
6+
pkgrel=1
7+
license=('MIT')
8+
pkgdesc="Wayland compositor"
9+
depends=(
10+
python3
11+
12+
wayland
13+
libinput
14+
libxcb
15+
libxkbcommon
16+
opengl-driver
17+
pixman
18+
xcb-util-errors
19+
xcb-util-renderutil
20+
xcb-util-wm
21+
seatd
22+
xorg-xwayland
23+
24+
python-evdev
25+
python-numpy
26+
python-imageio
27+
28+
python-cairo
29+
python-psutil
30+
python-websockets
31+
python-pam
32+
python-pyfiglet
33+
python-fuzzywuzzy
34+
)
35+
makedepends=(
36+
git
37+
sed
38+
python3
39+
meson
40+
wayland-protocols
41+
xorgproto
42+
)
43+
arch=('any')
44+
url="https://github.com/jbuchermn/newm"
45+
source=(
46+
'git://github.com/jbuchermn/pywm.git#branch=v0.1'
47+
'git://github.com/jbuchermn/newm.git#branch=v0.1'
48+
)
49+
md5sums=(
50+
'SKIP'
51+
'SKIP'
52+
)
53+
provides=('newm')
54+
conflicts=('newm')
55+
56+
pkgver() {
57+
cd $srcdir/newm
58+
git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
59+
}
60+
prepare() {
61+
cd $srcdir/pywm
62+
git submodule init
63+
git submodule update
64+
}
65+
build() {
66+
cd $srcdir/pywm
67+
python3 setup.py build
68+
cd $srcdir/newm
69+
python3 setup.py build
70+
}
71+
package() {
72+
cd $srcdir/pywm
73+
python3 setup.py install --root="$pkgdir" --optimize=1
74+
cd $srcdir/newm
75+
python3 setup.py install --root="$pkgdir" --optimize=1
76+
}

newm/cmd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
from __future__ import annotations
2+
13
import time
4+
25
from .panel_endpoint import msg
36

47
def cmd(command: str, *args: str) -> None:

newm/default_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from __future__ import annotations
22
from typing import Callable, Any
33

4-
from newm.layout import Layout
54
import os
65
import pwd
76
import time
87

8+
from newm.layout import Layout
9+
910
from newm import (
1011
SysBackendEndpoint_alsa,
1112
SysBackendEndpoint_sysfs
@@ -17,7 +18,7 @@
1718
)
1819

1920
mod = PYWM_MOD_LOGO
20-
wallpaper = '/etc/wallpaper.jpg'
21+
wallpaper = os.path.dirname(os.path.realpath(__file__)) + '/resources/wallpaper.jpg'
2122

2223

2324
def key_bindings(layout: Layout) -> list[tuple[str, Callable[[], Any]]]:

newm/grid.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/env python3
2-
32
from __future__ import annotations
43
from typing import Optional
54

6-
75
import math
86
import time
97

0 commit comments

Comments
 (0)