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
local user
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
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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