2024-05-06 19:34:00 +03:00
|
|
|
{ controlFile, enable, disable, ... }: {
|
|
|
|
script = ''
|
2024-05-08 18:26:33 +03:00
|
|
|
function toggle() {
|
|
|
|
if status; then
|
2024-05-06 19:34:00 +03:00
|
|
|
echo ${disable} > ${controlFile}
|
|
|
|
else
|
|
|
|
echo ${enable} > ${controlFile}
|
|
|
|
fi
|
|
|
|
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
2024-05-08 18:26:33 +03:00
|
|
|
function waybar() {
|
|
|
|
status || echo -n ""
|
2024-05-06 19:34:00 +03:00
|
|
|
}
|
|
|
|
|
2024-05-08 18:26:33 +03:00
|
|
|
function status() {
|
2024-05-06 19:34:00 +03:00
|
|
|
local current=$(cat ${controlFile})
|
|
|
|
local enabled="${enable}"
|
|
|
|
|
|
|
|
[[ "''${current}" = "''${enabled}" ]]
|
|
|
|
}
|
|
|
|
|
2024-05-08 18:26:33 +03:00
|
|
|
''${@}
|
2024-05-06 19:34:00 +03:00
|
|
|
'';
|
|
|
|
}
|