Browse Source

Hammerspoon: disable less useful functions

ubuntu_ci
Ein Verne 4 years ago
parent
commit
99ea408943
No known key found for this signature in database
GPG Key ID: 926634D64ACAD792
  1. 84
      hammerspoon/init.lua

84
hammerspoon/init.lua

@ -246,7 +246,7 @@ for _, v in pairs(hspoon_list) do
end end
hs.hotkey.bind({}, "F12", function() hs.hotkey.bind({}, "F12", function()
local app = hs.application.get("kitty") local app = hs.application.get("net.kovidgoyal.kitty")
if app then if app then
if not app:mainWindow() then if not app:mainWindow() then
app:selectMenuItem({"kitty", "New OS window"}) app:selectMenuItem({"kitty", "New OS window"})
@ -257,8 +257,8 @@ hs.hotkey.bind({}, "F12", function()
end end
app:mainWindow():moveToUnit'[100, 80, 0, 0]' app:mainWindow():moveToUnit'[100, 80, 0, 0]'
else else
hs.application.launchOrFocus("kitty") hs.application.launchOrFocus("/Applications/kitty.app")
app = hs.application.get("kitty") app = hs.application.get("net.kovidgoyal.kitty")
end end
end) end)
@ -491,28 +491,28 @@ end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- cheatsheetM modal environment (Because KSheet Spoon is NOT loaded, cheatsheetM will NOT be activated) -- cheatsheetM modal environment (Because KSheet Spoon is NOT loaded, cheatsheetM will NOT be activated)
if spoon.KSheet then -- if spoon.KSheet then
spoon.ModalMgr:new("cheatsheetM") -- spoon.ModalMgr:new("cheatsheetM")
local cmodal = spoon.ModalMgr.modal_list["cheatsheetM"] -- local cmodal = spoon.ModalMgr.modal_list["cheatsheetM"]
cmodal:bind('', 'escape', 'Deactivate cheatsheetM', function() -- cmodal:bind('', 'escape', 'Deactivate cheatsheetM', function()
spoon.KSheet:hide() -- spoon.KSheet:hide()
spoon.ModalMgr:deactivate({"cheatsheetM"}) -- spoon.ModalMgr:deactivate({"cheatsheetM"})
end) -- end)
cmodal:bind('', 'Q', 'Deactivate cheatsheetM', function() -- cmodal:bind('', 'Q', 'Deactivate cheatsheetM', function()
spoon.KSheet:hide() -- spoon.KSheet:hide()
spoon.ModalMgr:deactivate({"cheatsheetM"}) -- spoon.ModalMgr:deactivate({"cheatsheetM"})
end) -- end)
--
-- Register cheatsheetM with modal supervisor -- -- Register cheatsheetM with modal supervisor
hscheats_keys = hscheats_keys or {"alt", "S"} -- hscheats_keys = hscheats_keys or {"alt", "S"}
if string.len(hscheats_keys[2]) > 0 then -- if string.len(hscheats_keys[2]) > 0 then
spoon.ModalMgr.supervisor:bind(hscheats_keys[1], hscheats_keys[2], "Enter cheatsheetM Environment", function() -- spoon.ModalMgr.supervisor:bind(hscheats_keys[1], hscheats_keys[2], "Enter cheatsheetM Environment", function()
spoon.KSheet:show() -- spoon.KSheet:show()
spoon.ModalMgr:deactivateAll() -- spoon.ModalMgr:deactivateAll()
spoon.ModalMgr:activate({"cheatsheetM"}) -- spoon.ModalMgr:activate({"cheatsheetM"})
end) -- end)
end -- end
end -- end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- Register AClock -- Register AClock
@ -529,9 +529,9 @@ if spoon.WinRectangle then
end end
-- Register Caffeine -- Register Caffeine
if spoon.Caffeine then -- if spoon.Caffeine then
spoon.Caffeine:start() -- spoon.Caffeine:start()
end -- end
if spoon.wifiNotifier then if spoon.wifiNotifier then
spoon.wifiNotifier:start() spoon.wifiNotifier:start()
@ -539,20 +539,20 @@ end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- Register browser tab typist: Type URL of current tab of running browser in markdown format. i.e. [title](link) -- Register browser tab typist: Type URL of current tab of running browser in markdown format. i.e. [title](link)
hstype_keys = hstype_keys or {"alt", "V"} -- hstype_keys = hstype_keys or {"alt", "V"}
if string.len(hstype_keys[2]) > 0 then -- if string.len(hstype_keys[2]) > 0 then
spoon.ModalMgr.supervisor:bind(hstype_keys[1], hstype_keys[2], "Type Browser Link", function() -- spoon.ModalMgr.supervisor:bind(hstype_keys[1], hstype_keys[2], "Type Browser Link", function()
local safari_running = hs.application.applicationsForBundleID("com.apple.Safari") -- local safari_running = hs.application.applicationsForBundleID("com.apple.Safari")
local chrome_running = hs.application.applicationsForBundleID("com.google.Chrome") -- local chrome_running = hs.application.applicationsForBundleID("com.google.Chrome")
if #safari_running > 0 then -- if #safari_running > 0 then
local stat, data = hs.applescript('tell application "Safari" to get {URL, name} of current tab of window 1') -- local stat, data = hs.applescript('tell application "Safari" to get {URL, name} of current tab of window 1')
if stat then hs.eventtap.keyStrokes("[" .. data[2] .. "](" .. data[1] .. ")") end -- if stat then hs.eventtap.keyStrokes("[" .. data[2] .. "](" .. data[1] .. ")") end
elseif #chrome_running > 0 then -- elseif #chrome_running > 0 then
local stat, data = hs.applescript('tell application "Google Chrome" to get {URL, title} of active tab of window 1') -- local stat, data = hs.applescript('tell application "Google Chrome" to get {URL, title} of active tab of window 1')
if stat then hs.eventtap.keyStrokes("[" .. data[2] .. "](" .. data[1] .. ")") end -- if stat then hs.eventtap.keyStrokes("[" .. data[2] .. "](" .. data[1] .. ")") end
end -- end
end) -- end)
end -- end
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- Finally we initialize ModalMgr supervisor -- Finally we initialize ModalMgr supervisor

Loading…
Cancel
Save