Skip to content

Commit 26627e0

Browse files
committed
Fix taffybar host CSS composition
1 parent e10f8cd commit 26627e0

6 files changed

Lines changed: 113 additions & 100 deletions

File tree

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,83 @@
11
/* End-widget color rotation.
22
*
3-
* Defines a 5-color palette and cycles through it using :nth-child().
4-
* End widgets are children of their own container box in taffybar's layout,
5-
* so nth-child counts only among siblings in that box.
6-
*
7-
* NOTE: These rules also match workspace .outer-pad elements.
8-
* taffybar.css resets workspace pills via `.workspaces .outer-pad` which
9-
* has equal specificity but comes later in the cascade, so it wins.
3+
* End widgets get semantic palette classes from Haskell (`.end-widget` plus
4+
* `.end-slot-N`) when they are packed into the bar. That keeps the CSS simple
5+
* and avoids relying on GTK's `:nth-child(...)` matching behavior.
106
*
117
* To change the palette, edit the @define-color values below.
12-
* To add more colors to the rotation, add end-color-6-* etc. and a
13-
* corresponding :nth-child(Nn+6) rule block (updating N in all selectors).
8+
* To add more colors to the rotation, add end-color-6-* etc. and a matching
9+
* `.end-slot-6` rule.
1410
*/
1511

1612
/* --- Rotation palette (5 colors) --- */
1713

1814
/* 1 — indigo */
19-
@define-color end-color-1-bg rgba(50, 60, 160, 0.92);
15+
@define-color end-color-1-bg rgb(50, 60, 160);
2016
@define-color end-color-1-fg #d5d8f8;
21-
@define-color end-color-1-border rgba(90, 100, 210, 0.60);
17+
@define-color end-color-1-border rgb(90, 100, 210);
2218

2319
/* 2 — purple */
24-
@define-color end-color-2-bg rgba(110, 45, 160, 0.92);
20+
@define-color end-color-2-bg rgb(110, 45, 160);
2521
@define-color end-color-2-fg #e8d5f8;
26-
@define-color end-color-2-border rgba(155, 85, 210, 0.60);
22+
@define-color end-color-2-border rgb(155, 85, 210);
2723

2824
/* 3 — emerald */
29-
@define-color end-color-3-bg rgba(25, 130, 75, 0.92);
25+
@define-color end-color-3-bg rgb(25, 130, 75);
3026
@define-color end-color-3-fg #c8f5e0;
31-
@define-color end-color-3-border rgba(55, 190, 115, 0.60);
27+
@define-color end-color-3-border rgb(55, 190, 115);
3228

3329
/* 4 — teal */
34-
@define-color end-color-4-bg rgba(20, 120, 140, 0.92);
30+
@define-color end-color-4-bg rgb(20, 120, 140);
3531
@define-color end-color-4-fg #d0f2f8;
36-
@define-color end-color-4-border rgba(50, 175, 200, 0.60);
32+
@define-color end-color-4-border rgb(50, 175, 200);
3733

3834
/* 5 — rose */
39-
@define-color end-color-5-bg rgba(160, 40, 70, 0.92);
35+
@define-color end-color-5-bg rgb(160, 40, 70);
4036
@define-color end-color-5-fg #f8d5e0;
41-
@define-color end-color-5-border rgba(210, 80, 115, 0.60);
37+
@define-color end-color-5-border rgb(210, 80, 115);
4238

4339
/* --- Color rotation rules --- */
4440

45-
/* Slot 1: indigo (child 1, 6, 11, ...) */
46-
.outer-pad:nth-child(5n+1) {
41+
/* Slot 1: indigo */
42+
.outer-pad.end-widget.end-slot-1 {
4743
background-color: @end-color-1-bg;
44+
background-image: none;
4845
border-color: @end-color-1-border;
4946
color: @end-color-1-fg;
5047
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.30);
5148
}
5249

