From 1be76e6c709f95a1a8a631abbddee9d8f89ea7cc Mon Sep 17 00:00:00 2001 From: davidovski Date: Sat, 1 Nov 2025 13:34:24 +0000 Subject: add xrandr script --- scripts/toggle-mic.sh | 4 ++++ scripts/xrandr.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 scripts/toggle-mic.sh create mode 100755 scripts/xrandr.sh (limited to 'scripts') diff --git a/scripts/toggle-mic.sh b/scripts/toggle-mic.sh new file mode 100755 index 0000000..d3e3244 --- /dev/null +++ b/scripts/toggle-mic.sh @@ -0,0 +1,4 @@ +#!/bin/sh +SOURCE=1 +pactl list sources | grep -qi 'Mute: yes' && pactl set-source-mute $SOURCE false || pactl set-source-mute $SOURCE true + diff --git a/scripts/xrandr.sh b/scripts/xrandr.sh new file mode 100755 index 0000000..1827cd7 --- /dev/null +++ b/scripts/xrandr.sh @@ -0,0 +1,35 @@ +#!/bin/sh +all=$(xrandr | grep "connected" | cut -d' ' -f1 | paste -s -d' ') +available=$(xrandr | grep " connected" | cut -d' ' -f1 | paste -s -d' ') +set -- $available + +printf "connected: " +printf "%s " $available +printf "\n" + +printf "all: " +printf "%s " $all +printf "\n" + +if [ "$1" == "eDP1" ]; then + # this is a laptop so awesome! + + if [ "$#" != "1" ]; then + # ensure the main one is turned on yeah + xrandr --output eDP1 --mode 1920x1080 --pos 0x0 --rotate normal + + # put the non main one to the left (assume its +1920 because im lazy) + xrandr --output "$2" --primary --mode 2560x1440 --pos 1920x0 --rotate normal + else + # ensure the main one is turned on yeah + xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal + fi + #disconnect all the rest i think + for x in $all; do + echo disconnecting $x + case $available in + *"$x"*) ;; + *) xrandr --output "$x" --off + esac + done +fi -- cgit v1.2.3