Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

1.4 KB
Raw Blame
import { clipboard } from 'electron'
import { addListener, addHandler } from 'backend/ipc'

import { callAbortController } from './aborthandler/aborthandler'
import {
  getCometVersion,
  getGogdlVersion,
  getLegendaryVersion,
  getNileVersion,
  getAureliaVersion
} from './helperBinaries'
import { hasExecutable } from './os/path'
import { formatSystemInfo, getSystemInfo } from './systeminfo'
import { isIntelMac, isLinuxArm } from 'backend/constants/environment'
import { loadProtonShortcutsEntries } from './proton_shortcuts'

addListener('abort', (event, id) => {
  callAbortController(id)
})
addHandler('getLegendaryVersion', getLegendaryVersion)
addHandler('getGogdlVersion', getGogdlVersion)
addHandler('getCometVersion', getCometVersion)
addHandler('getNileVersion', getNileVersion)
addHandler('getAureliaVersion', getAureliaVersion)
addHandler('getSystemInfo', async (e, cache) => getSystemInfo(cache))
addListener('copySystemInfoToClipboard', async () => {
  const info = await getSystemInfo()
  const formatted = await formatSystemInfo(info)
  await clipboard.writeText(formatted)
})
addHandler('hasExecutable', async (event, executable) => {
  return hasExecutable(executable)
})

addHandler('isIntelMac', () => {
  return isIntelMac
})

addHandler('isLinuxArm', () => {
  return isLinuxArm
})

addHandler('getProtonShortcuts', (e, prefix) =>
  loadProtonShortcutsEntries(prefix)
)