Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-05-26 12:25:22 +01:00
parent 4893d413c8
commit e362f8c6e0
8 changed files with 40 additions and 23 deletions

View File

@@ -82,7 +82,7 @@ set_permissions() {
for path in "$flake/hosts/$host/users"/*; do for path in "$flake/hosts/$host/users"/*; do
local user local user
user=$(basename "$path") user=$(basename "$path")
chown -R "$(cat "$flake/hosts/$host/users/$user/uid"):100" "$root/persist/*/home/$user" chown -R "$(cat "$flake/hosts/$host/users/$user/uid"):100" "$root/persist/state/home/$user"
done done
} }

View File

@@ -6,11 +6,11 @@ export const range = (length: number, start = 1) => {
}; };
export const getHyprlandMonitor = (gdkmonitor: Gdk.Monitor) => { export const getHyprlandMonitor = (gdkmonitor: Gdk.Monitor) => {
const hyprland = Hyprland.get_default() const hyprland = Hyprland.get_default();
const display = Gdk.Display.get_default()!; const display = Gdk.Display.get_default()!;
const screen = display.get_default_screen(); const screen = display.get_default_screen();
for (let i = 0; i < display.get_n_monitors(); ++i) { for (let i = 0; i < display.get_n_monitors(); ++i) {
if (gdkmonitor === display.get_monitor(i)) if (gdkmonitor === display.get_monitor(i))
return hyprland.get_monitor_by_name(screen.get_monitor_plug_name(i)!); return hyprland.get_monitor_by_name(screen.get_monitor_plug_name(i)!);
} }
} };

View File

@@ -18,5 +18,5 @@ export default (monitor: Gdk.Monitor) => (
<Workspace monitor={getHyprlandMonitor(monitor)!} /> <Workspace monitor={getHyprlandMonitor(monitor)!} />
</box> </box>
</Hidden> </Hidden>
</window > </window>
); );

View File

@@ -3,24 +3,31 @@ import AstalBattery from "gi://AstalBattery";
const battery = AstalBattery.get_default(); const battery = AstalBattery.get_default();
const formatTime = (seconds: number) => seconds > 0 const formatTime = (seconds: number) =>
? `${String(Math.floor(seconds / 3600)).padStart(2, "0")}:${String(Math.floor((seconds % 3600) / 60)).padStart(2, "0")}` seconds > 0
: "--:--"; ? `${String(Math.floor(seconds / 3600)).padStart(2, "0")}:${String(Math.floor((seconds % 3600) / 60)).padStart(2, "0")}`
: "--:--";
export default () => { export default () => {
const percentage = bind(battery, "percentage").as((p) => Math.round(p * 100) + "%"); const percentage = bind(battery, "percentage").as(
(p) => Math.round(p * 100) + "%",
);
const charging = bind(battery, "charging"); const charging = bind(battery, "charging");
const timeToFull = bind(battery, "timeToFull"); const timeToFull = bind(battery, "timeToFull");
const timeToEmpty = bind(battery, "timeToEmpty"); const timeToEmpty = bind(battery, "timeToEmpty");
const time = Variable.derive([charging, timeToFull, timeToEmpty], (charging, full, empty) => const time = Variable.derive(
formatTime(charging ? full : empty) [charging, timeToFull, timeToEmpty],
(charging, full, empty) => formatTime(charging ? full : empty),
); );
const label = Variable.derive([percentage, charging, time], (percentage, charging, time) => { const label = Variable.derive(
const arrow = charging ? "▲" : "▼"; [percentage, charging, time],
return `${percentage} (${time}) ${arrow}`; (percentage, charging, time) => {
}); const arrow = charging ? "▲" : "▼";
return `${percentage} (${time}) ${arrow}`;
},
);
return ( return (
<button className="battery"> <button className="battery">

View File

@@ -2,14 +2,20 @@ import { bind, Variable } from "astal";
import { GLib } from "astal"; import { GLib } from "astal";
export default () => { export default () => {
const time = Variable(GLib.DateTime.new_now_local().format("%H:%M - %A, %d %B %Y")!).poll( const time = Variable(
GLib.DateTime.new_now_local().format("%H:%M - %A, %d %B %Y")!,
).poll(
1000, 1000,
() => GLib.DateTime.new_now_local().format("%H:%M - %A, %d %B %Y")!, () => GLib.DateTime.new_now_local().format("%H:%M - %A, %d %B %Y")!,
); );
return ( return (
<button className="date"> <button className="date">
<label className="label" onDestroy={() => time.drop()} label={bind(time)} /> <label
className="label"
onDestroy={() => time.drop()}
label={bind(time)}
/>
</button> </button>
); );
} };

View File

@@ -21,9 +21,13 @@ export default function Hidden({
onHover={() => show.set(true)} onHover={() => show.set(true)}
onHoverLost={() => show.set(false)} onHoverLost={() => show.set(false)}
> >
<box orientation={orientation} > <box orientation={orientation}>
<revealer setup={self => timeout(2000, () => self.revealChild = false)} revealChild={bind(show)} transitionType={transitionType}> <revealer
{Array.isArray(contents) ? (<>{contents}</>) : (contents)} setup={(self) => timeout(2000, () => (self.revealChild = false))}
revealChild={bind(show)}
transitionType={transitionType}
>
{Array.isArray(contents) ? <>{contents}</> : contents}
</revealer> </revealer>
<box clickThrough className="trigger-guard" /> <box clickThrough className="trigger-guard" />
</box> </box>

View File

@@ -101,9 +101,7 @@
home-manager.sharedModules = [ home-manager.sharedModules = [
{ {
wayland.windowManager.hyprland.settings.env = [ wayland.windowManager.hyprland.settings.env = [ "AQ_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1" ];
"AQ_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1"
];
theme = { theme = {
template.".config/asusctl/keyboard".source = template.".config/asusctl/keyboard".source =

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
HYPRLAND_DEVICE="$1" HYPRLAND_DEVICE="$1"
export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"