Sat 6 Jul 00:01:45 CEST 2024

This commit is contained in:
Thomas Avé 2024-07-06 00:01:45 +02:00
parent f945ad5112
commit 8238826e66
5 changed files with 38 additions and 21 deletions

View File

@ -25,6 +25,7 @@
};
home.file."${config.xdg.configHome}/ags/settings.json".text = builtins.toJSON {
temperature-cmd = "bash -c 'sensors | grep Tctl | cut -c16-22'";
enable-battery = false;
};
home.file."${config.xdg.configHome}/ags/style.css".text = pkgs.lib.mkAfter ''
window.bar {

View File

@ -19,6 +19,7 @@
};
home.file."${config.xdg.configHome}/ags/settings.json".text = pkgs.lib.mkDefault (builtins.toJSON {
temperature-cmd = "bash -c 'sensors | grep Package | cut -c17-23'";
enable-battery = true;
});
home.file."${config.xdg.configHome}/ags/style.css".text = ''
window.bar {

View File

@ -3,27 +3,41 @@ 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 powerProfiles = await Service.import('powerprofiles')
const settings = JSON.parse(Utils.readFile(App.configDir + '/settings.json'))
const batteryIndicator = Widget.Box({
children: [
children: settings["enable-battery"]? [
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`
const thresholds = [...Array(11).keys()].map( i => i * 10);
const icon = thresholds.find(threshold => threshold >= battery.percent)
self.icon = battery.charging? `battery-level-${icon}-charging-symbolic` : `battery-level-${icon}-symbolic`
self.tooltip_text = `Battery ${battery.percent}%`
self.class_name = "blue systray-item";
}),
Widget.Label().hook(battery, self => {
self.label = `${battery.percentage}%`
self.css = "margin-left: 0.7em;"
Widget.Button({
class_name: "item",
child: Widget.Label({
label: powerProfiles.bind('active_profile'),
}),
on_clicked: () => {
switch (powerProfiles.active_profile) {
case 'balanced':
powerProfiles.active_profile = 'performance';
break;
case 'performance':
powerProfiles.active_profile = 'power-saver';
break;
default:
powerProfiles.active_profile = 'balanced';
break;
};
},
})
]
]: []
})

View File

@ -35,6 +35,7 @@
fileSystems."/home/server".device = pkgs.lib.mkForce "10.0.0.1:/home/server";
services.upower.enable = true;
services.power-profiles-daemon.enable = true;
networking.wireless.iwd.enable = true;
networking.wireless.iwd.settings = {
IPv6 = {

View File

@ -47,10 +47,10 @@
};
};
# services.resolved = {
# enable = true;
# fallbackDns = [ "1.1.1.1" "1.0.0.1" ];
# };
services.resolved = {
enable = true;
fallbackDns = [ "1.1.1.1" "1.0.0.1" ];
};
fileSystems."/home/server" = {
device = "192.168.1.2:/home/server";