mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
refactor(hammerspoon): improve URL handling setup, enabling host-specific setup
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
local obj = {}
|
||||
|
||||
function obj.init()
|
||||
local apptoggle = require('app_toggle')
|
||||
--------------------------------------------------------------------------------
|
||||
-- Global Hotkeys
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local apptoggle = require('app_toggle')
|
||||
|
||||
local function init_hotkeys()
|
||||
apptoggle:bind({ 'cmd', 'alt', 'ctrl' }, 'A', { 'Activity Monitor' })
|
||||
apptoggle:bind({ 'cmd', 'ctrl' }, '2', { 'ChatGPT' })
|
||||
apptoggle:bind({ 'cmd', 'ctrl' }, '4', { 'FastGPT' })
|
||||
@@ -24,4 +28,53 @@ function obj.init()
|
||||
)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- URL Handling
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local uh = require('url_handler')
|
||||
|
||||
local function init_url_handler()
|
||||
local chromeProfiles = {
|
||||
default = uh.chromeProfile("Default"),
|
||||
work = uh.chromeProfile("Profile 1"),
|
||||
}
|
||||
|
||||
uh.default_handler = uh.browsers.safari
|
||||
uh.url_patterns = {
|
||||
{
|
||||
{ "%://github.com/krystal/", "%://%.github.com/krystal/" },
|
||||
uh.browsers.edge, nil, { "Slack" }
|
||||
},
|
||||
{
|
||||
{ "%://meet.google.com/" },
|
||||
chromeProfiles.work, nil, { "Slack", "Calendar" }
|
||||
}
|
||||
}
|
||||
-- uh.url_redir_decoders = {
|
||||
-- {
|
||||
-- "MS Teams links",
|
||||
-- function(_, _, params, fullUrl)
|
||||
-- if params.url then
|
||||
-- return params.url
|
||||
-- else
|
||||
-- return fullUrl
|
||||
-- end
|
||||
-- end,
|
||||
-- nil, true, "Microsoft Teams"
|
||||
-- },
|
||||
-- }
|
||||
|
||||
uh:init()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Initialization
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function obj.init()
|
||||
init_hotkeys()
|
||||
init_url_handler()
|
||||
end
|
||||
|
||||
return obj
|
||||
|
||||
Reference in New Issue
Block a user