feat(control-center/page): restore bottom buttons for pages

it was accidentally removed previously, but now it's backgit add .git add .
This commit is contained in:
retrozinndev
2025-10-24 18:24:21 -03:00
parent 9d1e91f72e
commit e473344eef
17 changed files with 247 additions and 233 deletions
+24 -27
View File
@@ -4,6 +4,7 @@ import { userData } from "../config";
import GObject, { getter, gtype, property, register, setter } from "ags/gobject";
import AstalBluetooth from "gi://AstalBluetooth";
import { createScopedConnection } from "gnim-utils";
/** AstalBluetooth helper (implements the default adapter feature) */
@@ -62,7 +63,7 @@ export class Bluetooth extends GObject.Object {
constructor() {
super();
createRoot((_) => {
createRoot(async () => {
this.#scope = getScope();
if(this.astalBl.adapters.length > 0) {
@@ -77,37 +78,33 @@ export class Bluetooth extends GObject.Object {
if(dataDefaultAdapter !== undefined && foundAdapter !== undefined)
this.adapter = foundAdapter;
this.#connections.set(
AstalBluetooth.get_default(), [
AstalBluetooth.get_default().connect("adapter-added", (self, adapter) => {
if(self.adapters.length === 1) // adapter was just added
this.adapter = adapter;
}),
AstalBluetooth.get_default().connect("adapter-removed", (self, adapter) => {
if(self.adapters.length < 1) {
this.adapter = null;
this.#isAvailable = false;
this.notify("is-available");
}
createScopedConnection(AstalBluetooth.get_default(), "adapter-added", (adapter) => {
if(this.astalBl.adapters.length === 1) // adapter was just added
this.adapter = adapter;
});
createScopedConnection(AstalBluetooth.get_default(), "adapter-removed", (adapter) => {
if(this.astalBl.adapters.length < 1) {
this.adapter = null;
this.#isAvailable = false;
this.notify("is-available");
}
if(this.#adapter?.address !== adapter.address)
return;
if(this.#adapter?.address !== adapter.address)
return;
// the removed adapter was the default
// the removed adapter was the default
if(self.adapters.length < 1) {
this.adapter = null;
this.#isAvailable = false;
this.notify("is-available");
if(this.astalBl.adapters.length < 1) {
this.adapter = null;
this.#isAvailable = false;
this.notify("is-available");
return;
}
this.#adapter = self.adapters[0];
})
]
);
return;
}
this.#adapter = this.astalBl.adapters[0];
});
// async to prevent slow start
setTimeout(() => {
this.#lastDevice = this.getLastConnectedDevice();
+3 -5
View File
@@ -2,12 +2,7 @@ import { createPoll } from "ags/time";
import { exec, execAsync } from "ags/process";
import { Astal, Gtk } from "ags/gtk4";
import { getSymbolicIcon } from "./apps";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
export {
type JSXNode as WidgetNodeType,
toBoolean as variableToBoolean,
construct,
transform,
@@ -19,6 +14,9 @@ export {
createSecureAccessorBinding as secureBaseBinding,
} from "gnim-utils";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
export const decoder = new TextDecoder("utf-8"),
encoder = new TextEncoder();