mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 09:26:42 +00:00
feat(hammerspoon/app_toggle): have showAppInfo print to console as well
This commit is contained in:
@@ -163,17 +163,23 @@ end
|
||||
--- Shows an alert with information about the frontmost application.
|
||||
function obj:showAppInfo()
|
||||
local app = hs.application.frontmostApplication()
|
||||
|
||||
hs.alert.show(app:name() .. " (" .. app:bundleID() .. ")")
|
||||
local ok, appPath = pcall(function()
|
||||
return app:path()
|
||||
end)
|
||||
|
||||
local info = { app:name() .. " (" .. app:bundleID() .. ")" }
|
||||
if ok and appPath then
|
||||
hs.alert.show(appPath)
|
||||
table.insert(info, appPath)
|
||||
else
|
||||
hs.alert.show("Path: <unavailable>")
|
||||
table.insert(info, "Path: <unavailable>")
|
||||
end
|
||||
table.insert(info, "PID: " .. app:pid())
|
||||
|
||||
print("Frontmost app info:")
|
||||
for _, line in ipairs(info) do
|
||||
hs.alert.show(line)
|
||||
print(line)
|
||||
end
|
||||
hs.alert.show("PID: " .. app:pid())
|
||||
end
|
||||
|
||||
-- the end
|
||||
|
||||
Reference in New Issue
Block a user