Mercurial > code > home > repos > racc
view collector/current_window_title_osx.py @ 10:6b6b1ea0e00d default tip
ok for no window to be focused (untested)
author | drewp@bigasterisk.com |
---|---|
date | Mon, 13 Mar 2023 19:16:58 -0700 |
parents | 5ad799e534a5 |
children |
line wrap: on
line source
from osascript import osascript #https://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title def get_current_window_title(): _, title, _ = osascript(''' tell application "System Events" set frontApp to name of first application process whose frontmost is true end tell tell application frontApp set window_name to name of front window end tell ''') return title