aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2022-10-08 16:28:27 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2022-10-08 16:28:27 +0200
commit5cd8449c399c939f0632a7346ec3f4e9cd3a4f08 (patch)
treee335d4343343f1242b35420333b1756ca034769a
parentf4b0a2b3ee0b82e6093335e37039f6d089492a8f (diff)
downloadscripts-5cd8449c399c939f0632a7346ec3f4e9cd3a4f08.tar.gz
scripts-5cd8449c399c939f0632a7346ec3f4e9cd3a4f08.zip
Conditionally swap Escape and Caps.
-rwxr-xr-xbluetooth/btConnect.sh10
-rwxr-xr-xxinit.sh9
2 files changed, 12 insertions, 7 deletions
diff --git a/bluetooth/btConnect.sh b/bluetooth/btConnect.sh
index 71bb93b..9d97938 100755
--- a/bluetooth/btConnect.sh
+++ b/bluetooth/btConnect.sh
@@ -26,16 +26,16 @@ if bluetoothctl show | grep -Fq 'Powered: no'; then
fi
lines=$(bluetoothctl devices Paired | wc -l)
-selected=$(bluetoothctl devices Paired | dmenu -l $lines -p "💓") || exit 1
-mac=$(echo $selected | cut -d' ' -f2)
-name=$(echo $selected | cut -d' ' -f3-)
+selected=$(bluetoothctl devices Paired | dmenu -l "$lines" -p "💓") || exit 1
+mac=$(echo "$selected" | cut -d' ' -f2)
+name=$(echo "$selected" | cut -d' ' -f3-)
-if bluetoothctl info $mac | grep -F 'Connected' | grep -Fq 'yes'; then
+if bluetoothctl info "$mac" | grep -F 'Connected' | grep -Fq 'yes'; then
notify-send "$title" "Already connected to ${name}\n(${mac})"
exit 2
fi
-if ! bluetoothctl connect $mac; then
+if ! bluetoothctl connect "$mac"; then
notify-send "$title" "Unable to connect to ${name}\n(${mac})"
exit 3
fi
diff --git a/xinit.sh b/xinit.sh
index d1e3ae9..349cc5b 100755
--- a/xinit.sh
+++ b/xinit.sh
@@ -4,11 +4,16 @@
xrdb ~/.Xresources
pgrep -x picom || picom -b
pgrep -x dunst || dunst &
-#setxkbmap -layout es -option caps:swapescape
-setxkbmap -layout es
xset -b
pgrep -x unclutter || unclutter --idle 1 &
#touchpad.sh
initialLayout.sh
setRandomWP.sh
pgrep -x sxhkd || sxhkd >~/logs/sxhkd.log &
+
+# Swap Escape and Caps except Kyria keyboard is connected
+if lsusb | grep -Fq 'Kyria'; then
+ setxkbmap -layout es
+else
+ setxkbmap -layout es -option caps:swapescape
+fi