feat: Shortcuts widget
This commit is contained in:
22
ags/app.ts
22
ags/app.ts
@ -6,28 +6,30 @@ import Hyprland from "gi://AstalHyprland";
|
||||
|
||||
import QuickSettings from "widget/quick_settings/quick_settings";
|
||||
import BluetoothWindow from "widget/quick_settings/bluetooth";
|
||||
import Shortcuts from "./widget/launcher/shortcuts";
|
||||
import Clipboard from "widget/launcher/clipboard";
|
||||
import Launcher from "widget/launcher/launcher";
|
||||
import BatteryInfo from "widget/bar/battery_info";
|
||||
import Launcher from "widget/launcher/launcher";
|
||||
import Bar from "widget/bar/bar";
|
||||
|
||||
const hypr = Hyprland.get_default();
|
||||
const windows = new Map<number, Gtk.Window[]>();
|
||||
const components = [
|
||||
Bar,
|
||||
Launcher,
|
||||
QuickSettings,
|
||||
Bar,
|
||||
Launcher,
|
||||
QuickSettings,
|
||||
BluetoothWindow,
|
||||
BatteryInfo,
|
||||
Clipboard
|
||||
Clipboard,
|
||||
Shortcuts
|
||||
];
|
||||
|
||||
const setupBars = async (monitor_id: number) => {
|
||||
const windows = await Promise.all(
|
||||
components.map(item => Promise.resolve(item(monitor_id)) as Promise<Gtk.Window>)
|
||||
);
|
||||
const windows = await Promise.all(
|
||||
components.map(item => Promise.resolve(item(monitor_id)) as Promise<Gtk.Window>)
|
||||
);
|
||||
|
||||
return windows;
|
||||
return windows;
|
||||
};
|
||||
|
||||
const STYLES = GLib.get_user_config_dir() + "/ags/styles/style.scss";
|
||||
@ -55,7 +57,7 @@ App.start({
|
||||
hypr.connect("monitor-added", async (_, monitor: Hyprland.Monitor) => {
|
||||
if (!windows.has(monitor.id)) windows.set(monitor.id, await setupBars(monitor.id))
|
||||
});
|
||||
|
||||
|
||||
hypr.connect("monitor-removed", (_, monitor_id: number) => {
|
||||
const monitorWindows = windows.get(monitor_id)
|
||||
if (monitorWindows) {
|
||||
|
Reference in New Issue
Block a user