-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: clux <[email protected]>
- Loading branch information
Showing
4 changed files
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
mash = {"⌘", "⌥", "⌃"} | ||
|
||
-- Non-laggy exec | ||
function aerospace(args) | ||
hs.task.new("/opt/homebrew/bin/aerospace", function(ud, ...) | ||
hs.inspect(table.pack(...)) | ||
return true | ||
end, args):start() | ||
end | ||
|
||
|
||
MAIN="3" | ||
local function activateApp(name) | ||
local app = hs.application.find(name) | ||
if not app or app:isHidden() then | ||
hs.application.launchOrFocus(name) | ||
elseif hs.application.frontmostApplication() ~= app then | ||
app:activate() | ||
else | ||
-- unfortunately we cannot swap out easily with aerospace | ||
-- unfortunately we cannot swap back easily with aerospace | ||
-- hiding the window would mean an empty workspace or pulling in another window | ||
-- thus we hardcode the toggle to go back to 3 for now | ||
aerospace({"workspace", "3"}) | ||
-- thus we hardcode the toggle return | ||
aerospace({"workspace", MAIN}) | ||
end | ||
end | ||
|
||
-- Global terminal activation | ||
hs.hotkey.bind({}, "F1", function() activateApp("alacritty") end) | ||
hs.hotkey.bind(mash, "r", function() hs.reload(); aerospace("reload-config"); end) | ||
hs.alert("HS + aerospace loaded") | ||
|
||
-- TODO: use hs to trigger aerospace for switching so we could keep track of MAIN? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters