diff --git a/sources/code/common/main.ts b/sources/code/common/main.ts index bc39540f..cccdfc45 100644 --- a/sources/code/common/main.ts +++ b/sources/code/common/main.ts @@ -251,9 +251,13 @@ let overwriteMain: (() => unknown) | undefined; } { const applyFlags = (name:string, value?:string) => { - if(name === "enable-features" && value !== undefined + if(value !== undefined && app.commandLine.getSwitchValue(name) !== "") - value = app.commandLine.getSwitchValue(name)+","+value; + switch(name) { + case "enable-features": + case "enable-blink-features": + value = app.commandLine.getSwitchValue(name)+","+value; + } app.commandLine.appendSwitch(name, value); console.debug("[OPTIMIZE] Applying flag: %s...","--"+name+(value ? "="+value : "")); }; @@ -267,6 +271,11 @@ let overwriteMain: (() => unknown) | undefined; }).catch(error => { console.error(error); }); + + // Enable MiddleClickAutoscroll for all windows. + if(process.platform !== "win32" && + new AppConfig().get().settings.advanced.unix.autoscroll) + applyFlags("enable-blink-features","MiddleClickAutoscroll"); for(const flag of getRedommendedOSFlags()) applyFlags(flag[0], flag[1]); diff --git a/sources/code/main/modules/config.ts b/sources/code/main/modules/config.ts index d4b4f02c..1a19b6c8 100644 --- a/sources/code/main/modules/config.ts +++ b/sources/code/main/modules/config.ts @@ -95,6 +95,9 @@ const defaultAppConfig = { }, webApi: { webGl: true + }, + unix: { + autoscroll: false } } }, diff --git a/sources/code/renderer/preload/settings.ts b/sources/code/renderer/preload/settings.ts index 3221ed34..23e60937 100644 --- a/sources/code/renderer/preload/settings.ts +++ b/sources/code/renderer/preload/settings.ts @@ -38,6 +38,21 @@ function generateRadioLabels(key:string) { } } +function checkPlatformKey(key:string) { + switch(key as NodeJS.Platform|"unix") { + case "win32": + case "darwin": + case "linux": + case "freebsd": + case "openbsd": + return process.platform === key; + case "unix": + return process.platform !== "win32"; + default: + return true; + } +} + function generateSettings(optionsGroups: htmlConfig) { // Clear old config (so this function can be executed multiple times). document.body.innerHTML = ""; @@ -47,7 +62,7 @@ function generateSettings(optionsGroups: htmlConfig) { h1.innerHTML = sanitize(group.name, sanitizeConfig); document.body.appendChild(h1); (Object.keys)(group).map(settingKey => { - if(settingKey !== "name" && settingKey !== buildType) { + if(settingKey !== "name" && settingKey !== buildType && checkPlatformKey(settingKey)) { const setting = (group as unknown as generatedConfigGeneric)[settingKey]; if(setting) { const h2 = document.createElement("h2"); diff --git a/sources/translations/en/settings.json b/sources/translations/en/settings.json index d74ba666..1c6e7b9b 100644 --- a/sources/translations/en/settings.json +++ b/sources/translations/en/settings.json @@ -94,6 +94,13 @@ "labels": { "webGl": "Enable WebGL support." } + }, + "unix": { + "name": "Experimental features for Unix/Unix-like OS", + "description": "Enables features that were flagged by Chromium/Blink engine as experimental. Use them at your own responsibility.", + "labels": { + "autoscroll": "Enable middle-click scrolling (aka. autoscroll)." + } } } } \ No newline at end of file diff --git a/sources/translations/pl/settings.json b/sources/translations/pl/settings.json index d089e116..f3ed91b4 100644 --- a/sources/translations/pl/settings.json +++ b/sources/translations/pl/settings.json @@ -94,6 +94,13 @@ "labels": { "webGl": "Włącz wsparcie dla WebGL." } + }, + "unix": { + "name": "Funkcje eksperymentalne dla systemu Unix/uniksopodobnego", + "description": "Włącza funkcje, które zostały oznaczone przez silnik Chromium/Blink jako eksperymentalne. Korzystasz z nich na własną odpowiedzialność.", + "labels": { + "autoscroll": "Włącz przewijanie za pomocą środkowego przycisku (tzw. autoscroll)." + } } } }