- V 96.2%
- Verilog 2.1%
- GLSL 1.4%
- Nix 0.2%
- CSS 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
`theme = ten`, or the edition once upgraded, gives flat white title bars with the caption buttons of Windows 10, a one pixel accent border and a soft shadow; a dark acrylic taskbar with the start button, a search box that opens the quick launcher, Task View, underlined program icons, the desktops, a two line clock and the Action Center; and a wallpaper of a window of blue light in a dark room. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
| aero | ||
| conf | ||
| dbus | ||
| examples | ||
| LICENSES | ||
| protocol | ||
| wayland | ||
| .envrc | ||
| .gitignore | ||
| boot.v | ||
| calc.v | ||
| center.v | ||
| clippy.v | ||
| config.v | ||
| desktop.v | ||
| edition.v | ||
| face.v | ||
| feelings.v | ||
| flake.lock | ||
| flake.nix | ||
| generate.vsh | ||
| gravity.v | ||
| icons.v | ||
| input.v | ||
| ipc.v | ||
| keymap.v | ||
| launcher.v | ||
| lock.v | ||
| main.v | ||
| media.v | ||
| notifications.v | ||
| overlay.v | ||
| psychosewm.conf | ||
| quick.v | ||
| README.md | ||
| scratchpad.v | ||
| screensaver.v | ||
| shell.v | ||
| surface.v | ||
| task_view.v | ||
| tree.v | ||
| uac.v | ||
| v.mod | ||
| window.v | ||
| wm.v | ||
psychosewm
Windows 7 glass on a bspwm tree: a river window manager written in V. On screen it goes by Michaelsoft 9.
- Binary space partitioning, like bspwm. Every desktop is a binary tree of windows. A new window splits the focused one along its longest side, or in the direction you preselected. Splits can be rotated, flipped, balanced and resized, and windows can float, go fullscreen, maximize and minimize.
- Desktops on every monitor. Each monitor has its own desktops and its own taskbar, and focus moves between monitors like between windows.
- Scriptable like bspwm.
psychosewm focus west,psychosewm query windows -j,psychosewm subscribeand runtimeconfigfrom any shell. - Windows 7. The Harmony wallpaper, Aero glass frames with the caption buttons of 7.css, the superbar with a big icon per program and the Start menu, with real program icons from your icon theme. Or plain pixel borders, if you prefer.
- A quick launcher, as on macOS: a search box in the middle of the screen that finds programs, runs commands and does math.
- Notifications. psychosewm is a notification server: notifications pop up in balloons above the clock, and clicking the clock opens a sidebar with a calendar, quick toggles, a spectrum analyzer for your music and all of them.
- Configured in psyconf, a small lazy functional language that borrows from Haskell, Nix and YAML. It is Turing complete; the examples include a Brainfuck interpreter that computes the gaps. Saved changes apply at once.
- Windows have feelings. Ignore one and a little sad face appears on it, its glass turns gray, and eventually it cries. Focus it and it is happy.
- Gravity. Windows fall onto the taskbar and pile up, as heavy as the memory their programs use, wobble like jelly when they land, and can be thrown.
- Clippy, the paperclip assistant, with a boymoder mode.
- The boot animation, the Mystify screensaver and the logon screen of Windows 7, including Ctrl+Alt+Delete, as a real screen locker, and User Account Control dimming the screen when something wants your password.
- A scratchpad terminal that drops down from the top of the screen.
- Pure V. psychosewm speaks the Wayland wire protocol itself and draws everything with its own renderer, including PNG, JPEG and WebP decoding. It talks D-Bus itself, too. It needs no libwayland, no wayland-scanner, no libdbus and no C code, only a few libc system calls.
Bindings
The modifier is Super. When river runs nested inside another compositor,
which usually takes Super for itself, the modifier is Ctrl instead. Set
modifier in the configuration or PSYCHOSEWM_MOD to super, ctrl or
alt to choose it yourself. Note that with Ctrl, combinations such as
Ctrl+C and Ctrl+W no longer reach programs.
The default keys follow bspwm's example sxhkdrc, except that the ones
bspwm puts on Ctrl use Alt, so that they also work nested. All of them can
be changed in the configuration. With Mod being the modifier:
Mod+Return: Open a terminalMod+-: Drop down the scratchpad terminal, or put it awayMod+Space: Open the quick launcher,Mod+d: the Start menu,Mod+a: the notification centerMod+w: Close the focused windowMod+Alt+q: Exit the Wayland sessionMod+Alt+r: Read the configuration file againMod+Escape: Lock the screenMod+Shift+g: Toggle gravityMod+h/j/k/lor arrow keys: Focus the window to the west, south, north or east, also on other monitorsMod+Shift+h/j/k/l: Swap the window with the one in that directionMod+Alt+h/j/k/l: Preselect where the next window goes, shown as a blue rectangle. Again cancels, as doesMod+Alt+Space.Mod+Alt+Shift+h/j/k/l: Move the split on that side of the window outwards, or the one on the other side inwardsMod+1…9,0: Focus a desktop of the focused monitorMod+Shift+1…9,0: Send the window to a desktop of the focused monitorMod+[/]: Focus the previous or next desktop of the monitorMod+,/.: Focus the previous or next monitor,Mod+Shift+,/.: send the window there, and follow itMod+Tab: Focus the last desktop,Mod+`: the last windowMod+c/Mod+Shift+c: Focus the next or previous windowMod+m: Toggle the monocle layout, one window at a timeMod+g: Swap the window with the biggest oneMod+s: Float the window, or tile it again if it floats.Mod+talways tiles it, also out of fullscreen and maximized.Mod+f: Toggle fullscreen,Mod+Shift+f: toggle maximizedMod+n: Minimize the window,Mod+Shift+nbrings back the last oneMod+r/Mod+Shift+r: Rotate the window's parent split clockwise or counterclockwiseMod+x/Mod+y: Mirror the splits left to right or top to bottomMod+e: Balance the desktop so all windows get the same area,Mod+Shift+e: reset every split to the configured ratio
Pointer:
Mod+Left dragor dragging a titlebar: Move a floating window, or drop a tiled one onto another to swap them, or onto an empty monitorMod+Right drag: Resize a floating window, or move the splits next to the corner nearest to the pointer- Clicking a window focuses it. The caption buttons minimize, maximize and close, and double-clicking a titlebar maximizes.
- Taskbar buttons start a pinned program, focus its window, minimize it if it already has focus, or cycle through its windows. The desktop names next to the clock switch desktops, and so does the wheel over the taskbar or the desktop. The clock opens the notification center, and the sliver at the far right shows the desktop.
Dialogs and windows with a fixed size float.
Binding keys
Bindings go in the keys section of the configuration, on top of the
defaults: a key combination, =, and an action.
keys =
mod+b = spawn "firefox"
mod+shift+s = exec "grim -g \"$(slurp)\" - | wl-copy"
ctrl+alt+t = terminal
XF86AudioRaiseVolume = exec "wpctl set-volume @DEFAULT_SINK@ 5%+"
mod+q = none -- remove a default binding
-- defaults = false -- or drop all of them
A combination is any of mod (the modifier above), super, ctrl,
alt and shift, joined with +, then a key. Keys are a single
character (a, 1, -, ,), F1 to F35, a name (Return, space,
Tab, Escape, BackSpace, Delete, Insert, Home, End, Prior,
Next, Left, Up, Right, Down, Print, Pause, Menu, minus,
plus, equal, bracketleft, bracketright, backslash, semicolon,
apostrophe, grave, comma, period, slash), a media key
(XF86AudioRaiseVolume, XF86AudioLowerVolume, XF86AudioMute,
XF86AudioMicMute, XF86AudioPlay, XF86AudioPause, XF86AudioStop,
XF86AudioNext, XF86AudioPrev, XF86MonBrightnessUp,
XF86MonBrightnessDown and more), or a keysym number like 0x1008ff2a.
The actions, which psychosewm <action> runs as well:
| Action | What it does |
|---|---|
terminal |
Open a terminal |
spawn "cmd", spawn [ "cmd", "arg" ] |
Run a program |
exec "shell command" |
Run a command with sh -c |
launcher (or start_menu) |
Open or close the Start menu |
quick |
Open or close the quick launcher |
center (or notifications) |
Open or close the notification center |
scratchpad |
Drop down the scratchpad terminal, focus it, or put it away |
close |
Close the focused window |
focus D, swap D |
Focus the window in direction D, or swap with it |
presel D, cancel_presel |
Preselect where the next window goes, or not |
grow D |
Move the split on side D outwards |
desktop N, send N |
Focus desktop N of the focused monitor, or send the window there |
next_desktop, prev_desktop, last_desktop |
Focus another desktop |
monitor M, send_monitor M |
Focus monitor M, or send the window there |
next_window, prev_window, last_window |
Focus another window |
floating |
Float the window, or tile it if it floats |
tiled |
Tile the window, out of floating, fullscreen and maximized |
fullscreen, maximize |
Toggle fullscreen, or maximized |
minimize, restore |
Minimize the window, or bring back the last one |
monocle |
Toggle showing one tiled window at a time |
swap_biggest |
Swap the window with the biggest one |
rotate 90, rotate 180, rotate 270 |
Rotate the parent split |
flip horizontal, flip vertical |
Mirror the parent split |
balance, equalize |
Give all windows the same area, or reset the ratios |
gravity |
Toggle gravity |
lock, screensaver |
Lock the screen, or start Mystify |
reload |
Read the configuration again |
exit |
End the Wayland session |
none |
Nothing, to remove a default binding |
D is west, south, north or east (or left, down, up,
right), N a desktop from 1 to 10, and M next, prev or a direction.
Configuration
psychosewm reads ~/.config/psychosewm/psychosewm.conf, or the file in
$PSYCHOSEWM_CONFIG. Without one it uses the defaults. When you save the
file, psychosewm reads it again within a second. Mistakes are shown in a
balloon above the clock and the rest of the file still applies; a syntax
error keeps the previous configuration.
psychosewm.conf in this repository documents every
option with its default, copy it to start. A shorter example:
-- Comments as in Haskell
gaps = { inner = 12; outer = 24; } -- attribute sets as in Nix
border = -- nesting by indentation as in YAML
style = pixel -- aero, pixel or none
width = 3
color = #3399ff
inactive = #5a6a7a
wallpaper: -- `:` works as well as `=`
image: ~/Pictures/wallpaper.jpg
mode: fill -- fill, fit, stretch, center, tile
desktops = [ web, code, chat, music ]
pinned =
- terminal
- firefox.desktop
keys =
mod+b = spawn "firefox" -- actions apply to their arguments
mod+shift+Return = spawn [ "foot", "-e", "htop" ]
XF86AudioRaiseVolume = exec "wpctl set-volume @DEFAULT_SINK@ 5%+"
mod+q = none
The options:
modifier:auto,super,ctrloraltterminal: the command forMod+Returnfont: a TrueType font filegaps: a number, orinner(between windows) andouter(at the screen edges)scheme:longest_sidelike bspwm, oralternate;split_ratio: where new splits dividefocus_follows_pointer:trueorfalsedesktops: how many desktops every monitor gets, up to 10, or a list of their names;monitorsnames them per monitor:monitors = { DP-1 = [ web, code ]; HDMI-A-1 = 3; }border:styleisaerofor glass frames, colored bycolorandintensity(Windows 7's window color),pixelfor a plain border ofwidthpixels incolorfor the focused window andinactivefor the others, ornone. Windows are asked to leave out their own title bars, and the ones that cannot, like GTK apps and Firefox, still get the frame around them;csd = trueleaves those to their own decorations.wallpaper:harmony, a color, or an image (PNG, JPEG or WebP) with amodeand a backgroundcolorpinned: the taskbar's pinned programs.terminal,browserandfilesare yours fromxdg-mime, other entries are desktop entries, program names or commands.keys: key bindings on top of the defaults, see Binding keysfeelings:enabled, and after how many seconds without focus windows get sad (sad_after) and cry (cry_after)gravity:strengthandbounceclippy:classic,boymoderoroffboot: whether to show the boot animationscreensaver: seconds idleafterwhich Mystify starts, and whether it shouldlocklock:ctrl_alt_del, and acheckercommand instead ofunix_chkpwdnotifications: whether to be the notification servervisualizer: whether the notification center has the music panel, orenabledand thecommandthat records what plays (16 bit mono samples at 44100 Hz on its output;pw-recordby default)scratchpad: thecommandof the scratchpad terminal and theapp_idit has, by default your terminal with an app id set for foot, ghostty, alacritty, kitty and wezterm, and itswidthandheightas parts of the monitor (1 and 0.45)uac: whether to be the polkit authentication agent, orenabledand ahelpercommand instead of polkit's
The language
The format in short: name = value entries; dotted names, indented blocks
or { a = 1; b = 2; } for nested options; lists as [ a, b ], [ a b ] or
- items; numbers, "strings", #rrggbb[aa] colors, true/false and
bare words; and -- or {- -} comments.
It is also a lazy functional language. Entries with parameters, entries
whose name starts with _ and everything below a let line are
definitions instead of options, visible to the whole file. There are
if then else, let ... in, \x -> x * 2 lambdas, arithmetic,
comparisons, && ||, ++ for strings and lists, ranges like [1 .. 10]
and builtins such as map, filter, foldl, show, env, mix and
hour. Recursion in tail position runs in constant space.
let
fib n = if n < 2 then n else fib (n - 1) + fib (n - 2)
night = hour >= 20 || hour < 7
gaps.inner = fib 7
border.color = if night then #3a3f6b else #74b8fc
desktops = map upper [ "web", "code", "chat" ]
Evaluation is bounded, so a configuration that loops forever is reported as
an error instead of hanging the window manager.
examples/turing.conf computes its outer gap with a
Brainfuck interpreter written in psyconf. The language is the conf
module, v test conf runs its tests, Brainfuck included.
Feelings, gravity and Clippy
Windows that have not had focus for sad_after seconds get a little sad
face in their corner, in the style of a 2006 instant messenger, and their
glass turns gray. After cry_after they cry. Focusing one makes it happy for
a moment.
Mod+Shift+g turns on gravity. Windows shrink a little and fall onto
the taskbar, pile up, and slide off each other. Each weighs as much as the
memory its program uses, shown in its titlebar: heavy windows fall faster
through the air, push light ones aside, shake the others when they land
and are harder to throw. Everything wobbles like jelly on impact. Drag a
window and let go to throw it. Turn gravity off and windows go back to
their tiles.
Clippy pops up above the taskbar now and then: when a window cries, when
the tiles get uneven, when gravity turns on, when the configuration is
broken. Click it for a tip. clippy = boymoder gives it a beanie, an
oversized hoodie and a little pin.
Boot, screensaver and lock screen
When psychosewm starts, four orbs of light swirl in and become the flag
before the desktop appears. After screensaver.after seconds without input
the Mystify screensaver starts: your window frames come loose and bounce
around as glowing polygons.
Mod+Escape locks the session with the Windows 7 logon screen: press
Ctrl+Alt+Delete, type your password below your picture, and get welcomed
back. Locking uses the ext-session-lock protocol, so the session stays
locked even if the window manager crashes. Passwords are checked by
unix_chkpwd, the setuid helper PAM itself uses, which psychosewm runs
with the password on its standard input; it is in /run/wrappers/bin on
NixOS. Without it, set lock.checker. psychosewm refuses to lock when it
cannot check passwords.
Quick launcher and Start menu
Mod+Space opens the quick launcher in the middle of the screen. Type to
find programs by name, description and keywords; Enter starts the
selected one. A calculation like 2^10*3 or sqrt(2)*pi shows its result,
and Enter copies it with wl-copy. The last result runs what you typed
as a shell command.
The Start menu opens with the start orb or Mod+d. It lists your
recently used programs, and "All Programs" lists all of them. Search works
the same way. The links on the right open your folders with xdg-open, the
shut down button ends the session and the arrow next to it locks the
screen. Your picture, here and on the lock screen, is ~/.face,
~/.face.icon or your AccountsService icon, in PNG, JPEG or WebP.
The taskbar pins your terminal, web browser and file manager by default. Programs that are running get a glass button, glowing in the color of their icon when hovered. Icons come from the hicolor theme and the pixmaps directories, PNG only.
Programs you launch are remembered in $XDG_STATE_HOME/psychosewm/recent.
Notifications
psychosewm implements the freedesktop notification server, so notify-send
and everything else that notifies just works. A notification pops up in a
balloon above the clock for six seconds, or as long as the program asks;
critical ones stay until you close them. Clicking a balloon runs its
default action or focuses the program's window.
Clicking the clock, or Mod+a, slides in the notification center: the
clock and a calendar, toggles for Do not disturb (no balloons but critical
ones), gravity, Clippy, the screensaver, the lock screen and the settings
(the configuration file in your $EDITOR), and below them every
notification, with its picture and its action buttons. A badge on the
clock counts the ones you haven't seen.
If another notification daemon, like mako or dunst, is already running,
psychosewm waits in line and takes over when it exits. To leave
notifications to it for good, set notifications = false.
The center also has a music panel. While it is open, pw-record listens
to what your speakers play and a spectrum analyzer shows it, LED bars from
green to red with peaks that hold and fall, under a green display with the
track of the playing MPRIS player scrolling past. The buttons go back,
play or pause, and skip. Nothing records while the center is closed.
Monitors
Every monitor has its own desktops, as in bspwm, and its own taskbar with
its own windows and pager. Mod+1…0 and the other desktop keys work
on the focused monitor; Mod+, and Mod+. move the focus between
monitors, and with Shift take the window along. The Start menu, the quick
launcher and the notification center open on the monitor they were opened
from.
Desktops can be named per monitor with monitors; the others get
desktops. When a monitor is unplugged, its desktops move to another one
with their windows, and they go back when it returns.
Scripting
psychosewm with arguments talks to the window manager running in the
session, like bspc does to bspwm:
psychosewm focus west # any action of a key binding
psychosewm desktop 2
psychosewm spawn foot
psychosewm window 7 floating # focus window 7, then float it
psychosewm query windows # one per line, tab separated
psychosewm query monitors -j # or as JSON
psychosewm config gaps 20 # an option for this session only
psychosewm config reset
psychosewm subscribe focus desktop
query lists windows (number, monitor, desktop, flags, app id, title),
desktops, monitors or the focused window. subscribe prints a line
for every change, tab separated: focus with the focused window, desktop
when a monitor shows another desktop, window add and window remove,
title and monitor. It suits status bars:
psychosewm subscribe focus | while IFS=$'\t' read -r _ id app title; do
echo "${title:-$app}"
done
Options set with config apply on top of the configuration file and stay
until config reset or the end of the session. The socket is in
$XDG_RUNTIME_DIR, and programs started by the window manager find it in
PSYCHOSEWM_SOCKET. Run psychosewm help for all of it.
Scratchpad
Mod+- drops a terminal down from the top of the focused monitor, and
puts it away again. It keeps running while hidden, so whatever you leave in
it is still there next time, on whichever monitor you call it. It is your
terminal started with its own app id; for a terminal psychosewm does not
know, set scratchpad.command and scratchpad.app_id.
User Account Control
psychosewm is the polkit authentication agent of its session. When
pkexec or a system service needs your password, every screen dims and
the Windows 7 dialog asks whether the program may make changes to this
computer, amber for programs and blue for system services, with your
picture and a password field. Yes checks the password with polkit's own
helper, No refuses. If another agent such as polkit-gnome or soteria
already runs in the session, it keeps the job; uac = false leaves it to
others for good.
Building and running
With Nix, nix develop opens a shell with V, river, foot and the Selawik
font, Microsoft's open stand-in for Segoe UI. The included .envrc does the
same for direnv after direnv allow.
v .
river -c ./psychosewm
Use v -prod . for an optimized build. Run from inside an existing Wayland
session, river opens nested in a window.
Without Nix you need V (0.5.2 tested), river (0.5.0 and 0.5.2 tested) and a TrueType font.
Environment
PSYCHOSEWM_CONFIG: the configuration filePSYCHOSEWM_MOD: the binding modifier, overriding the configurationPSYCHOSEWM_TERMINAL: the terminal, when the configuration sets nonePSYCHOSEWM_FONT: a TTF file, when the configuration sets nonePSYCHOSEWM_DEBUG: set to log every Wayland message, likeWAYLAND_DEBUGPSYCHOSEWM_SOCKET: the scripting socket, set by the window manager for the programs it startsPSYCHOSEWM_UAC_PROCESS: a process id; User Account Control then serves only that process instead of the session, for testing it
Code
main.v,wm.v: startup, the event loop and the manage and render sequences of the river protocolconfig.v,conf/: the configuration, and the psyconf lexer, parser and evaluatortree.v,desktop.v: the bspwm trees, desktops, monitors and focusipc.v: scripting,scratchpad.v: the scratchpad terminalwindow.v,shell.v,input.v,surface.v: window decorations, wallpaper and taskbar, bindings and pointer input, and buffersfeelings.v,gravity.v,clippy.v: feelings, physics and the paperclip;boot.v,screensaver.v,overlay.v: the boot animation and Mystify;lock.v,keymap.v: the screen locker and its keyboardlauncher.v: the Start menu,quick.v,calc.v: the quick launcher and its calculator,icons.v: program icons,face.v: your picturenotifications.v,center.v,media.v: the notification server and center, and its music panel;uac.v: User Account Control;dbus/: the D-Bus clientaero/: the renderer and the image decoders, seev run tools/previewfor mock desktopswayland/: the Wayland client.client.vhandles the wire protocol andsys.c.vholds the only libc calls. Theprotocol_*.vbindings are generated fromprotocol/*.xmlbyv run generate.vsh.
Limitations
- Everything is drawn at scale 1, so HiDPI outputs show it upscaled.
- GTK apps always draw their own header bar, inside the frame. Some can
turn theirs off, like Ghostty with
gtk-titlebar = false. - Glass shows a blurred copy of the wallpaper, not the windows behind it.
- Icons that only come as SVG are drawn as a lettered badge.
- JPEG wallpapers must be baseline or progressive with Huffman coding, which is nearly all of them; EXIF rotation is ignored.
- Animated WebP images show their first frame.
- Fonts must be TrueType with
glyfoutlines. - Passwords in the User Account Control dialog can use the Latin-1 characters, and those on the lock screen the characters of the XKB keymap's first group, but no compose sequences or input methods.
- A window's weight is the memory of its own process, which for some programs is only a part of what they use.
psychosewm is released under the Zero-Clause BSD license. The protocol files
are MIT licensed, see LICENSES/. The WebP decoder in aero/vp8.v,
aero/vp8l.v, aero/vp8_tables.v and aero/webp.v is a port of
golang.org/x/image and keeps
its BSD-3-Clause license. The caption button glyphs in aero/assets/ are
from 7.css, MIT licensed, see aero/assets/LICENSE-7.css. The Windows flag
is a trademark of Microsoft.