working on copy script
This commit is contained in:
parent
4406c93ac2
commit
a5973792c5
15
copy.sh
15
copy.sh
|
@ -124,6 +124,21 @@ fi
|
||||||
|
|
||||||
printf "\n%.0s" {1..1}
|
printf "\n%.0s" {1..1}
|
||||||
|
|
||||||
|
# Function to detect keyboard layout using localectl or setxkbmap
|
||||||
|
detect_layout() {
|
||||||
|
if command -v localectl >/dev/null 2>&1; then
|
||||||
|
layout=$(localectl status --no-pager | awk '/X11 Layout/ {print $3}')
|
||||||
|
if [ -n "$layout" ]; then
|
||||||
|
echo "$layout"
|
||||||
|
fi
|
||||||
|
elif command -v setxkbmap >/dev/null 2>&1; then
|
||||||
|
layout=$(setxkbmap -query | grep layout | awk '{print $2}')
|
||||||
|
if [ -n "$layout" ]; then
|
||||||
|
echo "$layout"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# detect the current keyboard layout
|
# detect the current keyboard layout
|
||||||
layout=$(detect_layout)
|
layout=$(detect_layout)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue