From 38266ed3e9cd69111f8a2bd4b0786d8934792cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Sat, 6 Jul 2024 00:48:20 +0200 Subject: [PATCH] Sat 6 Jul 00:48:20 CEST 2024 --- home/ags/files/config.js | 56 +++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/home/ags/files/config.js b/home/ags/files/config.js index b359ce2..9cee57f 100644 --- a/home/ags/files/config.js +++ b/home/ags/files/config.js @@ -18,25 +18,6 @@ const batteryIndicator = Widget.Box({ self.tooltip_text = `Battery ${battery.percent}%` self.class_name = "blue battery-item"; }), - 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; - }; - }, - }) ]: [] }) @@ -157,8 +138,6 @@ function Center() { }) } -const divide = ([total, free]) => free / total - function Right() { return Widget.Box({ hpack: "end", @@ -175,7 +154,7 @@ function Right() { vexpand: false, size: 16, icon: "speedometer", - css: "margin-right: 1em;", + css: "margin-right: 0.7em;", }), Widget.Label({ label: Variable("", { @@ -188,16 +167,41 @@ function Right() { ]}), Widget.Label({ class_name: "item blue", - label: Variable("", { poll: [5000, 'bash -c "cat /proc/cpuinfo | grep \\"MHz\\" | awk \'{print \\$4}\' | sort -n | tail -1 | awk \'{printf \\"%.2fGHz\\", \\$1/1000}\'"'] }).bind(), - }), - Widget.Label({ - class_name: "item", label: Variable("", { poll: [2000, 'free', out => (out.split('\n') .find(line => line.includes('Mem:')) .split(/\s+/)[2] / 1000000).toFixed(2) + "GB"], }).bind(), }), + Widget.Button({ + class_name: "item", + child: Widget.Box({ + children: [ + Widget.Icon({ + vexpand: false, + size: 16, + icon: powerProfiles.bind('active_profile').as(profile => `power-profile-${profile}-symbolic`), + css: "margin-right: 0.7em;", + }), + Widget.Label({ + label: Variable("", { poll: [5000, 'bash -c "cat /proc/cpuinfo | grep \\"MHz\\" | awk \'{print \\$4}\' | sort -n | tail -1 | awk \'{printf \\"%.2fGHz\\", \\$1/1000}\'"'] }).bind(), + }), + ] + }), + 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; + }; + }, + }), Widget.Label({ class_name: "item blue", label: Variable("", { poll: [5000, settings["temperature-cmd"] ] }).bind(),