Skip to content

Commit

Permalink
RC 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-js committed Nov 4, 2024
1 parent 544e3ea commit 4a55748
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@

![Hotkeys for Intel Graphics Command Centre](/images/igcc_profiles-1.png)

## Usage
## Install

1. Run Intel Graphics Command Centre (IGCC) and create profiles "Пользовательский 1", "Пользовательский 2", "Пользовательский 3" (it only has to be done once)
2. Minimize IGCC (but don't shut it down) Run igcc_profiles.py
3. Use Ctrl + Alt + [1, 2, 3] anywhere in the system

## Usage

1. Run igcc_profiles
2. Use Ctrl + Alt + [1, 2, 3, 0] anywhere in the system

## Remarks

Right now it's only for russian localization (RU)
> [!TIP]
> If Intel Graphics Command Centre (IGCC) is not running at the time of launching the utility, the utility will find the program in the list of installed programs and launch it on its own (it will take some time).
> [!WARNING]
> Right now it's only for russian localization (RU) installed from Window Store: Центр управления графикой Intel® (1.100.5635.0).
> [!IMPORTANT]
> If you experience problems (e.g., the program doesn't always trigger), try changing time.sleep and timeout in the source code.
47 changes: 42 additions & 5 deletions igcc_profiles.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
from pywinauto import Application
from pynput import keyboard
import subprocess
import win32con
import time
import os


def igcc_run_app(app_name='IntelGraphicsExperience'):
"""
Searches for an application by partial name and attempts to launch it.
Args:
app_name (str): Part of the application name for searching.
"""

# Execute PowerShell command to search for packages
result = subprocess.run(["powershell", "Get-AppxPackage", "*" + app_name + "* | Select-Object -ExpandProperty PackageFullName"], capture_output=True, text=True)

if result.returncode == 0:
package_full_name = result.stdout.strip()
if package_full_name:
install_path = package_full_name.split('!')[0]
executable_path = os.path.join('C:\\Program Files\\WindowsApps', install_path, 'IGCC.exe')
subprocess.Popen(executable_path)
print(f"Application {app_name} launched.")
else:
print(f"No application found matching '{app_name}'.")
else:
print(f"Error retrieving application list: {result.stderr}")


def igcc_set_profile(profile='По умолчанию'):
app = Application(backend="win32").connect(title_re='Центр управления графикой Intel®.*$', timeout=10)
try:
app = Application(backend="win32").connect(title_re='Центр управления графикой Intel®.*$', timeout=3)
except:
igcc_run_app()
time.sleep(10)
app = Application(backend="win32").connect(title_re='Центр управления графикой Intel®.*$', timeout=3)

root = app.window(title_re='Центр управления графикой Intel®.*$')
root.set_focus()
app = Application(backend="uia").connect(title_re='Центр управления графикой Intel®.*$', timeout=10)
app = Application(backend="uia").connect(title_re='Центр управления графикой Intel®.*$', timeout=2)
root = app.window(title_re='Центр управления графикой Intel®.*$')

display_item = root.child_window(title="Дисплей", control_type="ListItem")
Expand All @@ -26,15 +59,19 @@ def igcc_set_profile(profile='По умолчанию'):
def on_activate(combo):
print(f"{combo} pressed")
id = combo.split('+')[-1].strip()
profile = f'Пользовательский {id}'
igcc_set_profile(f'Пользовательский {id}')
if id == '1' or id == '2' or id == '3':
profile = f'Пользовательский {id}'
elif id == '0':
profile = f'По умолчанию'
igcc_set_profile(profile)
print(f'Custom profile activated: {profile}')


hotkeys = {
'<ctrl>+<alt>+1': lambda: on_activate("Ctrl + Alt + 1"),
'<ctrl>+<alt>+2': lambda: on_activate("Ctrl + Alt + 2"),
'<ctrl>+<alt>+3': lambda: on_activate("Ctrl + Alt + 3")
'<ctrl>+<alt>+3': lambda: on_activate("Ctrl + Alt + 3"),
'<ctrl>+<alt>+0': lambda: on_activate("Ctrl + Alt + 0")
}


Expand Down

0 comments on commit 4a55748

Please sign in to comment.