diff options
| author | davidovski <david@davidovski.xyz> | 2025-11-01 13:34:24 +0000 |
|---|---|---|
| committer | davidovski <david@davidovski.xyz> | 2025-11-01 13:34:24 +0000 |
| commit | 1be76e6c709f95a1a8a631abbddee9d8f89ea7cc (patch) | |
| tree | da4b11c011428dd391c02b39248680a2cd2d57d7 /scripts | |
| parent | e0a89621bde0751d1b340580f886976a79bf4db3 (diff) | |
add xrandr script
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/toggle-mic.sh | 4 | ||||
| -rwxr-xr-x | scripts/xrandr.sh | 35 |
2 files changed, 39 insertions, 0 deletions
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 |
