[AGS] Fix crashing

This commit is contained in:
Janis Hutz 2025-04-25 20:56:59 +02:00
parent 3e5136fdbb
commit 03d9d89102
6 changed files with 35 additions and 2796 deletions

View File

@ -3,6 +3,7 @@ import style from "./style.scss"
import Bar from "./components/bar/Bar";
import AstalHyprland from "gi://AstalHyprland?version=0.1";
import { hyprToGdk } from "./util/hyprland";
import { writeFile } from "astal";
App.start({
instanceName: "runner",
@ -40,6 +41,12 @@ App.start({
bars.delete( monitor );
}
} );
// const monitors = App.get_monitors();
// print( "adding bar to monitors" );
// for (let index = 0; index < monitors.length; index++) {
// Bar.BarLauncher( monitors[ index ] );
// }
},
requestHandler(request, res) {
const args = request.trimStart().split( ' ' );

View File

@ -1,4 +1,4 @@
import { bind, readFile, writeFile } from "astal";
import { bind, exec, interval, readFile, timeout, writeFile } from "astal";
import { Gtk } from "astal/gtk4";
import AstalBluetooth from "gi://AstalBluetooth";
import BTDevice from "./Device";
@ -70,12 +70,34 @@ const openBTPicker = () => {
picker.popup();
try {
bt.adapter.start_discovery();
} catch (_) {}
} catch (_) { }
};
const BluetoothPickerList = () => {
let btEnableState = readFile(`${DATADIR}./btconf`) === "true" ? true : false;
bt.adapter.set_powered(btEnableState);
let btEnableState = readFile("./btconf") === "true" ? true : false;
if (bt.adapter) {
bt.adapter.set_powered(btEnableState);
} else {
timeout( 1000, () => {
if (bt.adapter) {
bt.adapter.set_powered(btEnableState);
} else {
timeout( 2000, () => {
if ( bt.adapter ) {
bt.adapter.set_powered(btEnableState);
} else {
timeout( 10000, () => {
if ( bt.adapter ) {
bt.adapter.set_powered(btEnableState);
} else {
exec( `/bin/bash -c "notify-send 'Failed to connect to bluetooth adapter'"` );
}
} )
}
} )
}
} );
}
const updateState = () => {
btEnableState = !btEnableState;

View File

@ -1,5 +1,6 @@
project('bar-launcher-tools', version: '1.0')
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
main = meson.project_name() + '.wrapped'
main = meson.project_name() + '.built'
custom_target(
command: [

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
#!/bin/bash
LD_PRELOAD="@LAYER_SHELL_LIBDIR@/libgtk4-layer-shell.so" @MAIN_PROGRAM@ $@