Go to file
2025-09-05 13:44:57 +02:00
mediacontrol init 2025-05-19 18:10:07 +02:00
README.md Add README 2025-05-26 13:20:11 +02:00
windowmanagement.sh Add margin from bottom 2025-09-05 13:44:57 +02:00

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:

sudo apt install x11-utils xdotool wmctrl libnotify-bin

On Fedora:

sudo dnf install xorg-x11-utils xdotool wmctrl libnotify

On Arch Linux:

sudo pacman -S xorg-xdpyinfo xdotool wmctrl libnotify

Usage

  1. Make the script executable:
chmod +x windowmanagement.sh
  1. Run the script with one of the following commands:
./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:

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)