Skip to content

Instantly share code, notes, and snippets.

@andrewpetrochenkov
Last active August 3, 2024 18:53
Show Gist options
  • Select an option

  • Save andrewpetrochenkov/1ab9807998e82dfbb7d774f98cf6df9c to your computer and use it in GitHub Desktop.

Select an option

Save andrewpetrochenkov/1ab9807998e82dfbb7d774f98cf6df9c to your computer and use it in GitHub Desktop.
macOS frontmost app #app
osascript <<EOF
tell application "System Events"
name of (first process whose frontmost is true)
end tell
EOF
lsappinfo info -only name `lsappinfo front` | awk -F'"' '{print $4}'
lsappinfo info -only pid `lsappinfo front` | awk -F'"=' '{print $2}'
lsappinfo info -only bundlepath `lsappinfo front` | awk -F'"' '{print $4}'
lsappinfo info -only bundleID `lsappinfo front` | awk -F'"' '{print $4}'
@NightMachinery
Copy link

lsappinfo info `lsappinfo front` has stopped working for me after updating to Sonoma. Does it work for you?

@amake
Copy link

amake commented Apr 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment