✨ ags(runner): port to new PopupWindow function
This commit is contained in:
+10
-8
@@ -1,5 +1,5 @@
|
|||||||
import { AstalIO, timeout, Variable } from "astal";
|
import { AstalIO, timeout, Variable } from "astal";
|
||||||
import { Gdk, Gtk, Widget } from "astal/gtk3";
|
import { Astal, Gdk, Gtk, Widget } from "astal/gtk3";
|
||||||
import { PopupWindow, PopupWindowProps } from "../widget/PopupWindow";
|
import { PopupWindow, PopupWindowProps } from "../widget/PopupWindow";
|
||||||
import { updateApps } from "../scripts/apps";
|
import { updateApps } from "../scripts/apps";
|
||||||
import { ResultWidget, ResultWidgetProps } from "../widget/runner/ResultWidget";
|
import { ResultWidget, ResultWidgetProps } from "../widget/runner/ResultWidget";
|
||||||
@@ -165,16 +165,16 @@ export namespace Runner {
|
|||||||
runnerInstance = Windows.createWindowForFocusedMonitor((mon: number): (Widget.Window) => PopupWindow({
|
runnerInstance = Windows.createWindowForFocusedMonitor((mon: number): (Widget.Window) => PopupWindow({
|
||||||
namespace: "runner",
|
namespace: "runner",
|
||||||
monitor: mon,
|
monitor: mon,
|
||||||
widthRequest: props?.width || 750,
|
widthRequest: props?.width ?? 750,
|
||||||
heightRequest: props?.height || 0,
|
heightRequest: props?.height ?? 450,
|
||||||
marginTop: 230,
|
marginTop: 240,
|
||||||
valign: Gtk.Align.START,
|
anchor: Astal.WindowAnchor.TOP | Astal.WindowAnchor.BOTTOM,
|
||||||
onKeyPressEvent: (_, event: Gdk.Event) => {
|
onKeyPressEvent: (_, event: Gdk.Event) => {
|
||||||
const keyVal = event.get_keyval()[1];
|
const keyVal = event.get_keyval()[1];
|
||||||
|
|
||||||
if(!searchEntry.has_focus && keyVal !== Gdk.KEY_F5
|
if(!searchEntry.has_focus && keyVal !== Gdk.KEY_F5
|
||||||
&& keyVal !== Gdk.KEY_Down && keyVal !== Gdk.KEY_Up
|
&& keyVal !== Gdk.KEY_Down && keyVal !== Gdk.KEY_Up
|
||||||
&& keyVal !== Gdk.KEY_KP_Enter && keyVal !== Gdk.KEY_ISO_Enter
|
&& keyVal !== Gdk.KEY_Return) {
|
||||||
&& keyVal !== Gdk.KEY_Escape) {
|
|
||||||
searchEntry.grab_focus_without_selecting();
|
searchEntry.grab_focus_without_selecting();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,6 +188,8 @@ export namespace Runner {
|
|||||||
child: new Widget.Box({
|
child: new Widget.Box({
|
||||||
className: "runner main",
|
className: "runner main",
|
||||||
orientation: Gtk.Orientation.VERTICAL,
|
orientation: Gtk.Orientation.VERTICAL,
|
||||||
|
expand: false,
|
||||||
|
valign: Gtk.Align.START,
|
||||||
children: [
|
children: [
|
||||||
searchEntry,
|
searchEntry,
|
||||||
new Widget.Scrollable({
|
new Widget.Scrollable({
|
||||||
@@ -196,7 +198,7 @@ export namespace Runner {
|
|||||||
hscroll: Gtk.PolicyType.NEVER,
|
hscroll: Gtk.PolicyType.NEVER,
|
||||||
expand: true,
|
expand: true,
|
||||||
propagateNaturalHeight: true,
|
propagateNaturalHeight: true,
|
||||||
maxContentHeight: (props?.height ?? 450),
|
maxContentHeight: props?.height ?? 450,
|
||||||
child: resultsList
|
child: resultsList
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user