commit 85361bef2ba9857b6597ecccef6d5491c17cbefe
parent 219e4acb38307492bb71956e21d9b1ff0719b86b
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 7 Jan 2021 09:40:15 +0100
Merge branch 'master' of src.adamsgaard.dk:dotfiles
Diffstat:
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/.local/bin/keyboard-layout-switch.sh b/.local/bin/keyboard-layout-switch.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-set -e
+# toggle between two keyboard layouts
layoutfile="$HOME/.cache/kbd-layout"
@@ -8,23 +8,17 @@ lang1="us"
lang2="dk"
set_language() {
- echo "$1" > "$layoutfile"
- #pkill -RTMIN+3 i3blocks
- setxkbmap "$1" -option -option ctrl:nocaps #-option altwin:swap_lalt_lwin
- #xmodmap $HOME/.Xmodmap
- #notify "$1"
+ printf '%s\n' "$1" > "$layoutfile"
+ setxkbmap "$1" -option -option ctrl:nocaps
}
-[ $# -gt 0 ] && set_language "$1" && exit
-
-# write the file if it doesn't exist
if [ ! -f "$layoutfile" ]; then
- set_language "us"
+ set_language "$lang1"
exit 0
fi
# read the language file, and switch to the other language
-currlang=$(cat "$layoutfile")
+currlang="$(cat "$layoutfile")"
if [ "$currlang" = "$lang1" ]; then
set_language "$lang2"
diff --git a/LICENSE b/LICENSE
@@ -1,6 +1,6 @@
ISC License
-Copyright (c) 2012-2020 Anders Damsgaard <anders@adamsgaard.dk>
+Copyright (c) 2012-2021 Anders Damsgaard <anders@adamsgaard.dk>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above