foxygit / screen Log in
commits tags
ModeNameLast commitUpdatedSize
.gitignore Enhance README and code to support XDG autostart and improve layout sav… 4 months ago 68 B
Makefile 4 months ago 600 B
README.md update 1 month ago 2.34 KB
claude.md 4 months ago 1.87 KB
draw.c update 1 month ago 4.14 KB
draw.h 4 months ago 255 B
draw.o update 1 month ago 14.16 KB
main.c update 1 month ago 4.02 KB
main.o update 1 month ago 15.91 KB
monitors.c update 1 month ago 7.41 KB
monitors.h update 1 month ago 705 B
monitors.o update 1 month ago 27.96 KB
xrantui update 1 month ago 48.28 KB
README.md

xrantui

Interactive terminal UI for arranging monitors, built with ncurses and Xrandr.

C11 ncurses

Features

  • Visual scaled-down canvas showing all active monitors
  • Move monitors with arrow keys — snaps to edges automatically
  • Cycle through each monitor's supported resolutions
  • Set primary monitor
  • Apply layout instantly via xrandr
  • Save layout for persistence across reboots (XDG autostart, .xprofile, .xinitrc)
  • Undo to revert to positions at startup

Requirements

Runtime

  • X11 with Xrandr
  • xrandr in $PATH

Build dependencies

sudo apt install gcc make pkg-config libncurses-dev libxrandr-dev libx11-dev

Installation

git clone <repo>
cd xrantui
make
sudo make install        # installs to /usr/local/bin

Custom prefix:

sudo make install PREFIX=/usr     # → /usr/bin/xrantui
make install PREFIX=~/.local      # → ~/.local/bin/xrantui (no sudo)

Uninstall:

sudo make uninstall

Usage

Run inside a terminal within an X session:

xrantui

If DISPLAY is not set:

DISPLAY=:0 xrantui

Keybindings

KeyAction
TabSelect next monitor
← ↑ → ↓Move selected monitor (40 px/step, snaps to edges)
+ / -Cycle selected monitor's resolution (larger / smaller)
pSet selected monitor as primary
uUndo — revert all monitors to positions at startup
EnterApply layout with xrandr
sSave layout
qQuit

Persistent layout

Press s to save the current layout. xrantui writes to all relevant startup files automatically, covering most X setups:

FileUsed by
~/.screenlayout/xrantui.shThe xrandr script itself
~/.config/autostart/xrantui.desktopXDG autostart — GNOME, KDE, XFCE, LXDE
~/.xprofileDisplay manager without DE — e.g. LightDM + sxwm
~/.xinitrcstartx + bare WM — e.g. sxwm. Inserted before exec.

~/.xprofile and ~/.xinitrc are only modified if they already exist.

Project structure

├── main.c       — event loop and keybindings
├── monitors.c   — read/write monitor state via Xrandr
├── monitors.h
├── draw.c       — render monitors with ncurses
└── draw.h