💥 ags(runner): fix ResultWidget.closeOnClick property, do not close runner on media control plugin

This commit is contained in:
retrozinndev
2025-04-23 14:55:20 -03:00
parent ddf4f659b5
commit 4af7df5b17
3 changed files with 22 additions and 24 deletions
+10 -9
View File
@@ -46,9 +46,7 @@ export namespace Runner {
showResultsPlaceHolderOnStartup?: boolean;
};
export function close() {
runnerInstance?.close();
}
export function close() { runnerInstance?.close(); }
const plugins = new Set<Runner.Plugin>([]);
@@ -98,6 +96,7 @@ export namespace Runner {
if(resultWidget instanceof ResultWidget) {
entry.isFocus = false;
resultWidget.onClick();
resultWidget.closeOnClick && Runner.close();
}
},
primary_icon_name: "system-search"
@@ -140,13 +139,14 @@ export namespace Runner {
resultsList.insert(resultWidget, -1);
resultsList.connect("row-activated", (_, row: Gtk.ListBoxRow) => {
const rWidget = row.get_child()!;
const rWidget = row.get_child();
if(rWidget instanceof ResultWidget) {
if(!onClickTimeout) {
rWidget.onClick();
// Timeout, so it doesn't fire the event a hundred times :skull:
onClickTimeout = timeout(500, () => onClickTimeout = undefined);
}
if(onClickTimeout) return;
// Timeout, so it doesn't fire the event a hundred times :skull:
onClickTimeout = timeout(500, () => onClickTimeout = undefined);
rWidget.onClick();
rWidget.closeOnClick && Runner.close();
}
});
});
@@ -172,6 +172,7 @@ export namespace Runner {
&& keyVal !== Gdk.KEY_Down && keyVal !== Gdk.KEY_Up
&& keyVal !== Gdk.KEY_Return) {
searchEntry.grab_focus_without_selecting();
return;
}
event.get_keyval()[1] === Gdk.KEY_F5 &&
+4
View File
@@ -11,6 +11,7 @@ export const PluginMedia = {
if(!player) return new ResultWidget({
icon: "folder-music-symbolic",
title: "Couldn't find any players",
closeOnClick: false,
description: "No media / player found with mpris"
} as ResultWidgetProps);
return [
@@ -18,6 +19,7 @@ export const PluginMedia = {
icon: bind(player, "playbackStatus").as((status) => status === AstalMpris.PlaybackStatus.PLAYING ?
"media-playback-pause-symbolic"
: "media-playback-start-symbolic"),
closeOnClick: false,
title: Variable.derive([
bind(player, "title"),
bind(player, "artist"),
@@ -29,6 +31,7 @@ export const PluginMedia = {
} as ResultWidgetProps),
new ResultWidget({
icon: "media-skip-backward-symbolic",
closeOnClick: false,
title: Variable.derive([
bind(player, "title"),
bind(player, "artist")
@@ -39,6 +42,7 @@ export const PluginMedia = {
} as ResultWidgetProps),
new ResultWidget({
icon: "media-skip-forward-symbolic",
closeOnClick: false,
title: Variable.derive([
bind(player, "title"),
bind(player, "artist")