53-
/* Slot 2: purple (child 2, 7, 12, ...) */
54-
.outer-pad:nth-child(5n+2) {
50+
/* Slot 2: purple */
51+
.outer-pad.end-widget.end-slot-2 {
5552
background-color: @end-color-2-bg;
53+
background-image: none;
5654
border-color: @end-color-2-border;
5755
color: @end-color-2-fg;
5856
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.30);
5957
}
6058

61-
/* Slot 3: emerald (child 3, 8, 13, ...) */
62-
.outer-pad:nth-child(5n+3) {
59+
/* Slot 3: emerald */
60+
.outer-pad.end-widget.end-slot-3 {
6361
background-color: @end-color-3-bg;
62+
background-image: none;
6463
border-color: @end-color-3-border;
6564
color: @end-color-3-fg;
6665
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.30);
6766
}
6867

69-
/* Slot 4: teal (child 4, 9, 14, ...) */
70-
.outer-pad:nth-child(5n+4) {
68+
/* Slot 4: teal */
69+
.outer-pad.end-widget.end-slot-4 {
7170
background-color: @end-color-4-bg;
71+
background-image: none;
7272
border-color: @end-color-4-border;
7373
color: @end-color-4-fg;
7474
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.30);
7575
}
7676

77-
/* Slot 5: rose (child 5, 10, 15, ...) */
78-
.outer-pad:nth-child(5n+5) {
77+
/* Slot 5: rose */
78+
.outer-pad.end-widget.end-slot-5 {
7979
background-color: @end-color-5-bg;
80+
background-image: none;
8081
border-color: @end-color-5-border;
8182
color: @end-color-5-fg;
8283
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.30);
@@ -85,7 +86,8 @@
8586
/* --- SNI tray (center widget, not part of the rotation) --- */
8687

8788
.outer-pad.sni-tray {
88-
background-color: @widget-tray-bg;
89-
border-color: @widget-tray-border;
89+
background-color: rgb(65, 70, 100);
90+
background-image: none;
91+
border-color: rgb(110, 115, 160);
9092
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.30);
9193
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* Final pass overrides for end-widget pill chrome.
2+
*
3+
* This is loaded after the main bar/theme CSS so the end-widget palette stays
4+
* vivid even if earlier rules or theme rendering make the pills read too
5+
* transparent on some hosts.
6+
*/
7+
8+
.outer-pad.end-widget.end-slot-1 {
9+
background-color: rgb(50, 60, 160);
10+
background-image: none;
11+
border-color: rgb(90, 100, 210);
12+
}
13+
14+
.outer-pad.end-widget.end-slot-2 {
15+
background-color: rgb(110, 45, 160);
16+
background-image: none;
17+
border-color: rgb(155, 85, 210);
18+
}
19+
20+
.outer-pad.end-widget.end-slot-3 {
21+
background-color: rgb(25, 130, 75);
22+
background-image: none;
23+
border-color: rgb(55, 190, 115);
24+
}
25+
26+
.outer-pad.end-widget.end-slot-4 {
27+
background-color: rgb(20, 120, 140);
28+
background-image: none;
29+
border-color: rgb(50, 175, 200);
30+
}
31+
32+
.outer-pad.end-widget.end-slot-5 {
33+
background-color: rgb(160, 40, 70);
34+
background-image: none;
35+
border-color: rgb(210, 80, 115);
36+
}
37+
38+
.outer-pad.sni-tray {
39+
background-color: rgb(65, 70, 100);
40+
background-image: none;
41+
border-color: rgb(110, 115, 160);
42+
}
43+
44+
.outer-pad.end-widget,
45+
.outer-pad.sni-tray {
46+
box-shadow:
47+
inset 0 1px 0 rgba(255, 255, 255, 0.10),
48+
inset 0 0 0 1px rgba(255, 255, 255, 0.10),
49+
0 10px 24px rgba(0, 0, 0, 0.30);
50+
}
Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,9 @@
1+
@import url("taffybar.css");
2+
13
/* Host-specific density tweaks for ryzen-shine. Keep the same visual style,
24
* but shrink the bar back down after the upstream sizing change.
35
*/
46

57
.taffy-box {
68
font-size: 10pt;
79
}
8-
9-
.outer-pad {
10-
margin: 2px 3px;
11-
}
12-
13-
.inner-pad {
14-
padding: 1px 8px;
15-
}
16-
17-
.icon-label > .icon {
18-
padding-right: 8px;
19-
}
20-
21-
.ram-swap .icon-label > .icon {
22-
min-width: 18px;
23-
padding-right: 6px;
24-
}
25-
26-
.workspaces .outer-pad {
27-
margin: 2px 2px;
28-
}
29-
30-
.workspaces .inner-pad {
31-
padding: 1px 2px 1px 8px;
32-
}
33-
34-
.workspace-label {
35-
font-size: 9pt;
36-
}
37-
38-
.workspaces .overlay-box .workspace-label {
39-
padding: 1px 4px 3px 10px;
40-
}
41-
42-
.window-icon-container {
43-
padding: 0px 3px;
44-
}
45-
46-
.auto-size-image, .sni-tray {
47-
padding: 0px 3px;
48-
}
49-
50-
.sni-tray-expand-toggle,
51-
.sni-tray-edit-toggle,
52-
.sni-tray-settings-toggle {
53-
padding: 0px 3px;
54-
margin-left: 2px;
55-
}

dotfiles/config/taffybar/taffybar.css

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
@import url("theme.css");
2+
@import url("end-widget-colors.css");
3+
@import url("end-widget-solid.css");
4+
15
/* Widget/layout styling for taffybar.
26
*
3-
* Colors live in `theme.css`, and the end-widget palette lives in
4-
* `end-widget-colors.css`. Both are loaded explicitly from `cssPaths` so they
5-
* hot-reload reliably and do not depend on GTK's `@import` handling.
7+
* This file is the single CSS entrypoint for the shared bar theme. Supporting
8+
* stylesheets are pulled in via `@import` so GTK sees one user stylesheet per
9+
* host rather than several separately loaded files with fragile precedence.
610
*/
711

812
/* Base typography + foreground color for the bar itself.
@@ -15,7 +19,7 @@
1519
/* Most text should come from Iosevka Aile; icon glyphs (Font Awesome / Nerd
1620
Font PUA) should come from a Nerd Font family to avoid tiny fallback glyphs. */
1721
font-family: "Iosevka Aile", "Iosevka Nerd Font", "Iosevka NF", "Noto Sans", sans-serif;
18-
font-size: 11pt;
22+
font-size: 10.5pt;
1923
font-weight: 600;
2024
color: @font-color;
2125
text-shadow: none;
@@ -48,26 +52,27 @@
4852
padding: 0px 4px;
4953
}
5054

