-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.scripts.sh
executable file
·42 lines (36 loc) · 1015 Bytes
/
.scripts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
getKeyboardLayout () {
layout=$(setxkbmap -query | grep -oP 'layout:\s*\K([\w,]+)')
echo -n "$layout"
}
changeKeyboardLayout () {
LAYOUT=$(getKeyboardLayout)
if [[ "$LAYOUT" == "ir" ]]; then
setxkbmap us
else
setxkbmap ir
fi
}
changeWallpaper () {
WALLPAPER=$(shuf -n1 -e ~/Pictures/Wallpapers/*)
SHORTWALLPAPER=$(echo $WALLPAPER | sed "s/.*\///" | sed "s/\..*//")
nitrogen --set-auto --save $WALLPAPER
notify-send "Wallpaper Refreshed " " Current wallpaper: $SHORTWALLPAPER "
}
subcommand="$1"
shift || (echo "Please specify an option:
cngKeyboard Change Current Keyboard Layout
getKeyboard Get Current Keyboard Layout
cngWallpaper Change wallpaper randomly
Pics from ~/Pictures/Wallpapers/" && exit)
case $subcommand in
"cngKeyboard")
changeKeyboardLayout
;;
"getKeyboard")
getKeyboardLayout
;;
"cngWallpaper")
changeWallpaper
;;
esac