@howaboua/pi-pet 0.1.4 → 0.1.6
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/CHANGELOG.md +8 -0
- package/README.md +3 -1
- package/desktop/build.mjs +31 -24
- package/desktop/package-lock.json +351 -687
- package/desktop/package.json +3 -3
- package/dist/desktop/main.mjs +1 -1
- package/extensions/desktop-config.ts +1 -1
- package/package.json +11 -13
- package/src/desktop/attention.ts +1 -1
- package/src/desktop/cursor-provider.ts +2 -2
- package/src/desktop/main.ts +1 -0
package/desktop/package.json
CHANGED
package/dist/desktop/main.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createReadStream as qe}from"node:fs";import{writeFile as Xe}from"node:fs/promises";import{dirname as Ke,join as ce}from"node:path";import{fileURLToPath as Qe}from"node:url";import{app as s,BrowserWindow as Ze,Menu as ue,screen as de,session as v}from"electron";import{randomUUID as Ee}from"node:crypto";import{mkdir as Se,readFile as ke,rename as be,unlink as De,writeFile as _e}from"node:fs/promises";import{dirname as Te}from"node:path";var Ce=new Set(["schemaVersion","mode","petSize","snoozedUntil"]),Re=4096,Ae=604800000;function N(){return{schemaVersion:1,mode:"normal",petSize:"medium",snoozedUntil:null}}function Ne(e){let t=e??"medium";if(t!=="small"&&t!=="medium"&&t!=="large")throw Error("Desktop petSize must be small, medium, or large.");return t}function H(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Desktop attention preferences must be an object.");let t=e,n=Object.keys(t).find((o)=>!Ce.has(o));if(n)throw Error(`Desktop attention preferences have unknown field: ${n}.`);if(t.schemaVersion!==1)throw Error("Unsupported desktop attention schemaVersion.");if(t.mode!=="normal"&&t.mode!=="quiet")throw Error("Desktop attention mode must be normal or quiet.");let r=Ne(t.petSize);if(t.snoozedUntil!==null&&typeof t.snoozedUntil!=="string")throw Error("Desktop snoozedUntil must be an ISO timestamp or null.");if(typeof t.snoozedUntil==="string"){let o=Date.parse(t.snoozedUntil);if(!Number.isFinite(o))throw Error("Desktop snoozedUntil must be a valid ISO timestamp.");if(o-Date.now()>Ae)throw Error("Desktop snoozedUntil cannot be more than seven days away.")}return{schemaVersion:1,mode:t.mode,petSize:r,snoozedUntil:t.snoozedUntil}}async function B(e){try{let t=await ke(e,"utf8");if(Buffer.byteLength(t)>Re)throw Error("Attention preferences are too large.");return H(JSON.parse(t))}catch(t){if(t.code==="ENOENT")return N();throw Error(`Invalid desktop attention preferences at ${e}: ${t.message}`)}}async function F(e,t){let n=H(t);await Se(Te(e),{recursive:!0,mode:448});let r=`${e}.${process.pid}.${Ee()}.tmp`;try{await _e(r,`${JSON.stringify(n)}
|
|
2
2
|
`,{encoding:"utf8",flag:"wx",mode:384}),await be(r,e)}catch(o){throw await De(r).catch(()=>{return}),o}}function V(e=new Date){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1,8)}function k(e,t=Date.now()){if(!e.snoozedUntil)return 0;return Math.max(0,Date.parse(e.snoozedUntil)-t)}var U="pi-pet:cursor-position";function j(e){if(e===null)return null;if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Cursor position must be an object.");let t=e;if(Object.keys(t).some((n)=>n!=="x"&&n!=="y"))throw Error("Cursor position has an unknown field.");if(typeof t.x!=="number"||!Number.isFinite(t.x)||Math.abs(t.x)>1e5||typeof t.y!=="number"||!Number.isFinite(t.y)||Math.abs(t.y)>1e5)throw Error("Cursor position is invalid.");return{x:t.x,y:t.y}}import{constants as J}from"node:fs";import{open as Ue}from"node:fs/promises";import{homedir as Y}from"node:os";import{join as l,resolve as Oe}from"node:path";var ve=new Set(["schemaVersion","gippityUrl"]),G=16384;function Ie(e=process.env,t=process.platform,n=Y()){if(e.PI_PET_DESKTOP_CONFIG)return Oe(e.PI_PET_DESKTOP_CONFIG);if(t==="win32")return l(e.APPDATA||l(n,"AppData","Roaming"),"PiPetDesktop","config.json");if(t==="darwin")return l(n,"Library","Application Support","Pi Pet Desktop","config.json");return l(e.XDG_CONFIG_HOME||l(n,".config"),"pi-pet-desktop","config.json")}function q(e=process.env,t=process.platform,n=Y()){if(t==="win32")return l(e.LOCALAPPDATA||l(n,"AppData","Local"),"PiPetDesktop","state");if(t==="darwin")return l(n,"Library","Application Support","Pi Pet Desktop","state");return l(e.XDG_STATE_HOME||l(n,".local","state"),"pi-pet-desktop")}function xe(e){if(typeof e!=="string"||e.length>2048)throw Error("gippityUrl must be a bounded HTTPS URL.");let t;try{t=new URL(e)}catch{throw Error("gippityUrl must be a valid HTTPS URL.")}if(t.protocol!=="https:"||t.username||t.password||t.search||t.hash)throw Error("gippityUrl must be an HTTPS origin without credentials, query, or fragment.");if(t.pathname!=="/")throw Error("gippityUrl must not contain a path.");return t.origin}function X(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Pi Pet desktop config must be an object.");let t=e,n=Object.keys(t).find((r)=>!ve.has(r));if(n)throw Error(`Pi Pet desktop config has unknown field: ${n}.`);if(t.schemaVersion!==1)throw Error("Unsupported Pi Pet desktop config schemaVersion.");return{schemaVersion:1,gippityUrl:xe(t.gippityUrl)}}function ze(e){let t=e.PI_PET_GIPPITY_URL;return t?X({schemaVersion:1,gippityUrl:t}):void 0}async function Le(e){try{return await Ue(e,J.O_RDONLY|(J.O_NOFOLLOW||0))}catch(t){if(t.code==="ENOENT")throw Error(`Pi Pet desktop is not configured: ${e}`);if(t.code==="ELOOP")throw Error(`Pi Pet desktop config must not be a symbolic link: ${e}`);throw t}}async function Me(e,t){let n=await e.stat();if(!n.isFile()||n.size>G)throw Error(`Pi Pet desktop config must be a regular file no larger than ${G} bytes: ${t}`);if(process.platform==="win32")return;if((n.mode&63)!==0)throw Error(`Pi Pet desktop config must have mode 0600: ${t}`);if(process.getuid&&n.uid!==process.getuid())throw Error(`Pi Pet desktop config must be owned by the current user: ${t}`)}async function K(e=Ie(),t=process.env){let n=ze(t);if(n)return n;let r=await Le(e);try{await Me(r,e);let o=await r.readFile("utf8");return X(JSON.parse(o))}catch(o){throw Error(`Invalid Pi Pet desktop config at ${e}: ${o.message}`)}finally{await r.close()}}function Q(e,t="normal"){let n=new URL(e.gippityUrl);if(n.pathname="/_gippity/apps/pi-pet/",n.searchParams.set("shell","desktop"),t==="quiet")n.searchParams.set("attention","quiet");return n.toString()}import{createConnection as We}from"node:net";import{join as He}from"node:path";var Be=/^[a-zA-Z0-9._-]{1,200}$/,Fe=1024,Ve=1048576,$e=200;function ee(e){let{XDG_RUNTIME_DIR:t,HYPRLAND_INSTANCE_SIGNATURE:n}=e;if(!(t&&n&&t.startsWith("/")&&Be.test(n)))return;return He(t,"hypr",n,".socket.sock")}function je(e){let t=j(JSON.parse(e));if(!t)throw Error("Hyprland returned an empty cursor position.");return t}function Z(e,t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!=="number"||!Number.isFinite(e[0])||typeof e[1]!=="number"||!Number.isFinite(e[1]))throw Error(`Hyprland ${t} is invalid.`);return[e[0],e[1]]}function Je(e,t){let n=JSON.parse(e);if(!Array.isArray(n))throw Error("Hyprland clients response must be an array.");let r=n.find((a)=>a!==null&&typeof a==="object"&&!Array.isArray(a)&&a.pid===t);if(!r)throw Error(`Hyprland did not report the Pi Pet window for process ${t}.`);let o=r,[d,S]=Z(o.at,"window position"),[i,u]=Z(o.size,"window size");if(i<1||u<1||i>4096||u>4096)throw Error("Hyprland window size is invalid.");return{x:d,y:S,width:i,height:u}}async function te(e,t,n,r,o){return await new Promise((d,S)=>{let i=We(e),u="",a=!1,P=(c)=>{if(a)return;a=!0,i.destroy(),S(c)};i.setEncoding("utf8"),i.setTimeout($e),i.on("connect",()=>i.end(t)),i.on("data",(c)=>{if(u+=c,Buffer.byteLength(u)>n){P(Error("Hyprland returned an oversized IPC response."));return}if(!r(u.trimEnd()))return;try{let f=o(u);a=!0,i.destroy(),d(f)}catch(f){P(f instanceof Error?f:Error("Hyprland returned an invalid IPC response."))}}),i.on("timeout",()=>P(Error("Hyprland cursor IPC timed out."))),i.on("error",(c)=>P(c)),i.on("end",()=>{if(a)return;try{let c=o(u);a=!0,d(c)}catch(c){P(c instanceof Error?c:Error("Hyprland returned an invalid IPC response."))}})})}async function Ge(e){return await te(e,"j/cursorpos",Fe,(t)=>t.endsWith("}"),je)}async function Ye(e,t){return await te(e,"j/clients",Ve,(n)=>n.endsWith("]"),(n)=>Je(n,t))}function ne(e,t){let n=ee(e);if(n)return async()=>await Ge(n);return async()=>t()}function re(e,t){let n=ee(e);if(!n)return;return async()=>await Ye(n,t)}var oe=20,et=3000,tt=1500,nt=100,rt=220,ie=500,ot=1e4,it=1000,pe=Object.freeze({small:{width:180,height:195},medium:{width:240,height:260},large:{width:320,height:347}}),b,w,m,D,_,h,p=N(),I=Promise.resolve(),se=!1,y,fe=!1;s.setName("Pi Pet Desktop");s.setPath("userData",q());if(process.platform==="linux")s.disableHardwareAcceleration(),s.commandLine.appendSwitch("disable-gpu"),s.commandLine.appendSwitch("disable-gpu-compositing");function T(e){let t=process.platform==="darwin"?"floating":"screen-saver";e.setAlwaysOnTop(!0,t,1),e.moveTop(),e.setVisibleOnAllWorkspaces(!0,{visibleOnFullScreen:!0})}function le(){return ce(s.getPath("userData"),"attention.json")}function st(){let e=Number(process.env.PI_PET_OWNER_FD);if(!Number.isSafeInteger(e)||e<3||e>9)return;let t=()=>{if(!fe)s.quit()};y=qe("",{fd:e,autoClose:!1}),y.once("end",t),y.once("close",t),y.once("error",t),y.resume()}function me(){if(!h)throw Error("Pi Pet desktop configuration is not loaded.");return Q(h,p.mode)}function R(e){let t=I.then(async()=>{let n=e(p);await F(le(),n),p=n});return I=t.catch(()=>{return}),t}function g(e){process.stderr.write(`Pi Pet desktop: ${e instanceof Error?e.message:String(e)}
|
|
3
3
|
`)}function C(e){if(!(h&&e))return!1;try{return new URL(e).origin===new URL(h.gippityUrl).origin}catch{return!1}}function at(){v.defaultSession.setPermissionCheckHandler((e,t,n,r)=>t==="media"&&r.isMainFrame&&r.mediaType==="audio"&&e!==null&&C(e.getURL())&&C(n)),v.defaultSession.setPermissionRequestHandler((e,t,n,r)=>{let o="mediaTypes"in r?r.mediaTypes:void 0;n(t==="media"&&r.isMainFrame&&o?.length===1&&o[0]==="audio"&&C(e.getURL())&&C(r.requestingUrl))})}function ct(){v.defaultSession.setCertificateVerifyProc((e,t)=>{let n=h?new URL(h.gippityUrl).hostname:void 0,r=e.errorCode===-202||e.verificationResult==="CERT_AUTHORITY_INVALID"||e.verificationResult==="net::ERR_CERT_AUTHORITY_INVALID";t(e.hostname===n&&r?0:e.errorCode)})}s.on("certificate-error",(e,t,n,r,o,d)=>{try{if(h&&r==="net::ERR_CERT_AUTHORITY_INVALID"&&new URL(n).origin===new URL(h.gippityUrl).origin){e.preventDefault(),d(!0);return}}catch{}d(!1)});function x(e){if(k(p)>0){e.hide();return}T(e),e.show()}function we(e){if(m)clearTimeout(m);m=void 0;let t=k(p);if(t===0){x(e);return}e.hide(),m=setTimeout(()=>{m=void 0,R((n)=>({...n,snoozedUntil:null})).then(()=>x(e)).catch(g)},t),m.unref()}async function O(e,t){await R((n)=>({...n,snoozedUntil:t.toISOString()})),we(e)}async function ut(e,t){await R((n)=>({...n,mode:t?"quiet":"normal"})),await z(e,me())}async function dt(e,t){await R((o)=>({...o,petSize:t}));let n=e.getBounds(),r=pe[t];e.setBounds({x:n.x+n.width-r.width,y:n.y+n.height-r.height,...r}),T(e)}function pt(e){let t=de.getPrimaryDisplay().workArea,n=pe[e];return{x:t.x+t.width-n.width-oe,y:t.y+t.height-n.height-oe,...n}}function ft(e){let t=!1,n=!1,r=!1,o=ie,d=0,S=ne(process.env,()=>de.getCursorScreenPoint()),i=re(process.env,process.pid),u,a=!1,P=async()=>{if(!i)return;try{u=await i(),a=!1}catch(f){if(!a)a=!0,g(f)}},c=async()=>{if(n||Date.now()<d||e.isDestroyed()||k(p)>0)return;n=!0;let f;try{f=await S(),r=!1,o=ie,d=0}catch(A){if(!r)r=!0,g(A);d=Date.now()+o,o=Math.min(o*2,ot),n=!1;return}let E=u||e.getBounds(),L=f.x-E.x,M=f.y-E.y,Pe=L-E.width/2,ge=M-E.height/2,ye=Math.max(E.width,E.height)/2+rt,W=Math.hypot(Pe,ge)<=ye;if(W){let A={x:L,y:M};e.webContents.send(U,A)}else if(t)e.webContents.send(U,null);t=W,n=!1};D=setInterval(()=>void c(),nt),D.unref(),_=setInterval(()=>void P(),it),_.unref(),P().then(c)}function lt(e,t){e.webContents.setWindowOpenHandler(()=>({action:"deny"}));let n=(r,o)=>{try{if(new URL(o).origin!==t)r.preventDefault()}catch{r.preventDefault()}};e.webContents.on("will-navigate",n),e.webContents.on("will-redirect",n),e.webContents.on("context-menu",()=>{ue.buildFromTemplate([{label:"Use arrow keys and Enter",enabled:!1},{type:"separator"},{label:"Reload pet",click:()=>e.webContents.reload()},{label:"Quiet mode",type:"checkbox",checked:p.mode==="quiet",click:(r)=>void ut(e,r.checked).catch(g)},{label:"Snooze",submenu:[{label:"For 15 minutes",click:()=>void O(e,new Date(Date.now()+900000)).catch(g)},{label:"For 1 hour",click:()=>void O(e,new Date(Date.now()+3600000)).catch(g)},{label:"Until tomorrow",click:()=>void O(e,V()).catch(g)}]},{label:"Pet size",submenu:["small","medium","large"].map((r)=>({label:r[0]?.toUpperCase()+r.slice(1),type:"radio",checked:p.petSize===r,click:()=>void dt(e,r).catch(g)}))},{type:"separator"},{label:"Quit for this Pi session",click:()=>s.quit()}]).popup({window:e})})}async function mt(e,t){await new Promise((r)=>setTimeout(r,tt));let n=await e.capturePage();await Xe(t,n.toPNG()),s.quit()}function wt(e,t){w=setTimeout(()=>{w=void 0,z(e,t)},et),w.unref()}async function z(e,t){if(w)clearTimeout(w);w=void 0;try{if(await e.loadURL(t),e.isDestroyed())return;x(e);let n=process.env.PI_PET_DESKTOP_SCREENSHOT;if(n)await mt(e,n)}catch(n){if(e.isDestroyed())return;process.stderr.write(`Pi Pet desktop could not reach GipPity: ${n instanceof Error?n.message:String(n)}
|
|
4
|
-
`),wt(e,t)}}async function ae(){h=await K(),p=await B(le());let e=me(),t=new URL(e).origin,n=new Ze({...pt(p.petSize),frame:!1,transparent:!0,hasShadow:!1,backgroundColor:"#00000000",alwaysOnTop:!0,maximizable:!1,minimizable:!1,movable:!0,resizable:!1,show:!1,skipTaskbar:!0,title:"Pi Pet",webPreferences:{contextIsolation:!0,devTools:process.env.PI_PET_DESKTOP_DEVTOOLS==="1",nodeIntegration:!1,preload:ce(Ke(Qe(import.meta.url)),"preload.cjs"),sandbox:!0,webSecurity:!0}});if(lt(n,t),T(n),n.setFullScreenable(!1),n.on("blur",()=>T(n)),n.on("show",()=>T(n)),n.on("closed",()=>{if(w)clearTimeout(w);if(m)clearTimeout(m);if(D)clearInterval(D);if(_)clearInterval(_);if(w=void 0,m=void 0,D=void 0,_=void 0,b===n)b=void 0}),z(n,e),ft(n),k(p)>0)we(n);return n}s.whenReady().then(async()=>{ue.setApplicationMenu(null),st(),at(),ct(),b=await ae(),s.on("activate",()=>{if(!b)ae().then((e)=>{b=e})})}).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
4
|
+
`),wt(e,t)}}async function ae(){h=await K(),p=await B(le());let e=me(),t=new URL(e).origin,n=new Ze({...pt(p.petSize),frame:!1,transparent:!0,roundedCorners:process.platform!=="linux",hasShadow:!1,backgroundColor:"#00000000",alwaysOnTop:!0,maximizable:!1,minimizable:!1,movable:!0,resizable:!1,show:!1,skipTaskbar:!0,title:"Pi Pet",webPreferences:{contextIsolation:!0,devTools:process.env.PI_PET_DESKTOP_DEVTOOLS==="1",nodeIntegration:!1,preload:ce(Ke(Qe(import.meta.url)),"preload.cjs"),sandbox:!0,webSecurity:!0}});if(lt(n,t),T(n),n.setFullScreenable(!1),n.on("blur",()=>T(n)),n.on("show",()=>T(n)),n.on("closed",()=>{if(w)clearTimeout(w);if(m)clearTimeout(m);if(D)clearInterval(D);if(_)clearInterval(_);if(w=void 0,m=void 0,D=void 0,_=void 0,b===n)b=void 0}),z(n,e),ft(n),k(p)>0)we(n);return n}s.whenReady().then(async()=>{ue.setApplicationMenu(null),st(),at(),ct(),b=await ae(),s.on("activate",()=>{if(!b)ae().then((e)=>{b=e})})}).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
5
5
|
`),s.quit()});s.on("window-all-closed",()=>{if(process.platform!=="darwin")s.quit()});s.on("will-quit",()=>{fe=!0,y?.destroy(),y=void 0});async function he(){if(se)return;se=!0,setTimeout(()=>process.exit(0),1500).unref(),await I,s.quit()}process.once("SIGINT",()=>void he());process.once("SIGTERM",()=>void he());
|
|
@@ -85,7 +85,7 @@ function parseLegacyRegistry(input: Record<string, unknown>): DeviceRegistryConf
|
|
|
85
85
|
return { schemaVersion: 1, devices, defaultDevices: Object.keys(devices) };
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
function parseDeviceRegistry(value: unknown): DeviceRegistryConfig {
|
|
89
89
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
90
90
|
throw new Error("Pi Pet device registry must be an object.");
|
|
91
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-pet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Animated companions for GipPity Remote.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"!**/__pycache__",
|
|
43
43
|
"!**/*.pyc",
|
|
44
44
|
"!**/.venv",
|
|
45
|
-
"!authoring/hatch/tests",
|
|
46
45
|
"changelog.ts",
|
|
47
46
|
"CHANGELOG.md"
|
|
48
47
|
],
|
|
@@ -54,7 +53,6 @@
|
|
|
54
53
|
"scripts": {
|
|
55
54
|
"build": "bun scripts/build.mjs",
|
|
56
55
|
"desktop:start": "npm --prefix desktop run build && npm --prefix desktop start",
|
|
57
|
-
"pet:hatch:test": "uv run --isolated --project authoring/hatch --locked python -m unittest discover -s authoring/hatch/tests -p 'test_*.py' -v",
|
|
58
56
|
"pet:prepare": "node dist/authoring/prepare.mjs",
|
|
59
57
|
"pet:rebuild": "node dist/authoring/rebuild.mjs",
|
|
60
58
|
"pet:validate": "node dist/authoring/validate.mjs",
|
|
@@ -74,11 +72,11 @@
|
|
|
74
72
|
"engines": {
|
|
75
73
|
"node": ">=22"
|
|
76
74
|
},
|
|
77
|
-
"packageManager": "bun@1.4.
|
|
75
|
+
"packageManager": "bun@1.4.2",
|
|
78
76
|
"peerDependencies": {
|
|
79
77
|
"@howaboua/pi-gippity-control": ">=0.0.20",
|
|
80
|
-
"@earendil-works/pi-coding-agent": ">=0.
|
|
81
|
-
"@earendil-works/pi-tui": ">=0.
|
|
78
|
+
"@earendil-works/pi-coding-agent": ">=1.0.0",
|
|
79
|
+
"@earendil-works/pi-tui": ">=1.0.0",
|
|
82
80
|
"typebox": "*"
|
|
83
81
|
},
|
|
84
82
|
"peerDependenciesMeta": {
|
|
@@ -87,13 +85,13 @@
|
|
|
87
85
|
}
|
|
88
86
|
},
|
|
89
87
|
"devDependencies": {
|
|
90
|
-
"@biomejs/biome": "2.5.
|
|
91
|
-
"@earendil-works/pi-coding-agent": "
|
|
92
|
-
"@earendil-works/pi-tui": "
|
|
93
|
-
"@types/node": "^26.
|
|
94
|
-
"electron": "
|
|
95
|
-
"knip": "^6.
|
|
96
|
-
"typebox": "1.3.
|
|
88
|
+
"@biomejs/biome": "2.5.15",
|
|
89
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
90
|
+
"@earendil-works/pi-tui": "1.3.0",
|
|
91
|
+
"@types/node": "^26.6.5",
|
|
92
|
+
"electron": "44.7.2",
|
|
93
|
+
"knip": "^6.41.0",
|
|
94
|
+
"typebox": "1.3.37",
|
|
97
95
|
"@typescript/native-preview": "^7.0.0-dev.20260707.2",
|
|
98
96
|
"typescript": "^7.0.2"
|
|
99
97
|
},
|
package/src/desktop/attention.ts
CHANGED
|
@@ -28,7 +28,7 @@ function parsePetSize(value: unknown): PetSize {
|
|
|
28
28
|
return petSize;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
function parseAttentionPreferences(value: unknown): AttentionPreferences {
|
|
32
32
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
33
33
|
throw new Error("Desktop attention preferences must be an object.");
|
|
34
34
|
}
|
|
@@ -14,7 +14,7 @@ export interface DesktopWindowBounds {
|
|
|
14
14
|
height: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
function hyprlandCursorSocket(env: NodeJS.ProcessEnv): string | undefined {
|
|
18
18
|
const runtime = env["XDG_RUNTIME_DIR"];
|
|
19
19
|
const signature = env["HYPRLAND_INSTANCE_SIGNATURE"];
|
|
20
20
|
if (!(runtime && signature && runtime.startsWith("/") && HYPRLAND_SIGNATURE_PATTERN.test(signature)))
|
|
@@ -111,7 +111,7 @@ async function readHyprlandCommand<T>(
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
async function readHyprlandCursor(path: string): Promise<DesktopCursorPosition> {
|
|
115
115
|
return await readHyprlandCommand(
|
|
116
116
|
path,
|
|
117
117
|
"j/cursorpos",
|
package/src/desktop/main.ts
CHANGED
|
@@ -374,6 +374,7 @@ async function createWindow(): Promise<BrowserWindow> {
|
|
|
374
374
|
...initialBounds(attention.petSize),
|
|
375
375
|
frame: false,
|
|
376
376
|
transparent: true,
|
|
377
|
+
roundedCorners: process.platform !== "linux",
|
|
377
378
|
hasShadow: false,
|
|
378
379
|
backgroundColor: "#00000000",
|
|
379
380
|
alwaysOnTop: true,
|