Skip to content

Commit a4d5bc4

Browse files
committed
refactor: optimize Linux desktop environment detection
1 parent 558265a commit a4d5bc4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

frontend/src/utils/helper.ts

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

270-
const desktop = (await Exec('sh', ['-c', 'echo $XDG_CURRENT_DESKTOP'])).trim()
270+
const desktop = await GetEnv('XDG_CURRENT_DESKTOP')
271271
if (desktop.includes('KDE')) {
272272
const p1 = ignoredError(Exec, 'kwriteconfig5', [
273273
'--file',
@@ -440,7 +440,7 @@ export const GetSystemProxy = async () => {
440440
}
441441

442442
if (os === OS.Linux) {
443-
const desktop = (await Exec('sh', ['-c', 'echo $XDG_CURRENT_DESKTOP'])).trim()
443+
const desktop = await GetEnv('XDG_CURRENT_DESKTOP')
444444
if (desktop.includes('KDE')) {
445445
const out = await Exec('kreadconfig5', [
446446
'--file',
@@ -532,7 +532,7 @@ export const GetSystemProxyBypass = async () => {
532532
}
533533

534534
if (os === OS.Linux) {
535-
const desktop = (await Exec('sh', ['-c', 'echo $XDG_CURRENT_DESKTOP'])).trim()
535+
const desktop = await GetEnv('XDG_CURRENT_DESKTOP')
536536
if (desktop.includes('KDE')) {
537537
const out = await ignoredError(Exec, 'kreadconfig5', [
538538
'--file',

0 commit comments

Comments
 (0)