commit f003740436f2eb90b09d25fe70caaede269a3798 parent 90080463e4166482643780a56c91f4fef336a2f9 Author: Anton Konyahin <me@konyahin.xyz> Date: Tue, 20 Feb 2024 10:19:30 +0300 scripts: script for cyclic switch between monitors Diffstat:
D | scripts/dot-bin/chscr | | | 16 | ---------------- |
A | scripts/dot-bin/switchscreen | | | 13 | +++++++++++++ |
2 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/scripts/dot-bin/chscr b/scripts/dot-bin/chscr @@ -1,16 +0,0 @@ -#!/usr/bin/env sh - -set -e - -if [ -z "$1" ]; then - echo "Use vga or lvds as a argument." - exit 1 -fi - -case "$1" in - "vga" ) - xrandr --output VGA-1 --auto --output LVDS-1 --off;; - "lvds" | * ) - xrandr --output LVDS-1 --auto --output VGA-1 --off;; -esac - diff --git a/scripts/dot-bin/switchscreen b/scripts/dot-bin/switchscreen @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +set -e + +CUR_SCREEN=$(xrandr --listactivemonitors | tail -1 | awk '{print $NF}') + +if [ "$CUR_SCREEN" = "VGA-1" ]; then + SCREEN=LVDS-1 +else + SCREEN=VGA-1 +fi + +xrandr --output "$SCREEN" --auto --output "$CUR_SCREEN" --off