mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 20:25:30 +00:00
fix(hammerspoon): change to Apple Script for better compability
This commit is contained in:
@@ -124,15 +124,10 @@ function launchToggleApplication(applicationName)
|
||||
if app:isHidden() then
|
||||
app:unhide()
|
||||
else
|
||||
-- Some apps don't allow hiding, so Apple Script is needed
|
||||
if app:hide() == false then
|
||||
HideApplicationWithAppleScript(app)
|
||||
else
|
||||
app:hide()
|
||||
end
|
||||
HideApplicationWithAppleScript(app)
|
||||
end
|
||||
else
|
||||
app:activate()
|
||||
ShowApplicationWithAppleScript(app)
|
||||
end
|
||||
else
|
||||
app:activate()
|
||||
@@ -154,6 +149,18 @@ function HideApplicationWithAppleScript(app)
|
||||
hs.osascript.applescript(formattedScript)
|
||||
end
|
||||
|
||||
-- Show application with AppleScript
|
||||
function ShowApplicationWithAppleScript(app)
|
||||
local appName = app:name()
|
||||
local showScript = [[
|
||||
tell application "Finder"
|
||||
set visible of process "%s" to true
|
||||
end tell
|
||||
]]
|
||||
local formattedScript = string.format(showScript, appName)
|
||||
hs.osascript.applescript(formattedScript)
|
||||
end
|
||||
|
||||
function Yabai(commands)
|
||||
for _, cmd in ipairs(commands) do
|
||||
os.execute("/opt/homebrew/bin/yabai -m " .. cmd)
|
||||
|
||||
Reference in New Issue
Block a user