blob: ff309779920e06bed89144c11c62beb825d6954f (
plain)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
{ config, lib, ... }:
{
xdg.configFile."eww/colors.css".text = let c = config.theme.colors; in ''
@define-color accent #${c.accent};
@define-color black #${c.black};
@define-color red #${c.red};
@define-color green #${c.green};
@define-color yellow #${c.yellow};
@define-color blue #${c.blue};
@define-color magenta #${c.magenta};
@define-color cyan #${c.cyan};
@define-color white #${c.white};
@define-color brightBlack #${c.brightBlack};
@define-color brightRed #${c.brightRed};
@define-color brightGreen #${c.brightGreen};
@define-color brightYellow #${c.brightYellow};
@define-color brightBlue #${c.brightBlue};
@define-color brightMagenta #${c.brightMagenta};
@define-color brightCyan #${c.brightCyan};
@define-color brightWhite #${c.brightWhite};
@define-color bg #${c.bg};
@define-color bg0 #${c.bg0};
@define-color bg1 #${c.bg1};
@define-color bg2 #${c.bg2};
@define-color bg3 #${c.bg3};
@define-color bg4 #${c.bg4};
@define-color fg #${c.fg};
@define-color fg0 #${c.fg0};
@define-color fg1 #${c.fg1};
@define-color fg2 #${c.fg2};
@define-color fg3 #${c.fg3};
@define-color fg4 #${c.fg4};
@define-color orange #${c.orange};
@define-color brightOrange #${c.brightOrange};
'';
xdg.configFile."eww/eww.css".text = ''
@import "colors.css";
window {
color: @fg;
background-color: @bg;
border: 2px solid @bg1;
}
.main {
margin: 8px;
}
.left {
margin-top: 8px;
}
.song-title {
font-size: 16px;
font-weight: bold;
}
.song-album {
color: @fg2;
}
.song-artist {
color: @fg2;
}
.control {
font-size: 24;
}
button {
color: @fg;
background: @bg;
border: none;
border-radius: 0;
box-shadow: none;
text-shadow: none;
}
button:hover {
background: @bg1;
}
button:active {
background: @bg2;
}
'';
xdg.configFile."eww/eww.yuck".text = ''
(defwindow music [pos]
:monitor "<primary>"
:geometry (geometry
:x { pos == "right" ? "-8px" : "0px" }
:y { pos == "right" ? "-8px" : "2px" }
:height {128 + 16}
:anchor { pos == "right" ? "bottom right" : "bottom center" }
)
:stacking "fg"
:windowtype "dock"
:wm-ignore true
(box :class "main"
:orientation "h"
:spacing 8
:space-evenly false
:height {128 + 16}
(image
:path { substring(song-cover, 7, 255) }
:image-width 128
:image-height 128
)
(box :class "left"
:orientation "v"
:spacing 0
:space-evenly true
:hexpand true
(box :class "info"
:orientation "v"
:space-evenly false
:valign "center"
(label :class "song-title"
:text song-title
:halign "start"
)
(label :class "song-album"
:text song-album
:halign "start"
)
(label :class "song-artist"
:text song-artist
:halign "start"
)
)
(box :class "control"
:space-evenly false
:halign "center"
:valign "end"
(button
:onclick `playerctl previous`
""
)
(button
:onclick `playerctl play-pause`
{ song-status == "Playing" ? "" : "" }
)
(button
:onclick `playerctl next`
""
)
; Offset controls to center of screen
(box :width {128 + 8})
)
)
)
)
(deflisten song-title
`playerctl -F metadata title`
)
(deflisten song-album
`playerctl -F metadata album`
)
(deflisten song-artist
`playerctl -F metadata artist`
)
(deflisten song-cover
`playerctl -F metadata mpris:artUrl`
)
(deflisten song-status
`playerctl -F status`
)
'';
}
|