-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. 新增:底部的播放栏点击歌曲名的跳转功能优化; 3. 修复在window、linux下移动窗口卡顿、崩溃的bug; 4. 新增windows支持自定义安装路径; 5. linux新增适配歌词插件功能,可通过插件实现状态栏歌词功能;
- Loading branch information
Showing
23 changed files
with
363 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
class ServiceMonitor { | ||
constructor(busName, win) { | ||
this.interfaceName = 'org.freedesktop.DBus'; | ||
this.objectPath = '/org/freedesktop/DBus'; | ||
this.busName = busName; | ||
this.status = false; | ||
this.win = win; | ||
this.iface = null; | ||
this.sessionBus = require('dbus-native').sessionBus(); | ||
this.watchName(); | ||
} | ||
|
||
watchName() { | ||
this.sessionBus.getInterface( | ||
this.interfaceName, | ||
this.objectPath, | ||
this.interfaceName, | ||
(err, iface) => { | ||
if (err) { | ||
console.error('error getting interface:', err); | ||
return; | ||
} | ||
iface.on('NameOwnerChanged', (name, oldOwner, newOwner) => { | ||
if (name === this.busName) { | ||
const isRunning = !!newOwner; | ||
|
||
if (isRunning) { | ||
this.onOwnerName(); | ||
} else { | ||
this.onLostOwnerName(); | ||
} | ||
} | ||
}); | ||
|
||
iface.GetNameOwner(this.busName, err => { | ||
if (err) { | ||
this.onLostOwnerName(); | ||
} else { | ||
this.onOwnerName(); | ||
} | ||
}); | ||
} | ||
); | ||
} | ||
|
||
onOwnerName() { | ||
const path = `/${this.busName.replace(/\./g, '/')}`; | ||
this.sessionBus | ||
.getService(this.busName) | ||
.getInterface(path, this.busName, (err, iface) => { | ||
if (err) { | ||
console.error('error getting interface:', err); | ||
this.status = false; | ||
this.win.webContents.send('dbus-status', this.status); | ||
return; | ||
} | ||
|
||
this.iface = iface; | ||
this.status = true; | ||
this.win.webContents.send('dbus-status', this.status); | ||
}); | ||
} | ||
|
||
onLostOwnerName() { | ||
this.status = false; | ||
this.win.webContents.send('dbus-status', this.status); | ||
} | ||
} | ||
|
||
export const createDBus = (busName, win) => { | ||
return new ServiceMonitor(busName, win); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.