@sunshine-star/dsh-access-pc 0.1.9 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunshine-star/dsh-access-pc",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "DSH Access PC client (Electron shell around the hub console)",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -87,7 +87,7 @@ Type=Application
87
87
  Name=${APP_NAME}
88
88
  Comment=Remote DSH client
89
89
  Exec="${electron}" "${appDir}"
90
- Icon=${iconPng}
90
+ Icon=dsh-access-pc
91
91
  Terminal=false
92
92
  Categories=Network;RemoteAccess;
93
93
  StartupWMClass=dsh-access-pc
@@ -102,8 +102,29 @@ function markTrusted(file) {
102
102
  }
103
103
  }
104
104
 
105
+ function installLinuxIcon() {
106
+ const home = os.homedir()
107
+ const sizes = [
108
+ [256, path.join(appDir, 'assets', 'icon-256.png')],
109
+ [512, path.join(appDir, 'assets', 'icon-512.png')],
110
+ ]
111
+ for (const [size, source] of sizes) {
112
+ if (!fs.existsSync(source)) continue
113
+ const target = path.join(home, '.local', 'share', 'icons', 'hicolor', `${size}x${size}`, 'apps', 'dsh-access-pc.png')
114
+ fs.mkdirSync(path.dirname(target), { recursive: true })
115
+ fs.copyFileSync(source, target)
116
+ fs.chmodSync(target, 0o644)
117
+ }
118
+ try {
119
+ spawnSync('gtk-update-icon-cache', ['-f', '-t', path.join(home, '.local', 'share', 'icons', 'hicolor')], { stdio: 'ignore' })
120
+ } catch {
121
+ // 忽略
122
+ }
123
+ }
124
+
105
125
  function createLinuxEntry(targetPath) {
106
126
  fs.mkdirSync(path.dirname(targetPath), { recursive: true })
127
+ installLinuxIcon()
107
128
  fs.writeFileSync(targetPath, desktopEntry())
108
129
  fs.chmodSync(targetPath, 0o755)
109
130
  markTrusted(targetPath)