mirror of
https://github.com/lutris/lutris
synced 2024-10-14 11:42:36 +00:00
electron runner -> web runner, more options
This commit is contained in:
parent
98d4f5b7c1
commit
f78dc9040e
|
@ -3,7 +3,7 @@
|
|||
|
||||
__all__ = (
|
||||
# Native
|
||||
"linux", "steam", "browser", "desura", "electron",
|
||||
"linux", "steam", "browser", "web", "desura",
|
||||
# Microsoft based
|
||||
"wine", "winesteam", "dosbox",
|
||||
# Multi-system
|
||||
|
|
|
@ -4,15 +4,15 @@ import os
|
|||
|
||||
from lutris.runners.runner import Runner
|
||||
from lutris.util import datapath
|
||||
from lutris import pga
|
||||
from lutris import pga, settings
|
||||
|
||||
DEFAULT_ICON = os.path.join(datapath.get(), 'media/default_icon.png')
|
||||
|
||||
class electron(Runner):
|
||||
human_name = "Electron"
|
||||
description = "Runs browser games"
|
||||
class web(Runner):
|
||||
human_name = "Web"
|
||||
description = "Runs web based games"
|
||||
platform = "Web based games"
|
||||
description = "Runs browser games in an Electron window"
|
||||
description = "Runs web games"
|
||||
game_options = [
|
||||
{
|
||||
"option": "main_file",
|
||||
|
@ -27,7 +27,29 @@ class electron(Runner):
|
|||
"label": "Open in fullscreen",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
'help': ("Tells Electron to launch the game in fullscreen.")
|
||||
'help': ("Launch the game in fullscreen.")
|
||||
},
|
||||
{
|
||||
"option": "maximize_window",
|
||||
"label": "Open window maximized",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
'help': ("Maximizes the window when game starts.")
|
||||
},
|
||||
{
|
||||
'option': 'window_size',
|
||||
'label': 'Window size',
|
||||
'type': 'choice_with_entry',
|
||||
'choices': ["640x480", "800x600", "1024x768", "1280x720", "1280x1024", "1920x1080"],
|
||||
'default': '800x600',
|
||||
'help': ("The initial size of the game window when not opened.")
|
||||
},
|
||||
{
|
||||
"option": "disable_resizing",
|
||||
"label": "Disable window resizing (disables fullscreen and maximize)",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
'help': ("You can't resize this window.")
|
||||
},
|
||||
{
|
||||
"option": "frameless",
|
||||
|
@ -36,16 +58,9 @@ class electron(Runner):
|
|||
"default": False,
|
||||
'help': ("The window has no borders/frame.")
|
||||
},
|
||||
{
|
||||
"option": "disable_resizing",
|
||||
"label": "Disable window resizing (disables fullscreen)",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
'help': ("You can't resize this window.")
|
||||
},
|
||||
{
|
||||
"option": "disable_menu_bar",
|
||||
"label": "Disable menu bar",
|
||||
"label": "Disable menu bar and default shortcuts",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
'help': ("This also disables default keyboard shortcuts, like copy/paste and fullscreen toggling.")
|
||||
|
@ -64,21 +79,20 @@ class electron(Runner):
|
|||
"default": False,
|
||||
'help': ("Prevents the mouse cursor from showing when hovering above the window.")
|
||||
},
|
||||
{
|
||||
'option': 'window_size',
|
||||
'label': 'Window size',
|
||||
'type': 'choice_with_entry',
|
||||
'choices': ["640x480", "800x600", "1024x768", "1280x720", "1280x1024", "1920x1080"],
|
||||
'default': '800x600',
|
||||
'help': ("The initial size of the game window when not opened.")
|
||||
},
|
||||
{
|
||||
'option': 'open_links',
|
||||
'label': 'Open links inside game window',
|
||||
'label': 'Open links in game window',
|
||||
'type': 'bool',
|
||||
'default': False,
|
||||
'help': ("Enable this option if you want clicked links to open inside the game window. By default all links open in your default web browser.")
|
||||
},
|
||||
{
|
||||
"option": "enable_flash",
|
||||
"label": "Enable Adobe Flash Player",
|
||||
"type": "bool",
|
||||
"default": False,
|
||||
'help': ("Enable Adobe Flash Player.")
|
||||
},
|
||||
{
|
||||
"option": "devtools",
|
||||
"label": "Debug with Developer Tools",
|
||||
|
@ -88,7 +102,7 @@ class electron(Runner):
|
|||
'advanced': True
|
||||
},
|
||||
]
|
||||
runner_executable = 'electron/electron'
|
||||
runner_executable = 'web/electron/electron'
|
||||
system_options_override = [
|
||||
{
|
||||
'option': 'disable_runtime',
|
||||
|
@ -96,6 +110,16 @@ class electron(Runner):
|
|||
}
|
||||
]
|
||||
|
||||
def get_env(self, full=True):
|
||||
if full:
|
||||
env = os.environ.copy()
|
||||
else:
|
||||
env = {}
|
||||
|
||||
env['ENABLE_FLASH_PLAYER'] = '1' if self.runner_config['enable_flash'] else '0'
|
||||
|
||||
return env
|
||||
|
||||
def play(self):
|
||||
url = self.game_config.get('main_file')
|
||||
if not url:
|
||||
|
@ -111,7 +135,7 @@ class electron(Runner):
|
|||
|
||||
command = [self.get_executable()]
|
||||
|
||||
command.append('/home/djazz/code/git/lutris-electron-runner/app')
|
||||
command.append(os.path.join(settings.RUNNER_DIR, 'web/runner.asar'))
|
||||
|
||||
command.append(url)
|
||||
|
||||
|
@ -130,9 +154,12 @@ class electron(Runner):
|
|||
command.append("--disable-menu-bar")
|
||||
|
||||
if self.runner_config.get("window_size"):
|
||||
command.append("--window")
|
||||
command.append("--window-size")
|
||||
command.append(self.runner_config.get("window_size"))
|
||||
|
||||
if self.runner_config.get("maximize_window"):
|
||||
command.append("--maximize-window")
|
||||
|
||||
if self.runner_config.get("disable_scrolling"):
|
||||
command.append("--disable-scrolling")
|
||||
|
||||
|
@ -145,4 +172,4 @@ class electron(Runner):
|
|||
if self.runner_config.get("devtools"):
|
||||
command.append("--devtools")
|
||||
|
||||
return {'command': command}
|
||||
return {'command': command, 'env': self.get_env()}
|
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB |
BIN
share/lutris/media/runner_icons/web.png
Normal file
BIN
share/lutris/media/runner_icons/web.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in a new issue