-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
PyGetWindow does not Support Linux
The Error occured in visual_parser.py while importing the package
Try using xdotool and wmctrl for Linux because there is no cross platform Library
Maybe try this change all over the code :
import sys
def get_active_window_title():
if sys.platform.startswith('win'):
import pygetwindow as gw
win = gw.getActiveWindow()
return win.title if win else None
elif sys.platform == 'darwin':
import pygetwindow as gw
win = gw.getActiveWindow()
return win.title if win else None
elif sys.platform.startswith('linux'):
import subprocess
try:
output = subprocess.check_output(['xdotool', 'getactivewindow', 'getwindowname'])
return output.decode().strip()
except Exception:
return None
else:
return None
print("Active window:", get_active_window_title())

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels