Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gamescope toggle as an override for individual programs #3572

Merged
merged 5 commits into from
Dec 7, 2024

Conversation

EmoonX
Copy link
Contributor

@EmoonX EmoonX commented Nov 28, 2024

Description

Allows Gamescope to be toggled on a program-by-program basis, instead of just bottle-wide. This means that you can either leave the global toggle off and enable it for individual programs (default settings will be used) or leave it global-on and disable on specific ones.

image

All in all, avoids the hassle of having to manage two near-identical instances of the same bottle just to deal with gamescope-ness.

Closes #3377 (well-requested feature).

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Try toying with different values for Gamescope (global setting and individual override):

  • Override not set (gamescope: null in bottle.yml) should just be ignored
  • Override toggled on (gamescope: true) should always start said game with Gamescope
  • Override toggled off (gamescope: false) should never start said game with Gamescope

Copy link
Member

@mirkobrombin mirkobrombin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

github-actions bot commented Dec 7, 2024

Pylint result on modfied files:
************* Module bottles.frontend.cli.cli
bottles/frontend/cli/cli.py:34:0: C0103: Constant name "pkgdatadir" doesn't conform to UPPER_CASE naming style (invalid-name)
bottles/frontend/cli/cli.py:36:0: C0103: Constant name "gresource_path" doesn't conform to UPPER_CASE naming style (invalid-name)
bottles/frontend/cli/cli.py:41:0: C0413: Import "from gi.repository import Gio" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:43:0: C0413: Import "from bottles.frontend.params import APP_ID" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:44:0: C0413: Import "from bottles.backend.globals import Paths" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:45:0: C0413: Import "from bottles.backend.health import HealthChecker" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:46:0: C0413: Import "from bottles.backend.managers.manager import Manager" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:47:0: C0413: Import "from bottles.backend.models.config import BottleConfig" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:48:0: C0413: Import "from bottles.backend.wine.cmd import CMD" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:49:0: C0413: Import "from bottles.backend.wine.control import Control" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:50:0: C0413: Import "from bottles.backend.wine.executor import WineExecutor" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:51:0: C0413: Import "from bottles.backend.wine.winecommand import WineCommand" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:52:0: C0413: Import "from bottles.backend.wine.reg import Reg" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:53:0: C0413: Import "from bottles.backend.wine.winepath import WinePath" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:54:0: C0413: Import "from bottles.backend.wine.regedit import Regedit" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:55:0: C0413: Import "from bottles.backend.wine.taskmgr import Taskmgr" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:56:0: C0413: Import "from bottles.backend.wine.uninstaller import Uninstaller" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:57:0: C0413: Import "from bottles.backend.wine.winecfg import WineCfg" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:58:0: C0413: Import "from bottles.backend.wine.explorer import Explorer" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:59:0: C0413: Import "from bottles.backend.wine.regkeys import RegKeys" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:60:0: C0413: Import "from bottles.backend.runner import Runner" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:61:0: C0413: Import "from bottles.backend.utils import json" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:62:0: C0413: Import "from bottles.backend.utils.manager import ManagerUtils" should be placed at the top of the module (wrong-import-position)
bottles/frontend/cli/cli.py:304:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:309:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:330:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:360:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:362:8: C0206: Consider iterating with .items() (consider-using-dict-items)
bottles/frontend/cli/cli.py:377:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:385:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:403:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:441:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:449:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:457:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:491:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:500:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:525:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:535:20: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:564:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:574:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:584:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:594:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:659:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:667:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:671:16: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:721:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:740:12: R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
bottles/frontend/cli/cli.py:755:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/frontend/cli/cli.py:239:4: W0238: Unused private member `CLI.__clear()` (unused-private-member)
************* Module bottles.frontend.windows.launchoptions
bottles/frontend/windows/launchoptions.py:18:0: E0611: No name 'Adw' in module 'gi.repository' (no-name-in-module)
bottles/frontend/windows/launchoptions.py:190:31: W0613: Unused argument 'widget' (unused-argument)
bottles/frontend/windows/launchoptions.py:190:39: W0613: Unused argument 'state' (unused-argument)
bottles/frontend/windows/launchoptions.py:197:50: W0613: Unused argument 'global_value' (unused-argument)
bottles/frontend/windows/launchoptions.py:204:4: R1711: Useless return at end of function or method (useless-return)
bottles/frontend/windows/launchoptions.py:255:19: E1101: Instance of 'Error' has no 'code' member (no-member)
bottles/frontend/windows/launchoptions.py:263:20: W0107: Unnecessary pass statement (unnecessary-pass)
bottles/frontend/windows/launchoptions.py:287:19: E1101: Instance of 'Error' has no 'code' member (no-member)
bottles/frontend/windows/launchoptions.py:28:0: R0903: Too few public methods (1/2) (too-few-public-methods)
bottles/frontend/windows/launchoptions.py:22:0: C0411: standard import "gettext.gettext" should be placed before third party import "gi.repository.Gtk" and first party imports "bottles.backend.utils.manager.ManagerUtils", "bottles.backend.logger.Logger"  (wrong-import-order)
************* Module bottles.backend.models.samples
bottles/backend/models/samples.py:1:0: R0903: Too few public methods (0/2) (too-few-public-methods)
************* Module bottles.backend.wine.winecommand
bottles/backend/wine/winecommand.py:90:4: W0102: Dangerous default value {} as argument (dangerous-default-value)
bottles/backend/wine/winecommand.py:90:4: R0913: Too many arguments (12/5) (too-many-arguments)
bottles/backend/wine/winecommand.py:90:4: R0917: Too many positional arguments (12/5) (too-many-positional-arguments)
bottles/backend/wine/winecommand.py:142:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:148:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:407:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:411:51: E1136: Value 'gpu['prime']['integrated']' is unsubscriptable (unsubscriptable-object)
bottles/backend/wine/winecommand.py:413:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:192:8: W0612: Unused variable 'is_nvidia' (unused-variable)
bottles/backend/wine/winecommand.py:459:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:468:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:484:4: R0913: Too many arguments (7/5) (too-many-arguments)
bottles/backend/wine/winecommand.py:484:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
bottles/backend/wine/winecommand.py:520:32: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/wine/winecommand.py:527:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/wine/winecommand.py:536:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/wine/winecommand.py:552:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:557:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:562:20: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/wine/winecommand.py:658:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/wine/winecommand.py:669:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/wine/winecommand.py:707:12: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bottles/backend/wine/winecommand.py:728:23: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
************* Module bottles.backend.wine.executor
bottles/backend/wine/executor.py:100:0: C0303: Trailing whitespace (trailing-whitespace)
bottles/backend/wine/executor.py:26:4: R0913: Too many arguments (18/5) (too-many-arguments)
bottles/backend/wine/executor.py:26:4: R0917: Too many positional arguments (18/5) (too-many-positional-arguments)
bottles/backend/wine/executor.py:148:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bottles/backend/wine/executor.py:206:8: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
bottles/backend/wine/executor.py:299:8: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
bottles/backend/wine/executor.py:310:8: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
bottles/backend/wine/executor.py:346:21: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
************* Module bottles.backend.managers.manager
bottles/backend/managers/manager.py:1:0: C0302: Too many lines in module (1640/1000) (too-many-lines)
bottles/backend/managers/manager.py:182:8: W0106: Expression "self.check_dxvk(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:185:8: W0106: Expression "self.check_vkd3d(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:188:8: W0106: Expression "self.check_nvapi(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:191:8: W0106: Expression "self.check_latencyflex(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:194:8: W0106: Expression "self.check_runtimes(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:197:8: W0106: Expression "self.check_winebridge(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:200:8: W0106: Expression "self.check_runners(install_latest) or rv.set_status(False)" is assigned to nothing (expression-not-assigned)
bottles/backend/managers/manager.py:376:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:381:16: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/managers/manager.py:385:31: C0207: Use version.split('\n', maxsplit=1)[0] instead (use-maxsplit-arg)
bottles/backend/managers/manager.py:405:12: C0206: Consider iterating with .items() (consider-using-dict-items)
bottles/backend/managers/manager.py:416:16: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
bottles/backend/managers/manager.py:421:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:467:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:496:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:633:16: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
bottles/backend/managers/manager.py:638:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:707:8: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:741:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:758:16: W0702: No exception type(s) specified (bare-except)
bottles/backend/managers/manager.py:828:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:887:16: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:945:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:953:16: W1202: Use lazy % or % formatting in logging functions (logging-format-interpolation)
bottles/backend/managers/manager.py:965:4: R0913: Too many arguments (7/5) (too-many-arguments)
bottles/backend/managers/manager.py:965:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
bottles/backend/managers/manager.py:990:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1027:8: C0206: Consider iterating with .items() (consider-using-dict-items)
bottles/backend/managers/manager.py:1028:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1036:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1044:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1051:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1058:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1068:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1091:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1097:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1103:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1110:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1113:29: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
bottles/backend/managers/manager.py:1126:4: R0913: Too many arguments (14/5) (too-many-arguments)
bottles/backend/managers/manager.py:1126:4: R0917: Too many positional arguments (14/5) (too-many-positional-arguments)
bottles/backend/managers/manager.py:1230:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1251:8: W0702: No exception type(s) specified (bare-except)
bottles/backend/managers/manager.py:1265:12: W0702: No exception type(s) specified (bare-except)
bottles/backend/managers/manager.py:1262:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:1315:12: W0105: String statement has no effect (pointless-string-statement)
bottles/backend/managers/manager.py:1319:15: W0125: Using a conditional statement with a constant value (using-constant-test)
bottles/backend/managers/manager.py:1314:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:1314:8: R1702: Too many nested blocks (7/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:1314:8: R1702: Too many nested blocks (7/5) (too-many-nested-blocks)
bottles/backend/managers/manager.py:1402:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bottles/backend/managers/manager.py:1563:8: W1510: 'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
bottles/backend/managers/manager.py:1602:4: R0913: Too many arguments (7/5) (too-many-arguments)
bottles/backend/managers/manager.py:1602:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments)
bottles/backend/managers/manager.py:77:0: R0904: Too many public methods (24/20) (too-many-public-methods)

@mirkobrombin mirkobrombin merged commit 7d9016d into bottlesdevs:main Dec 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request]: Make gamescope an executable/shortcut override
2 participants