51-
/* The main bar container. border-radius matches the widget squircles (6px)
52-
so the bar itself has softly rounded corners. */
55+
/* The main bar container. Keep the bar and widget pills aligned so the whole
56+
surface reads as one rounded system rather than a mix of sharp and round
57+
shapes. */
5358
.taffy-box {
5459
border-width: 0px;
5560
padding: 0px;
5661
margin: 0px;
57-
border-radius: 6px;
62+
border-radius: 10px;
5863
box-shadow: none;
5964
background-color: @bar-background;
6065
background-image: none;
6166
}
6267

6368
/* Each widget is wrapped in outer-pad > inner-pad > contents by
6469
buildContentsBox (Haskell). The outer-pad draws the squircle
65-
background pill. border-radius kept low (6px) for a more squared
66-
"squircle" shape rather than a fully rounded pill. */
70+
background pill. Use a clearly rounded radius so the pill silhouette stays
71+
visible even on the denser desktop monitor. */
6772
.outer-pad {
6873
background-color: @pill-background;
6974
border: 0px;
70-
border-radius: 6px;
75+
border-radius: 10px;
7176
margin: 4px 4px;
7277
/* No white outline; define shape with subtle inner highlight + dark stroke. */
7378
box-shadow:
@@ -78,7 +83,7 @@
7883

7984
.inner-pad {
8085
padding: 2px 10px;
81-
border-radius: 4px;
86+
border-radius: 8px;
8287
}
8388

8489
.contents {
@@ -142,7 +147,7 @@
142147

143148
.workspaces .contents {
144149
box-shadow: none;
145-
border-radius: 5px;
150+
border-radius: 8px;
146151
border-width: 0px;
147152
border-style: solid;
148153
border-color: @transparent;
@@ -153,7 +158,7 @@
153158
/* Overlay label (workspace number) that sits inside the icon "squircle". */
154159
padding: 1px 3px;
155160
margin: 0px;
156-
font-size: 10pt;
161+
font-size: 9.5pt;
157162
opacity: 0.92;
158163
font-weight: 700;
159164
transition: color .2s;
@@ -231,7 +236,7 @@
231236
.workspaces .window-icon-container.active {
232237
background-color: rgba(255, 255, 255, 0.10);
233238
border: 1px solid rgba(255, 255, 255, 0.5);
234-
border-radius: 4px;
239+
border-radius: 7px;
235240
padding: 2px 4px;
236241
}
237242

@@ -247,7 +252,7 @@
247252
.window-icon-container {
248253
transition: opacity .2s, box-shadow .2s;
249254
opacity: 1;
250-
border-radius: 5px;
255+
border-radius: 8px;
251256
transition: background-color .2s;
252257
background-color: rgba(255, 255, 255, 0.04);
253258
padding: 1px 4px;
@@ -266,7 +271,7 @@
266271
.sni-tray-settings-toggle {
267272
background-color: rgba(255, 255, 255, 0.08);
268273
border: 1px solid rgba(255, 255, 255, 0.18);
269-
border-radius: 6px;
274+
border-radius: 8px;
270275
padding: 0px 4px;
271276
margin-left: 3px;
272277
}
@@ -343,7 +348,7 @@
343348

344349
.wakeup-debug-hit {
345350
background-color: rgba(255, 255, 255, 0.22);
346-
border-radius: 5px;
351+
border-radius: 8px;
347352
}
348353

349354

dotfiles/config/taffybar/taffybar.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ workspaceWindowIconGetter =
246246
-- ** Host Overrides
247247

248248
defaultCssFiles :: [FilePath]
249-
defaultCssFiles = ["theme.css", "end-widget-colors.css", "taffybar.css"]
249+
defaultCssFiles = ["taffybar.css"]
250250

251251
cssFilesByHostname :: [(String, [FilePath])]
252252
cssFilesByHostname =
253-
[ ("imalison-home", ["theme.css", "end-widget-colors.css", "taffybar.css"]),
254-
("ryzen-shine", ["theme.css", "end-widget-colors.css", "taffybar.css", "ryzen-shine.css"]),
255-
("stevie-nixos", ["theme.css", "end-widget-colors.css", "taffybar.css"])
253+
[ ("imalison-home", ["taffybar.css"]),
254+
("ryzen-shine", ["ryzen-shine.css"]),
255+
("stevie-nixos", ["taffybar.css"])
256256
]
257257

258258
laptopHosts :: [String]
@@ -509,6 +509,8 @@ cpuWidget =
509509
cpuMonitorNew
510510
defaultGraphConfig
511511
{ graphDataColors = [(0, 1, 0.5, 0.8), (1, 0, 0, 0.5)],
512+
graphBackgroundColor = (0, 0, 0, 0),
513+
graphBorderWidth = 0,
512514
graphLabel = Just "CPU",
513515
graphWidth = 50,
514516
graphDirection = LEFT_TO_RIGHT
66 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)