Hide spotlight when an application is selected on appdock

This commit is contained in:
DanyLE 2023-01-04 11:06:29 +01:00 committed by Dany LE
parent 84cfc87ce0
commit 30c63748b0
4 changed files with 58 additions and 34 deletions

1
d.ts/antos.d.ts vendored
View File

@ -8716,6 +8716,7 @@ declare namespace OS {
* Handle the application selection action * Handle the application selection action
* *
* @private * @private
* @returns {Promise<application.BaseApplication>}
* @memberof AppDockTag * @memberof AppDockTag
*/ */
private handleAppSelect; private handleAppSelect;

View File

@ -110,6 +110,7 @@ namespace OS {
this.on("exit", () => this.quit(false)); this.on("exit", () => this.quit(false));
// first register some base event to the app // first register some base event to the app
this.on("focus", () => { this.on("focus", () => {
//if(this.sysdock.selectedApp != this)
this.sysdock.selectedApp = this; this.sysdock.selectedApp = this;
(this.scheme as GUI.tag.WindowTag).onmenuopen = (el) => el.nodes = this.baseMenu() || []; (this.scheme as GUI.tag.WindowTag).onmenuopen = (el) => el.nodes = this.baseMenu() || [];
OS.PM.pidactive = this.pid; OS.PM.pidactive = this.pid;

View File

@ -162,6 +162,11 @@ namespace OS {
} }
$(el.domel).addClass("selected"); $(el.domel).addClass("selected");
($(Ant.OS.GUI.workspace)[0] as FloatListTag).unselect(); ($(Ant.OS.GUI.workspace)[0] as FloatListTag).unselect();
const evt = {
id: this.aid,
data: v
};
announcer.trigger("appselect", evt);
} }
get selectedApp(): application.BaseApplication { get selectedApp(): application.BaseApplication {
@ -215,7 +220,8 @@ namespace OS {
item.domel = bt; item.domel = bt;
bt.onbtclick = (e) => { bt.onbtclick = (e) => {
e.data.stopPropagation(); e.data.stopPropagation();
this.handleAppSelect(bt); this
.handleAppSelect(bt);
}; };
} }
@ -269,22 +275,26 @@ namespace OS {
* Handle the application selection action * Handle the application selection action
* *
* @private * @private
* @returns {Promise<application.BaseApplication>}
* @memberof AppDockTag * @memberof AppDockTag
*/ */
private handleAppSelect(bt: ButtonTag) private handleAppSelect(bt: ButtonTag): Promise<application.BaseApplication>
{ {
return new Promise(async (resolve, reject) => {
try {
const name = bt.data.name as string; const name = bt.data.name as string;
const collection = this.items.filter(it => it.app.name == name); const collection = this.items.filter(it => it.app.name == name);
const ctxmenu = $("#contextmenu")[0] as tag.StackMenuTag; const ctxmenu = $("#contextmenu")[0] as tag.StackMenuTag;
ctxmenu.hide(); ctxmenu.hide();
if(collection.length == 0) if(collection.length == 0)
{ {
GUI.launch(name, []); resolve(await GUI.launch(name, []) as application.BaseApplication);
return; return;
} }
if(collection.length == 1) if(collection.length == 1)
{ {
collection[0].app.trigger("focus"); collection[0].app.trigger("focus");
resolve(collection[0].app);
return; return;
} }
// show the context menu containning a list of application to select // show the context menu containning a list of application to select
@ -304,9 +314,16 @@ namespace OS {
ctxmenu.onmenuselect = (e) => ctxmenu.onmenuselect = (e) =>
{ {
e.data.item.data.app.show(); e.data.item.data.app.show();
resolve(e.data.item.data.app);
} }
ctxmenu.show(); ctxmenu.show();
} }
catch(e)
{
reject(__e(e));
}
});
}
/** /**
* Delete and application entry from the dock. * Delete and application entry from the dock.

View File

@ -438,6 +438,7 @@ namespace OS {
const systray = this.refs.systray as GUI.tag.ButtonTag; const systray = this.refs.systray as GUI.tag.ButtonTag;
(this.refs.osmenu as ButtonTag).set(this._osmenu); (this.refs.osmenu as ButtonTag).set(this._osmenu);
this._cb = (e) => { this._cb = (e) => {
console.log("Clicked");
if ( if (
!$(e.target).closest($(this.refs.overlay)).length && !$(e.target).closest($(this.refs.overlay)).length &&
!$(e.target).closest(this.refs.osmenu).length !$(e.target).closest(this.refs.osmenu).length
@ -549,6 +550,10 @@ namespace OS {
announcer.on("desktopresize", (e) => { announcer.on("desktopresize", (e) => {
this.calibrate(); this.calibrate();
}); });
announcer.on("appselect", (e) => {
if(this._view)
this.toggle(false);
});
Ant.OS.announcer.trigger("syspanelloaded", undefined); Ant.OS.announcer.trigger("syspanelloaded", undefined);
} }
} }