Mercurial > code > home > repos > racc
annotate current_window_title_osx.py @ 3:3d7fc94a404a
a few more inputs; daemonize
author | drewp@bigasterisk.com |
---|---|
date | Wed, 08 Mar 2023 10:57:11 -0800 |
parents | |
children |
rev | line source |
---|---|
3 | 1 from osascript import osascript |
2 #https://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title | |
3 | |
4 | |
5 def get_current_window_title(): | |
6 _, title, _ = osascript(''' | |
7 tell application "System Events" | |
8 set frontApp to name of first application process whose frontmost is true | |
9 end tell | |
10 | |
11 tell application frontApp | |
12 set window_name to name of front window | |
13 end tell | |
14 ''') | |
15 return title |