mirror of
https://github.com/zoriya/flake.git
synced 2025-12-18 12:35:19 +00:00
Cleanup bluetooth module
This commit is contained in:
@@ -30,6 +30,7 @@ in {
|
|||||||
# TODO: Find a way to add this for ags only
|
# TODO: Find a way to add this for ags only
|
||||||
covercolors
|
covercolors
|
||||||
brightnessctl
|
brightnessctl
|
||||||
|
blueberry
|
||||||
];
|
];
|
||||||
# systemd.user.services.ags = {
|
# systemd.user.services.ags = {
|
||||||
# Unit = {
|
# Unit = {
|
||||||
|
|||||||
@@ -168,11 +168,11 @@ export const Menu = ({ name, icon, title, content, ...props }) =>
|
|||||||
...props,
|
...props,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @param {{type: string} & import("../types/widgets/button").ButtonProps} props */
|
/** @param {{type?: string, command?: string} & import("../types/widgets/button").ButtonProps} props */
|
||||||
export const SettingsButton = ({ type, ...props }) =>
|
export const SettingsButton = ({ type, command, ...props }) =>
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
Utils.execAsync(`gnome-control-center ${type}`);
|
Utils.execAsync(command ?? `gnome-control-center ${type}`);
|
||||||
App.closeWindow("quicksettings");
|
App.closeWindow("quicksettings");
|
||||||
},
|
},
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export const Selection = (props) =>
|
|||||||
children: bluetooth.bind("devices").as((x) => x.map(DeviceItem)),
|
children: bluetooth.bind("devices").as((x) => x.map(DeviceItem)),
|
||||||
}),
|
}),
|
||||||
Widget.Separator({ className: "accent" }),
|
Widget.Separator({ className: "accent" }),
|
||||||
SettingsButton({ type: "bluetooth" }),
|
SettingsButton({ command: "blueberry" }),
|
||||||
],
|
],
|
||||||
...props,
|
...props,
|
||||||
});
|
});
|
||||||
@@ -70,11 +70,12 @@ const DeviceItem = (device) =>
|
|||||||
children: [
|
children: [
|
||||||
Widget.Icon(`${device.icon_name}-symbolic`),
|
Widget.Icon(`${device.icon_name}-symbolic`),
|
||||||
Widget.Label(device.name),
|
Widget.Label(device.name),
|
||||||
|
Widget.Box({ hexpand: true }),
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
label: `${device.battery_percentage}%`,
|
label: `${device.battery_percentage}%`,
|
||||||
|
css: "padding-right: 24px;",
|
||||||
visible: device.bind("battery_percentage").as((x) => x > 0),
|
visible: device.bind("battery_percentage").as((x) => x > 0),
|
||||||
}),
|
}),
|
||||||
Widget.Box({ hexpand: true }),
|
|
||||||
Widget.Spinner({
|
Widget.Spinner({
|
||||||
active: device.bind("connecting"),
|
active: device.bind("connecting"),
|
||||||
visible: device.bind("connecting"),
|
visible: device.bind("connecting"),
|
||||||
@@ -82,8 +83,8 @@ const DeviceItem = (device) =>
|
|||||||
Widget.Switch({
|
Widget.Switch({
|
||||||
active: device.bind("connected"),
|
active: device.bind("connected"),
|
||||||
visible: device.bind("connecting").as((p) => !p),
|
visible: device.bind("connecting").as((p) => !p),
|
||||||
// sensitive: false,
|
|
||||||
setup: (self) =>
|
setup: (self) =>
|
||||||
|
// TODO: If connecting to the device failed, reset back the switch to `active: false`.
|
||||||
self.connect("state_set", () => {
|
self.connect("state_set", () => {
|
||||||
device.setConnection(self.active);
|
device.setConnection(self.active);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ mark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
background-color: #000;
|
background-color: #1E1E2E;
|
||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user