summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdock.sh4
-rwxr-xr-xdockd.sh53
-rwxr-xr-xundock.sh11
3 files changed, 15 insertions, 53 deletions
diff --git a/dock.sh b/dock.sh
new file mode 100755
index 0000000..c6e9915
--- /dev/null
+++ b/dock.sh
@@ -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...'" &