A GNOME Shell extension and command-line tool for capturing and positioning windows at precise locations on your desktop.
- Capture window positions - Save current window location and size
- Position windows - Move windows to saved positions instantly
- Flexible matching - Match by WM_CLASS or title patterns
- Configuration management - Edit, list, and clear saved configurations
- Debug tools - View window information for troubleshooting
-
Install dependencies:
sudo apt install jq
-
Run setup:
./setup
-
Log out and back in (required for extension changes to take effect)
The setup script will:
- Install the GNOME Shell extension
- Copy the
positionscript to~/bin/ - Add
~/binto your PATH (if needed) - Auto-enable the extension after login
# Capture current window position
position capture
# Position a saved window
position <config_name>
# List all saved configurations
position list
# Show detailed configuration info
position list --full
position list <config_name>
# Edit a configuration
position edit <config_name>
# Remove a configuration
position clear <config_name>
# Remove all configurations
position clear-all
# Debug: show all windows with WM_CLASS values
position debug# Capture KeePassXC window position
position capture
# Follow prompts to name it "keepass"
# Position KeePassXC window
position keepass
# List all saved configurations
position list
# Show detailed info for specific config
position list keepass
# Edit the keepass configuration
position edit keepassWindow configurations are stored in .window_positions.conf in INI format:
[keepass]
name = "KeePassXC"
x = 100
y = 100
width = 800
height = 600
wm_class = "org.keepassxc.KeePassXC"
title_pattern = "KeePassXC"The system uses two matching strategies:
- WM_CLASS matching - Primary identifier (e.g., "org.keepassxc.KeePassXC")
- Title pattern matching - Optional filter for multiple windows of the same class
When capturing a window, you can:
- Use WM_CLASS only (matches any window of that application)
- Add a title pattern (matches specific windows with that title)
extension.js- GNOME Shell extension (D-Bus interface)position- Command-line toolsetup- Deployment scriptmetadata.json- Extension metadata
- Edit files in this directory
- Test locally:
./position <command> - Deploy changes:
./setup - Log out/in for extension updates
# Test CLI tool locally
./position capture
# Deploy to system locations
./setup
# Enable extension
gnome-extensions enable window-positioner@example.com
# Monitor extension logs
journalctl --user -f --grep="WindowPositioner"The system uses a hybrid approach:
- Extension exports D-Bus methods at
/org/gnome/Shell/WindowPositioner - CLI tool calls these methods via
gdbus callcommands - Configuration stored in INI format
GetActiveWindowInfo()- Capture current window detailsPositionWindowByClass(wmClass, x, y, width, height)- Position by WM_CLASSPositionWindowByClassAndTitle(wmClass, titlePattern, x, y, width, height)- Position with title filter
-
Check if extension is enabled:
gnome-extensions list --enabled | grep window-positioner -
Check extension logs:
journalctl --user -f --grep="WindowPositioner" -
Re-enable extension:
gnome-extensions disable window-positioner@example.com gnome-extensions enable window-positioner@example.com
- Check if application is running
- Verify WM_CLASS with:
position debug - Try without title pattern (edit config to remove it)
- Check extension logs for errors
# Install jq
sudo apt install jq
# Check if ~/bin is in PATH
echo $PATH | grep -q "$HOME/bin" || echo "Add ~/bin to PATH"This project is open source. See the code for implementation details.
This is a personal tool built for my specific needs. It is not actively maintained for public use. Feel free to fork it, but please note that I may not respond to issues or pull requests.