diff options
| author | Ja.KooLit <jimmielovejay@gmail.com> | 2023-12-23 16:00:51 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-23 16:00:51 +0900 |
| commit | 184df5c379ca655355140691608a383643cf2399 (patch) | |
| tree | 1b1fe7ae786baaf0bc82683b0a6cc29a3159cdcd /config/hypr/scripts | |
| parent | 60d648fc4fc4733b9215ce5c214ea5e0df04881f (diff) | |
| parent | 687d01c4100f910dbbf18c1aeaceb33db1343a8e (diff) | |
Merge pull request #96 from JaKooLit/main
update main to development
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/ZshChangeTheme.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/config/hypr/scripts/ZshChangeTheme.sh b/config/hypr/scripts/ZshChangeTheme.sh new file mode 100755 index 00000000..7057ed2e --- /dev/null +++ b/config/hypr/scripts/ZshChangeTheme.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +themes_dir="$HOME/.oh-my-zsh/themes" +file_extension=".zsh-theme" + +themes_array=($(find "$themes_dir" -type f -name "*$file_extension" -exec basename {} \; | sed -e "s/$file_extension//")) + +rofi_command="rofi -dmenu -config ~/.config/rofi/config-zsh-theme.rasi" + +menu() { + for theme in "${themes_array[@]}"; do + echo "$theme" + done +} + +main() { + choice=$(menu | ${rofi_command}) + + # if nothing selected, script wont change anything + if [ -z "$choice" ]; then + exit 0 + fi + + zsh_path="$HOME/.zshrc" + var_name="ZSH_THEME" + for i in "${themes_array[@]}"; do + if [[ "$i" == "$choice"* ]]; then + if [ -f "$zsh_path" ]; then + sed -i "s/^$var_name=.*/$var_name=\"$i\"/" "$zsh_path" + else + echo "File not found" + fi + break + fi + done +} + +main |
