mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 21:01:54 +05:30
feat: update style
This commit is contained in:
15
style.scss
15
style.scss
@@ -1,9 +1,14 @@
|
|||||||
$accent: #ebdbb2;
|
$accent: #54cdb3;
|
||||||
$fg-color: #ebdbb2;
|
$fg-color: #fff;
|
||||||
$bg-color: #282828;
|
$bg-color: #0e0e0e;
|
||||||
$inactive-color: #807966;
|
$inactive-color: #252525;
|
||||||
$rounded: 8px;
|
$rounded: 8px;
|
||||||
$font-size: 1.3rem;
|
$font-size: 1.1rem;
|
||||||
|
|
||||||
|
* {
|
||||||
|
all: unset;
|
||||||
|
font-family: FiraCode Nerd Font Bold;
|
||||||
|
}
|
||||||
|
|
||||||
// bar
|
// bar
|
||||||
@import "./widgets/bar/style.scss";
|
@import "./widgets/bar/style.scss";
|
||||||
|
@@ -5,9 +5,11 @@ export const Battery = () => {
|
|||||||
const battery = AstalBattery.get_default();
|
const battery = AstalBattery.get_default();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<box cssClasses={["battery"]} visible={bind(battery, "isPresent")}>
|
<box cssClasses={["pill"]} visible={bind(battery, "isPresent")}>
|
||||||
<label
|
<label
|
||||||
label={bind(battery, "percentage").as((p) => `${Math.floor(p * 100)}%`)}
|
label={bind(battery, "percentage").as(
|
||||||
|
(p) => `Bat: ${Math.floor(p * 100)}%`,
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
|
@@ -1,15 +1,13 @@
|
|||||||
import { App, Astal, Gdk } from "astal/gtk4";
|
import { App, Astal, Gdk } from "astal/gtk4";
|
||||||
import { FocusedClient, WorkspaceButton } from "./workspace";
|
import { FocusedClient, WorkspaceButton } from "./workspace";
|
||||||
import { Battery } from "./battery";
|
import { Battery } from "./battery";
|
||||||
import { Launcher } from "./launcher";
|
|
||||||
import { Tailscale } from "./tailscale";
|
import { Tailscale } from "./tailscale";
|
||||||
import { Tray } from "./tray";
|
|
||||||
import { Time } from "./time";
|
import { Time } from "./time";
|
||||||
|
|
||||||
export const WINDOW_NAME = "bar";
|
export const WINDOW_NAME = "bar";
|
||||||
|
|
||||||
export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
const { TOP } = Astal.WindowAnchor;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<window
|
<window
|
||||||
@@ -18,7 +16,7 @@ export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
|||||||
cssClasses={["Bar"]}
|
cssClasses={["Bar"]}
|
||||||
gdkmonitor={gdkmonitor}
|
gdkmonitor={gdkmonitor}
|
||||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
||||||
anchor={TOP | LEFT | RIGHT}
|
anchor={TOP}
|
||||||
application={App}
|
application={App}
|
||||||
>
|
>
|
||||||
<centerbox>
|
<centerbox>
|
||||||
@@ -32,8 +30,7 @@ export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
|||||||
|
|
||||||
const Start = () => {
|
const Start = () => {
|
||||||
return (
|
return (
|
||||||
<box spacing={15}>
|
<box spacing={10}>
|
||||||
<Launcher />
|
|
||||||
<WorkspaceButton />
|
<WorkspaceButton />
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
@@ -45,10 +42,9 @@ const Center = () => {
|
|||||||
|
|
||||||
const End = () => {
|
const End = () => {
|
||||||
return (
|
return (
|
||||||
<box spacing={15}>
|
<box spacing={10}>
|
||||||
<Tailscale />
|
<Tailscale />
|
||||||
<Battery />
|
<Battery />
|
||||||
<Tray />
|
|
||||||
<Time />
|
<Time />
|
||||||
</box>
|
</box>
|
||||||
);
|
);
|
||||||
|
@@ -7,6 +7,7 @@ window.Bar {
|
|||||||
margin: 5px;
|
margin: 5px;
|
||||||
border-radius: $rounded;
|
border-radius: $rounded;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
min-width: 100rem;
|
||||||
|
|
||||||
.launcher {
|
.launcher {
|
||||||
background-color: $inactive-color;
|
background-color: $inactive-color;
|
||||||
@@ -30,8 +31,8 @@ window.Bar {
|
|||||||
border: 0px;
|
border: 0px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
background-color: $inactive-color;
|
background-color: $inactive-color;
|
||||||
min-height: 1.3rem;
|
min-height: 1rem;
|
||||||
min-width: 1.3rem;
|
min-width: 1rem;
|
||||||
border-radius: calc(list.nth(8px, 1) * 1.5);
|
border-radius: calc(list.nth(8px, 1) * 1.5);
|
||||||
transition: min-width 0.15s ease-out;
|
transition: min-width 0.15s ease-out;
|
||||||
|
|
||||||
@@ -43,8 +44,8 @@ window.Bar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
min-width: 3.5rem;
|
min-width: 2.5rem;
|
||||||
min-height: 1.3rem;
|
min-height: 1rem;
|
||||||
background-color: $accent;
|
background-color: $accent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,42 +60,14 @@ window.Bar {
|
|||||||
|
|
||||||
.focused-client {
|
.focused-client {
|
||||||
font-size: $font-size;
|
font-size: $font-size;
|
||||||
font-weight: 900;
|
color: $fg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tailscale {
|
.pill {
|
||||||
font-size: $font-size;
|
font-size: $font-size;
|
||||||
font-weight: 900;
|
color: $fg-color;
|
||||||
color: $bg-color;
|
|
||||||
background-color: $inactive-color;
|
background-color: $inactive-color;
|
||||||
border-radius: $rounded;
|
border-radius: calc($rounded / 1.5);
|
||||||
padding: 0px 10px;
|
padding: 5px 10px;
|
||||||
}
|
|
||||||
|
|
||||||
.tray {
|
|
||||||
font-size: $font-size;
|
|
||||||
font-weight: 900;
|
|
||||||
color: #fff;
|
|
||||||
background-color: $inactive-color;
|
|
||||||
border-radius: $rounded;
|
|
||||||
padding: 0px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.battery {
|
|
||||||
font-size: $font-size;
|
|
||||||
font-weight: 900;
|
|
||||||
color: $bg-color;
|
|
||||||
background-color: $inactive-color;
|
|
||||||
border-radius: $rounded;
|
|
||||||
padding: 0px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time {
|
|
||||||
font-size: $font-size;
|
|
||||||
font-weight: 900;
|
|
||||||
color: $bg-color;
|
|
||||||
background-color: $inactive-color;
|
|
||||||
border-radius: $rounded;
|
|
||||||
padding: 0px 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,11 +8,11 @@ export const Tailscale = () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<box cssClasses={["tailscale"]}>
|
<box cssClasses={["pill"]}>
|
||||||
<label
|
<label
|
||||||
label={bind(tailscale).as((val) => {
|
label={bind(tailscale).as((val) => {
|
||||||
const data = val.split(" ");
|
const data = val.split(" ");
|
||||||
return data[data.length - 1];
|
return "Home: " + data[data.length - 1];
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</box>
|
</box>
|
||||||
|
@@ -3,10 +3,10 @@ import { GLib, Variable } from "astal";
|
|||||||
export const Time = () => {
|
export const Time = () => {
|
||||||
const time = Variable("").poll(
|
const time = Variable("").poll(
|
||||||
1000,
|
1000,
|
||||||
() => GLib.DateTime.new_now_local().format("%I:%M:%S %p")!,
|
() => GLib.DateTime.new_now_local().format("%a %b %d - %I:%M:%S %p")!,
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label cssClasses={["time"]} onDestroy={() => time.drop()} label={time()} />
|
<label cssClasses={["pill"]} onDestroy={() => time.drop()} label={time()} />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -9,7 +9,7 @@ export const Tray = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<box cssClasses={["tray"]}>
|
<box cssClasses={["pill"]}>
|
||||||
{bind(tray, "items").as((items) =>
|
{bind(tray, "items").as((items) =>
|
||||||
items.map((item) => <image gicon={bind(item, "gicon")} />),
|
items.map((item) => <image gicon={bind(item, "gicon")} />),
|
||||||
)}
|
)}
|
||||||
|
@@ -48,9 +48,14 @@ export const WorkspaceButton = () => {
|
|||||||
|
|
||||||
export const FocusedClient = () => {
|
export const FocusedClient = () => {
|
||||||
const hyprland = AstalHyprland.get_default();
|
const hyprland = AstalHyprland.get_default();
|
||||||
const title = bind(hyprland, "focusedClient").as(
|
const focused = bind(hyprland, "focusedClient");
|
||||||
(fcsClient) => fcsClient.title,
|
|
||||||
);
|
|
||||||
|
|
||||||
return <label cssClasses={["focused-client"]}>{title}</label>;
|
return (
|
||||||
|
<box cssClasses={["focused-client"]} visible={focused.as(Boolean)}>
|
||||||
|
{focused.as(
|
||||||
|
(client) =>
|
||||||
|
client && <label label={bind(client, "initialTitle").as(String)} />,
|
||||||
|
)}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user