From a6b38487fece5b27f8cb3602912007b585d3bc93 Mon Sep 17 00:00:00 2001 From: Snorky Date: Wed, 24 Sep 2025 21:55:26 +0200 Subject: [PATCH] Add music in i3status --- i3/config | 5 ++-- i3status/mytopbar.sh | 67 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/i3/config b/i3/config index b5ab5e9..612d49d 100644 --- a/i3/config +++ b/i3/config @@ -124,6 +124,7 @@ bindsym Mod4+space focus mode_toggle # default_border pixel 1 for_window [class="^.*"] border pixel 1 for_window [class="term_date"] floating enable +for_window [class="org.nicotine_plus.Nicotine"] floating enable for_window [class="mpv"] floating enable resize set 680 420 #default_floating_border pixel 1 #gaps inner 1px @@ -134,11 +135,11 @@ bindsym Mod4+a focus parent #bindsym Mod4+d focus child # move the currently focused window to the scratchpad -bindsym Mod4+Shift+minus move scratchpad +#bindsym Mod4+Shift+minus move scratchpad # Show the next scratchpad window or hide the focused scratchpad window. # If there are multiple scratchpad windows, this command cycles through them. -bindsym Mod4+minus scratchpad show +#bindsym Mod4+minus scratchpad show # Define names for default workspaces for which we configure key bindings later on. # We use variables to avoid repeating the names in multiple places. diff --git a/i3status/mytopbar.sh b/i3status/mytopbar.sh index af1a4c7..e6e30de 100755 --- a/i3status/mytopbar.sh +++ b/i3status/mytopbar.sh @@ -42,7 +42,7 @@ root_text() { echo -n ",{" echo -n "\"name\":\"id_root_text\"," echo -n "\"color\":\"$text_color\"," - echo -n "\"full_text\":\" $(echo -n 'Root:')\"," + echo -n "\"full_text\":\"  $(echo -n 'Root:')\"," echo -n "\"background\":\"$bg\"," common echo -n "}," @@ -293,6 +293,58 @@ systemupdate() { fi } + +Artist_text() { + local bg="#000000" + local text_color="#D48F06" + separator $bg "#FFD180" + echo -n ",{" + echo -n "\"name\":\"id_artist_text\"," + echo -n "\"color\":\"$text_color\"," + echo -n "\"full_text\":\"🎧 $(ncmpcpp --current-song "{%a} ")\"," + echo -n "\"background\":\"$bg\"," + common + echo -n "}," +} + +Music_text() { + local bg="#000000" + local text_color="#00A300" + separator $bg "#FFD180" + echo -n ",{" + echo -n "\"name\":\"id_music_text\"," + echo -n "\"color\":\"$text_color\"," + echo -n "\"full_text\":\"$(ncmpcpp --current-song "{%t} ")\"," + echo -n "\"background\":\"$bg\"," + common + echo -n "}," +} + +Album_text() { + local bg="#000000" + local text_color="#D48F06" + separator $bg "#FFD180" + echo -n ",{" + echo -n "\"name\":\"id_album_text\"," + echo -n "\"color\":\"$text_color\"," + echo -n "\"full_text\":\"$(ncmpcpp --current-song " {%b} ")\"," + echo -n "\"background\":\"$bg\"," + common + echo -n "}," +} + +cutator() { + local bg="#000000" + local text_color="#919191" + separator $bg "#FFD180" + echo -n ",{" + echo -n "\"name\":\"id_cutator_text\"," + echo -n "\"color\":\"$text_color\"," + echo -n "\"full_text\":\"$(echo -n '||')\"," + echo -n "\"background\":\"$bg\"," + common + echo -n "}," +} logout() { echo -n ",{" echo -n "\"name\":\"id_logout\"," @@ -309,6 +361,10 @@ echo '[]' # We send an empty first array of blocks to make the (while :; do echo -n ",[" + Artist_text + Music_text + Album_text + cutator root_text root_usage home_text @@ -317,12 +373,14 @@ do boot_usage src_text src_usage - seclists_text - seclists_usage +# seclists_text +# seclists_usage + cutator memory_text memory cpu_text cpu_usage + cutator mydate bat_text battery0 @@ -350,6 +408,9 @@ do elif [[ $line == *"name"*"id_volume"* ]]; then wezterm -e --class term_date -e pulsemixer & + elif [[ $line == *"name"*"artist"* ]]; then + wezterm -e --class term_date -e ncmpcpp & + # # LOGOUT elif [[ $line == *"name"*"id_logout"* ]]; then i3-nagbar -t warning -m 'Log out ?' -b 'yes' 'i3-msg exit' > /dev/null &