1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
{ pkgs, ... }:
{
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 15;
modules-left = [ "hyprland/workspaces" "idle_inhibitor" ];
modules-center = [ "hyprland/window" ];
modules-right = [ "custom/spotify" "pulseaudio" "battery" "clock" ];
battery = {
interval = 60;
format = "{capacity}% {icon}";
format-charging = "{capacity}% {icon}";
format-icons = [" " " " " " " " " "];
max-length = 25;
};
clock = {
format = "{:%H:%M}";
tooltip = true;
tooltip-format = "{:%a, %b %d\nDay %j, Week %U\n%Z, UTC%z}";
};
"hyprland/window" = {
format = "{initialClass}";
on-click = "rofi -show window";
max-length = 25;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " ";
deactivated = " ";
};
};
pulseaudio = {
format = "{volume}% {icon}";
format-bluetooth = "{volume}% {icon}";
format-muted = "";
format-icons = {
default = [" " " "];
};
};
"custom/spotify" = {
format = "{}";
escape = true;
exec-if = "pgrep spotify";
interval = 1;
on-click = "playerctl --player=spotify_player,spotify play-pause";
on-click-right = "playerctl --player=spotify_player,spotify loop track";
on-double-click-right = "playerctl --player=spotify_player,spotify loop playlist";
on-click-middle = "playerctl --player=spotify_player,spotify shuffle toggle";
on-scroll-up = "playerctl --player=spotify_player,spotify next";
on-scroll-down = "playerctl --player=spotify_player,spotify previous";
exec = "${pkgs.writeShellScriptBin "spotifyplayer" ''
shorten() {
if [ ''${#1} -le 16 ]; then
printf "%s" "$1"
else
local truncated="''${1:0:13}"
if [ "''${truncated: -1}" = " " ]; then
truncated="''${truncated:0:12}"
fi
printf "%s…" "$truncated"
fi
}
player_status=$(playerctl --player=spotify_player,spotify status 2> /dev/null)
artist="$(shorten "$(playerctl --player=spotify_player,spotify metadata artist)")"
title="$(shorten "$(playerctl --player=spotify_player,spotify metadata title)")"
info="$artist - $title"
if [ "$(playerctl --player=spotify_player,spotify shuffle)" = "On" ]; then
info="$info "
fi
if [ "$player_status" != "Playing" ]; then
info="$info "
fi
if [ "$(playerctl --player=spotify_player,spotify loop)" = "Track" ]; then
info="$info "
fi
echo "$info "
''}/bin/spotifyplayer";
};
};
};
style = ''
*{
border: none;
border-radius: 0;
font-family: "JetBrains Mono"
}
window#waybar {
background: #141617;
color: #D4BE98;
}
label.module {
padding: 0 20px;
}
#workspaces button {
color: #D4BE98;
}
'';
};
}
|