From 88bda96496044341b1338dd4b979c83c0b8b0393 Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Fri, 30 May 2025 23:04:26 +0200 Subject: [PATCH] Fixed volume and media keybinds --- .config/hypr/scripts/MediaCtrl.sh | 38 +++++++++++++++---- .config/hypr/scripts/Volume.sh | 12 +++--- .../applications/11-DesktopEnv.sh | 3 +- .ideavimrc | 4 +- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/.config/hypr/scripts/MediaCtrl.sh b/.config/hypr/scripts/MediaCtrl.sh index 85a401f..06986dd 100755 --- a/.config/hypr/scripts/MediaCtrl.sh +++ b/.config/hypr/scripts/MediaCtrl.sh @@ -2,42 +2,66 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Playerctl -music_icon="$HOME/.config/swaync/icons/music.png" +iconPath="/usr/share/icons/Qogir/24/actions" + +nextIcon="$iconPath/gtk-media-next-ltr.svg" +previousIcon="$iconPath/gtk-media-previous-ltr.svg" +stopIcon="$iconPath/gtk-media-stop.svg" +playIcon="$iconPath/gtk-media-play-ltr.svg" +pauseIcon="$iconPath/gtk-media-pause.svg" # Play the next track play_next() { playerctl next - show_music_notification + show_music_notification next } # Play the previous track play_previous() { playerctl previous - show_music_notification + show_music_notification previous } # Toggle play/pause toggle_play_pause() { playerctl play-pause - show_music_notification + show_music_notification toggle } # Stop playback stop_playback() { playerctl stop - notify-send -e -u low -i $music_icon " Playback:" " Stopped" + notify-send -e -u low -i $stopIcon " Playback:" " Stopped" } # Display notification with song information show_music_notification() { + sleep 0.5s status=$(playerctl status) + icon="" + case "$1" in + "next") + icon=$nextIcon + ;; + "previous") + icon=$previousIcon + ;; + "toggle") + if [[ "$status" == "Paused" ]]; then + icon=$pauseIcon + else + icon=$playIcon + fi + ;; + esac + if [[ "$status" == "Playing" ]]; then song_title=$(playerctl metadata title) song_artist=$(playerctl metadata artist) - notify-send -e -u low -i $music_icon "Now Playing:" "$song_title by $song_artist" + notify-send -e -u low -i $icon "Now Playing:" "$song_title by $song_artist" elif [[ "$status" == "Paused" ]]; then - notify-send -e -u low -i $music_icon " Playback:" " Paused" + notify-send -e -u low -i $icon " Playback:" " Paused" fi } diff --git a/.config/hypr/scripts/Volume.sh b/.config/hypr/scripts/Volume.sh index 2ab6a51..a6d962f 100755 --- a/.config/hypr/scripts/Volume.sh +++ b/.config/hypr/scripts/Volume.sh @@ -2,7 +2,7 @@ # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Scripts for volume controls for audio and mic -iDIR="$HOME/.config/swaync/icons" +iDIR="/usr/share/icons/Qogir/24/actions" sDIR="$HOME/.config/hypr/scripts" # Get Volume @@ -19,13 +19,13 @@ get_volume() { get_icon() { current=$(get_volume) if [[ "$current" == "Muted" ]]; then - echo "$iDIR/volume-mute.png" + echo "$iDIR/audio-volume-muted.svg" elif [[ "${current%\%}" -le 30 ]]; then - echo "$iDIR/volume-low.png" + echo "$iDIR/audio-volume-low.svg" elif [[ "${current%\%}" -le 60 ]]; then - echo "$iDIR/volume-mid.png" + echo "$iDIR/audio-volume-medium.svg" else - echo "$iDIR/volume-high.png" + echo "$iDIR/audio-volume-high.svg" fi } @@ -60,7 +60,7 @@ dec_volume() { # Toggle Mute toggle_mute() { if [ "$(pamixer --get-mute)" == "false" ]; then - pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" " Mute" + pamixer -m && notify-send -e -u low -i "$iDIR/audio-volume-muted.svg" " Mute" elif [ "$(pamixer --get-mute)" == "true" ]; then pamixer -u && notify-send -e -u low -i "$(get_icon)" " Volume:" " Switched ON" fi diff --git a/.config/yadm/bootstrap.v2/applications/11-DesktopEnv.sh b/.config/yadm/bootstrap.v2/applications/11-DesktopEnv.sh index 4ad2f19..829bd15 100755 --- a/.config/yadm/bootstrap.v2/applications/11-DesktopEnv.sh +++ b/.config/yadm/bootstrap.v2/applications/11-DesktopEnv.sh @@ -31,5 +31,6 @@ if [ $XDG_SESSION_DESKTOP = "Hyprland" ]; then darkman \ anyrun-git \ hyprshade-git \ - posy-improved-cursors + posy-improved-cursors \ + pamixer fi diff --git a/.ideavimrc b/.ideavimrc index 0c47824..6a80706 100644 --- a/.ideavimrc +++ b/.ideavimrc @@ -112,8 +112,6 @@ let g:WhichKeyDesc_errors_prev = "ep Go to previous error in solution" "" Key mappings "" ======================================================== -inoremap jj - " Tab navigation nnoremap :tabnext nnoremap :tabprev @@ -180,7 +178,7 @@ map fl (RecentLocations) map fs (NewScratchFile) " Close active tab -map q (CloseContent) +map q (CloseContent) " Refactoring map rn (RenameElement)