What makes us different from other similar websites? › Forums › Tech › Tiled Display Script [Xubuntu]
Tagged: Grid Display, Linux, Tiled Windows, Titled, Xubuntu
- This topic has 0 replies, 1 voice, and was last updated 3 months ago by
thumbtak.
-
AuthorPosts
-
June 2, 2025 at 11:56 am #8064
thumbtak
ModeratorIf you want apps to be easily placed into sections on your monitor that seems to fit nicely and will help you be more productive, then this could work for you.
It will work like this, in the end, but this only works if you have one monitor.
Install these files:
$ sudo apt install xdotool wmctrl
Bash Script (make sure to correct the width and height):
#!/bin/bash # --- Configuration --- # IMPORTANT: Set these accurately for your monitor! MONITOR_WIDTH=5120 MONITOR_HEIGHT=1440 # --- Calculations (DO NOT MODIFY) --- GRID_COLS=3 GRID_ROWS=2 CELL_WIDTH=$((MONITOR_WIDTH / GRID_COLS)) CELL_HEIGHT=$((MONITOR_HEIGHT / GRID_ROWS)) # --- Helper Function for Tiling --- tile_window() { local target_x=$1 local target_y=$2 WIN_ID=$(xdotool getactivewindow) if [ -z "$WIN_ID" ]; then # No active window found, exit quietly exit 1 fi # Unmaximize window if it's maximized, crucial for resizing. wmctrl -i -r "$WIN_ID" -b remove,maximized_vert,maximized_horz # Move and Resize Window xdotool windowmove "$WIN_ID" "$target_x" "$target_y" xdotool windowsize "$WIN_ID" "$CELL_WIDTH" "$CELL_HEIGHT" } # --- Specific Tiling Functions for Each Cell --- tile_top_left() { tile_window 0 0 } tile_top_middle() { tile_window "$CELL_WIDTH" 0 } tile_top_right() { tile_window $((2 * CELL_WIDTH)) 0 } tile_bottom_left() { tile_window 0 "$CELL_HEIGHT" } tile_bottom_middle() { tile_window "$CELL_WIDTH" "$CELL_HEIGHT" } tile_bottom_right() { tile_window $((2 * CELL_WIDTH)) "$CELL_HEIGHT" } # --- Main Script Logic --- # This part executes the correct function based on the argument passed to the script. case "$1" in "top_left") tile_top_left ;; "top_middle") tile_top_middle ;; "top_right") tile_top_right ;; "bottom_left") tile_bottom_left ;; "bottom_middle") tile_bottom_middle ;; "bottom_right") tile_bottom_right ;; *) echo "Usage: $0 {top_left|top_middle|top_right|bottom_left|bottom_middle|bottom_right}" exit 1 ;; esac
Save the script in your home folder (called “tile_grid_master.sh”) and into a folder called script.
Now make the keyboard shortcuts.
Go to:
Applications => Settings => Keyboard => Application ShortcutsAdd the following commands, and shortcuts. Make sure to change HOME, to your logged in home folder name.
/home/HOME/scripts/tile_grid_master.sh bottom_left
Super+1
/home/HOME/scripts/tile_grid_master.sh bottom_middle
Super +2
/home/HOME/scripts/tile_grid_master.sh bottom_right
Super+3
/home/HOME/scripts/tile_grid_master.sh top_left
Super+4
/home/HOME/scripts/tile_grid_master.sh top_middle
Super+5
/home/HOME/scripts/tile_grid_master.sh top_right
Super+6
-
AuthorPosts
- You must be logged in to reply to this topic.