From 52683ff3309c2a43fd6dc12057931e92008b50e5 Mon Sep 17 00:00:00 2001 From: Raoul Branten Date: Mon, 26 May 2025 13:20:11 +0200 Subject: [PATCH] Add README --- README.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e61f03e --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +# 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) \ No newline at end of file