From f945ad5112729ca72842f0d1e8afadff51bb149d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Fri, 5 Jul 2024 23:18:09 +0200 Subject: [PATCH] Fri 5 Jul 23:18:09 CEST 2024 --- home/Kell.nix | 2 +- home/ags/files/config.js | 22 ++++++++++++++++++++++ hosts/Aloria/default.nix | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/home/Kell.nix b/home/Kell.nix index 30990c4..0c2c726 100644 --- a/home/Kell.nix +++ b/home/Kell.nix @@ -28,7 +28,7 @@ }; home.file."${config.xdg.configHome}/ags/style.css".text = pkgs.lib.mkAfter '' window.bar { - font-size: 1.3em; + font-size: 1.2em; } ''; } diff --git a/home/ags/files/config.js b/home/ags/files/config.js index 1923df8..049dc14 100644 --- a/home/ags/files/config.js +++ b/home/ags/files/config.js @@ -3,9 +3,30 @@ const audio = await Service.import("audio") const systemtray = await Service.import("systemtray") import { getIconName } from "./utils.js" import { NotificationPopups } from "./notificationPopups.js" +const battery = await Service.import('battery') const settings = JSON.parse(Utils.readFile(App.configDir + '/settings.json')) +const batteryIndicator = Widget.Box({ + children: [ + Widget.Icon().hook(battery, self => { + const icon = [ + [101, 'full'], + [67, 'good'], + [34, 'low'], + [1, 'caution'], + [0, 'empty'], + ].find(([threshold]) => threshold <= battery.percentage)?.[1] + self.icon = `battery-${icon}-symbolic` + }), + Widget.Label().hook(battery, self => { + self.label = `${battery.percentage}%` + self.css = "margin-left: 0.7em;" + }) + ] +}) + + const volumeIndicator = Widget.Button({ on_clicked: () => audio.speaker.is_muted = !audio.speaker.is_muted, class_name: "item blue", @@ -131,6 +152,7 @@ function Right() { class_name: "right", children: [ SysTray(), + batteryIndicator, volumeIndicator, Widget.Label({ class_name: "item", diff --git a/hosts/Aloria/default.nix b/hosts/Aloria/default.nix index 9366ea9..5dcc766 100644 --- a/hosts/Aloria/default.nix +++ b/hosts/Aloria/default.nix @@ -34,6 +34,7 @@ }; fileSystems."/home/server".device = pkgs.lib.mkForce "10.0.0.1:/home/server"; + services.upower.enable = true; networking.wireless.iwd.enable = true; networking.wireless.iwd.settings = { IPv6 = {