forked from giomatfois62/rofi-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrofi-settings.sh
executable file
·143 lines (111 loc) · 3.1 KB
/
rofi-settings.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env bash
# depends: xterm inxi htop
SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROFI_CMD="rofi -dmenu -i -matching fuzzy"
TASK_MANAGER="xterm -e htop"
SYSTEM_INFO="inxi -c0 -v2 | $ROFI_CMD -p Info"
declare -A commands=(
["Appearance"]=appearance_menu
["Network"]=network
["Bluetooth"]=bluetooth
["Display"]=display
["Volume"]=volume
["Brightness"]=brightness
["Keyboard Layout"]=kb_layout
["Default Applications"]=default_apps
["Menu Configuration"]=menu_config
["Task Manager"]=task_mgr
["System Info"]=sys_info
# Appearance Settings
["Qt5 Appearance"]=qt5_app
["GTK Appearance"]=gtk_app
["Rofi Style"]=rofi_app
["Set Wallpaper"]=wallpaper
["Rofi Shortcuts"]=shortcuts
)
settings_menu() {
entries=("Appearance\nNetwork\nBluetooth\nDisplay\nVolume\nBrightness\nKeyboard Layout\nRofi Shortcuts\nDefault Applications\nMenu Configuration\nTask Manager\nSystem Info")
# remember last entry chosen
local choice_row=0
local choice_text
while choice=`echo -en $entries | $ROFI_CMD -selected-row ${choice_row} -format 'i s' -p Settings`; do
if [ ${#choice} -gt 0 ]; then
choice_row=$(echo $choice | awk '{print $1;}')
choice_text=$(echo $choice | cut -d' ' -f2-)
${commands[$choice_text]};
fi
done
exit 1
}
appearance_menu() {
appearance_entries=("Qt5 Appearance\nGTK Appearance\nRofi Style\nSet Wallpaper")
# remember last entry chosen
local selected_row=0
local selected_text
while selected=`echo -en $appearance_entries | $ROFI_CMD -selected-row ${selected_row} -format 'i s' -p Appearance`; do
if [ ${#selected} -gt 0 ]; then
selected_row=$(echo $selected | awk '{print $1;}')
selected_text=$(echo $selected | cut -d' ' -f2-)
${commands[$selected_text]};
fi
done
}
shortcuts() {
rofi -show keys
}
network() {
$SCRIPT_PATH/networkmanager_dmenu
}
bluetooth() {
$SCRIPT_PATH/rofi-bluetooth.sh
}
display() {
$SCRIPT_PATH/rofi-monitor-layout.sh
}
volume() {
$SCRIPT_PATH/rofi-volume.sh
}
menu_config() {
selected=`find $SCRIPT_PATH -iname '*.sh' -maxdepth 1 -type f | $ROFI_CMD -p Open`
if [ ${#selected} -gt 0 ]; then
xdg-open $selected && exit 0
fi
}
task_mgr() {
have_blocks=`rofi -dump-config | grep blocks`
if [ ${#have_blocks} -gt 0 ]; then
$SCRIPT_PATH/rofi-top.sh
else
eval "$TASK_MANAGER"
fi
}
sys_info() {
eval "$SYSTEM_INFO"
}
default_apps() {
$SCRIPT_PATH/rofi-mime.sh
}
brightness() {
rofi -e "Brightness Menu"
# TODO: implement brightness controls
}
kb_layout() {
kbd_file="/usr/share/X11/xkb/rules/evdev.lst"
selected=$(cat $kbd_file | grep -Poz '(?<=layout\n)(.|\n)*(?=! variant)' | head -n -2 | rofi -dmenu -i -p Layout | awk '{print $1;}')
if [ ${#selected} -gt 0 ]; then
setxkbmap $selected
fi
}
qt5_app() {
qt5ct;
}
gtk_app() {
lxappearance;
}
rofi_app() {
rofi-theme-selector;
}
wallpaper() {
$SCRIPT_PATH/rofi-wallpaper.sh;
}
settings_menu