mirror of
https://github.com/zoriya/flake.git
synced 2025-12-06 06:36: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
|
||||
covercolors
|
||||
brightnessctl
|
||||
blueberry
|
||||
];
|
||||
# systemd.user.services.ags = {
|
||||
# Unit = {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -88,7 +88,7 @@ mark {
|
||||
}
|
||||
|
||||
switch {
|
||||
background-color: #000;
|
||||
background-color: #1E1E2E;
|
||||
border-radius: 100px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user