From ca968c4e5040f1ff4b5b5e12d9312360d807dcc1 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 3 Jun 2024 19:56:39 +0800 Subject: added submodules, change . -> dot (see man stow --dotfiles) --- dot-config/rofi/scripts/rofi_themes | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 dot-config/rofi/scripts/rofi_themes (limited to 'dot-config/rofi/scripts/rofi_themes') 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="Available Themes : `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 -- cgit v1.2.3