Restyle AGS bar as filled full-width bar with inverse corners
This commit is contained in:
parent
d341d83381
commit
84b689eb12
|
|
@ -1,5 +1,7 @@
|
||||||
@use "palette" as *;
|
@use "palette" as *;
|
||||||
|
|
||||||
|
$radius: 12px;
|
||||||
|
|
||||||
* {
|
* {
|
||||||
all: unset;
|
all: unset;
|
||||||
font-family: $font-family;
|
font-family: $font-family;
|
||||||
|
|
@ -13,12 +15,19 @@
|
||||||
|
|
||||||
.bar {
|
.bar {
|
||||||
background: $base01;
|
background: $base01;
|
||||||
border-radius: 10px;
|
|
||||||
margin: 8px;
|
|
||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
color: $base05;
|
color: $base05;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bar-corners {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner {
|
||||||
|
background: transparent;
|
||||||
|
color: $base01;
|
||||||
|
}
|
||||||
|
|
||||||
.ws {
|
.ws {
|
||||||
min-width: 20px;
|
min-width: 20px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,38 @@ import { WifiWidget } from "./Wifi"
|
||||||
import { BatteryWidget } from "./Battery"
|
import { BatteryWidget } from "./Battery"
|
||||||
import { PowerWidget } from "./Power"
|
import { PowerWidget } from "./Power"
|
||||||
|
|
||||||
|
const RADIUS = 12
|
||||||
|
|
||||||
|
// paints the concave sliver below the bar at the screen edge: the r x r
|
||||||
|
// square minus the quarter disk where the wallpaper shows through
|
||||||
|
function Corner({ side }: { side: "left" | "right" }) {
|
||||||
|
return (
|
||||||
|
<drawingarea
|
||||||
|
className="corner"
|
||||||
|
widthRequest={RADIUS}
|
||||||
|
heightRequest={RADIUS}
|
||||||
|
halign={side === "left" ? Gtk.Align.START : Gtk.Align.END}
|
||||||
|
onDraw={(self, cr) => {
|
||||||
|
const w = self.get_allocated_width()
|
||||||
|
const h = self.get_allocated_height()
|
||||||
|
const c = self.get_style_context().get_color(Gtk.StateFlags.NORMAL)
|
||||||
|
cr.setSourceRGBA(c.red, c.green, c.blue, c.alpha)
|
||||||
|
if (side === "left") {
|
||||||
|
cr.moveTo(0, 0)
|
||||||
|
cr.lineTo(w, 0)
|
||||||
|
cr.arcNegative(w, h, w, -Math.PI / 2, -Math.PI)
|
||||||
|
} else {
|
||||||
|
cr.moveTo(w, 0)
|
||||||
|
cr.lineTo(0, 0)
|
||||||
|
cr.arc(0, h, w, -Math.PI / 2, 0)
|
||||||
|
}
|
||||||
|
cr.closePath()
|
||||||
|
cr.fill()
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
|
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
|
||||||
const volume = VolumeWidget(gdkmonitor)
|
const volume = VolumeWidget(gdkmonitor)
|
||||||
|
|
@ -35,29 +67,36 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||||
anchor={TOP | LEFT | RIGHT}
|
anchor={TOP | LEFT | RIGHT}
|
||||||
application={App}
|
application={App}
|
||||||
>
|
>
|
||||||
<centerbox className="bar">
|
<box vertical>
|
||||||
<box
|
<centerbox className="bar">
|
||||||
className="bar-left"
|
<box
|
||||||
halign={Gtk.Align.START}
|
className="bar-left"
|
||||||
valign={Gtk.Align.CENTER}
|
halign={Gtk.Align.START}
|
||||||
>
|
valign={Gtk.Align.CENTER}
|
||||||
<Workspaces />
|
>
|
||||||
|
<Workspaces />
|
||||||
|
</box>
|
||||||
|
<box
|
||||||
|
className="bar-center"
|
||||||
|
halign={Gtk.Align.CENTER}
|
||||||
|
valign={Gtk.Align.CENTER}
|
||||||
|
>
|
||||||
|
<Clock />
|
||||||
|
</box>
|
||||||
|
<box
|
||||||
|
className="bar-right"
|
||||||
|
halign={Gtk.Align.END}
|
||||||
|
valign={Gtk.Align.CENTER}
|
||||||
|
>
|
||||||
|
{right}
|
||||||
|
</box>
|
||||||
|
</centerbox>
|
||||||
|
<box className="bar-corners">
|
||||||
|
<Corner side="left" />
|
||||||
|
<box hexpand />
|
||||||
|
<Corner side="right" />
|
||||||
</box>
|
</box>
|
||||||
<box
|
</box>
|
||||||
className="bar-center"
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
valign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
<Clock />
|
|
||||||
</box>
|
|
||||||
<box
|
|
||||||
className="bar-right"
|
|
||||||
halign={Gtk.Align.END}
|
|
||||||
valign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
{right}
|
|
||||||
</box>
|
|
||||||
</centerbox>
|
|
||||||
</window>
|
</window>
|
||||||
),
|
),
|
||||||
...popups,
|
...popups,
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export default function Notifications(gdkmonitor: Gdk.Monitor) {
|
||||||
anchor={TOP | RIGHT}
|
anchor={TOP | RIGHT}
|
||||||
exclusivity={Astal.Exclusivity.IGNORE}
|
exclusivity={Astal.Exclusivity.IGNORE}
|
||||||
keymode={Astal.Keymode.NONE}
|
keymode={Astal.Keymode.NONE}
|
||||||
marginTop={48}
|
marginTop={54}
|
||||||
marginRight={8}
|
marginRight={8}
|
||||||
visible={bind(notifd, "notifications").as((ns) => ns.length > 0)}
|
visible={bind(notifd, "notifications").as((ns) => ns.length > 0)}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue