fix
This commit is contained in:
1 parent
9ea0dd2cdc
commit
3d984cebbd
3 files changed
+54
-4
No files matched your search
@@ -429,7 +429,12 @@ function TaskBar() {
|
|||||||
return Widget.Box({
|
return Widget.Box({
|
||||||
class_name: "tray",
|
class_name: "tray",
|
||||||
spacing: 5,
|
spacing: 5,
|
||||||
children: hyprland.bind("clients").as(Clients)
|
setup: (self) => {
|
||||||
|
self.hook(hyprland, () => {
|
||||||
|
self.children = Clients(hyprland.clients);
|
||||||
|
self.visible = self.children.length > 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import App from "resource:///com/github/Aylur/ags/app.js";
|
||||||
|
import Widget from "resource:///com/github/Aylur/ags/widget.js";
|
||||||
|
import { WindowProps, Window } from "types/widgets/window";
|
||||||
|
import Gtk from "gi://Gtk?version=3.0";
|
||||||
|
|
||||||
|
type _WindowProps = WindowProps<any, unknown, Window<any, unknown>> | undefined[];
|
||||||
|
|
||||||
|
type Type = {
|
||||||
|
name: string;
|
||||||
|
child: any;
|
||||||
|
showClassName?: string;
|
||||||
|
hideClassName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default <T extends Type>({
|
||||||
|
name,
|
||||||
|
child,
|
||||||
|
showClassName = "",
|
||||||
|
hideClassName = "",
|
||||||
|
...props
|
||||||
|
}: T & Omit<_WindowProps, keyof Type>) => {
|
||||||
|
return Widget.Window({
|
||||||
|
name,
|
||||||
|
visible: false,
|
||||||
|
type: Gtk.WindowType.POPUP,
|
||||||
|
layer: "overlay",
|
||||||
|
resizable: true,
|
||||||
|
...props,
|
||||||
|
setup: (self) => {
|
||||||
|
self.keybind("Escape", () => App.closeWindow(name));
|
||||||
|
self.on("button-press-event", () => App.closeWindow(name)); // Close on mouse click
|
||||||
|
|
||||||
|
if (showClassName !== "" && hideClassName !== "") {
|
||||||
|
self.hook(App, (self, currentName, visible) => {
|
||||||
|
if (currentName === name) {
|
||||||
|
self.toggleClassName(hideClassName, !visible);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
self.class_name = `${showClassName} ${hideClassName}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: child
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -3,10 +3,10 @@ const encoder = new TextEncoder();
|
|||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const WINDOW_NAME = "applauncher";
|
|
||||||
import Box from "types/widgets/box";
|
import Box from "types/widgets/box";
|
||||||
import { Application } from "types/service/applications";
|
import { Application } from "types/service/applications";
|
||||||
import Gtk from "gi://Gtk?version=3.0";
|
import Gtk from "gi://Gtk?version=3.0";
|
||||||
|
import { WINDOW_NAME } from "modules/sideleft/main";
|
||||||
|
|
||||||
const LAUNCH_COUNT_FILE = Gio.File.new_for_path(
|
const LAUNCH_COUNT_FILE = Gio.File.new_for_path(
|
||||||
GLib.build_filenamev([GLib.get_home_dir(), ".cache", "launch_counts.json"])
|
GLib.build_filenamev([GLib.get_home_dir(), ".cache", "launch_counts.json"])
|
||||||
@@ -75,7 +75,7 @@ function AppItem(app: Application): Box<any, any> {
|
|||||||
|
|
||||||
button.connect("clicked", () => {
|
button.connect("clicked", () => {
|
||||||
clickCount++;
|
clickCount++;
|
||||||
if (clickCount === 1) {
|
if (clickCount === 2) {
|
||||||
incrementLaunchCount(app.name);
|
incrementLaunchCount(app.name);
|
||||||
App.closeWindow(WINDOW_NAME);
|
App.closeWindow(WINDOW_NAME);
|
||||||
app.launch();
|
app.launch();
|
||||||
@@ -122,7 +122,7 @@ export const Applauncher = () => {
|
|||||||
on_accept: () => {
|
on_accept: () => {
|
||||||
const results = applications.filter((item) => item.visible);
|
const results = applications.filter((item) => item.visible);
|
||||||
if (results[0]) {
|
if (results[0]) {
|
||||||
App.toggleWindow(WINDOW_NAME);
|
App.closeWindow(WINDOW_NAME);
|
||||||
results[0].attribute.app.launch();
|
results[0].attribute.app.launch();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user