Skip to content

Commit df79963

Browse files
committed
refactor: optimize Linux desktop environment detection
1 parent 53ac655 commit df79963

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

frontend/src/utils/helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ async function setLinuxSystemProxy(
276276
const httpEnabled = enabled && ['mixed', 'http'].includes(proxyType)
277277
const socksEnabled = enabled && ['mixed', 'socks'].includes(proxyType)
278278

279-
const desktop = (await Exec('sh', ['-c', 'echo $XDG_CURRENT_DESKTOP'])).trim()
279+
const desktop = await GetEnv('XDG_CURRENT_DESKTOP')
280280
if (desktop.includes('KDE')) {
281281
const p1 = ignoredError(Exec, 'kwriteconfig5', [
282282
'--file',
@@ -449,7 +449,7 @@ export const GetSystemProxy = async () => {
449449
}
450450

451451
if (os === OS.Linux) {
452-
const desktop = (await Exec('sh', ['-c', 'echo $XDG_CURRENT_DESKTOP'])).trim()
452+
const desktop = await GetEnv('XDG_CURRENT_DESKTOP')
453453
if (desktop.includes('KDE')) {
454454
const out = await Exec('kreadconfig5', [
455455
'--file',
@@ -541,7 +541,7 @@ export const GetSystemProxyBypass = async () => {
541541
}
542542

543543
if (os === OS.Linux) {
544-
const desktop = (await Exec('sh', ['-c', 'echo $XDG_CURRENT_DESKTOP'])).trim()
544+
const desktop = await GetEnv('XDG_CURRENT_DESKTOP')
545545
if (desktop.includes('KDE')) {
546546
const out = await ignoredError(Exec, 'kreadconfig5', [
547547
'--file',

0 commit comments

Comments
 (0)