forked from Shinonome/dots-hyprland
use case no swap, no zram (#227)
This commit is contained in:
@@ -154,7 +154,7 @@ export default () => {
|
|||||||
child: Box({
|
child: Box({
|
||||||
className: 'spacing-h-10',
|
className: 'spacing-h-10',
|
||||||
children: [
|
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}'`),
|
BarResource('CPU Usage', 'settings_motion_mode', `top -bn1 | grep Cpu | awk '{print $2}'`),
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ const resources = Box({
|
|||||||
label.label = `${output}`
|
label.label = `${output}`
|
||||||
}).catch(print);
|
}).catch(print);
|
||||||
}, { hpack: 'end' }),
|
}, { 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) => {
|
(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) => {
|
.then((output) => {
|
||||||
label.label = `${output}`
|
label.label = `${output}`
|
||||||
}).catch(print);
|
}).catch(print);
|
||||||
|
|||||||
Reference in New Issue
Block a user