@gjsify/adwaita-app 0.64.34 → 0.64.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/esm/application.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{applyAboutLinks as e,createAboutDialog as t}from"./about-dialog.js";import{addAppIconDir as n}from"./app-icon.js";import{
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{applyAboutLinks as e,createAboutDialog as t}from"./about-dialog.js";import{addAppIconDir as n}from"./app-icon.js";import{installDockReopen as r}from"./dock-reopen.js";import{installBundledIconTheme as i}from"./icon-theme.js";import a from"gi://Adw?version=1";import o from"gi://Gio?version=2.0";import s from"gi://Gtk?version=4.0";import c from"gi://Gdk?version=4.0";import l from"gi://GObject?version=2.0";import u from"system";import{installDevtools as d}from"@gjsify/devtools";var f=class AdwaitaApp extends a.Application{static{l.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??o.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this._initActions(),this.connect(`startup`,()=>this._onStartup()),this.connect(`activate`,()=>this._onActivate())}_initActions(){if(this._options.quitAction!==!1){let e=new o.SimpleAction({name:`quit`});e.connect(`activate`,()=>this.quit()),this.add_action(e),this.set_accels_for_action(`app.quit`,[`<primary>q`])}if(this._options.about||this._options.aboutAppdata){let e=new o.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._installBundledIcons(),this._installAppIcon(),this._options.css&&this._loadCss(this._options.css),this._installDevtools(),r(),this._options.onStartup?.(this)}_installBundledIcons(){let e=this._options.bundledIcons;e!==!1&&i(typeof e==`object`?e:{})}_installAppIcon(){let e=c.Display.get_default();e&&n(s.IconTheme.get_for_display(e),this._options.about?.applicationIcon??this._options.applicationId,{iconDir:this._options.iconDir})}_loadCss(e){let t=c.Display.get_default();if(!t){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let n=new s.CssProvider;n.load_from_string(e),s.StyleContext.add_provider_for_display(t,n,s.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};d(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let n=this._options.aboutAppdata;if(n){t(n).present(this.get_active_window());return}let r=this._options.about;if(!r)return;let i=new a.AboutDialog({application_name:r.applicationName,application_icon:r.applicationIcon??this._options.applicationId});r.version&&(i.version=r.version),r.developerName&&(i.developer_name=r.developerName),r.website&&(i.website=r.website),r.issueUrl&&(i.issue_url=r.issueUrl),r.license&&(i.license=r.license),r.comments&&(i.comments=r.comments),r.copyright&&(i.copyright=r.copyright),r.developers?.length&&i.set_developers(r.developers),e(i,r.links),i.present(this.get_active_window())}};async function runAdwaitaApp(e){return runApplication(new f(e),[u.programInvocationName,...u.programArgs])}async function runApplication(e,t){let n=!1;try{e.register(null),n=e.get_is_remote()}catch{n=!1}let r=await e.runAsync(t);return n&&console.error(`${e.applicationId??`This application`} is already running — brought the existing instance to the front instead of opening a second window.`),r}l.type_ensure(f.$gtype);export{f as AdwaitaApp,runAdwaitaApp,runApplication};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{loadOptionalNativeModule as e}from"@gjsify/utils/core";function installDockReopen(t=process.platform,n){if(t!==`darwin`)return!1;let{module:r}=e(`GjsifyQuartz`,[`install_reopen_handler`],n);if(!r)return!1;try{return r.install_reopen_handler()}catch{return!1}}export{installDockReopen};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type GiImportsView } from '@gjsify/utils/core';
|
|
2
|
+
/**
|
|
3
|
+
* Install the Dock-click reopen handler on darwin.
|
|
4
|
+
*
|
|
5
|
+
* @param platform the OS to act on — a parameter so the spec can drive it
|
|
6
|
+
* @param gi the `imports.gi` to load the bridge from — defaults to the host's
|
|
7
|
+
* @returns whether this call installed the handler; `false` off darwin, without
|
|
8
|
+
* the bridge, or when GTK already implements it
|
|
9
|
+
*/
|
|
10
|
+
export declare function installDockReopen(platform?: string, gi?: GiImportsView): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-app",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.36",
|
|
4
4
|
"description": "Native Adwaita application shell for GJS/GTK apps — Adw.Application lifecycle (runAsync + devtools + CSS), a data-driven NavigationSplitView nav shell, an async-view mounter, promise dialog/toast/file helpers, and a display-less reader of the desktop accent and colour scheme (`./appearance`)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -62,14 +62,17 @@
|
|
|
62
62
|
"@girs/glib-2.0": "5.4.0",
|
|
63
63
|
"@girs/gobject-2.0": "5.4.0",
|
|
64
64
|
"@girs/gtk-4.0": "5.4.0",
|
|
65
|
-
"@gjsify/adwaita-core": "^0.64.
|
|
66
|
-
"@gjsify/devtools": "^0.64.
|
|
67
|
-
"@gjsify/utils": "^0.64.
|
|
65
|
+
"@gjsify/adwaita-core": "^0.64.36",
|
|
66
|
+
"@gjsify/devtools": "^0.64.36",
|
|
67
|
+
"@gjsify/utils": "^0.64.36"
|
|
68
|
+
},
|
|
69
|
+
"optionalDependencies": {
|
|
70
|
+
"@gjsify/gtk-quartz-native": "^0.64.36"
|
|
68
71
|
},
|
|
69
72
|
"devDependencies": {
|
|
70
|
-
"@gjsify/cli": "^0.64.
|
|
71
|
-
"@gjsify/storybook": "^0.64.
|
|
72
|
-
"@gjsify/unit": "^0.64.
|
|
73
|
+
"@gjsify/cli": "^0.64.36",
|
|
74
|
+
"@gjsify/storybook": "^0.64.36",
|
|
75
|
+
"@gjsify/unit": "^0.64.36",
|
|
73
76
|
"@types/node": "^25.9.2",
|
|
74
77
|
"typescript": "^6.0.3"
|
|
75
78
|
},
|