Add music in i3status

This commit is contained in:
Snorky 2025-09-24 21:55:26 +02:00
parent 68298a6d58
commit a6b38487fe
2 changed files with 67 additions and 5 deletions

View File

@ -124,6 +124,7 @@ bindsym Mod4+space focus mode_toggle
# default_border pixel 1 # default_border pixel 1
for_window [class="^.*"] border pixel 1 for_window [class="^.*"] border pixel 1
for_window [class="term_date"] floating enable 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 for_window [class="mpv"] floating enable resize set 680 420
#default_floating_border pixel 1 #default_floating_border pixel 1
#gaps inner 1px #gaps inner 1px
@ -134,11 +135,11 @@ bindsym Mod4+a focus parent
#bindsym Mod4+d focus child #bindsym Mod4+d focus child
# move the currently focused window to the scratchpad # 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. # Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them. # 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. # Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places. # We use variables to avoid repeating the names in multiple places.

View File

@ -42,7 +42,7 @@ root_text() {
echo -n ",{" echo -n ",{"
echo -n "\"name\":\"id_root_text\"," echo -n "\"name\":\"id_root_text\","
echo -n "\"color\":\"$text_color\"," echo -n "\"color\":\"$text_color\","
echo -n "\"full_text\":\"$(echo -n 'Root:')\"," echo -n "\"full_text\":\" $(echo -n 'Root:')\","
echo -n "\"background\":\"$bg\"," echo -n "\"background\":\"$bg\","
common common
echo -n "}," echo -n "},"
@ -293,6 +293,58 @@ systemupdate() {
fi 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() { logout() {
echo -n ",{" echo -n ",{"
echo -n "\"name\":\"id_logout\"," echo -n "\"name\":\"id_logout\","
@ -309,6 +361,10 @@ echo '[]' # We send an empty first array of blocks to make the
(while :; (while :;
do do
echo -n ",[" echo -n ",["
Artist_text
Music_text
Album_text
cutator
root_text root_text
root_usage root_usage
home_text home_text
@ -317,12 +373,14 @@ do
boot_usage boot_usage
src_text src_text
src_usage src_usage
seclists_text # seclists_text
seclists_usage # seclists_usage
cutator
memory_text memory_text
memory memory
cpu_text cpu_text
cpu_usage cpu_usage
cutator
mydate mydate
bat_text bat_text
battery0 battery0
@ -350,6 +408,9 @@ do
elif [[ $line == *"name"*"id_volume"* ]]; then elif [[ $line == *"name"*"id_volume"* ]]; then
wezterm -e --class term_date -e pulsemixer & wezterm -e --class term_date -e pulsemixer &
elif [[ $line == *"name"*"artist"* ]]; then
wezterm -e --class term_date -e ncmpcpp &
#
# LOGOUT # LOGOUT
elif [[ $line == *"name"*"id_logout"* ]]; then elif [[ $line == *"name"*"id_logout"* ]]; then
i3-nagbar -t warning -m 'Log out ?' -b 'yes' 'i3-msg exit' > /dev/null & i3-nagbar -t warning -m 'Log out ?' -b 'yes' 'i3-msg exit' > /dev/null &