summaryrefslogtreecommitdiff
path: root/.scripts/togglecaps
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2023-07-01 20:58:49 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2023-07-01 20:58:49 +0530
commited779a4bc67e7506ba5521ac1d2308aaedeb89de (patch)
treea8f1a6f2a55cd95d52a94d25dde41c5af21281b3 /.scripts/togglecaps
parentab60bbbf1b19bae28f7302d2299ca14dd64a7bc5 (diff)
.scripts: Adding order and rsyncfon script
Diffstat (limited to '.scripts/togglecaps')
-rwxr-xr-x.scripts/togglecaps4
1 files changed, 2 insertions, 2 deletions
diff --git a/.scripts/togglecaps b/.scripts/togglecaps
index 09dd90c..b3c1b48 100755
--- a/.scripts/togglecaps
+++ b/.scripts/togglecaps
@@ -5,11 +5,11 @@ hyprland_cfg="$HOME/.config/hypr/hyprland.conf"
line1=$(grep "kb_options" "$hyprland_cfg" | head -n 1)
line2=$(grep "kb_options" "$hyprland_cfg" | tail -n 1)
-if [ "${line1:0:1}" = "#" ]; then
+if echo "$line1" | grep -qE "^\s*#"; then
# If first line is commented, uncomment it and comment the second line
sed -i 's/^#\s*kb_options=caps:escape/kb_options=caps:escape/' "$hyprland_cfg"
sed -i 's/^kb_options=ctrl:nocaps/# kb_options=ctrl:nocaps/' "$hyprland_cfg"
-elif [ "${line2:0:1}" = "#" ]; then
+elif echo "$line1" | grep -qE "^\s*#"; then
# If second line is commented, uncomment it and comment the first line
sed -i 's/^#\s*kb_options=ctrl:nocaps/kb_options=ctrl:nocaps/' "$hyprland_cfg"
sed -i 's/^kb_options=caps:escape/# kb_options=caps:escape/' "$hyprland_cfg"