Skip to content

Commit

Permalink
Fix device targeting
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Bocchini committed Apr 3, 2024
1 parent 80b7b9f commit 0212c49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Package Application
uses: JackMcKew/pyinstaller-action-windows@python3-10-pyinstaller-5-3
uses: JackMcKew/pyinstaller-action-windows@main
with:
path: src
- uses: actions/upload-artifact@v2
Expand Down
10 changes: 5 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Functions for getting display devices and settings
from win32api import EnumDisplayDevices
from win32api import EnumDisplaySettings
from win32api import ChangeDisplaySettings
from win32api import ChangeDisplaySettingsEx

# Display device state flags
from win32con import DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
Expand All @@ -32,7 +32,7 @@
from pywintypes import DEVMODEWType

# Application metadata
VERSION: str = "v2.0.0"
VERSION: str = "v2.0.1"
NAME: str = "ResolutionSwitcher"

# Terminal colors
Expand Down Expand Up @@ -154,11 +154,11 @@ def print_device_info(device: DisplayDevice, detailed: bool = False):
pass


def set_device_mode(device_mode: DEVMODEWType) -> int:
def set_device_mode(device_identifier: str, device_mode: DEVMODEWType) -> int:
if device_mode is None:
raise ValueError("Display settings cannot be empty")

return ChangeDisplaySettings(device_mode, 0)
return ChangeDisplaySettingsEx(device_identifier, device_mode, 0)


def print_human_readable_mode_change_result(result: int):
Expand Down Expand Up @@ -252,7 +252,7 @@ def print_error(error: str):
else:
print_message(f'Attempting to change primary display settings to: {str(new_mode)}')

device_mode_change_result: int = set_device_mode(new_mode_as_devmodew_type)
device_mode_change_result: int = set_device_mode(args.device, new_mode_as_devmodew_type)
print_human_readable_mode_change_result(device_mode_change_result)

if device_mode_change_result != DISP_CHANGE_SUCCESSFUL:
Expand Down
Binary file added src/requirements
Binary file not shown.

0 comments on commit 0212c49

Please sign in to comment.