Hide spotlight when an application is selected on appdock
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good

This commit is contained in:
DanyLE 2023-01-04 11:06:29 +01:00
parent ece24f7a5e
commit 760bcee465
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,43 +275,54 @@ 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>
{ {
const name = bt.data.name as string; return new Promise(async (resolve, reject) => {
const collection = this.items.filter(it => it.app.name == name); try {
const ctxmenu = $("#contextmenu")[0] as tag.StackMenuTag; const name = bt.data.name as string;
ctxmenu.hide(); const collection = this.items.filter(it => it.app.name == name);
if(collection.length == 0) const ctxmenu = $("#contextmenu")[0] as tag.StackMenuTag;
{ ctxmenu.hide();
GUI.launch(name, []); if(collection.length == 0)
return; {
} resolve(await GUI.launch(name, []) as application.BaseApplication);
if(collection.length == 1) return;
{ }
collection[0].app.trigger("focus"); if(collection.length == 1)
return; {
} collection[0].app.trigger("focus");
// show the context menu containning a list of application to select resolve(collection[0].app);
const menu_data = collection.map(e => { return;
return { }
text: (e.app.scheme as WindowTag).apptitle, // show the context menu containning a list of application to select
icon: e.icon, const menu_data = collection.map(e => {
iconclass: e.iconclass, return {
app: e.app text: (e.app.scheme as WindowTag).apptitle,
}; icon: e.icon,
iconclass: e.iconclass,
app: e.app
};
});
const offset = $(bt).offset();
ctxmenu.nodes = menu_data;
$(ctxmenu)
.css("left", offset.left)
.css("bottom", $(this).height());
ctxmenu.onmenuselect = (e) =>
{
e.data.item.data.app.show();
resolve(e.data.item.data.app);
}
ctxmenu.show();
}
catch(e)
{
reject(__e(e));
}
}); });
const offset = $(bt).offset();
ctxmenu.nodes = menu_data;
$(ctxmenu)
.css("left", offset.left)
.css("bottom", $(this).height());
ctxmenu.onmenuselect = (e) =>
{
e.data.item.data.app.show();
}
ctxmenu.show();
} }
/** /**

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);
} }
} }