add current playing music to polybar

This commit is contained in:
Kopatz
2024-07-19 19:45:32 +02:00
parent 23ef026095
commit 190b82526a
5 changed files with 42 additions and 20 deletions

View File

@@ -33,7 +33,9 @@ tiling_drag modifier titlebar
# start a terminal # start a terminal
bindsym $mod+q exec kitty bindsym $mod+q exec kitty
bindsym $mod+e exec thunar bindsym $mod+e exec thunar
bindsym Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png #bindsym Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png
bindsym Print exec --no-startup-id flameshot gui
# kill focused window # kill focused window
bindsym $mod+c kill bindsym $mod+c kill
# lock with wallpaper # lock with wallpaper
@@ -270,8 +272,8 @@ exec --no-startup-id nm-applet
# set lock timeout to 20 minutes # set lock timeout to 20 minutes
exec_always --no-startup-id xset dpms 0 0 1200 & exec_always --no-startup-id xset dpms 0 0 1200 &
exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/scripts/lock.sh exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/scripts/lock.sh
# prevent screen locking # prevent screen locking, has xdg autostart
exec --no-startup-id caffeine # exec --no-startup-id caffeine
# NetworkManager is the most popular way to manage wireless networks on Linux, # NetworkManager is the most popular way to manage wireless networks on Linux,

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# hack nerd font required for icons
player_status=$(playerctl status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
echo "$(playerctl metadata artist) - $(playerctl metadata title)"
elif [ "$player_status" = "Paused" ]; then
echo "$(playerctl metadata artist) - $(playerctl metadata title)"
else
echo "" # nothing is playing
fi

View File

@@ -43,7 +43,8 @@ in {
line-size = "3pt"; line-size = "3pt";
font-0 = "Noto Sans:size=11;1"; font-0 = "Noto Sans:size=11;1";
font-1 = "Hack-Regular.ttf: Hack:style=Regular"; font-1 = "Hack-Regular.ttf: Hack:style=Regular";
font-2 = "Noto Sans CJK JP:style=Regular"; font-2 = "HackNerdFont-Regular.ttf: Hack Nerd Font:style=Regular";
font-3 = "Noto Sans CJK JP:style=Regular";
border-top-size = 0; border-top-size = 0;
border-right-size = 0; border-right-size = 0;
border-left-size = 0; border-left-size = 0;
@@ -52,10 +53,10 @@ in {
padding-left = 2; padding-left = 2;
padding-right = 2; padding-right = 2;
module-margin = 1; module-margin = 1;
modules-left = "i3"; modules-left = "i3 xwindow";
modules-center = "xwindow"; modules-center = "";
modules-right = modules-right =
"network memory cpu cpu-temp gpu pulseaudio date tray"; "music network memory cpu cpu-temp gpu pulseaudio date tray";
cursor-click = "pointer"; cursor-click = "pointer";
cursor-scroll = "ns-resize"; cursor-scroll = "ns-resize";
enable-ipc = true; enable-ipc = true;
@@ -187,6 +188,14 @@ in {
exec = "~/.config/polybar/nvidia.sh"; exec = "~/.config/polybar/nvidia.sh";
interval = 3; interval = 3;
}; };
"module/music" = {
type = "custom/script";
exec = "~/.config/polybar/player-mpris-simple.sh";
interval = 3;
"click-left" = "playerctl previous &";
"click-right" = "playerctl next &";
"click-middle" = "playerctl play-pause &";
};
# "network-base" = { # "network-base" = {
# type = "internal/network"; # type = "internal/network";
# interval = 5; # interval = 5;

View File

@@ -1,18 +1,16 @@
{ {
plugins.diffview = { plugins = {
diffview = { enable = true; };
neogit = {
enable = true; enable = true;
integrations = { diffview = true; };
}; };
plugins.neogit = { gitsigns = {
enable = true;
integrations = {
diffview = true;
};
};
plugins.gitsigns = {
enable = true; enable = true;
settings = { settings = {
current_line_blame = true; current_line_blame = true;
trouble = true; trouble = true;
}; };
}; };
};
} }

View File

@@ -75,6 +75,7 @@ in {
brightnessctl brightnessctl
i3blocks i3blocks
autotiling autotiling
flameshot
pmutils # suspend with pm-suspend pmutils # suspend with pm-suspend
lm_sensors # for cpu in polybar lm_sensors # for cpu in polybar
feh # sets the wallpaper feh # sets the wallpaper