Skip to content

A daemon to save and restore the state and positions of X11 windows when screens are plugged / unplugged.

License

Notifications You must be signed in to change notification settings

OneBlue/kvmtool

Repository files navigation

kvmtool

A daemon to save and restore the state / positions of X11 windows when screens are plugged / unplugged.

This tends to be useful for people using passive KVM's, because switching between machines causes the screen to be physically detached, and so all windows usually end up in one corner, which can be annoying.

This program solves the problem by periodically saving the position of all windows on an X11 display, and restoring them when screens are unplugged and then plugged again.

Usage

Usage: ./kvmtool -x screen_witdh -y screen_height [--screen-timeout timeout_ms] [--refresh refresh_ms] [--exclude window1,window2]
Options:
	-x: The width, in pixels of the original screen area
	-y: The height, in pixels of the original screen area
	--screen_timeout: The timeout, in milliseconds, to wait for RRScreenChangeNotify events after a new screen is plugged / unplugged
	--exclude: A comma separated list of window titles to exclude when saving / restoring positions
	--refresh: The refresh rate at which windows are to be saved (in milliseconds)
	--help: Display this message

Build

Instructions for debian based distros

$ apt-get install libx11-dev # Install the libx11 headers
$ git clone https://bitbucket.org/_Blue/kvmtool # Clone this repository
$ cd kvmtool
$ make

Run with systemd

Update the x & y arguments to match your desktop resolution.

[Unit]
Description=kvmtool

[Service]
Environment=DISPLAY=:0
ExecStart=/usr/bin/kvmtool -x 7040 -y 3600 --exclude nemo-desktop,Desktop

[Install]
WantedBy=default.target

Then install and start with:

$ systemctl --user daemon-reload
$ systemctl --user start kvmtool
$ systemctl --user enable kvmtool

About

A daemon to save and restore the state and positions of X11 windows when screens are plugged / unplugged.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published