diff options
| author | HyprHex <swapapis@gmail.com> | 2023-12-23 01:09:58 +0100 |
|---|---|---|
| committer | HyprHex <swapapis@gmail.com> | 2023-12-23 01:09:58 +0100 |
| commit | 83e1c2688b429fc761ab2d14e04cc8b56b0230e1 (patch) | |
| tree | 1dfc4405c29d01721c2a2348cff4e46845cb64ba /config/hypr | |
| parent | ecbdf16080e48898e7d94a6337963967497b76fa (diff) | |
Add script to switch oh-my-zsh themes
Diffstat (limited to 'config/hypr')
| -rw-r--r-- | config/hypr/configs/Keybinds.conf | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/ChangeTheme.sh | 35 |
2 files changed, 37 insertions, 1 deletions
diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index b5f565b3..f30dd626 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -40,6 +40,7 @@ bind = $mainMod SHIFT, B, exec, $scriptsDir/ChangeBlur.sh # Toggle blur settings bind = $mainMod SHIFT, G, exec, $scriptsDir/GameMode.sh bind = CTRL ALT, W, exec, $scriptsDir/Wallpaper.sh bind = $mainMod, W, exec, $scriptsDir/WallpaperSelect.sh +bind = $mainMod, C, exec, $scriptsDir/ChangeTheme.sh # Change oh-my-zsh theme bind = $mainMod ALT, K, exec, $scriptsDir/SwitchKeyboardLayout.sh bind = $mainMod ALT, R, exec, $scriptsDir/Refresh.sh @@ -183,4 +184,4 @@ bind = $mainMod ALT, P, submap, passthru submap = passthru # to unbind bind = $mainMod ALT, P, submap, reset -submap = reset
\ No newline at end of file +submap = reset diff --git a/config/hypr/scripts/ChangeTheme.sh b/config/hypr/scripts/ChangeTheme.sh new file mode 100755 index 00000000..3b7ad3d4 --- /dev/null +++ b/config/hypr/scripts/ChangeTheme.sh @@ -0,0 +1,35 @@ +#!/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-themezsh.rasi" + +menu() { + for theme in "${themes_array[@]}"; do + echo "$theme" + done +} + +main() { + choice=$(menu | ${rofi_command}) + 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 |
