From a68a4601311afe7e0f1ead98fa972732d8c2bdb9 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.uk>
Date: Mon, 30 Jan 2023 22:00:53 +0000
Subject: [PATCH] Add bin scripts

---
 bin/switch-to-laptop-screen.sh |  7 +++++++
 bin/switch-to-monitor.sh       |  7 +++++++
 bin/watch-changes              | 11 +++++++++++
 3 files changed, 25 insertions(+)
 create mode 100755 bin/switch-to-laptop-screen.sh
 create mode 100755 bin/switch-to-monitor.sh
 create mode 100755 bin/watch-changes

diff --git a/bin/switch-to-laptop-screen.sh b/bin/switch-to-laptop-screen.sh
new file mode 100755
index 00000000..7de579f6
--- /dev/null
+++ b/bin/switch-to-laptop-screen.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+set -ueo pipefail
+
+xrandr \
+  --output eDP-1 --mode 1920x1200 \
+  --output DP-3 --off
diff --git a/bin/switch-to-monitor.sh b/bin/switch-to-monitor.sh
new file mode 100755
index 00000000..b6784fff
--- /dev/null
+++ b/bin/switch-to-monitor.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+set -ueo pipefail
+
+xrandr \
+  --output DP-3 --mode 2560x1440 \
+  --output eDP-1 --off
diff --git a/bin/watch-changes b/bin/watch-changes
new file mode 100755
index 00000000..29e647b9
--- /dev/null
+++ b/bin/watch-changes
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if [ "$1" ] && [ "$2" ]; then
+  while true
+  do
+    inotifywait --event modify --exclude ".null-ls_*" --recursive $1 2> /dev/null
+    $2
+  done
+else
+  echo "usage: watch-changes <file> <command>"
+fi