diff options
-rwxr-xr-x | dock.sh | 4 | ||||
-rwxr-xr-x | dockd.sh | 53 | ||||
-rwxr-xr-x | undock.sh | 11 |
3 files changed, 15 insertions, 53 deletions
@@ -0,0 +1,4 @@ +#!/bin/sh +xrandr --output DP-3 --off --output DP-2 --auto --primary +doas sysctl hw.acpi.lid_switch_state=NONE +killall xautolock diff --git a/dockd.sh b/dockd.sh deleted file mode 100755 index 4b67bc5..0000000 --- a/dockd.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -set -x - -# To dock: -# - set DP-2 (external monitor) to primary output -# - restart i3 to get scaling correct via themer -# - set default sound unit to external speakers -# - disable laptop lid close sleep -# - disable auto locking and sleeping -dock() { - xrandr --output DP-3 --off --output DP-2 --auto --primary - #nvidia-settings --assign CurrentMetaMode="DP-2:nvidia-auto-select +0+0 { ForceCompositionPipeline = On }" - sysctl hw.snd.default_unit=1 - doas sysctl hw.acpi.lid_switch_state=NONE - killall xautolock - notify-send Docked. -} - -# To un-dock: -# - set DP-3 (internal screen) to primary output -# - restart i3 to get scaling correct via themer -# - set default sound unit to builtin speakers -# - enable laptop lid close sleep -# - enable auto locking and sleeping -undock() { - xrandr --output DP-3 --auto --primary --output DP-2 --off - #nvidia-settings --assign CurrentMetaMode="DP-3:nvidia-auto-select +0+0 { ForceCompositionPipeline = On }" - sysctl hw.snd.default_unit=4 - doas sysctl hw.acpi.lid_switch_state=S3 - killall xautolock - xautolock \ - -killtime 10 \ - -killer "sleep 0.5; doas acpiconf -s3" \ - -notify 10 \ - -time 10 \ - -locker "i3lock -n -f -c 002b36 ; sleep 0.2" \ - -notifier "notify-send -t=10000 '10 seconds to lock...'" & - notify-send Undocked -} - -sleep 1 -xrandr=$(xrandr) -case "$xrandr" in - *"DP-2 disconnected primary"*) - # if DP-2 is disconnected and primary then undock - undock - ;; - *"DP-2 connected ("*) - # if DP-2 is connected but isn't primary then dock - dock - ;; -esac - diff --git a/undock.sh b/undock.sh new file mode 100755 index 0000000..1f84470 --- /dev/null +++ b/undock.sh @@ -0,0 +1,11 @@ +#!/bin/sh +xrandr --output DP-3 --auto --primary --output DP-2 --off +doas sysctl hw.acpi.lid_switch_state=S3 +killall xautolock +xautolock \ + -killtime 10 \ + -killer "sleep 0.5; doas acpiconf -s3" \ + -notify 10 \ + -time 10 \ + -locker "i3lock -n -f -c 002b36 ; sleep 0.2" \ + -notifier "notify-send -t=10000 '10 seconds to lock...'" & |