Restyle bars slightly and add date
parent
285e007180
commit
1f9e028732
|
@ -8,19 +8,15 @@ window.Bar {
|
||||||
color: $ctp-text;
|
color: $ctp-text;
|
||||||
|
|
||||||
>centerbox {
|
>centerbox {
|
||||||
background: $ctp-base;
|
margin: 8px 8px 0 8px;
|
||||||
border-radius: 5px;
|
|
||||||
margin: 8px;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.Time {
|
.pill {
|
||||||
background: $ctp-surface-0;
|
background: $ctp-surface-0;
|
||||||
border-radius: 5px;
|
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;
|
||||||
|
@ -32,28 +28,24 @@ window.Bar {
|
||||||
&.icon-right>.icon {
|
&.icon-right>.icon {
|
||||||
border-radius: 0 5px 5px 0;
|
border-radius: 0 5px 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
>.label {
|
>.label {
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.Workspaces {
|
.Time >.icon {
|
||||||
background: $ctp-surface-0;
|
background: $ctp-red;
|
||||||
border-radius: 5px;
|
}
|
||||||
|
|
||||||
|
.Date >.icon {
|
||||||
|
background: $ctp-lavender;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Workspaces {
|
||||||
>.icon {
|
>.icon {
|
||||||
background: $ctp-blue;
|
background: $ctp-blue;
|
||||||
color: $ctp-surface-0;
|
|
||||||
padding: 6px 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.icon-left>.icon {
|
|
||||||
border-radius: 5px 0 0 5px;
|
|
||||||
}
|
|
||||||
&.icon-right>.icon {
|
|
||||||
border-radius: 0 5px 5px 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
>.labels {
|
>.labels {
|
||||||
|
@ -72,22 +64,10 @@ 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;
|
||||||
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 {
|
||||||
|
|
|
@ -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={`Time icon-${props.iconSide}`}>
|
return <box className={`pill Time icon-${props.iconSide}`}>
|
||||||
{props.iconSide == "left" && <label className="icon" label="" />}
|
{props.iconSide == "left" && <label className="icon" label="" />}
|
||||||
<label
|
<label
|
||||||
className="label"
|
className="label"
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
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>
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
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";
|
||||||
|
|
||||||
|
@ -13,13 +14,14 @@ 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}>
|
<box halign={Gtk.Align.START} spacing={8}>
|
||||||
<Clock iconSide="left" />
|
<Clock iconSide="left" />
|
||||||
|
<Date iconSide="left" />
|
||||||
</box>
|
</box>
|
||||||
<box halign={Gtk.Align.CENTER}>
|
<box halign={Gtk.Align.CENTER} spacing={8}>
|
||||||
<Workspaces monitor="HDMI-A-1" iconSide="left" />
|
<Workspaces monitor="HDMI-A-1" iconSide="left" />
|
||||||
</box>
|
</box>
|
||||||
<box halign={Gtk.Align.END}>
|
<box halign={Gtk.Align.END} spacing={8}>
|
||||||
<Systray iconSide="left" />
|
<Systray iconSide="left" />
|
||||||
</box>
|
</box>
|
||||||
</centerbox>
|
</centerbox>
|
||||||
|
|
|
@ -4,7 +4,7 @@ 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={`Systray icon-${props.iconSide}`}>
|
return <box className={`pill Systray icon-${props.iconSide}`}>
|
||||||
{props.iconSide == "left" && <label className="icon" label="" />}
|
{props.iconSide == "left" && <label className="icon" label="" />}
|
||||||
{bind(tray, "items").as(items => items.map(item => <SystrayItem item={item} />))}
|
{bind(tray, "items").as(items => items.map(item => <SystrayItem item={item} />))}
|
||||||
{props.iconSide == "right" && <label className="icon" label="" />}
|
{props.iconSide == "right" && <label className="icon" label="" />}
|
||||||
|
|
|
@ -4,7 +4,7 @@ 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={`Workspaces icon-${props.iconSide}`}>
|
return <box className={`pill Workspaces icon-${props.iconSide}`}>
|
||||||
{props.iconSide == "left" && <label className="icon" label="" />}
|
{props.iconSide == "left" && <label className="icon" label="" />}
|
||||||
<box className="labels">
|
<box className="labels">
|
||||||
{bind(hyprland, "workspaces").as(wss => wss
|
{bind(hyprland, "workspaces").as(wss => wss
|
||||||
|
|
Loading…
Reference in New Issue