summaryrefslogtreecommitdiff
path: root/dot-config/rofi/scripts/rofi_themes
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-06-03 19:56:39 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-06-03 19:56:39 +0800
commitca968c4e5040f1ff4b5b5e12d9312360d807dcc1 (patch)
tree9900920e8f566794560c1519678e344351d2803b /dot-config/rofi/scripts/rofi_themes
parent5f3deaff0bf006a1a353e57b82ad48c0e8f143bc (diff)
added submodules, change . -> dot (see man stow --dotfiles)
Diffstat (limited to 'dot-config/rofi/scripts/rofi_themes')
-rwxr-xr-xdot-config/rofi/scripts/rofi_themes44
1 files changed, 44 insertions, 0 deletions
diff --git a/dot-config/rofi/scripts/rofi_themes b/dot-config/rofi/scripts/rofi_themes
new file mode 100755
index 00000000..854e8860
--- /dev/null
+++ b/dot-config/rofi/scripts/rofi_themes
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+# Import Current Theme
+DIR="$HOME/.config/rofi"
+RASI="$DIR/themes.rasi"
+
+# List Available Themes
+THEMES=(`cd $DIR/themes && ls -d */ | cut -d '/' -f1`)
+
+# Theme Elements
+prompt="Themes"
+mesg="<b>Available Themes</b> : `cd $DIR/themes && ls -d */ | cut -d '/' -f1 | wc -l`"
+
+# Rofi CMD
+rofi_cmd() {
+ rofi -dmenu \
+ -p "$prompt" \
+ -mesg "$mesg" \
+ -sep '|' \
+ -markup-rows \
+ -theme ${RASI}
+}
+
+# Pass variables to rofi dmenu
+run_rofi() {
+ echo ${THEMES[@]} | sed 's/ /|/g' | sed 's/$/|/' | rofi_cmd
+}
+
+# Apply Theme
+apply_theme() {
+ selected="`run_rofi`"
+ current="`cat $DIR/themes/.current`"
+
+ for theme in "${THEMES[@]}"; do
+ if [[ -z "$selected" ]]; then
+ break
+ elif [[ "$selected" == "$theme" ]]; then
+ "$DIR"/themes/"$theme"/apply.sh
+ break
+ fi
+ done
+}
+
+apply_theme && exit 0