From 5df8cb82ccb01fefbd70aa059a326925b9ea98d6 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 12 Jan 2025 12:50:56 +0900 Subject: some changes on scripts which depends on rofi. Downside is only way to close the rofi is pressing esc button. However, you can execute immediately the script. ie., rofi menu is opened, by pressing Super W, it will execute wallpaper menu immediately. --- config/hypr/UserScripts/QuickEdit.sh | 5 +++++ config/hypr/UserScripts/RofiBeats.sh | 6 ++++++ config/hypr/UserScripts/RofiCalc.sh | 1 - config/hypr/UserScripts/WallpaperEffects.sh | 1 - config/hypr/UserScripts/WallpaperSelect.sh | 1 - config/hypr/UserScripts/ZshChangeTheme.sh | 5 +++++ config/hypr/configs/Keybinds.conf | 3 ++- config/hypr/scripts/ClipManager.sh | 5 +++++ config/hypr/scripts/KeyBinds.sh | 5 +++++ config/hypr/scripts/RofiEmoji.sh | 6 ++++++ config/hypr/scripts/RofiSearch.sh | 2 +- config/hypr/scripts/WaybarLayout.sh | 2 +- config/hypr/scripts/WaybarStyles.sh | 2 +- 13 files changed, 37 insertions(+), 7 deletions(-) diff --git a/config/hypr/UserScripts/QuickEdit.sh b/config/hypr/UserScripts/QuickEdit.sh index ed5a4e1c..29ce3506 100755 --- a/config/hypr/UserScripts/QuickEdit.sh +++ b/config/hypr/UserScripts/QuickEdit.sh @@ -51,4 +51,9 @@ main() { $tty -e $edit "$file" } +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + main diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index cde7eccf..e615aadb 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -94,6 +94,12 @@ play_online_music() { # Check if an online music process is running and send a notification, otherwise run the main function pkill mpv && notify-send -u low -i "$iDIR/music.png" "Music stopped" || { +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + + # Prompt the user to choose between local and online music user_choice=$(printf "Play from Online Stations\nPlay from Music Folder\nShuffle Play from Music Folder" | rofi -dmenu -config ~/.config/rofi/config-rofi-Beats-menu.rasi -p "Select music source") diff --git a/config/hypr/UserScripts/RofiCalc.sh b/config/hypr/UserScripts/RofiCalc.sh index 355130de..cef80b81 100755 --- a/config/hypr/UserScripts/RofiCalc.sh +++ b/config/hypr/UserScripts/RofiCalc.sh @@ -8,7 +8,6 @@ rofi_config="$HOME/.config/rofi/config-calc.rasi" # Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then pkill rofi - exit 0 fi # main function diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh index 9c872457..9a9d289c 100755 --- a/config/hypr/UserScripts/WallpaperEffects.sh +++ b/config/hypr/UserScripts/WallpaperEffects.sh @@ -95,7 +95,6 @@ main() { # Check if rofi is already running and kill it if pidof rofi > /dev/null; then pkill rofi - exit 0 fi main diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index d74933a3..8daa4f28 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -97,7 +97,6 @@ main() { # Check if rofi is already running if pidof rofi > /dev/null; then pkill rofi - sleep 1 # Allow some time for rofi to close fi main diff --git a/config/hypr/UserScripts/ZshChangeTheme.sh b/config/hypr/UserScripts/ZshChangeTheme.sh index 57fbf37d..662a36bb 100755 --- a/config/hypr/UserScripts/ZshChangeTheme.sh +++ b/config/hypr/UserScripts/ZshChangeTheme.sh @@ -48,4 +48,9 @@ main() { fi } +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + main diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index 6ab51bd5..019ca11d 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -37,7 +37,8 @@ bind = $mainMod, W, exec, $UserScripts/WallpaperSelect.sh # Select wallpaper to bind = $mainMod SHIFT, W, exec, $UserScripts/WallpaperEffects.sh # Wallpaper Effects by imagemagick bind = CTRL ALT, W, exec, $UserScripts/WallpaperRandom.sh # Random wallpapers bind = $mainMod ALT, O, exec, hyprctl setprop active opaque toggle # disable opacity on active window -bind = $mainMod SHIFT, K, exec, pkill rofi || $scriptsDir/KeyBinds.sh # search keybinds via rofi +bind = $mainMod SHIFT, K, exec, $scriptsDir/KeyBinds.sh # search keybinds via rofi + # Waybar / Bar related bind = $mainMod, B, exec, pkill -SIGUSR1 waybar # Toggle hide/show waybar bind = $mainMod CTRL, B, exec, $scriptsDir/WaybarStyles.sh # Waybar Styles Menu diff --git a/config/hypr/scripts/ClipManager.sh b/config/hypr/scripts/ClipManager.sh index ddce2999..13f90a9e 100755 --- a/config/hypr/scripts/ClipManager.sh +++ b/config/hypr/scripts/ClipManager.sh @@ -6,6 +6,11 @@ # CTRL Del to delete an entry # ALT Del to wipe clipboard contents +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + while true; do result=$( rofi -i -dmenu \ diff --git a/config/hypr/scripts/KeyBinds.sh b/config/hypr/scripts/KeyBinds.sh index 4aca73d9..9e01a7c3 100755 --- a/config/hypr/scripts/KeyBinds.sh +++ b/config/hypr/scripts/KeyBinds.sh @@ -5,6 +5,11 @@ # Kill yad to not interfere with this binds pkill yad || true +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + # Define the config files KEYBINDS_CONF="$HOME/.config/hypr/configs/Keybinds.conf" USER_KEYBINDS_CONF="$HOME/.config/hypr/UserConfigs/UserKeybinds.conf" diff --git a/config/hypr/scripts/RofiEmoji.sh b/config/hypr/scripts/RofiEmoji.sh index 6bf6a5ab..fa27a341 100755 --- a/config/hypr/scripts/RofiEmoji.sh +++ b/config/hypr/scripts/RofiEmoji.sh @@ -2,6 +2,11 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Rofi Emoticons. Not my own. Cant remember the source +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + sed '1,/^# # DATA # #$/d' "$0" | \ rofi -i -dmenu -config ~/.config/rofi/config-emoji.rasi | \ awk -F'\t' '{print $1}' | \ @@ -10,6 +15,7 @@ wl-copy exit + # # DATA # # 😀 face face | grin | grinning face 😃 face with big eyes face | grinning face with big eyes | mouth | open | smile diff --git a/config/hypr/scripts/RofiSearch.sh b/config/hypr/scripts/RofiSearch.sh index 9b7e4bd4..ccc73016 100755 --- a/config/hypr/scripts/RofiSearch.sh +++ b/config/hypr/scripts/RofiSearch.sh @@ -9,7 +9,7 @@ rofi_config="$HOME/.config/rofi/config-search.rasi" # Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then pkill rofi - exit 0 + #exit 0 fi # Open rofi with a dmenu and pass the selected item to xdg-open for Google search diff --git a/config/hypr/scripts/WaybarLayout.sh b/config/hypr/scripts/WaybarLayout.sh index 36cbeb10..738d34f4 100755 --- a/config/hypr/scripts/WaybarLayout.sh +++ b/config/hypr/scripts/WaybarLayout.sh @@ -50,7 +50,7 @@ main() { # Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then pkill rofi - exit 0 + #exit 0 fi main diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh index 95a348ba..096e4d7c 100755 --- a/config/hypr/scripts/WaybarStyles.sh +++ b/config/hypr/scripts/WaybarStyles.sh @@ -44,7 +44,7 @@ main() { # Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then pkill rofi - exit 0 + #exit 0 fi main -- cgit v1.2.3