summaryrefslogtreecommitdiff
path: root/dotfiles/dwm/.local/bin/monitor
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-01-26 17:27:50 -0600
committerCraig Jennings <c@cjennings.net>2026-01-26 17:27:50 -0600
commita80dbca48b09ff50274e34fbf27c09c475aa09c7 (patch)
tree58198a3defb7320d7a21959a92cd84a004e9f27e /dotfiles/dwm/.local/bin/monitor
parent0c182874d924d79ab5fba7f8f0172c5a4240a27a (diff)
refactor(scripts): reorganize scripts by desktop environment
Move X11/DWM-specific scripts to dotfiles/dwm/.local/bin/: - All dmenu* scripts (7) - All statusbar/sb-* scripts (24) - Display scripts: brightness, displayselect, monitor, colorpick - Input scripts: remaps, toggle-touchpad, samedir - Menu scripts: exitmenu, prompt, airplanemodetoggle, audioselect - Media scripts: screenshotmenu, recordnow, setbg, wallsearch, bookfind - Misc: battery_monitor, td-toggle Delete obsolete scripts: - build.emacs.aur.sh (redundant with build-emacs.sh) - bsdnet_bounce (FreeBSD only) - calibre-install (just curls installer) - debugemacs (hardcoded paths) - gruv (duplicate of alias) - reset-auth (unclear purpose) - touchpad-indicator-start (obsolete daemon) - starth (unused Hyprland starter) Universal scripts remain in dotfiles/system/.local/bin/ for both X11 and Wayland installs. Also update todo.org: cancel pywal and waybar netspeed tasks, mark desktop file pruning done. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'dotfiles/dwm/.local/bin/monitor')
-rwxr-xr-xdotfiles/dwm/.local/bin/monitor50
1 files changed, 50 insertions, 0 deletions
diff --git a/dotfiles/dwm/.local/bin/monitor b/dotfiles/dwm/.local/bin/monitor
new file mode 100755
index 0000000..30f04b6
--- /dev/null
+++ b/dotfiles/dwm/.local/bin/monitor
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Craig Jennings
+# convenience script to switch monitors
+
+# this script assumes there are at most two monitors attached and we want to switch between then
+CHOICES="Laptop\nLaptop-Scaled\nHome-Display\nExternal-Auto\nExternal-Scaled\nVirtualbox"
+
+# laptops always have a monitor connected when running the script.
+LAPTOP=$(xrandr -q | grep primary | awk '$2 == "connected" {print $1}')
+echo "primary monitor is $LAPTOP"
+
+# an external monitor will always be a connected monitor that isn't primary
+EXTERNAL=$(xrandr -q | grep -v primary | awk '$2 == "connected" {print $1}')
+
+# start by resetting
+xrandr -s 0
+
+# disable if called automatically, otherwise you'll want the menu
+# if there's only one monitor connected, setup laptop monitor
+# if [ -z "$EXTERNAL" ]; then
+# xrandr -s 0
+# xrandr --output "$LAPTOP" --auto --dpi 144 --scale 0.6
+# exit 0
+# fi
+
+CHOSEN=$(echo -e "$CHOICES" | dmenu -i)
+
+case "$CHOSEN" in
+"Laptop")
+ xrandr --output "$LAPTOP" --auto --output "$EXTERNAL" --off
+ ;;
+"Laptop-Scaled")
+ xrandr --output "$LAPTOP" --auto --dpi 144 --scale 0.6 --output "$EXTERNAL" --off
+ ;;
+"External")
+ xrandr --output "$EXTERNAL" --auto --dpi 96 --mode 3440x1440 --scale 1.0 --output "$LAPTOP" --off
+ ;;
+"External-Auto")
+ xrandr --output "$EXTERNAL" --auto --output "$LAPTOP" --off
+ ;;
+"External-Scaled")
+ xrandr --output "$EXTERNAL" --auto --scale 0.6 --output "$LAPTOP" --off
+ ;;
+"Virtualbox")
+ xrandr --output "$LAPTOP" --auto --mode 1920x1080
+ ;;
+esac
+
+# restore the wallpaper after resolution change
+[ -f ~/.fehbg ] && ~/.fehbg