Cleanup bluetooth module

This commit is contained in:
2024-07-12 10:35:35 +07:00
parent 440625f9be
commit 713771affa
4 changed files with 9 additions and 7 deletions

View File

@@ -30,6 +30,7 @@ in {
# TODO: Find a way to add this for ags only
covercolors
brightnessctl
blueberry
];
# systemd.user.services.ags = {
# Unit = {

View File

@@ -168,11 +168,11 @@ export const Menu = ({ name, icon, title, content, ...props }) =>
...props,
});
/** @param {{type: string} & import("../types/widgets/button").ButtonProps} props */
export const SettingsButton = ({ type, ...props }) =>
/** @param {{type?: string, command?: string} & import("../types/widgets/button").ButtonProps} props */
export const SettingsButton = ({ type, command, ...props }) =>
Widget.Button({
onClicked: () => {
Utils.execAsync(`gnome-control-center ${type}`);
Utils.execAsync(command ?? `gnome-control-center ${type}`);
App.closeWindow("quicksettings");
},
hexpand: true,

View File

@@ -59,7 +59,7 @@ export const Selection = (props) =>
children: bluetooth.bind("devices").as((x) => x.map(DeviceItem)),
}),
Widget.Separator({ className: "accent" }),
SettingsButton({ type: "bluetooth" }),
SettingsButton({ command: "blueberry" }),
],
...props,
});
@@ -70,11 +70,12 @@ const DeviceItem = (device) =>
children: [
Widget.Icon(`${device.icon_name}-symbolic`),
Widget.Label(device.name),
Widget.Box({ hexpand: true }),
Widget.Label({
label: `${device.battery_percentage}%`,
css: "padding-right: 24px;",
visible: device.bind("battery_percentage").as((x) => x > 0),
}),
Widget.Box({ hexpand: true }),
Widget.Spinner({
active: device.bind("connecting"),
visible: device.bind("connecting"),
@@ -82,8 +83,8 @@ const DeviceItem = (device) =>
Widget.Switch({
active: device.bind("connected"),
visible: device.bind("connecting").as((p) => !p),
// sensitive: false,
setup: (self) =>
// TODO: If connecting to the device failed, reset back the switch to `active: false`.
self.connect("state_set", () => {
device.setConnection(self.active);
return true;

View File

@@ -88,7 +88,7 @@ mark {
}
switch {
background-color: #000;
background-color: #1E1E2E;
border-radius: 100px;
}