fix(ags quick-settings): switch to async execs and fix bluetooth toggle
This commit is contained in:
parent
812c1b7a52
commit
c97ddec619
2 changed files with 18 additions and 19 deletions
|
@ -18,7 +18,7 @@ if [[ $1 == "toggle-radio" ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
FILE='/home/matt/.config/.bluetooth'
|
||||||
get_state() {
|
get_state() {
|
||||||
if [[ "$(rfkill list | grep -A 1 hci0 | grep -o no)" == "no" ]]; then
|
if [[ "$(rfkill list | grep -A 1 hci0 | grep -o no)" == "no" ]]; then
|
||||||
echo " " > "$FILE"
|
echo " " > "$FILE"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { Box, CenterBox, Label, Icon } = ags.Widget;
|
const { Box, CenterBox, Label, Icon } = ags.Widget;
|
||||||
const { Network, Bluetooth, Audio } = ags.Service;
|
const { Network, Bluetooth, Audio } = ags.Service;
|
||||||
const { exec } = ags.Utils;
|
const { execAsync } = ags.Utils;
|
||||||
|
const { openWindow } = ags.App;
|
||||||
|
|
||||||
import { EventBox } from '../misc/cursorbox.js';
|
import { EventBox } from '../misc/cursorbox.js';
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ const FirstRow = Box({
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => Network.toggleWifi(),
|
command: () => Network.toggleWifi(),
|
||||||
secondaryCommand: () => exec("bash -c 'nm-connection-editor &'"),
|
secondaryCommand: () => execAsync(['bash', '-c', 'nm-connection-editor']).catch(print),
|
||||||
icon: Icon({
|
icon: Icon({
|
||||||
className: 'grid-label',
|
className: 'grid-label',
|
||||||
connections: [[Network, icon => {
|
connections: [[Network, icon => {
|
||||||
|
@ -49,26 +50,26 @@ const FirstRow = Box({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => exec("bash -c '$AGS_PATH/qs-toggles.sh blue-toggle'"),
|
command: () => execAsync(['bash', '-c', '$AGS_PATH/qs-toggles.sh blue-toggle']).catch(print),
|
||||||
secondaryCommand: () => exec("bash -c 'blueberry &'"),
|
secondaryCommand: () => execAsync(['bash', '-c', 'blueberry']).catch(print),
|
||||||
icon: Icon({
|
icon: Icon({
|
||||||
className: 'grid-label',
|
className: 'grid-label',
|
||||||
connections: [[Bluetooth, icon => {
|
connections: [[Bluetooth, icon => {
|
||||||
if (Bluetooth.enabled) {
|
if (Bluetooth.enabled) {
|
||||||
icon.icon = 'bluetooth-active-symbolic';
|
icon.icon = 'bluetooth-active-symbolic';
|
||||||
exec('bash -c "echo > $HOME/.config/.bluetooth"');
|
execAsync(['bash', '-c', 'echo > $HOME/.config/.bluetooth']).catch(print);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
icon.icon = 'bluetooth-disabled-symbolic';
|
icon.icon = 'bluetooth-disabled-symbolic';
|
||||||
exec('bash -c "echo > $HOME/.config/.bluetooth"');
|
execAsync(['bash', '-c', 'echo > $HOME/.config/.bluetooth']).catch(print);
|
||||||
}
|
}
|
||||||
}, 'changed']],
|
}, 'changed']],
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => exec('bash -c "$AGS_PATH/qs-toggles.sh toggle-radio"'),
|
command: () => execAsync(['bash', '-c', '$AGS_PATH/qs-toggles.sh toggle-radio']).catch(print),
|
||||||
secondaryCommand: () => exec("notify-send 'set this up moron'"),
|
secondaryCommand: () => execAsync(['notify-send', 'set this up moron']).catch(print),
|
||||||
icon: Icon({
|
icon: Icon({
|
||||||
className: 'grid-label',
|
className: 'grid-label',
|
||||||
connections: [[Network, icon => {
|
connections: [[Network, icon => {
|
||||||
|
@ -103,7 +104,8 @@ const SubRow = CenterBox({
|
||||||
truncate: 'end',
|
truncate: 'end',
|
||||||
maxWidthChars: 12,
|
maxWidthChars: 12,
|
||||||
connections: [[Bluetooth, label => {
|
connections: [[Bluetooth, label => {
|
||||||
label.label = String(Bluetooth.connectedDevices[0]);
|
label.label = Bluetooth.connectedDevices[0] ? String(Bluetooth.connectedDevices[0]) :
|
||||||
|
'Disconnected';
|
||||||
}, 'changed']],
|
}, 'changed']],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -140,8 +142,8 @@ const SecondRow = Box({
|
||||||
children: [
|
children: [
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => exec("swayosd-client --output-volume mute-toggle"),
|
command: () => execAsync(['swayosd-client', '--output-volume', 'mute-toggle']).catch(print),
|
||||||
secondaryCommand: () => exec('bash -c "pavucontrol &"'),
|
secondaryCommand: () => execAsync(['bash', '-c', 'pavucontrol']).catch(print),
|
||||||
icon: Icon({
|
icon: Icon({
|
||||||
className: 'grid-label',
|
className: 'grid-label',
|
||||||
connections: [[Audio, icon => {
|
connections: [[Audio, icon => {
|
||||||
|
@ -163,8 +165,8 @@ const SecondRow = Box({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => exec("swayosd-client --input-volume mute-toggle"),
|
command: () => execAsync(['swayosd-client', '--input-volume', 'mute-toggle']).catch(print),
|
||||||
secondaryCommand: () => exec('bash -c "pavucontrol &"'),
|
secondaryCommand: () => execAsync(['bash', '-c', 'pavucontrol']).catch(print),
|
||||||
icon: Icon({
|
icon: Icon({
|
||||||
className: 'grid-label',
|
className: 'grid-label',
|
||||||
connections: [[Audio, icon => {
|
connections: [[Audio, icon => {
|
||||||
|
@ -186,11 +188,8 @@ const SecondRow = Box({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
GridButton({
|
GridButton({
|
||||||
command: () => exec('bash -c "$LOCK_PATH/lock.sh &"'),
|
command: () => execAsync(['bash', '-c', '$LOCK_PATH/lock.sh']).catch(print),
|
||||||
secondaryCommand: () => {
|
secondaryCommand: () => openWindow('powermenu'),
|
||||||
ags.App.openWindow('closer');
|
|
||||||
ags.App.openWindow('powermenu');
|
|
||||||
},
|
|
||||||
icon: Label({
|
icon: Label({
|
||||||
className: 'grid-label',
|
className: 'grid-label',
|
||||||
label: " ",
|
label: " ",
|
||||||
|
|
Loading…
Reference in a new issue