Compare commits

..

No commits in common. "445e0269d86d184e9ca1cf1c0f10c4c5785fc459" and "285e007180c3d7744ad54ce4bab95e3fcc480493" have entirely different histories.

6 changed files with 56 additions and 77 deletions

View file

@ -8,55 +8,59 @@ window.Bar {
color: $ctp-text; color: $ctp-text;
>centerbox { >centerbox {
margin: 8px 8px 0 8px; background: $ctp-base;
border-radius: 5px;
margin: 8px;
padding: 8px;
} }
} }
.pill { .Time {
background: $ctp-surface-0;
border-radius: 5px;
>.icon { >.icon {
background: $ctp-red;
color: $ctp-surface-0; color: $ctp-surface-0;
padding: 6px 8px; padding: 6px 8px;
font-size: 18px; font-size: 18px;
} }
&.icon-left { &.icon-left>.icon {
&>.icon {
border-radius: 5px 0 0 5px; border-radius: 5px 0 0 5px;
} }
&>.label { &.icon-right>.icon {
border-radius: 0 5px 5px 0; border-radius: 0 5px 5px 0;
} }
}
&.icon-right {
&>.icon {
border-radius: 0 5px 5px 0;
}
&>.label {
border-radius: 5px 0 0 5px;
}
}
>.label { >.label {
background: $ctp-surface-0;
padding: 0 8px; padding: 0 8px;
font-size: 16px; font-size: 16px;
} }
} }
.Time >.icon {
background: $ctp-red;
}
.Date >.icon {
background: $ctp-lavender;
}
.Workspaces { .Workspaces {
background: $ctp-surface-0;
border-radius: 5px;
>.icon { >.icon {
background: $ctp-blue; background: $ctp-blue;
color: $ctp-surface-0;
padding: 6px 8px;
font-size: 18px;
} }
>.label button { &.icon-left>.icon {
border-radius: 5px 0 0 5px;
}
&.icon-right>.icon {
border-radius: 0 5px 5px 0;
}
>.labels {
padding: 0 8px;
font-size: 16px;
button {
all: unset; all: unset;
&.add { &.add {
@ -65,31 +69,28 @@ window.Bar {
} }
} }
} }
}
.Systray { .Systray {
background: $ctp-surface-0;
border-radius: 5px;
>.icon { >.icon {
background: $ctp-green; background: $ctp-green;
color: $ctp-surface-0;
padding: 4px 8px 0 8px; padding: 4px 8px 0 8px;
font-size: 20px; font-size: 20px;
}
.items {
background: $ctp-surface-0;
font-size: 16px;
}
&.icon-left {
.items {
border-radius: 0 5px 5px 0;
}
}
&.icon-right {
.items {
border-radius: 5px 0 0 5px; border-radius: 5px 0 0 5px;
} }
&.icon-left>.icon {
border-radius: 5px 0 0 5px;
}
&.icon-right>.icon {
border-radius: 0 5px 5px 0;
} }
.item { >.item {
all: unset; all: unset;
padding: 8px 8px; padding: 8px 8px;
} }

View file

@ -6,7 +6,7 @@ export default function Clock(props: { iconSide: "left" | "right" }) {
const time = Variable<string>("").poll(1000, () => const time = Variable<string>("").poll(1000, () =>
GLib.DateTime.new_now_local().format(TIME_FORMAT)!) GLib.DateTime.new_now_local().format(TIME_FORMAT)!)
return <box className={`pill Time icon-${props.iconSide}`}> return <box className={`Time icon-${props.iconSide}`}>
{props.iconSide == "left" && <label className="icon" label="" />} {props.iconSide == "left" && <label className="icon" label="" />}
<label <label
className="label" className="label"

View file

@ -1,18 +0,0 @@
import { GLib, Variable } from "astal"
const DATE_FORMAT = "%Y-%m-%d"
export default function Date(props: { iconSide: "left" | "right" }) {
const date = Variable<string>("").poll(1000, () =>
GLib.DateTime.new_now_local().format(DATE_FORMAT)!)
return <box className={`pill Date icon-${props.iconSide}`}>
{props.iconSide == "left" && <label className="icon" label="" />}
<label
className="label"
onDestroy={() => date.drop()}
label={date()}
/>
{props.iconSide == "right" && <label className="icon" label="" />}
</box>
}

View file

@ -1,6 +1,5 @@
import { App, Astal, Gdk, Gtk } from "astal/gtk3"; import { App, Astal, Gdk, Gtk } from "astal/gtk3";
import Clock from "./Clock"; import Clock from "./Clock";
import Date from "./Date";
import Workspaces from "./Workspaces"; import Workspaces from "./Workspaces";
import Systray from "./Systray"; import Systray from "./Systray";
@ -14,14 +13,13 @@ export default function RightBar(gdkmonitor: Gdk.Monitor) {
anchor={TOP | LEFT | RIGHT} anchor={TOP | LEFT | RIGHT}
application={App}> application={App}>
<centerbox> <centerbox>
<box halign={Gtk.Align.START} spacing={8}> <box halign={Gtk.Align.START}>
<Clock iconSide="left" /> <Clock iconSide="left" />
<Date iconSide="left" />
</box> </box>
<box halign={Gtk.Align.CENTER} spacing={8}> <box halign={Gtk.Align.CENTER}>
<Workspaces monitor="HDMI-A-1" iconSide="left" /> <Workspaces monitor="HDMI-A-1" iconSide="left" />
</box> </box>
<box halign={Gtk.Align.END} spacing={8}> <box halign={Gtk.Align.END}>
<Systray iconSide="left" /> <Systray iconSide="left" />
</box> </box>
</centerbox> </centerbox>

View file

@ -4,11 +4,9 @@ import Tray from "gi://AstalTray"
const tray = Tray.get_default() const tray = Tray.get_default()
export default function Systray(props: { iconSide: "left" | "right" }) { export default function Systray(props: { iconSide: "left" | "right" }) {
return <box className={`pill Systray icon-${props.iconSide}`}> return <box className={`Systray icon-${props.iconSide}`}>
{props.iconSide == "left" && <label className="icon" label="󱊔" />} {props.iconSide == "left" && <label className="icon" label="󱊔" />}
<box className="items">
{bind(tray, "items").as(items => items.map(item => <SystrayItem item={item} />))} {bind(tray, "items").as(items => items.map(item => <SystrayItem item={item} />))}
</box>
{props.iconSide == "right" && <label className="icon" label="󱊔" />} {props.iconSide == "right" && <label className="icon" label="󱊔" />}
</box> </box>
} }

View file

@ -4,9 +4,9 @@ import Hyprland from "gi://AstalHyprland"
export default function Workspaces(props: { monitor: string, iconSide: "left" | "right" }) { export default function Workspaces(props: { monitor: string, iconSide: "left" | "right" }) {
const hyprland = Hyprland.get_default(); const hyprland = Hyprland.get_default();
return <box className={`pill Workspaces icon-${props.iconSide}`}> return <box className={`Workspaces icon-${props.iconSide}`}>
{props.iconSide == "left" && <label className="icon" label="󱗼" />} {props.iconSide == "left" && <label className="icon" label="󱗼" />}
<box className="label"> <box className="labels">
{bind(hyprland, "workspaces").as(wss => wss {bind(hyprland, "workspaces").as(wss => wss
.filter(it => it && it.get_monitor && it.get_monitor().name == props.monitor) .filter(it => it && it.get_monitor && it.get_monitor().name == props.monitor)
.sort((a, b) => a.get_id() - b.get_id()) .sort((a, b) => a.get_id() - b.get_id())