✨ ags(apps-window, control-center, center-window): port to new PopupWindow function
This commit is contained in:
@@ -1,55 +1,33 @@
|
||||
import { Astal, Gdk, Gtk, Widget } from "astal/gtk3";
|
||||
import { Astal, Gtk, Widget } from "astal/gtk3";
|
||||
import { QuickActions } from "../widget/control-center/QuickActions";
|
||||
import { Tiles } from "../widget/control-center/Tiles";
|
||||
import { Sliders } from "../widget/control-center/Sliders";
|
||||
import { hidePages, PagesWidget } from "../widget/control-center/Pages";
|
||||
import { NotifHistory } from "../widget/control-center/NotifHistory";
|
||||
import { Windows } from "../windows";
|
||||
import { PopupWindow } from "../widget/PopupWindow";
|
||||
|
||||
const { TOP, LEFT, BOTTOM, RIGHT } = Astal.WindowAnchor;
|
||||
|
||||
export const ControlCenter = (mon: number) => new Widget.Window({
|
||||
export const ControlCenter = (mon: number) => PopupWindow({
|
||||
namespace: "control-center",
|
||||
className: "control-center",
|
||||
anchor: TOP | BOTTOM | LEFT | RIGHT,
|
||||
exclusivity: Astal.Exclusivity.NORMAL,
|
||||
keymode: Astal.Keymode.EXCLUSIVE,
|
||||
anchor: Astal.WindowAnchor.TOP | Astal.WindowAnchor.RIGHT | Astal.WindowAnchor.BOTTOM,
|
||||
layer: Astal.Layer.OVERLAY,
|
||||
focusOnMap: true,
|
||||
marginTop: 10,
|
||||
marginRight: 10,
|
||||
monitor: mon,
|
||||
onDestroy: () => {
|
||||
hidePages();
|
||||
},
|
||||
onButtonPressEvent: (_, event: Gdk.Event) => {
|
||||
const [, posX, posY] = event.get_coords();
|
||||
const childAllocation = _.get_child()!.get_allocation();
|
||||
|
||||
if((posX < childAllocation.x || posX > (childAllocation.x + childAllocation.width)) ||
|
||||
(posY < childAllocation.y || posY > (childAllocation.y + childAllocation.height))) {
|
||||
Windows.close("control-center");
|
||||
hidePages();
|
||||
}
|
||||
},
|
||||
onKeyPressEvent: (_, event: Gdk.Event) => {
|
||||
if(event.get_keyval()[1] === Gdk.KEY_Escape) {
|
||||
Windows.close("control-center");
|
||||
hidePages();
|
||||
}
|
||||
},
|
||||
onDestroy: () => hidePages(),
|
||||
widthRequest: 420,
|
||||
child: new Widget.Box({
|
||||
className: "popup",
|
||||
halign: Gtk.Align.END,
|
||||
css: `margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;`,
|
||||
widthRequest: 420,
|
||||
onButtonPressEvent: () => true,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
className: "control-center-container",
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
widthRequest: 400,
|
||||
vexpand: false,
|
||||
children: [
|
||||
QuickActions(),
|
||||
|
||||
Reference in New Issue
Block a user