# Window Management Script A Linux utility script for managing window positions and sizes on your desktop. This script allows you to quickly position windows in predefined layouts using keyboard shortcuts or direct commands. ## Features - Position windows in various preset layouts (center, left, right) - Support for different window widths (25%, 50%, 100%) - Automatically accounts for taskbar/panel height - Shows notifications when windows are repositioned ## Dependencies The script requires the following tools to be installed: - `xdpyinfo` - for getting screen dimensions - `xdotool` - for window manipulation - `wmctrl` - for window control - `notify-send` - for desktop notifications ### Installing Dependencies On Ubuntu/Debian: ```bash sudo apt install x11-utils xdotool wmctrl libnotify-bin ``` On Fedora: ```bash sudo dnf install xorg-x11-utils xdotool wmctrl libnotify ``` On Arch Linux: ```bash sudo pacman -S xorg-xdpyinfo xdotool wmctrl libnotify ``` ## Usage 1. Make the script executable: ```bash chmod +x windowmanagement.sh ``` 2. Run the script with one of the following commands: ```bash ./windowmanagement.sh [command] ``` Available commands: - `center` - Full width window - `center50` - 50% width window in center - `left25` - 25% width window on left side - `right25` - 25% width window on right side - `left50` - 50% width window on left side - `right50` - 50% width window on right side - `centerleft25` - 25% width window on left side of center - `centerright25` - 25% width window on right side of center ## Functions ### get_usable_height Returns the available vertical screen space by calculating: ```bash screen_height - panel_height ``` This ensures windows are sized correctly accounting for the taskbar/panel height. ## Integration You can integrate this script with your desktop environment's keyboard shortcuts system. For example, you could bind: - `Super + Left` to `./windowmanagement.sh left50` - `Super + Right` to `./windowmanagement.sh right50` - `Super + Up` to `./windowmanagement.sh center` ## Notes - The script automatically detects your screen dimensions and panel height - Windows are positioned slightly below the top of the screen (0.1 pixels) to prevent issues with some desktop environments - The script will show a notification when a window is repositioned - If any required dependencies are missing, the script will notify you ## Author R. Branten (2022)