Created
September 14, 2024 00:19
-
-
Save remixer-dec/4510b02ad817e74a1a1d025ab8791848 to your computer and use it in GitHub Desktop.
gets information about window name and app name of top window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def get_window_name_with_applescript(): | |
window_name = os.popen("osascript -e 'tell application \"System Events\" to get the name of window 1 of (first application process whose frontmost is true)'").read().strip() | |
process_name = os.popen("osascript -e 'tell application \"System Events\" to get the name of (first application process whose frontmost is true)'").read().strip() | |
return window_name, process_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment