|
|
@ -10,8 +10,8 @@ require 'ime' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local module = { |
|
|
|
local module = { |
|
|
|
'ime', |
|
|
|
'ime', |
|
|
|
'autoscript' |
|
|
|
'autoscript' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
local function loadModuleByName(modName) |
|
|
|
local function loadModuleByName(modName) |
|
|
@ -26,24 +26,28 @@ end |
|
|
|
k = hs.hotkey.modal.new({}, "F17") |
|
|
|
k = hs.hotkey.modal.new({}, "F17") |
|
|
|
|
|
|
|
|
|
|
|
-- Enter Hyper Mode when F18 (Hyper/Capslock) is pressed |
|
|
|
-- Enter Hyper Mode when F18 (Hyper/Capslock) is pressed |
|
|
|
pressedF18 = function() k:enter() end |
|
|
|
pressedF18 = function() |
|
|
|
|
|
|
|
k:enter() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Leave Hyper Mode when F18 (Hyper/Capslock) is pressed, |
|
|
|
-- Leave Hyper Mode when F18 (Hyper/Capslock) is pressed, |
|
|
|
-- send ESCAPE if no other keys are pressed. |
|
|
|
-- send ESCAPE if no other keys are pressed. |
|
|
|
releasedF18 = function() k:exit() end |
|
|
|
releasedF18 = function() |
|
|
|
|
|
|
|
k:exit() |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
f18 = hs.hotkey.bind({}, 'F18', pressedF18, releasedF18) |
|
|
|
f18 = hs.hotkey.bind({}, 'F18', pressedF18, releasedF18) |
|
|
|
|
|
|
|
|
|
|
|
hyper = {"ctrl", "alt", "cmd", "shift"} |
|
|
|
hyper = { "ctrl", "alt", "cmd", "shift" } |
|
|
|
|
|
|
|
|
|
|
|
-- hs.hotkey.bind(hyper, "C", function() hs.application.launchOrFocus("Google Chrome") end) |
|
|
|
-- hs.hotkey.bind(hyper, "C", function() hs.application.launchOrFocus("Google Chrome") end) |
|
|
|
function moveWindowToDisplay(d) |
|
|
|
function moveWindowToDisplay(d) |
|
|
|
return function() |
|
|
|
return function() |
|
|
|
local displays = hs.screen.allScreens() |
|
|
|
local displays = hs.screen.allScreens() |
|
|
|
log.i(displays) |
|
|
|
log.i(displays) |
|
|
|
local win = hs.window.focusedWindow() |
|
|
|
local win = hs.window.focusedWindow() |
|
|
|
win:moveToScreen(displays[d], false, true) |
|
|
|
win:moveToScreen(displays[d], false, true) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- hs.hotkey.bind(hyper, "m", moveWindowToDisplay(1)) |
|
|
|
-- hs.hotkey.bind(hyper, "m", moveWindowToDisplay(1)) |
|
|
@ -51,37 +55,35 @@ end |
|
|
|
-- hs.hotkey.bind(hyper, "9", moveWindowToDisplay(3)) |
|
|
|
-- hs.hotkey.bind(hyper, "9", moveWindowToDisplay(3)) |
|
|
|
|
|
|
|
|
|
|
|
function movieWinBetweenMonitors(d) |
|
|
|
function movieWinBetweenMonitors(d) |
|
|
|
return function() |
|
|
|
return function() |
|
|
|
local win = hs.window.focusedWindow() |
|
|
|
local win = hs.window.focusedWindow() |
|
|
|
-- get the screen where the focused window is displayed, a.k.a current screen |
|
|
|
-- get the screen where the focused window is displayed, a.k.a current screen |
|
|
|
local screen = win:screen() |
|
|
|
local screen = win:screen() |
|
|
|
-- compute the unitRect of the focused window relative to the current screen |
|
|
|
-- compute the unitRect of the focused window relative to the current screen |
|
|
|
-- and move the window to the next screen setting the same unitRect |
|
|
|
-- and move the window to the next screen setting the same unitRect |
|
|
|
-- https://www.hammerspoon.org/docs/hs.window.html#move |
|
|
|
-- https://www.hammerspoon.org/docs/hs.window.html#move |
|
|
|
if d == 'next' then |
|
|
|
if d == 'next' then |
|
|
|
win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0) |
|
|
|
win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0) |
|
|
|
elseif d == 'previous' then |
|
|
|
elseif d == 'previous' then |
|
|
|
win:move(win:frame():toUnitRect(screen:frame()), screen:previous(), true, 0) |
|
|
|
win:move(win:frame():toUnitRect(screen:frame()), screen:previous(), true, 0) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
hs.hotkey.bind(hyper, 'N', movieWinBetweenMonitors('next')) |
|
|
|
hs.hotkey.bind(hyper, 'N', movieWinBetweenMonitors('next')) |
|
|
|
hs.hotkey.bind(hyper, 'P', movieWinBetweenMonitors('previous')) |
|
|
|
hs.hotkey.bind(hyper, 'P', movieWinBetweenMonitors('previous')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local grid = require 'hs.grid' |
|
|
|
local grid = require 'hs.grid' |
|
|
|
hs.hotkey.bind(hyper, ",", grid.show) |
|
|
|
hs.hotkey.bind(hyper, ",", grid.show) |
|
|
|
|
|
|
|
|
|
|
|
middle_monitor="DELL U2414H" |
|
|
|
middle_monitor = "DELL U2414H" |
|
|
|
left_monitor="DELL P2417H" |
|
|
|
left_monitor = "DELL P2417H" |
|
|
|
right_monitor="DELL U2412M" |
|
|
|
right_monitor = "DELL U2412M" |
|
|
|
|
|
|
|
|
|
|
|
local reading_layout = { |
|
|
|
local reading_layout = { |
|
|
|
{"Google Chrome", nil, middle_monitor, hs.layout.maximized, nil, nil}, |
|
|
|
{ "Google Chrome", nil, middle_monitor, hs.layout.maximized, nil, nil }, |
|
|
|
{"iTerm", nil, left_monitor, hs.layout.maximized, nil, nil}, |
|
|
|
{ "iTerm", nil, left_monitor, hs.layout.maximized, nil, nil }, |
|
|
|
{"Miwork", nil, right_monitor, hs.layout.top50, nil, nil}, |
|
|
|
{ "Miwork", nil, right_monitor, hs.layout.top50, nil, nil }, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
-- hs.hotkey.bind(hyper, "1", function() |
|
|
|
-- hs.hotkey.bind(hyper, "1", function() |
|
|
@ -93,8 +95,8 @@ local reading_layout = { |
|
|
|
-- end) |
|
|
|
-- end) |
|
|
|
|
|
|
|
|
|
|
|
local coding_layout = { |
|
|
|
local coding_layout = { |
|
|
|
{"IntelliJ IDEA Ultimate", nil, middle_monitor, hs.layout.maximized, nil, nil}, |
|
|
|
{ "IntelliJ IDEA Ultimate", nil, middle_monitor, hs.layout.maximized, nil, nil }, |
|
|
|
{"iTerm", nil, left_monitor, hs.layout.maximized, nil, nil}, |
|
|
|
{ "iTerm", nil, left_monitor, hs.layout.maximized, nil, nil }, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
-- hs.hotkey.bind(hyper, "2", function() |
|
|
|
-- hs.hotkey.bind(hyper, "2", function() |
|
|
@ -109,42 +111,42 @@ homeSSID = "PhRouter_5G" |
|
|
|
homeDDID1 = "EinVerne_5G" |
|
|
|
homeDDID1 = "EinVerne_5G" |
|
|
|
lastSSID = hs.wifi.currentNetwork() |
|
|
|
lastSSID = hs.wifi.currentNetwork() |
|
|
|
|
|
|
|
|
|
|
|
workSSID = "MIOffice-5G" |
|
|
|
workSSID = "XXX-5G" |
|
|
|
|
|
|
|
|
|
|
|
function selectKarabinerProfile(profile) |
|
|
|
function selectKarabinerProfile(profile) |
|
|
|
hs.execute("'/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli' --select-profile '" .. profile .. "'") |
|
|
|
hs.execute("'/Library/Application Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli' --select-profile '" .. profile .. "'") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function ssidChangedCallback() |
|
|
|
function ssidChangedCallback() |
|
|
|
newSSID = hs.wifi.currentNetwork() |
|
|
|
newSSID = hs.wifi.currentNetwork() |
|
|
|
|
|
|
|
|
|
|
|
local devices = hs.usb.attachedDevices() |
|
|
|
local devices = hs.usb.attachedDevices() |
|
|
|
|
|
|
|
|
|
|
|
if newSSID == homeSSID and lastSSID ~= homeSSID then |
|
|
|
if newSSID == homeSSID and lastSSID ~= homeSSID then |
|
|
|
-- We just joined our home WiFi network |
|
|
|
-- We just joined our home WiFi network |
|
|
|
-- hs.alert.show("Welcome home!") |
|
|
|
-- hs.alert.show("Welcome home!") |
|
|
|
hs.notify.new({title="Wifi", informativeText="Welcome home"}):send() |
|
|
|
hs.notify.new({ title = "Wifi", informativeText = "Welcome home" }):send() |
|
|
|
hs.audiodevice.defaultOutputDevice():setVolume(25) |
|
|
|
hs.audiodevice.defaultOutputDevice():setVolume(25) |
|
|
|
-- result = hs.network.configuration:setLocation("Home") |
|
|
|
-- result = hs.network.configuration:setLocation("Home") |
|
|
|
-- hs.alert.show(result) |
|
|
|
-- hs.alert.show(result) |
|
|
|
elseif newSSID ~= homeSSID and lastSSID == homeSSID then |
|
|
|
elseif newSSID ~= homeSSID and lastSSID == homeSSID then |
|
|
|
-- We just departed our home WiFi network |
|
|
|
-- We just departed our home WiFi network |
|
|
|
-- hs.alert.show("left home!") |
|
|
|
-- hs.alert.show("left home!") |
|
|
|
hs.notify.new({title="Wifi", informativeText="Left home"}):send() |
|
|
|
hs.notify.new({ title = "Wifi", informativeText = "Left home" }):send() |
|
|
|
hs.audiodevice.defaultOutputDevice():setVolume(0) |
|
|
|
hs.audiodevice.defaultOutputDevice():setVolume(0) |
|
|
|
-- result = hs.network.configuration:setLocation("Automatic") |
|
|
|
-- result = hs.network.configuration:setLocation("Automatic") |
|
|
|
-- hs.alert.show(result) |
|
|
|
-- hs.alert.show(result) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if newSSID == workSSID then |
|
|
|
if newSSID == workSSID then |
|
|
|
-- hs.alert.show("work karabiner setup") |
|
|
|
-- hs.alert.show("work karabiner setup") |
|
|
|
hs.notify.new({title="Wifi", informativeText="work karabiner setup"}):send() |
|
|
|
hs.notify.new({ title = "Wifi", informativeText = "work karabiner setup" }):send() |
|
|
|
selectKarabinerProfile("goku") |
|
|
|
selectKarabinerProfile("goku") |
|
|
|
else |
|
|
|
else |
|
|
|
-- hs.alert.show("built-in karabiner setup") |
|
|
|
-- hs.alert.show("built-in karabiner setup") |
|
|
|
hs.notify.new({title="Wifi", informativeText="built-in karabiner setup"}):send() |
|
|
|
hs.notify.new({ title = "Wifi", informativeText = "built-in karabiner setup" }):send() |
|
|
|
selectKarabinerProfile("goku") |
|
|
|
selectKarabinerProfile("goku") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
lastSSID = newSSID |
|
|
|
lastSSID = newSSID |
|
|
|
end |
|
|
|
end |
|
|
@ -156,35 +158,34 @@ networkConf = hs.network.configuration.open() |
|
|
|
location = networkConf:location() |
|
|
|
location = networkConf:location() |
|
|
|
|
|
|
|
|
|
|
|
function switchNetworkLocation(location) |
|
|
|
function switchNetworkLocation(location) |
|
|
|
hs.execute('/usr/sbin/networksetup -switchtolocation ' .. location) |
|
|
|
hs.execute('/usr/sbin/networksetup -switchtolocation ' .. location) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "H", function() |
|
|
|
hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "H", function() |
|
|
|
switchNetworkLocation("Home") |
|
|
|
switchNetworkLocation("Home") |
|
|
|
end) |
|
|
|
end) |
|
|
|
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function() |
|
|
|
hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "W", function() |
|
|
|
switchNetworkLocation("Automatic") |
|
|
|
switchNetworkLocation("Automatic") |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
homeDNS="192.168.2.21" |
|
|
|
homeDNS = "192.168.2.21" |
|
|
|
automaticLocationUUID="/Sets/5783E8CE-BA08-4BE2-9799-5F00E15E5837" |
|
|
|
automaticLocationUUID = "/Sets/5783E8CE-BA08-4BE2-9799-5F00E15E5837" |
|
|
|
homeLocationUUID="/Sets/C55127DB-F0CD-4573-890A-6F8EB59D9AFF" |
|
|
|
homeLocationUUID = "/Sets/C55127DB-F0CD-4573-890A-6F8EB59D9AFF" |
|
|
|
|
|
|
|
|
|
|
|
hs.network.reachability.forAddress(homeDNS):setCallback(function(self, flags) |
|
|
|
hs .network.reachability.forAddress(homeDNS):setCallback(function(self, flags) |
|
|
|
-- note that because having an internet connection at all will show the remote network |
|
|
|
-- note that because having an internet connection at all will show the remote network |
|
|
|
-- as "reachable", we instead look at whether or not our specific address is "local" instead |
|
|
|
-- as "reachable", we instead look at whether or not our specific address is "local" instead |
|
|
|
local networkConf = hs.network.configuration.open() |
|
|
|
local networkConf = hs.network.configuration.open() |
|
|
|
if (flags & hs.network.reachability.flags.reachable) > 0 and currentLocation == homeLocationUUID then |
|
|
|
if (flags & hs.network.reachability.flags.reachable) > 0 and currentLocation == homeLocationUUID then |
|
|
|
hs.alert.show("switch to Home network location") |
|
|
|
hs.alert.show("switch to Home network location") |
|
|
|
networkConf:setLocation("Home") |
|
|
|
networkConf:setLocation("Home") |
|
|
|
elseif (flags & hs.network.reachability.flags.reachable) == 0 and currentLocation ~= homeLocationUUID then |
|
|
|
elseif (flags & hs.network.reachability.flags.reachable) == 0 and currentLocation ~= homeLocationUUID then |
|
|
|
-- hs.alert.show("switch back to Automatic network location") |
|
|
|
-- hs.alert.show("switch back to Automatic network location") |
|
|
|
hs.notify.new({title="", informativeText="switch back to Automatic network location"}):send() |
|
|
|
hs.notify.new({ title = "", informativeText = "switch back to Automatic network location" }):send() |
|
|
|
networkConf:setLocation("Automatic") |
|
|
|
networkConf:setLocation("Automatic") |
|
|
|
end |
|
|
|
end |
|
|
|
end):start() |
|
|
|
end):start() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hs.hotkey.alertDuration = 0 |
|
|
|
hs.hotkey.alertDuration = 0 |
|
|
|
hs.hints.showTitleThresh = 0 |
|
|
|
hs.hints.showTitleThresh = 0 |
|
|
|
hs.window.animationDuration = 0 |
|
|
|
hs.window.animationDuration = 0 |
|
|
@ -193,7 +194,7 @@ hs.window.animationDuration = 0 |
|
|
|
custom_config = hs.fs.pathToAbsolute(os.getenv("HOME") .. '/.config/hammerspoon/private/config.lua') |
|
|
|
custom_config = hs.fs.pathToAbsolute(os.getenv("HOME") .. '/.config/hammerspoon/private/config.lua') |
|
|
|
if custom_config then |
|
|
|
if custom_config then |
|
|
|
print("Loading custom config") |
|
|
|
print("Loading custom config") |
|
|
|
dofile( os.getenv("HOME") .. "/.config/hammerspoon/private/config.lua") |
|
|
|
dofile(os.getenv("HOME") .. "/.config/hammerspoon/private/config.lua") |
|
|
|
privatepath = hs.fs.pathToAbsolute(hs.configdir .. '/private/config.lua') |
|
|
|
privatepath = hs.fs.pathToAbsolute(hs.configdir .. '/private/config.lua') |
|
|
|
if privatepath then |
|
|
|
if privatepath then |
|
|
|
hs.alert("You have config in both .config/hammerspoon and .hammerspoon/private.\nThe .config/hammerspoon one will be used.") |
|
|
|
hs.alert("You have config in both .config/hammerspoon and .hammerspoon/private.\nThe .config/hammerspoon one will be used.") |
|
|
@ -212,18 +213,16 @@ else |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function reloadConfig() |
|
|
|
function reloadConfig() |
|
|
|
hs.reload() |
|
|
|
hs.reload() |
|
|
|
hs.execute("/bin/launchctl kickstart -k \"gui/${UID}/homebrew.mxcl.yabai\"") |
|
|
|
hs.execute("/bin/launchctl kickstart -k \"gui/${UID}/homebrew.mxcl.yabai\"") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
hsreload_keys = {hyper, "R"} |
|
|
|
hsreload_keys = { hyper, "R" } |
|
|
|
hsreload_keys = hsreload_keys or {{"cmd", "shift", "ctrl"}, "R"} |
|
|
|
hsreload_keys = hsreload_keys or { { "cmd", "shift", "ctrl" }, "R" } |
|
|
|
if string.len(hsreload_keys[2]) > 0 then |
|
|
|
if string.len(hsreload_keys[2]) > 0 then |
|
|
|
hs.hotkey.bind(hsreload_keys[1], hsreload_keys[2], "Reload Configuration", reloadConfig) |
|
|
|
hs.hotkey.bind(hsreload_keys[1], hsreload_keys[2], "Reload Configuration", reloadConfig) |
|
|
|
hs.notify.new({title="Hammerspoon config reloaded", informativeText="Manually trigged via keyboard shortcut"}):send() |
|
|
|
hs.notify.new({ title = "Hammerspoon config reloaded", informativeText = "Manually trigged via keyboard shortcut" }):send() |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- ModalMgr Spoon must be loaded explicitly, because this repository heavily relies upon it. |
|
|
|
-- ModalMgr Spoon must be loaded explicitly, because this repository heavily relies upon it. |
|
|
@ -240,9 +239,9 @@ if not hspoon_list then |
|
|
|
"HCalendar", |
|
|
|
"HCalendar", |
|
|
|
--"HSaria2", |
|
|
|
--"HSaria2", |
|
|
|
"WinWin", |
|
|
|
"WinWin", |
|
|
|
"WifiNotifier", |
|
|
|
--"WifiNotifier", |
|
|
|
"WinRectangle", |
|
|
|
"WinRectangle", |
|
|
|
"Caffeine", |
|
|
|
"Caffeine", |
|
|
|
"PomodoroTimer", |
|
|
|
"PomodoroTimer", |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
@ -256,13 +255,13 @@ hs.hotkey.bind({}, "F12", function() |
|
|
|
local app = hs.application.get("dev.warp.Warp-Stable") |
|
|
|
local app = hs.application.get("dev.warp.Warp-Stable") |
|
|
|
if app then |
|
|
|
if app then |
|
|
|
if not app:mainWindow() then |
|
|
|
if not app:mainWindow() then |
|
|
|
app:selectMenuItem({"Warp", "New Window"}) |
|
|
|
app:selectMenuItem({ "Warp", "New Window" }) |
|
|
|
elseif app:isFrontmost() then |
|
|
|
elseif app:isFrontmost() then |
|
|
|
app:hide() |
|
|
|
app:hide() |
|
|
|
else |
|
|
|
else |
|
|
|
app:activate() |
|
|
|
app:activate() |
|
|
|
end |
|
|
|
end |
|
|
|
app:mainWindow():moveToUnit'[100, 80, 0, 0]' |
|
|
|
app:mainWindow():moveToUnit '[100, 80, 0, 0]' |
|
|
|
else |
|
|
|
else |
|
|
|
hs.application.launchOrFocus("/Applications/Warp.app") |
|
|
|
hs.application.launchOrFocus("/Applications/Warp.app") |
|
|
|
app = hs.application.get("dev.warp.Warp-Stable") |
|
|
|
app = hs.application.get("dev.warp.Warp-Stable") |
|
|
@ -273,7 +272,7 @@ end) |
|
|
|
-- Then we create/register all kinds of modal keybindings environments. |
|
|
|
-- Then we create/register all kinds of modal keybindings environments. |
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
---------------------------------------------------------------------------------------------------- |
|
|
|
-- Register windowHints (Register a keybinding which is NOT modal environment with modal supervisor) |
|
|
|
-- Register windowHints (Register a keybinding which is NOT modal environment with modal supervisor) |
|
|
|
hswhints_keys = hswhints_keys or {"alt", "tab"} |
|
|
|
hswhints_keys = hswhints_keys or { "alt", "tab" } |
|
|
|
if string.len(hswhints_keys[2]) > 0 then |
|
|
|
if string.len(hswhints_keys[2]) > 0 then |
|
|
|
spoon.ModalMgr.supervisor:bind(hswhints_keys[1], hswhints_keys[2], 'Show Window Hints', function() |
|
|
|
spoon.ModalMgr.supervisor:bind(hswhints_keys[1], hswhints_keys[2], 'Show Window Hints', function() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
@ -285,18 +284,24 @@ end |
|
|
|
-- appM modal environment |
|
|
|
-- appM modal environment |
|
|
|
spoon.ModalMgr:new("appM") |
|
|
|
spoon.ModalMgr:new("appM") |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["appM"] |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["appM"] |
|
|
|
cmodal:bind('', 'escape', 'Deactivate appM', function() spoon.ModalMgr:deactivate({"appM"}) end) |
|
|
|
cmodal:bind('', 'escape', 'Deactivate appM', function() |
|
|
|
cmodal:bind('', 'Q', 'Deactivate appM', function() spoon.ModalMgr:deactivate({"appM"}) end) |
|
|
|
spoon.ModalMgr:deactivate({ "appM" }) |
|
|
|
cmodal:bind('', 'tab', 'Toggle Cheatsheet', function() spoon.ModalMgr:toggleCheatsheet() end) |
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'Q', 'Deactivate appM', function() |
|
|
|
|
|
|
|
spoon.ModalMgr:deactivate({ "appM" }) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'tab', 'Toggle Cheatsheet', function() |
|
|
|
|
|
|
|
spoon.ModalMgr:toggleCheatsheet() |
|
|
|
|
|
|
|
end) |
|
|
|
if not hsapp_list then |
|
|
|
if not hsapp_list then |
|
|
|
hsapp_list = { |
|
|
|
hsapp_list = { |
|
|
|
{key = 'f', name = 'Finder'}, |
|
|
|
{ key = 'f', name = 'Finder' }, |
|
|
|
{key = 'c', name = 'Google Chrome'}, |
|
|
|
{ key = 'c', name = 'Google Chrome' }, |
|
|
|
{key = 'o', name = 'Obsidian'}, |
|
|
|
{ key = 'o', name = 'Obsidian' }, |
|
|
|
{key = 's', name = 'Safari'}, |
|
|
|
{ key = 's', name = 'Safari' }, |
|
|
|
{key = 't', name = 'Terminal'}, |
|
|
|
{ key = 't', name = 'Terminal' }, |
|
|
|
{key = 'v', id = 'com.apple.ActivityMonitor'}, |
|
|
|
{ key = 'v', id = 'com.apple.ActivityMonitor' }, |
|
|
|
{key = 'y', id = 'com.apple.systempreferences'}, |
|
|
|
{ key = 'y', id = 'com.apple.systempreferences' }, |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
for _, v in ipairs(hsapp_list) do |
|
|
|
for _, v in ipairs(hsapp_list) do |
|
|
@ -305,24 +310,24 @@ for _, v in ipairs(hsapp_list) do |
|
|
|
if located_name then |
|
|
|
if located_name then |
|
|
|
cmodal:bind('', v.key, located_name, function() |
|
|
|
cmodal:bind('', v.key, located_name, function() |
|
|
|
hs.application.launchOrFocusByBundleID(v.id) |
|
|
|
hs.application.launchOrFocusByBundleID(v.id) |
|
|
|
spoon.ModalMgr:deactivate({"appM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "appM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
elseif v.name then |
|
|
|
elseif v.name then |
|
|
|
cmodal:bind('', v.key, v.name, function() |
|
|
|
cmodal:bind('', v.key, v.name, function() |
|
|
|
hs.application.launchOrFocus(v.name) |
|
|
|
hs.application.launchOrFocus(v.name) |
|
|
|
spoon.ModalMgr:deactivate({"appM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "appM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Then we register some keybindings with modal supervisor |
|
|
|
-- Then we register some keybindings with modal supervisor |
|
|
|
hsappM_keys = hsappM_keys or {"alt", "A"} |
|
|
|
hsappM_keys = hsappM_keys or { "alt", "A" } |
|
|
|
if string.len(hsappM_keys[2]) > 0 then |
|
|
|
if string.len(hsappM_keys[2]) > 0 then |
|
|
|
spoon.ModalMgr.supervisor:bind(hsappM_keys[1], hsappM_keys[2], "Enter AppM Environment", function() |
|
|
|
spoon.ModalMgr.supervisor:bind(hsappM_keys[1], hsappM_keys[2], "Enter AppM Environment", function() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
-- Show the keybindings cheatsheet once appM is activated |
|
|
|
-- Show the keybindings cheatsheet once appM is activated |
|
|
|
spoon.ModalMgr:activate({"appM"}, "#FFBD2E", true) |
|
|
|
spoon.ModalMgr:activate({ "appM" }, "#FFBD2E", true) |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -333,11 +338,11 @@ if spoon.ClipShow then |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["clipshowM"] |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["clipshowM"] |
|
|
|
cmodal:bind('', 'escape', 'Deactivate clipshowM', function() |
|
|
|
cmodal:bind('', 'escape', 'Deactivate clipshowM', function() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'Q', 'Deactivate clipshowM', function() |
|
|
|
cmodal:bind('', 'Q', 'Deactivate clipshowM', function() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'N', 'Save this Session', function() |
|
|
|
cmodal:bind('', 'N', 'Save this Session', function() |
|
|
|
spoon.ClipShow:saveToSession() |
|
|
|
spoon.ClipShow:saveToSession() |
|
|
@ -348,37 +353,37 @@ if spoon.ClipShow then |
|
|
|
cmodal:bind('', 'B', 'Open in Browser', function() |
|
|
|
cmodal:bind('', 'B', 'Open in Browser', function() |
|
|
|
spoon.ClipShow:openInBrowserWithRef() |
|
|
|
spoon.ClipShow:openInBrowserWithRef() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'S', 'Search with Bing', function() |
|
|
|
cmodal:bind('', 'S', 'Search with Bing', function() |
|
|
|
spoon.ClipShow:openInBrowserWithRef("https://www.bing.com/search?q=") |
|
|
|
spoon.ClipShow:openInBrowserWithRef("https://www.bing.com/search?q=") |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'M', 'Open in MacVim', function() |
|
|
|
cmodal:bind('', 'M', 'Open in MacVim', function() |
|
|
|
spoon.ClipShow:openWithCommand("/usr/local/bin/mvim") |
|
|
|
spoon.ClipShow:openWithCommand("/usr/local/bin/mvim") |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'F', 'Save to Desktop', function() |
|
|
|
cmodal:bind('', 'F', 'Save to Desktop', function() |
|
|
|
spoon.ClipShow:saveToFile() |
|
|
|
spoon.ClipShow:saveToFile() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'H', 'Search in Github', function() |
|
|
|
cmodal:bind('', 'H', 'Search in Github', function() |
|
|
|
spoon.ClipShow:openInBrowserWithRef("https://github.com/search?q=") |
|
|
|
spoon.ClipShow:openInBrowserWithRef("https://github.com/search?q=") |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'G', 'Search with Google', function() |
|
|
|
cmodal:bind('', 'G', 'Search with Google', function() |
|
|
|
spoon.ClipShow:openInBrowserWithRef("https://www.google.com/search?q=") |
|
|
|
spoon.ClipShow:openInBrowserWithRef("https://www.google.com/search?q=") |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'L', 'Open in Sublime Text', function() |
|
|
|
cmodal:bind('', 'L', 'Open in Sublime Text', function() |
|
|
|
spoon.ClipShow:openWithCommand("/usr/local/bin/subl") |
|
|
|
spoon.ClipShow:openWithCommand("/usr/local/bin/subl") |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ClipShow:toggleShow() |
|
|
|
spoon.ModalMgr:deactivate({"clipshowM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "clipshowM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
@ -391,9 +396,11 @@ if spoon.HSaria2 then |
|
|
|
hsaria2_secret = hsaria2_secret or "token" |
|
|
|
hsaria2_secret = hsaria2_secret or "token" |
|
|
|
spoon.HSaria2:connectToHost(hsaria2_host, hsaria2_secret) |
|
|
|
spoon.HSaria2:connectToHost(hsaria2_host, hsaria2_secret) |
|
|
|
|
|
|
|
|
|
|
|
hsaria2_keys = hsaria2_keys or {"alt", "D"} |
|
|
|
hsaria2_keys = hsaria2_keys or { "alt", "D" } |
|
|
|
if string.len(hsaria2_keys[2]) > 0 then |
|
|
|
if string.len(hsaria2_keys[2]) > 0 then |
|
|
|
spoon.ModalMgr.supervisor:bind(hsaria2_keys[1], hsaria2_keys[2], 'Toggle aria2 Panel', function() spoon.HSaria2:togglePanel() end) |
|
|
|
spoon.ModalMgr.supervisor:bind(hsaria2_keys[1], hsaria2_keys[2], 'Toggle aria2 Panel', function() |
|
|
|
|
|
|
|
spoon.HSaria2:togglePanel() |
|
|
|
|
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -414,35 +421,41 @@ end |
|
|
|
if spoon.CountDown then |
|
|
|
if spoon.CountDown then |
|
|
|
spoon.ModalMgr:new("countdownM") |
|
|
|
spoon.ModalMgr:new("countdownM") |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["countdownM"] |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["countdownM"] |
|
|
|
cmodal:bind('', 'escape', 'Deactivate countdownM', function() spoon.ModalMgr:deactivate({"countdownM"}) end) |
|
|
|
cmodal:bind('', 'escape', 'Deactivate countdownM', function() |
|
|
|
cmodal:bind('', 'Q', 'Deactivate countdownM', function() spoon.ModalMgr:deactivate({"countdownM"}) end) |
|
|
|
spoon.ModalMgr:deactivate({ "countdownM" }) |
|
|
|
cmodal:bind('', 'tab', 'Toggle Cheatsheet', function() spoon.ModalMgr:toggleCheatsheet() end) |
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'Q', 'Deactivate countdownM', function() |
|
|
|
|
|
|
|
spoon.ModalMgr:deactivate({ "countdownM" }) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'tab', 'Toggle Cheatsheet', function() |
|
|
|
|
|
|
|
spoon.ModalMgr:toggleCheatsheet() |
|
|
|
|
|
|
|
end) |
|
|
|
cmodal:bind('', '0', '5 Minutes Countdown', function() |
|
|
|
cmodal:bind('', '0', '5 Minutes Countdown', function() |
|
|
|
spoon.CountDown:startFor(5) |
|
|
|
spoon.CountDown:startFor(5) |
|
|
|
spoon.ModalMgr:deactivate({"countdownM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "countdownM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
for i = 1, 9 do |
|
|
|
for i = 1, 9 do |
|
|
|
cmodal:bind('', tostring(i), string.format("%s Minutes Countdown", 10 * i), function() |
|
|
|
cmodal:bind('', tostring(i), string.format("%s Minutes Countdown", 10 * i), function() |
|
|
|
spoon.CountDown:startFor(10 * i) |
|
|
|
spoon.CountDown:startFor(10 * i) |
|
|
|
spoon.ModalMgr:deactivate({"countdownM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "countdownM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
cmodal:bind('', 'return', '25 Minutes Countdown', function() |
|
|
|
cmodal:bind('', 'return', '25 Minutes Countdown', function() |
|
|
|
spoon.CountDown:startFor(25) |
|
|
|
spoon.CountDown:startFor(25) |
|
|
|
spoon.ModalMgr:deactivate({"countdownM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "countdownM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'space', 'Pause/Resume CountDown', function() |
|
|
|
cmodal:bind('', 'space', 'Pause/Resume CountDown', function() |
|
|
|
spoon.CountDown:pauseOrResume() |
|
|
|
spoon.CountDown:pauseOrResume() |
|
|
|
spoon.ModalMgr:deactivate({"countdownM"}) |
|
|
|
spoon.ModalMgr:deactivate({ "countdownM" }) |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
-- Register countdownM with modal supervisor |
|
|
|
-- Register countdownM with modal supervisor |
|
|
|
hscountdM_keys = hscountdM_keys or {"alt", "I"} |
|
|
|
hscountdM_keys = hscountdM_keys or { "alt", "I" } |
|
|
|
if string.len(hscountdM_keys[2]) > 0 then |
|
|
|
if string.len(hscountdM_keys[2]) > 0 then |
|
|
|
spoon.ModalMgr.supervisor:bind(hscountdM_keys[1], hscountdM_keys[2], "Enter countdownM Environment", function() |
|
|
|
spoon.ModalMgr.supervisor:bind(hscountdM_keys[1], hscountdM_keys[2], "Enter countdownM Environment", function() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
-- Show the keybindings cheatsheet once countdownM is activated |
|
|
|
-- Show the keybindings cheatsheet once countdownM is activated |
|
|
|
spoon.ModalMgr:activate({"countdownM"}, "#FF6347", true) |
|
|
|
spoon.ModalMgr:activate({ "countdownM" }, "#FF6347", true) |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -452,46 +465,143 @@ end |
|
|
|
if spoon.WinWin then |
|
|
|
if spoon.WinWin then |
|
|
|
spoon.ModalMgr:new("resizeM") |
|
|
|
spoon.ModalMgr:new("resizeM") |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["resizeM"] |
|
|
|
local cmodal = spoon.ModalMgr.modal_list["resizeM"] |
|
|
|
cmodal:bind('', 'escape', 'Deactivate resizeM', function() spoon.ModalMgr:deactivate({"resizeM"}) end) |
|
|
|
cmodal:bind('', 'escape', 'Deactivate resizeM', function() |
|
|
|
cmodal:bind('', 'Q', 'Deactivate resizeM', function() spoon.ModalMgr:deactivate({"resizeM"}) end) |
|
|
|
spoon.ModalMgr:deactivate({ "resizeM" }) |
|
|
|
cmodal:bind('', 'tab', 'Toggle Cheatsheet', function() spoon.ModalMgr:toggleCheatsheet() end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'A', 'Move Leftward', function() spoon.WinWin:stepMove("left") end, nil, function() spoon.WinWin:stepMove("left") end) |
|
|
|
cmodal:bind('', 'Q', 'Deactivate resizeM', function() |
|
|
|
cmodal:bind('', 'D', 'Move Rightward', function() spoon.WinWin:stepMove("right") end, nil, function() spoon.WinWin:stepMove("right") end) |
|
|
|
spoon.ModalMgr:deactivate({ "resizeM" }) |
|
|
|
cmodal:bind('', 'W', 'Move Upward', function() spoon.WinWin:stepMove("up") end, nil, function() spoon.WinWin:stepMove("up") end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'S', 'Move Downward', function() spoon.WinWin:stepMove("down") end, nil, function() spoon.WinWin:stepMove("down") end) |
|
|
|
cmodal:bind('', 'tab', 'Toggle Cheatsheet', function() |
|
|
|
cmodal:bind('', 'H', 'Lefthalf of Screen', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("halfleft") end) |
|
|
|
spoon.ModalMgr:toggleCheatsheet() |
|
|
|
cmodal:bind('', 'L', 'Righthalf of Screen', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("halfright") end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'K', 'Uphalf of Screen', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("halfup") end) |
|
|
|
cmodal:bind('', 'A', 'Move Leftward', function() |
|
|
|
cmodal:bind('', 'J', 'Downhalf of Screen', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("halfdown") end) |
|
|
|
spoon.WinWin:stepMove("left") |
|
|
|
cmodal:bind('', 'Y', 'NorthWest Corner', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("cornerNW") end) |
|
|
|
end, nil, function() |
|
|
|
cmodal:bind('', 'O', 'NorthEast Corner', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("cornerNE") end) |
|
|
|
spoon.WinWin:stepMove("left") |
|
|
|
cmodal:bind('', 'U', 'SouthWest Corner', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("cornerSW") end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'I', 'SouthEast Corner', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("cornerSE") end) |
|
|
|
cmodal:bind('', 'D', 'Move Rightward', function() |
|
|
|
cmodal:bind('', 'F', 'Fullscreen', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("fullscreen") end) |
|
|
|
spoon.WinWin:stepMove("right") |
|
|
|
cmodal:bind('', 'C', 'Center Window', function() spoon.WinWin:stash() spoon.WinWin:moveAndResize("center") end) |
|
|
|
end, nil, function() |
|
|
|
cmodal:bind('', '=', 'Stretch Outward', function() spoon.WinWin:moveAndResize("expand") end, nil, function() spoon.WinWin:moveAndResize("expand") end) |
|
|
|
spoon.WinWin:stepMove("right") |
|
|
|
cmodal:bind('', '-', 'Shrink Inward', function() spoon.WinWin:moveAndResize("shrink") end, nil, function() spoon.WinWin:moveAndResize("shrink") end) |
|
|
|
end) |
|
|
|
cmodal:bind('shift', 'H', 'Move Leftward', function() spoon.WinWin:stepResize("left") end, nil, function() spoon.WinWin:stepResize("left") end) |
|
|
|
cmodal:bind('', 'W', 'Move Upward', function() |
|
|
|
cmodal:bind('shift', 'L', 'Move Rightward', function() spoon.WinWin:stepResize("right") end, nil, function() spoon.WinWin:stepResize("right") end) |
|
|
|
spoon.WinWin:stepMove("up") |
|
|
|
cmodal:bind('shift', 'K', 'Move Upward', function() spoon.WinWin:stepResize("up") end, nil, function() spoon.WinWin:stepResize("up") end) |
|
|
|
end, nil, function() |
|
|
|
cmodal:bind('shift', 'J', 'Move Downward', function() spoon.WinWin:stepResize("down") end, nil, function() spoon.WinWin:stepResize("down") end) |
|
|
|
spoon.WinWin:stepMove("up") |
|
|
|
cmodal:bind('', 'left', 'Move to Left Monitor', function() spoon.WinWin:stash() spoon.WinWin:moveToScreen("left") end) |
|
|
|
end) |
|
|
|
cmodal:bind('', 'right', 'Move to Right Monitor', function() spoon.WinWin:stash() spoon.WinWin:moveToScreen("right") end) |
|
|
|
cmodal:bind('', 'S', 'Move Downward', function() |
|
|
|
cmodal:bind('', 'up', 'Move to Above Monitor', function() spoon.WinWin:stash() spoon.WinWin:moveToScreen("up") end) |
|
|
|
spoon.WinWin:stepMove("down") |
|
|
|
cmodal:bind('', 'down', 'Move to Below Monitor', function() spoon.WinWin:stash() spoon.WinWin:moveToScreen("down") end) |
|
|
|
end, nil, function() |
|
|
|
cmodal:bind('', 'space', 'Move to Next Monitor', function() spoon.WinWin:stash() spoon.WinWin:moveToScreen("next") end) |
|
|
|
spoon.WinWin:stepMove("down") |
|
|
|
cmodal:bind('', '[', 'Undo Window Manipulation', function() spoon.WinWin:undo() end) |
|
|
|
end) |
|
|
|
cmodal:bind('', ']', 'Redo Window Manipulation', function() spoon.WinWin:redo() end) |
|
|
|
cmodal:bind('', 'H', 'Lefthalf of Screen', function() |
|
|
|
cmodal:bind('', '`', 'Center Cursor', function() spoon.WinWin:centerCursor() end) |
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("halfleft") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'L', 'Righthalf of Screen', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("halfright") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'K', 'Uphalf of Screen', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("halfup") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'J', 'Downhalf of Screen', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("halfdown") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'Y', 'NorthWest Corner', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("cornerNW") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'O', 'NorthEast Corner', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("cornerNE") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'U', 'SouthWest Corner', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("cornerSW") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'I', 'SouthEast Corner', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("cornerSE") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'F', 'Fullscreen', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("fullscreen") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'C', 'Center Window', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("center") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', '=', 'Stretch Outward', function() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("expand") |
|
|
|
|
|
|
|
end, nil, function() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("expand") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', '-', 'Shrink Inward', function() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("shrink") |
|
|
|
|
|
|
|
end, nil, function() |
|
|
|
|
|
|
|
spoon.WinWin:moveAndResize("shrink") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('shift', 'H', 'Move Leftward', function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("left") |
|
|
|
|
|
|
|
end, nil, function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("left") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('shift', 'L', 'Move Rightward', function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("right") |
|
|
|
|
|
|
|
end, nil, function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("right") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('shift', 'K', 'Move Upward', function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("up") |
|
|
|
|
|
|
|
end, nil, function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("up") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('shift', 'J', 'Move Downward', function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("down") |
|
|
|
|
|
|
|
end, nil, function() |
|
|
|
|
|
|
|
spoon.WinWin:stepResize("down") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'left', 'Move to Left Monitor', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveToScreen("left") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'right', 'Move to Right Monitor', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveToScreen("right") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'up', 'Move to Above Monitor', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveToScreen("up") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'down', 'Move to Below Monitor', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveToScreen("down") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', 'space', 'Move to Next Monitor', function() |
|
|
|
|
|
|
|
spoon.WinWin:stash() |
|
|
|
|
|
|
|
spoon.WinWin:moveToScreen("next") |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', '[', 'Undo Window Manipulation', function() |
|
|
|
|
|
|
|
spoon.WinWin:undo() |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', ']', 'Redo Window Manipulation', function() |
|
|
|
|
|
|
|
spoon.WinWin:redo() |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
cmodal:bind('', '`', 'Center Cursor', function() |
|
|
|
|
|
|
|
spoon.WinWin:centerCursor() |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
-- Register resizeM with modal supervisor |
|
|
|
-- Register resizeM with modal supervisor |
|
|
|
hsresizeM_keys = hsresizeM_keys or {"alt", "R"} |
|
|
|
hsresizeM_keys = hsresizeM_keys or { "alt", "R" } |
|
|
|
if string.len(hsresizeM_keys[2]) > 0 then |
|
|
|
if string.len(hsresizeM_keys[2]) > 0 then |
|
|
|
spoon.ModalMgr.supervisor:bind(hsresizeM_keys[1], hsresizeM_keys[2], "Enter resizeM Environment", function() |
|
|
|
spoon.ModalMgr.supervisor:bind(hsresizeM_keys[1], hsresizeM_keys[2], "Enter resizeM Environment", function() |
|
|
|
-- Deactivate some modal environments or not before activating a new one |
|
|
|
-- Deactivate some modal environments or not before activating a new one |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
spoon.ModalMgr:deactivateAll() |
|
|
|
-- Show an status indicator so we know we're in some modal environment now |
|
|
|
-- Show an status indicator so we know we're in some modal environment now |
|
|
|
spoon.ModalMgr:activate({"resizeM"}, "#B22222") |
|
|
|
spoon.ModalMgr:activate({ "resizeM" }, "#B22222") |
|
|
|
end) |
|
|
|
end) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -532,7 +642,7 @@ end |
|
|
|
|
|
|
|
|
|
|
|
-- Register WinRectangle |
|
|
|
-- Register WinRectangle |
|
|
|
if spoon.WinRectangle then |
|
|
|
if spoon.WinRectangle then |
|
|
|
spoon.WinRectangle:bindHotkeys(spoon.WinRectangle.defaultHotkeys) |
|
|
|
spoon.WinRectangle:bindHotkeys(spoon.WinRectangle.defaultHotkeys) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Register Caffeine |
|
|
|
-- Register Caffeine |
|
|
@ -540,13 +650,13 @@ end |
|
|
|
-- spoon.Caffeine:start() |
|
|
|
-- spoon.Caffeine:start() |
|
|
|
-- end |
|
|
|
-- end |
|
|
|
|
|
|
|
|
|
|
|
if spoon.wifiNotifier then |
|
|
|
--if spoon.wifiNotifier then |
|
|
|
spoon.wifiNotifier:start() |
|
|
|
-- spoon.wifiNotifier:start() |
|
|
|
end |
|
|
|
--end |
|
|
|
|
|
|
|
|
|
|
|
log.d("PomodoroTimer Spoon loaded successfully") |
|
|
|
log.d("PomodoroTimer Spoon loaded successfully") |
|
|
|
if spoon.PomodoroTimer then |
|
|
|
if spoon.PomodoroTimer then |
|
|
|
hs.hotkey.bind({"cmd", "ctrl"}, "0", function() |
|
|
|
hs.hotkey.bind({ "cmd", "ctrl" }, "0", function() |
|
|
|
log.d("PomodoroTimer hotkey pressed") |
|
|
|
log.d("PomodoroTimer hotkey pressed") |
|
|
|
spoon.PomodoroTimer:toggle() |
|
|
|
spoon.PomodoroTimer:toggle() |
|
|
|
end) |
|
|
|
end) |
|
|
|