Skip to main content

Get details about the application and opened URL which is in foreground

Project description

Ever wanted to get some details about the foreground app, such as which is it, which URL is currently opened, etc? This project is for you.

Demo via sleep 3; ./demo.py.

Examples:

$ ./demo.py
{'appName': 'Terminal',
 'idleTime': 0.274327906,
 'url': 'file:///Users/az/Programmierung/foreground_app_info',
 'windowTitle': './demo.py  /Users/az/Programmierung/foreground_app_info \xe2\x80\x94 osascript \xe2\x80\x94 80\xc3\x9724'}

$ sleep 3; ./demo.py
{'appName': 'Chrome',
 'idleTime': 1.440957492,
 'url': 'https://news.ycombinator.com/',
 'windowTitle': 'Hacker News'}

$ sleep 3; ./demo.py
{'appName': 'Finder',
 'idleTime': 2.213467371,
 'url': 'file:///Users/az/Documents/',
 'windowTitle': 'Documents'}

$ sleep 3; ./demo.py
{'appName': 'TextEdit',
 'idleTime': 1.435908488,
 'url': 'file:///Users/az/Documents/todo-musicplayer.txt',
 'windowTitle': 'todo-musicplayer.txt'}

This project is registered on Pypi. You can install it via:

$ pip install foreground_app_info

Simple demo code:

from foreground_app_info import get_app_info
from pprint import pprint

pprint(get_app_info())

This is currently used by TimeCapture.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foreground_app_info-1.20150501.162721.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file foreground_app_info-1.20150501.162721.tar.gz.

File metadata

File hashes

Hashes for foreground_app_info-1.20150501.162721.tar.gz
Algorithm Hash digest
SHA256 963b8148de87db7d046b18643ded3a232e5ae15b4e8c7a01384d892d759fe26a
MD5 b54571389b277f3622838c2b813ad843
BLAKE2b-256 022f6d92b8386ada1d1ac2ba71cc82545000139aa04351bbca74114630f9050a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page