From 8e21c557a3cb139a587f720154deda9908c84eb9 Mon Sep 17 00:00:00 2001 From: loeken Date: Thu, 1 Feb 2024 22:45:14 +0100 Subject: [PATCH 1/2] Update system.js --- .config/ags/widgets/desktopbackground/system.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/ags/widgets/desktopbackground/system.js b/.config/ags/widgets/desktopbackground/system.js index 6d49c524..a22888fa 100644 --- a/.config/ags/widgets/desktopbackground/system.js +++ b/.config/ags/widgets/desktopbackground/system.js @@ -63,9 +63,9 @@ const resources = Box({ label.label = `${output}` }).catch(print); }, { hpack: 'end' }), - ResourceValue('Swap', 'swap_horiz', 10000, `free | awk '/^Swap/ {printf("%.2f\\n", ($3/$2) * 100)}'`, + ResourceValue('Swap', 'swap_horiz', 10000, `free | awk '/^Swap/ {if ($2 > 0) printf("%.2f\\n", ($3/$2) * 100); else print "0";}'`, (label) => { - execAsync(['bash', '-c', `free -h | awk '/^Swap/ {print $3 " / " $2}' | sed 's/Gi/Gib/g'`]) + execAsync(['bash', '-c', `free -h | awk '/^Swap/ {if ($2 != "0") print $3 " / " $2; else print "No swap"}' | sed 's/Gi/Gib/g'`]) .then((output) => { label.label = `${output}` }).catch(print); From 478e7cccb969a24cdc34166440f502b44ce11041 Mon Sep 17 00:00:00 2001 From: loeken Date: Thu, 1 Feb 2024 22:45:50 +0100 Subject: [PATCH 2/2] Update music.js --- .config/ags/widgets/bar/music.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/ags/widgets/bar/music.js b/.config/ags/widgets/bar/music.js index 4001bb6e..4d1682ed 100644 --- a/.config/ags/widgets/bar/music.js +++ b/.config/ags/widgets/bar/music.js @@ -154,7 +154,7 @@ export default () => { child: Box({ className: 'spacing-h-10', children: [ - BarResource('Swap Usage', 'swap_horiz', `free | awk '/^Swap/ {printf("%.2f\\n", ($3/$2) * 100)}'`), + BarResource('Swap Usage', 'swap_horiz', `free | awk '/^Swap/ {if ($2 > 0) printf("%.2f\\n", ($3/$2) * 100); else print "0";}'`), BarResource('CPU Usage', 'settings_motion_mode', `top -bn1 | grep Cpu | awk '{print $2}'`), ] }), @@ -180,4 +180,4 @@ export default () => { ] }) }); -} \ No newline at end of file +}