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
123
124
125
126
127
128
|
{ pkgs, ... }:
{
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
modules-left = [ "hyprland/workspaces" "idle_inhibitor" ];
modules-center = [ "hyprland/window" ];
modules-right = [ "custom/feishin" "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/feishin" = {
format = "{}";
escape = true;
exec-if = "pgrep -f 'feishin'";
interval = 1;
on-click = "playerctl --player=,Feishin play-pause";
on-click-right = "playerctl --player=,Feishin loop track";
on-double-click-right = "playerctl --player=,Feishin loop playlist";
on-click-middle = "playerctl --player=,Feishin shuffle toggle";
on-scroll-up = "playerctl --player=,Feishin next";
on-scroll-down = "playerctl --player=,Feishin previous";
exec = "${pkgs.writeShellScriptBin "feishin-module-script" ''
shorten() {
if [ ''${#1} -le 12 ]; then
printf "%s" "$1"
else
local truncated="''${1:0:9}"
if [ "''${truncated: -1}" = " " ]; then
truncated="''${truncated:0:8}"
fi
printf "%s…" "$truncated"
fi
}
player_status=$(playerctl --player=,Feishin status 2> /dev/null)
artist="$(shorten "$(playerctl --player=,Feishin metadata artist)")"
title="$(shorten "$(playerctl --player=,Feishin metadata title)")"
info="$artist - $title"
if [ "$(playerctl --player=,Feishin shuffle)" = "On" ]; then
info="$info "
fi
if [ "$player_status" != "Playing" ]; then
info="$info "
fi
if [ "$(playerctl --player=,Feishin loop)" = "Track" ]; then
info="$info "
fi
echo "$info "
''}/bin/feishin-module-script";
};
};
};
style = ''
*{
border: none;
border-radius: 0;
font-family: "JetBrains Mono"
}
window#waybar {
background: #141617;
color: #D4BE98;
}
label.module {
padding: 0 15px;
}
#workspaces button {
background: #141617;
color: #D4BE98;
}
#workspaces button active {
background: #D4BE98;
color: #141617;
}
'';
};
}
|