add support for directly launching windows exes from file exporer using .desktop shortcut
This commit is contained in:
parent
66f42f30cc
commit
5e217472aa
15 changed files with 440 additions and 28 deletions
|
|
@ -12,6 +12,7 @@ const runner = require('../runner')
|
|||
const { extractIconFromExe } = require('../icons')
|
||||
const { createGamesService, sendToWindow } = require('./games')
|
||||
const shortcuts = require('../shortcuts')
|
||||
const openwith = require('../openwith')
|
||||
|
||||
const ICON_EXTS = ['png', 'jpe?g', 'svg', 'ico', 'webp', 'gif', 'bmp']
|
||||
|
||||
|
|
@ -110,6 +111,7 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
}
|
||||
})
|
||||
ipcMain.handle('games:shortcutPaths', (e, id) => shortcuts.shortcutPaths(id))
|
||||
ipcMain.handle('openwith:texts', (e, lang) => openwith.textsFor(lang))
|
||||
ipcMain.handle('games:clearPlaytime', (e, id) => library.clearPlaytime(id))
|
||||
|
||||
// games: icons ---------------------------------------------------------------------
|
||||
|
|
@ -156,6 +158,29 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
return extractGameIcon(id, game.exePath)
|
||||
})
|
||||
|
||||
// "Open with PLWL" ------------------------------------------------------------------
|
||||
// The renderer asks for the file handed in via `--open` (Exec %f), then
|
||||
// launches it with the wine/prefix picked in the popup. Nothing is imported
|
||||
// into the library.
|
||||
ipcMain.handle('openwith:take', async () => {
|
||||
const p = openwith.getPending()
|
||||
if (!p) return null
|
||||
openwith.clearPending()
|
||||
return p
|
||||
})
|
||||
ipcMain.handle('openwith:run', async (e, payload) => {
|
||||
try {
|
||||
return await openwith.run({
|
||||
openPath: payload && payload.openPath,
|
||||
wine: payload && payload.wine,
|
||||
prefix: payload && payload.prefix,
|
||||
lang: library.loadSettings().language
|
||||
})
|
||||
} catch (err) {
|
||||
return errorResult(err)
|
||||
}
|
||||
})
|
||||
|
||||
// games: run --------------------------------------------------------------------------
|
||||
ipcMain.handle('games:run', (e, id) => games.start(getWindow(), id))
|
||||
ipcMain.handle('games:kill', (e, id) => games.kill(id))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue