Skip to content

Commit

Permalink
feat(hs): tweak hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
minusfive committed Oct 14, 2024
1 parent 1aac8e1 commit 30adeac
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions .hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ local m = {
---@type hs.hotkey.KeySpec[]
local baseSpecs = {
-- Apps
{ m.hotkeys.mods.meh, "1", "1Password", m.appLauncher:openApp("1Password") },
{ m.hotkeys.mods.meh, "c", "Slack", m.appLauncher:openApp("Slack") }, -- Chat
{ m.hotkeys.mods.meh, "c", "Slack", m.appLauncher:openApp("Slack") }, -- Chat, Channels
{ m.hotkeys.mods.meh, "d", "Discord", m.appLauncher:openApp("Discord") },
{ m.hotkeys.mods.meh, "e", "Microsoft Outlook", m.appLauncher:openApp("Microsoft Outlook") }, -- Email
{ m.hotkeys.mods.meh, "f", "Finder", m.appLauncher:openApp("Finder") },
{ m.hotkeys.mods.meh, "g", "Google Chrome", m.appLauncher:openApp("Google Chrome") },
{ m.hotkeys.mods.meh, "i", "Insomnia", m.appLauncher:openApp("Insomnia") },
{ m.hotkeys.mods.meh, "m", "Messages", m.appLauncher:openApp("Messages") },
{ m.hotkeys.mods.meh, "n", "Notes", m.appLauncher:openApp("Notes") },
{ m.hotkeys.mods.meh, "o", "Obsidian", m.appLauncher:openApp("Obsidian") },
{ m.hotkeys.mods.meh, "p", "Messages", m.appLauncher:openApp("Messages") }, -- Personal
{ m.hotkeys.mods.meh, "p", "1Password", m.appLauncher:openApp("1Password") },
{ m.hotkeys.mods.meh, "r", "Reminders", m.appLauncher:openApp("Reminders") },
{ m.hotkeys.mods.meh, "s", "Safari", m.appLauncher:openApp("Safari") },
{ m.hotkeys.mods.meh, "t", "WezTerm", m.appLauncher:openApp("WezTerm") },
Expand All @@ -52,22 +52,24 @@ local baseSpecs = {

-- Window Layouts
-- Top Row
{ m.hotkeys.mods.meh, "2", "1/3 Left", m.windowManager:move(m.windowManager.layout.left33) },
{ m.hotkeys.mods.meh, "3", "1/3 Center", m.windowManager:move(m.windowManager.layout.center33) },
{ m.hotkeys.mods.meh, "4", "1/3 Right", m.windowManager:move(m.windowManager.layout.right33) },
{ m.hotkeys.mods.meh, "1", "1/4 1", m.windowManager:move(m.windowManager.layout.first25) },
{ m.hotkeys.mods.meh, "2", "1/4 2", m.windowManager:move(m.windowManager.layout.second25) },
{ m.hotkeys.mods.meh, "3", "1/4 3", m.windowManager:move(m.windowManager.layout.third25) },
{ m.hotkeys.mods.meh, "4", "1/4 4", m.windowManager:move(m.windowManager.layout.fourth25) },

{ m.hotkeys.mods.meh, "=", "Grow Width", m.windowManager.growX },
{ m.hotkeys.mods.meh, "-", "Shrink Width", m.windowManager.shrinkX },
{ m.hotkeys.mods.hyper, "=", "Grow Height", m.windowManager.growY },
{ m.hotkeys.mods.hyper, "-", "Shrink Height", m.windowManager.shrinkY },

-- Middle Row
{ m.hotkeys.mods.meh, "6", "1/4 1", m.windowManager:move(m.windowManager.layout.first25) },
{ m.hotkeys.mods.meh, "7", "1/2 Left", m.windowManager:move(m.windowManager.layout.left50) },
{ m.hotkeys.mods.hyper, "7", "1/4 2", m.windowManager:move(m.windowManager.layout.second25) },
{ m.hotkeys.mods.meh, "8", "1/2 Center", m.windowManager:move(m.windowManager.layout.center50) },
{ m.hotkeys.mods.meh, "9", "1/2 Right", m.windowManager:move(m.windowManager.layout.right50) },
{ m.hotkeys.mods.hyper, "9", "1/4 3", m.windowManager:move(m.windowManager.layout.third25) },
{ m.hotkeys.mods.meh, "0", "1/4 4", m.windowManager:move(m.windowManager.layout.fourth25) },
{ m.hotkeys.mods.meh, "7", "1/3 Left", m.windowManager:move(m.windowManager.layout.left33) },
{ m.hotkeys.mods.meh, "8", "1/3 Center", m.windowManager:move(m.windowManager.layout.center33) },
{ m.hotkeys.mods.meh, "9", "1/3 Right", m.windowManager:move(m.windowManager.layout.right33) },

{ m.hotkeys.mods.hyper, "7", "1/2 Left", m.windowManager:move(m.windowManager.layout.left50) },
{ m.hotkeys.mods.hyper, "8", "1/2 Center", m.windowManager:move(m.windowManager.layout.center50) },
{ m.hotkeys.mods.hyper, "9", "1/2 Right", m.windowManager:move(m.windowManager.layout.right50) },
}

-- Modal hotkeys
Expand All @@ -85,42 +87,43 @@ local modeSystem = {
trigger = { m.hotkeys.mods.hyper, "s", "System" },
isOneShot = true,
specs = {
{ {}, "a", "Activity Monitor", m.appLauncher:openApp("Activity Monitor") },
{ {}, "c", "Caffeine", m.caffeine.toggle },
{ {}, "h", "Hammerspoon", m.appLauncher:openApp("Hammerspoon") },
{ {}, "m", "Activity Monitor", m.appLauncher:openApp("Activity Monitor") },
{ {}, "p", "System Preferences", m.appLauncher:openApp("System Preferences") },
{ {}, "r", "Reload Config", hs.reload },
{ {}, ",", "System Preferences", m.appLauncher:openApp("System Preferences") },
},
}

-- Window manager mode
---@type Hotkeys.ModalSpec
local modeWindowManager = {
trigger = { m.hotkeys.mods.hyper, "w", "Window Manager" },
trigger = { m.hotkeys.mods.hyper, "w", "Window" },
isOneShot = true,
specs = {
-- Top Row - Thirds [||]
{ { "shift" }, "2", "1/3 Left", m.windowManager:move(m.windowManager.layout.left33) },
{ { "shift" }, "3", "1/3 Center", m.windowManager:move(m.windowManager.layout.center33) },
{ { "shift" }, "4", "1/3 Right", m.windowManager:move(m.windowManager.layout.right33) },

-- Middle Row - Halves [|] and Quarters [|||]
{ { "shift" }, "6", "1/4 1", m.windowManager:move(m.windowManager.layout.first25) },
{ { "shift" }, "7", "1/2 Left", m.windowManager:move(m.windowManager.layout.left50) },
{ { "cmd", "shift" }, "7", "1/4 2", m.windowManager:move(m.windowManager.layout.second25) },
{ { "shift" }, "8", "1/2 Center", m.windowManager:move(m.windowManager.layout.center50) },
{ { "shift" }, "9", "1/2 Right", m.windowManager:move(m.windowManager.layout.right50) },
{ { "cmd", "shift" }, "9", "1/4 3", m.windowManager:move(m.windowManager.layout.third25) },
{ { "shift" }, "0", "1/4 4", m.windowManager:move(m.windowManager.layout.fourth25) },
-- Top Row
-- { {}, "1", "1/4 1", m.windowManager:move(m.windowManager.layout.first25) },
-- { {}, "2", "1/4 2", m.windowManager:move(m.windowManager.layout.second25) },
-- { {}, "3", "1/4 3", m.windowManager:move(m.windowManager.layout.third25) },
-- { {}, "4", "1/4 4", m.windowManager:move(m.windowManager.layout.fourth25) },

-- Middle Row
-- { {}, "7", "1/3 Left", m.windowManager:move(m.windowManager.layout.left33) },
-- { {}, "8", "1/3 Center", m.windowManager:move(m.windowManager.layout.center33) },
-- { {}, "9", "1/3 Right", m.windowManager:move(m.windowManager.layout.right33) },
--
-- { { "shift" }, "7", "1/2 Left", m.windowManager:move(m.windowManager.layout.left50) },
-- { { "shift" }, "8", "1/2 Center", m.windowManager:move(m.windowManager.layout.center50) },
-- { { "shift" }, "9", "1/2 Right", m.windowManager:move(m.windowManager.layout.right50) },

{ {}, "up", "1/2 Top", m.windowManager:move(m.windowManager.layout.top50) },
{ {}, "down", "1/2 Bottom", m.windowManager:move(m.windowManager.layout.bottom50) },

-- Corners
{ {}, "q", "1/4 Top-Left", m.windowManager:move(m.windowManager.layout.topLeft25) },
{ {}, "b", "1/4 Top-Right", m.windowManager:move(m.windowManager.layout.topRigh25) },
{ {}, "z", "1/4 Bottom-Left", m.windowManager:move(m.windowManager.layout.bottomLeft25) },
{ {}, "v", "1/4 Bottom-Right", m.windowManager:move(m.windowManager.layout.bottomRigh25) },
{ { "shift" }, "1", "1/4 Top-Left", m.windowManager:move(m.windowManager.layout.topLeft25) },
{ { "shift" }, "2", "1/4 Top-Right", m.windowManager:move(m.windowManager.layout.topRigh25) },
{ { "shift" }, "3", "1/4 Bottom-Left", m.windowManager:move(m.windowManager.layout.bottomLeft25) },
{ { "shift" }, "4", "1/4 Bottom-Right", m.windowManager:move(m.windowManager.layout.bottomRigh25) },

-- Move
{ {}, "[", "Move Left", m.windowManager.moveL },
Expand Down

0 comments on commit 30adeac

Please sign in to comment.