💥 ags(runner): actually run Runner.Plugin.init() on runner open
This commit is contained in:
@@ -56,7 +56,7 @@ export namespace Runner {
|
|||||||
readonly prefix?: string;
|
readonly prefix?: string;
|
||||||
/** name of the plugin. e.g.: websearch, shell */
|
/** name of the plugin. e.g.: websearch, shell */
|
||||||
readonly name?: string;
|
readonly name?: string;
|
||||||
/** ran on plugin load */
|
/** ran on runner open */
|
||||||
readonly init?: () => void;
|
readonly init?: () => void;
|
||||||
/** handle the user input to return results (does not include plugin's prefix) */
|
/** handle the user input to return results (does not include plugin's prefix) */
|
||||||
readonly handle: (inputText: string) => (ResultWidget|Array<ResultWidget>|null|undefined);
|
readonly handle: (inputText: string) => (ResultWidget|Array<ResultWidget>|null|undefined);
|
||||||
@@ -106,6 +106,9 @@ export namespace Runner {
|
|||||||
expand: true
|
expand: true
|
||||||
} as Gtk.ListBox.ConstructorProps);
|
} as Gtk.ListBox.ConstructorProps);
|
||||||
|
|
||||||
|
// Init plugins
|
||||||
|
plugins.forEach(plugin => plugin.init && plugin.init());
|
||||||
|
|
||||||
function updateResultsList(entryText: string) {
|
function updateResultsList(entryText: string) {
|
||||||
const calledPlugins: Array<Plugin> = getPlugins().filter((plugin) => plugin.prefix && entryText.startsWith(plugin.prefix) ?
|
const calledPlugins: Array<Plugin> = getPlugins().filter((plugin) => plugin.prefix && entryText.startsWith(plugin.prefix) ?
|
||||||
plugin : null).concat(getPlugins().filter(plugin => plugin.prefix === undefined));
|
plugin : null).concat(getPlugins().filter(plugin => plugin.prefix === undefined));
|
||||||
@@ -150,7 +153,9 @@ export namespace Runner {
|
|||||||
runnerInstance = PopupWindow({
|
runnerInstance = PopupWindow({
|
||||||
namespace: "runner",
|
namespace: "runner",
|
||||||
widthRequest: props?.width || 750,
|
widthRequest: props?.width || 750,
|
||||||
heightRequest: props?.height || 450,
|
heightRequest: props?.height || 0,
|
||||||
|
marginTop: 250,
|
||||||
|
valign: Gtk.Align.START,
|
||||||
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
|
||||||
@@ -178,6 +183,8 @@ export namespace Runner {
|
|||||||
vscroll: Gtk.PolicyType.AUTOMATIC,
|
vscroll: Gtk.PolicyType.AUTOMATIC,
|
||||||
hscroll: Gtk.PolicyType.NEVER,
|
hscroll: Gtk.PolicyType.NEVER,
|
||||||
expand: true,
|
expand: true,
|
||||||
|
propagateNaturalHeight: true,
|
||||||
|
maxContentHeight: 450,
|
||||||
child: resultsList
|
child: resultsList
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user