feat: add Dotbot

This commit is contained in:
Stefan Imhoff
2024-08-09 11:57:28 +02:00
parent a41290c297
commit 0437240919
248 changed files with 1205 additions and 44 deletions

View File

@@ -0,0 +1,20 @@
-- Replace Caffeine.app with 18 lines of Lua :D
local caffeine = hs.menubar.new()
function SetCaffeineDisplay(state)
local result
if state then
result = caffeine:setIcon("~/.hammerspoon/icons/sun.pdf")
else
result = caffeine:setIcon("~/.hammerspoon/icons/moon.pdf")
end
end
function CaffeineClicked()
SetCaffeineDisplay(hs.caffeinate.toggle("displayIdle"))
end
if caffeine then
caffeine:setClickCallback(CaffeineClicked)
SetCaffeineDisplay(hs.caffeinate.get("displayIdle"))
end

View File

@@ -0,0 +1,184 @@
----------------------
-- Helper Functions --
----------------------
-- Get list of screens and refresh that list whenever screens are plugged or unplugged:
local screens = hs.screen.allScreens()
local screenwatcher = hs.screen.watcher.new(function()
screens = hs.screen.allScreens()
end)
screenwatcher:start()
-- Move a window a number of pixels in x and y
function Nudge(xpos, ypos)
local win = hs.window.focusedWindow()
local f = win:frame()
f.x = f.x + xpos
f.y = f.y + ypos
win:setFrame(f)
end
-- Resize a window by moving the bottom
function Yank(xpixels, ypixels)
local win = hs.window.focusedWindow()
local f = win:frame()
f.w = f.w + xpixels
f.h = f.h + ypixels
win:setFrame(f)
end
-- Resize window for chunk of screen.
-- For x and y: use 0 to expand fully in that dimension, 0.5 to expand halfway
-- For w and h: use 1 for full, 0.5 for half
function Push(x, y, w, h)
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x + (max.w * x)
f.y = max.y + (max.h * y)
f.w = max.w * w
f.h = max.h * h
win:setFrame(f)
end
-- Move to monitor x. Checks to make sure monitor exists, if not moves to last monitor that exists
function MoveToMonitor(x)
local win = hs.window.focusedWindow()
local newScreen = nil
while not newScreen do
newScreen = screens[x]
x = x - 1
end
win:moveToScreen(newScreen)
end
-- Move to next screen
local function moveToNextScreen(win)
win = win or window.focusedWindow()
win:moveToScreen(win:screen():next())
end
-- Move to previous screen
local function moveToPreviousScreen(win)
win = win or window.focusedWindow()
win:moveToScreen(win:screen():previous())
end
-- This places a red circle around the mouse pointer
local mouseCircle = nil
local mouseCircleTimer = nil
function MouseHighlight()
-- Delete an existing highlight if it exists
if mouseCircle then
mouseCircle:delete()
if mouseCircleTimer then
mouseCircleTimer:stop()
end
end
-- Get the current co-ordinates of the mouse pointer
Mousepoint = hs.mouse.get()
-- Prepare a big red circle around the mouse pointer
mouseCircle = hs.drawing.circle(hs.geometry.rect(Mousepoint.x - 40, Mousepoint.y - 40, 80, 80))
mouseCircle:setStrokeColor({ ["red"] = 1, ["blue"] = 0, ["green"] = 0, ["alpha"] = 1 })
mouseCircle:setFill(false)
mouseCircle:setStrokeWidth(5)
mouseCircle:show()
-- Set a timer to delete the circle after 3 seconds
mouseCircleTimer = hs.timer.doAfter(2, function()
mouseCircle:delete()
end)
end
-- Get all valid windows
function GetAllValidWindows()
local allWindows = hs.window.allWindows()
local windows = {}
local index = 1
for i = 1, #allWindows do
local w = allWindows[i]
if w:screen() then
windows[index] = w
index = index + 1
end
end
return windows
end
-- Launch application or toggle it
function launchToggleApplication(applicationName)
local app = hs.application.find(applicationName)
if app then
local appWindows = app:visibleWindows()
if #appWindows > 0 then
local focusedWindow = app:focusedWindow()
if focusedWindow then
if app:isHidden() then
app:unhide()
else
HideApplicationWithAppleScript(app)
end
else
ShowApplicationWithAppleScript(app)
end
else
app:activate()
end
else
hs.application.launchOrFocus(applicationName)
end
end
-- Hide application with AppleScript
function HideApplicationWithAppleScript(app)
local appName = app:name()
local hideScript = [[
tell application "Finder"
set visible of process "%s" to false
end tell
]]
local formattedScript = string.format(hideScript, appName)
hs.osascript.applescript(formattedScript)
end
-- Show application with AppleScript
function ShowApplicationWithAppleScript(app)
local appName = app:name()
local showScript = [[
tell application "Finder"
set visible of process "%s" to true
end tell
]]
local formattedScript = string.format(showScript, appName)
hs.osascript.applescript(formattedScript)
end
function Yabai(commands)
for _, cmd in ipairs(commands) do
os.execute("/opt/homebrew/bin/yabai -m " .. cmd)
end
end
-- Auto Reload Config
function ReloadConfig(files)
DoReload = false
for _, file in pairs(files) do
if file:sub(-4) == ".lua" then
DoReload = true
end
end
if DoReload then
hs.reload()
end
end
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", ReloadConfig):start()
hs.alert.show("Hammerspoon")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

275
darwin/hammerspoon/init.lua Normal file
View File

@@ -0,0 +1,275 @@
require("functions")
require("caffeine")
rawset(_G, "hs", hs or {})
local application = hs.application
local window = hs.window
local layout = hs.layout
local screen = hs.screen
local hotkey = hs.hotkey
local hints = hs.hints
-------------------
-- Configuration --
-------------------
-- Animation
window.animationDuration = 0
-- Hints
hints.fontName = "Helvetica-Bold"
hints.fontSize = 18
hints.showTitleThresh = 0
hints.style = "vimperator"
-- Allow searching for alternate names
application.enableSpotlightForNameSearches(true)
------------
-- Aliases --
------------
-- Keys
local KEY_HYPER = { "", "", "", "" }
local KEY_A = { "" }
local KEY_AM = { "", "" }
local KEY_CA = { "", "" }
local KEY_CAM = { "", "", "" }
local KEY_CM = { "", "" }
local KEY_SA = { "", "" }
local KEY_SAM = { "", "", "" }
local KEY_SC = { "", "" }
local KEY_SCA = { "", "", "" }
local KEY_SCM = { "", "", "" }
-- Displays
local DISPLAY_PRIMARY = screen.primaryScreen()
local DISPLAY_NOTEBOOK = "Color LCD"
-- Sizes
local LEFT_MOST = hs.geometry.unitrect(0, 0, 0.6, 1)
local LEFT_LESS = hs.geometry.unitrect(0, 0, 0.4, 1)
local RIGHT_MOST = hs.geometry.unitrect(0.4, 0, 0.6, 1)
local RIGHT_LESS = hs.geometry.unitrect(0.6, 0, 0.4, 1)
local FULLSCREEN = hs.geometry.unitrect(0, 0, 1, 1)
local RIGHT_HALF = hs.geometry.unitrect(0.5, 0, 0.5, 1)
local LEFT_HALF = hs.geometry.unitrect(0, 0, 0.5, 1)
-------------
-- Layouts --
-------------
-- Format reminder:
-- {"App name", "Window name", "Display Name", "unitrect", "framerect", "fullframerect"},
-- One Monitor and Notebook
local LAYOUT_DUAL = {
{ "Brave Browser", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Calendar", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Code", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "DEVONthink 3", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Element", nil, DISPLAY_NOTEBOOK, RIGHT_HALF, nil, nil },
{ "Firefox Developer Edition", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Mail", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Messages", nil, DISPLAY_PRIMARY, RIGHT_HALF, nil, nil },
{ "Microsoft Outlook", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Music", nil, DISPLAY_NOTEBOOK, FULLSCREEN, nil, nil },
{ "Obsidian", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Slack", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Sonos", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Telegram", nil, DISPLAY_PRIMARY, LEFT_HALF, nil, nil },
{ "Things", nil, DISPLAY_NOTEBOOK, FULLSCREEN, nil, nil },
{ "iA Writer", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "kitty", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
}
-- One Monitor
local LAYOUT_SINGLE = {
{ "Brave Browser", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Calendar", nil, DISPLAY_PRIMARY, LEFT_MOST, nil, nil },
{ "Code", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "DEVONthink 3", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Element", nil, DISPLAY_PRIMARY, RIGHT_HALF, nil, nil },
{ "Firefox Developer Edition", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Mail", nil, DISPLAY_PRIMARY, RIGHT_MOST, nil, nil },
{ "Messages", nil, DISPLAY_PRIMARY, RIGHT_LESS, nil, nil },
{ "Microsoft Outlook", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Music", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Obsidian", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Slack", nil, DISPLAY_PRIMARY, LEFT_MOST, nil, nil },
{ "Sonos", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "Telegram", nil, DISPLAY_PRIMARY, LEFT_MOST, nil, nil },
{ "Things", nil, DISPLAY_PRIMARY, RIGHT_LESS, nil, nil },
{ "iA Writer", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
{ "kitty", nil, DISPLAY_PRIMARY, FULLSCREEN, nil, nil },
}
------------------
-- Key Bindings --
------------------
-- stylua: ignore start
-- Movement hotkeys
-- hotkey.bind(KEY_AM, "down", function() Nudge(0, 100) end)
-- hotkey.bind(KEY_AM, "up", function() Nudge(0, -100) end)
-- hotkey.bind(KEY_AM, "right", function() Nudge(100, 0) end)
-- hotkey.bind(KEY_AM, "left", function() Nudge(-100, 0) end)
-- Resize hotkeys
-- hotkey.bind(KEY_SAM, "up", function() Yank(0, -100) end)
-- hotkey.bind(KEY_SAM, "down", function() Yank(0, 100) end)
-- hotkey.bind(KEY_SAM, "right", function() Yank(100, 0) end)
-- hotkey.bind(KEY_SAM, "left", function() Yank(-100, 0) end)
-- Push to screen edge
-- hotkey.bind(KEY_CAM, "left", function() Push(0, 0, 0.5, 1) end)
-- hotkey.bind(KEY_CAM, "right", function() Push(0.5, 0, 0.5, 1) end)
-- hotkey.bind(KEY_CAM, "up", function() Push(0, 0, 1, 0.5) end)
-- hotkey.bind(KEY_CAM, "down", function() Push(0, 0.5, 1, 0.5) end)
-- Focus
hotkey.bind(KEY_AM, 'k', function() window.focusedWindow():focusWindowNorth() end)
hotkey.bind(KEY_AM, 'j', function() window.focusedWindow():focusWindowSouth() end)
hotkey.bind(KEY_AM, 'l', function() window.focusedWindow():focusWindowEast() end)
hotkey.bind(KEY_AM, 'h', function() window.focusedWindow():focusWindowWest() end)
-- Centered window with some room to see the desktop
-- hotkey.bind(KEY_SCM, "l", function() Push(0.05, 0.05, 0.9, 0.9) end)
-- hotkey.bind(KEY_SCM, "m", function() Push(0.1, 0.1, 0.8, 0.8) end)
-- hotkey.bind(KEY_SCM, "s", function() Push(0.15, 0.15, 0.7, 0.7) end)
-- Fullscreen
-- hotkey.bind(KEY_CAM, "0", function() Push(0, 0, 1, 1) end)
-- Quarter Screens
-- hotkey.bind(KEY_CAM, "q", function() Push(0, 0, 0.5, 0.5) end)
-- hotkey.bind(KEY_CAM, "w", function() Push(0.5, 0, 0.5, 0.5) end)
-- hotkey.bind(KEY_CAM, "a", function() Push(0, 0.5, 0.5, 0.5) end)
-- hotkey.bind(KEY_CAM, "s", function() Push(0.5, 0.5, 0.5, 0.5) end)
-- Part Screens
-- hotkey.bind(KEY_CAM, "4", function() Push(0, 0, 0.6, 1) end)
-- hotkey.bind(KEY_CAM, "5", function() Push(0, 0, 0.4, 1) end)
-- hotkey.bind(KEY_CAM, "6", function() Push(0.4, 0, 0.6, 1) end)
-- hotkey.bind(KEY_CAM, "7", function() Push(0.6, 0, 0.4, 1) end)
-- Move a window between monitors (preserve size)
-- hotkey.bind(KEY_CM, "1", function() window.focusedWindow():moveOneScreenNorth() end)
-- hotkey.bind(KEY_CM, "2", function() window.focusedWindow():moveOneScreenSouth() end)
-- hotkey.bind(KEY_CM, "3", function() window.focusedWindow():moveOneScreenWest() end)
-- hotkey.bind(KEY_CM, "down", function() window.focusedWindow():moveOneScreenSouth() end)
-- hotkey.bind(KEY_CM, "h", function() window.focusedWindow():moveOneScreenWest() end)
-- hotkey.bind(KEY_CM, "j", function() window.focusedWindow():moveOneScreenSouth() end)
-- hotkey.bind(KEY_CM, "k", function() window.focusedWindow():moveOneScreenNorth() end)
-- hotkey.bind(KEY_CM, "l", function() window.focusedWindow():moveOneScreenEast() end)
-- hotkey.bind(KEY_CM, "left", function() window.focusedWindow():moveOneScreenWest() end)
-- hotkey.bind(KEY_CM, "right", function() window.focusedWindow():moveOneScreenEast() end)
-- hotkey.bind(KEY_CM, "up", function() window.focusedWindow():moveOneScreenNorth() end)
-- Move a window between monitors (change to fullscreen)
-- hotkey.bind(KEY_SCM, "1", function() window.focusedWindow():moveOneScreenNorth(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "2", function() window.focusedWindow():moveOneScreenSouth(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "3", function() window.focusedWindow():moveOneScreenWest(); window.focusedWindow():moveOneScreenWest(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "up", function() window.focusedWindow():moveOneScreenNorth(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "down", function() window.focusedWindow():moveOneScreenSouth(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "right", function() window.focusedWindow():moveOneScreenEast(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "left", function() window.focusedWindow():moveOneScreenWest(); window.focusedWindow():moveOneScreenWest(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "k", function() window.focusedWindow():moveOneScreenNorth(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "j", function() window.focusedWindow():moveOneScreenSouth(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "l", function() window.focusedWindow():moveOneScreenEast(); push(0, 0, 1, 1) end)
-- hotkey.bind(KEY_SCM, "h", function() window.focusedWindow():moveOneScreenWest(); window.focusedWindow():moveOneScreenWest(); push(0, 0, 1, 1) end)
-- Yabai
-- Focus Window
hotkey.bind(KEY_A, "h", function() Yabai({"window --focus west"}) end)
hotkey.bind(KEY_A, "j", function() Yabai({"window --focus south"}) end)
hotkey.bind(KEY_A, "k", function() Yabai({"window --focus north"}) end)
hotkey.bind(KEY_A, "l", function() Yabai({"window --focus east"}) end)
-- Swap Managed Windows
hotkey.bind(KEY_SA, "h", function() Yabai({"window --swap west"}) end)
hotkey.bind(KEY_SA, "j", function() Yabai({"window --swap south"}) end)
hotkey.bind(KEY_SA, "k", function() Yabai({"window --swap north"}) end)
hotkey.bind(KEY_SA, "l", function() Yabai({"window --swap east"}) end)
-- Move Managed Windows
hotkey.bind(KEY_SCA, "h", function() Yabai({"window --warp west"}) end)
hotkey.bind(KEY_SCA, "j", function() Yabai({"window --warp south"}) end)
hotkey.bind(KEY_SCA, "k", function() Yabai({"window --warp north"}) end)
hotkey.bind(KEY_SCA, "l", function() Yabai({"window --warp east"}) end)
-- Rotate Windows
hotkey.bind(KEY_A, "r", function() Yabai({"space --rotate 90"}) end)
-- Toggle Window Fullscreen Zoom
hotkey.bind(KEY_A, "f", function() Yabai({"window --toggle zoom-fullscreen"}) end)
-- Toggle Padding and Gap
hotkey.bind(KEY_A, "g", function() Yabai({"space --toggle padding", "space --toggle gap"}) end)
-- Float/Unfloat Window
hotkey.bind(KEY_A, "t", function() Yabai({"window --toggle float", "window --grid 7:7:1:1:5:5"}) end)
-- Toggle Window Split Type
hotkey.bind(KEY_A, "e", function() Yabai({"window --toggle split"}) end)
-- Balance Size of Windows
hotkey.bind(KEY_SA, "0", function() Yabai({"space --balance"}) end)
-- Move Window to space
hotkey.bind(KEY_SCA, "1", function() Yabai({"window --space 1"}) end)
hotkey.bind(KEY_SCA, "2", function() Yabai({"window --space 2"}) end)
hotkey.bind(KEY_SCA, "3", function() Yabai({"window --space 3"}) end)
hotkey.bind(KEY_SCA, "4", function() Yabai({"window --space 4"}) end)
hotkey.bind(KEY_SCA, "5", function() Yabai({"window --space 5"}) end)
hotkey.bind(KEY_SCA, "6", function() Yabai({"window --space 6"}) end)
hotkey.bind(KEY_SCA, "7", function() Yabai({"window --space 7"}) end)
hotkey.bind(KEY_SCA, "8", function() Yabai({"window --space 8"}) end)
hotkey.bind(KEY_SCA, "9", function() Yabai({"window --space 9"}) end)
-- Send Window to Monitor
hotkey.bind(KEY_SA, "n", function() Yabai({"window --display next"}) end)
hotkey.bind(KEY_SA, "p", function() Yabai({"window --display prev"}) end)
-- Move Focus to Monitor
hotkey.bind(KEY_SAM, "h", function() Yabai({"display --focus next"}) end)
hotkey.bind(KEY_SAM, "l", function() Yabai({"display --focus prev"}) end)
-- Application shortcuts
-- hotkey.bind(KEY_SC, "r", function() launchToggleApplication("Wezterm") end)
-- hotkey.bind(KEY_SC, "w", function() launchToggleApplication("kitty") end)
-- hotkey.bind(KEY_HYPER, "a", function() launchToggleApplication("Arc") end)
-- hotkey.bind(KEY_HYPER, "b", function() launchToggleApplication("Brave Browser") end)
-- hotkey.bind(KEY_HYPER, "c", function() launchToggleApplication("Visual Studio Code") end)
-- hotkey.bind(KEY_HYPER, "d", function() launchToggleApplication("DEVONthink 3") end)
-- hotkey.bind(KEY_HYPER, "e", function() launchToggleApplication("Eagle") end)
-- hotkey.bind(KEY_HYPER, "f", function() launchToggleApplication("Reeder") end)
-- hotkey.bind(KEY_HYPER, "g", function() launchToggleApplication("Signal") end)
-- hotkey.bind(KEY_HYPER, "i", function() launchToggleApplication("Messages") end)
-- hotkey.bind(KEY_HYPER, "m", function() launchToggleApplication("Mail") end)
-- hotkey.bind(KEY_HYPER, "n", function() launchToggleApplication("MindNode") end)
-- hotkey.bind(KEY_HYPER, "o", function() launchToggleApplication("Obsidian") end)
-- hotkey.bind(KEY_HYPER, "r", function() launchToggleApplication("Raindrop.io") end)
-- hotkey.bind(KEY_HYPER, "s", function() launchToggleApplication("Spotify") end)
-- hotkey.bind(KEY_HYPER, "t", function() launchToggleApplication("Things") end)
-- hotkey.bind(KEY_HYPER, "u", function() launchToggleApplication("Kalender") end)
-- hotkey.bind(KEY_HYPER, "w", function() launchToggleApplication("iA Writer") end)
-- hotkey.bind(KEY_HYPER, "x", function() launchToggleApplication("Microsoft Teams") end)
-- Place red circle around mouse
hotkey.bind(KEY_CAM, "space", MouseHighlight)
-- Hints
hotkey.bind(KEY_HYPER, "space", function() hints.windowHints(GetAllValidWindows()) end)
-- Manual config reloading (from getting started guide):
hotkey.bind(KEY_HYPER, "delete", function() hs.reload() end)
-- Layouts
hotkey.bind(KEY_HYPER, "1", function() layout.apply(LAYOUT_SINGLE) end)
hotkey.bind(KEY_HYPER, "2", function() layout.apply(LAYOUT_DUAL) end)
-- stylua: ignore end

View File

@@ -0,0 +1,31 @@
{
"title": "Caps Lock to Escape, enable Caps Lock when held",
"rules": [
{
"description": "Caps Lock to Escape on single press, Caps Lock on press and hold.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "escape"
}
],
"to_if_held_down": [
{
"key_code": "caps_lock"
}
]
}
]
}
]
}

View File

@@ -0,0 +1 @@
{"title":"Keychron K8 Microphone Button to Microsoft Teams Mute","rules":[{"description":"Focus Microsoft Teams Meeting Manager Window","manipulators":[{"from":{"modifiers":{"mandatory":["fn"]},"key_code":"spacebar"},"conditions":[{"type":"frontmost_application_unless","bundle_identifiers":["com.microsoft.teams"]}],"to":[{"shell_command":"if [ $(ps aux | grep -v grep | grep -ci \"Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper.app\") -gt 0 ]; then osascript -e 'activate application id \"com.microsoft.teams\"' -e 'tell application \"System Events\" to keystroke \"m\" using {command down, shift down}'; fi","lazy":true,"repeat":true}],"type":"basic"}]},{"description":"Change Fn + Spacebar to Shift + Cmd + A","manipulators":[{"type":"basic","from":{"modifiers":{"mandatory":["fn"]},"key_code":"spacebar"},"conditions":[{"type":"frontmost_application_if","bundle_identifiers":["^com\\.microsoft\\.teams$"]}],"to":[{"key_code":"m","modifiers":["left_shift","left_gui"]}]}]}]}

View File

@@ -0,0 +1,181 @@
{
"title": "German Umlaut",
"rules": [
{
"description": "Change option + a/o/u to ä/ö/ü",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "a"
},
{
"key_code": "vk_none"
}
]
},
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"option",
"shift"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "a",
"modifiers": [
"left_shift"
]
},
{
"key_code": "vk_none"
}
]
},
{
"type": "basic",
"from": {
"key_code": "o",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "o"
},
{
"key_code": "vk_none"
}
]
},
{
"type": "basic",
"from": {
"key_code": "o",
"modifiers": {
"mandatory": [
"option",
"shift"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "o",
"modifiers": [
"left_shift"
]
},
{
"key_code": "vk_none"
}
]
},
{
"type": "basic",
"from": {
"key_code": "u",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "u"
},
{
"key_code": "vk_none"
}
]
},
{
"type": "basic",
"from": {
"key_code": "u",
"modifiers": {
"mandatory": [
"option",
"shift"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "u",
"modifiers": [
"left_shift"
]
},
{
"key_code": "vk_none"
}
]
}
]
}
]
}

View File

@@ -0,0 +1,764 @@
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false,
"unsafe_ui": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 1000,
"basic.to_if_held_down_threshold_milliseconds": 500,
"mouse_motion_to_scroll.speed": 100
},
"rules": [
{
"description": "CAPS_LOCK : (Hyper) SHIFT+COMMAND+OPTION+CONTROL or ESCAPE (if alone)",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
],
"to_if_alone": [
{
"key_code": "escape"
}
],
"type": "basic"
},
{
"description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+,",
"from": {
"key_code": "comma",
"modifiers": {
"mandatory": [
"command",
"shift",
"option",
"control"
]
}
},
"to": [],
"type": "basic"
},
{
"description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+.",
"from": {
"key_code": "period",
"modifiers": {
"mandatory": [
"command",
"shift",
"option",
"control"
]
}
},
"to": [],
"type": "basic"
},
{
"from": {
"description": "Avoid starting sysdiagnose with the built-in macOS shortcut cmd+shift+option+ctrl+/",
"key_code": "slash",
"modifiers": {
"mandatory": [
"command",
"shift",
"option",
"control"
]
}
},
"to": [],
"type": "basic"
}
]
},
{
"description": "CAPS_LOCK + i/j/k/l == Arrow Keys",
"manipulators": [
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "semicolon",
"modifiers": {
"mandatory": [
"left_shift",
"left_command",
"left_control",
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_command"
]
}
],
"type": "basic"
}
]
},
{
"description": "F4: Open Raycast",
"manipulators": [
{
"from": {
"key_code": "f4"
},
"to": [
{
"shell_command": "open -a raycast"
}
],
"type": "basic"
}
]
},
{
"description": "Focus Microsoft Teams Meeting Manager Window",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"com.microsoft.teams"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "spacebar",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"lazy": true,
"repeat": true,
"shell_command": "if [ $(ps aux | grep -v grep | grep -ci \"Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper.app\") -gt 0 ]; then osascript -e 'activate application id \"com.microsoft.teams\"' -e 'tell application \"System Events\" to keystroke \"m\" using {command down, shift down}'; fi"
}
],
"type": "basic"
}
]
},
{
"description": "Change Fn + Spacebar to Shift + Cmd + A",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.microsoft\\.teams$"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "spacebar",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"key_code": "m",
"modifiers": [
"left_shift",
"left_gui"
]
}
],
"type": "basic"
}
]
},
{
"description": "Change option + a/o/u to ä/ö/ü",
"manipulators": [
{
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "a"
},
{
"key_code": "vk_none"
}
],
"type": "basic"
},
{
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"option",
"shift"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "a",
"modifiers": [
"left_shift"
]
},
{
"key_code": "vk_none"
}
],
"type": "basic"
},
{
"from": {
"key_code": "o",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "o"
},
{
"key_code": "vk_none"
}
],
"type": "basic"
},
{
"from": {
"key_code": "o",
"modifiers": {
"mandatory": [
"option",
"shift"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "o",
"modifiers": [
"left_shift"
]
},
{
"key_code": "vk_none"
}
],
"type": "basic"
},
{
"from": {
"key_code": "u",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "u"
},
{
"key_code": "vk_none"
}
],
"type": "basic"
},
{
"from": {
"key_code": "u",
"modifiers": {
"mandatory": [
"option",
"shift"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": [
"left_option"
]
},
{
"key_code": "u",
"modifiers": [
"left_shift"
]
},
{
"key_code": "vk_none"
}
],
"type": "basic"
}
]
}
]
},
"devices": [
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 632,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 632,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 620,
"vendor_id": 76
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 617,
"vendor_id": 76
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 34304,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 832,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 832,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 591,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
}
],
"fn_function_keys": [
{
"from": {
"key_code": "f1"
},
"to": [
{
"consumer_key_code": "display_brightness_decrement"
}
]
},
{
"from": {
"key_code": "f2"
},
"to": [
{
"consumer_key_code": "display_brightness_increment"
}
]
},
{
"from": {
"key_code": "f3"
},
"to": [
{
"apple_vendor_keyboard_key_code": "mission_control"
}
]
},
{
"from": {
"key_code": "f4"
},
"to": [
{
"apple_vendor_keyboard_key_code": "launchpad"
}
]
},
{
"from": {
"key_code": "f5"
},
"to": [
{
"key_code": "f5"
}
]
},
{
"from": {
"key_code": "f6"
},
"to": [
{
"key_code": "f6"
}
]
},
{
"from": {
"key_code": "f7"
},
"to": [
{
"consumer_key_code": "rewind"
}
]
},
{
"from": {
"key_code": "f8"
},
"to": [
{
"consumer_key_code": "play_or_pause"
}
]
},
{
"from": {
"key_code": "f9"
},
"to": [
{
"consumer_key_code": "fast_forward"
}
]
},
{
"from": {
"key_code": "f10"
},
"to": [
{
"consumer_key_code": "mute"
}
]
},
{
"from": {
"key_code": "f11"
},
"to": [
{
"consumer_key_code": "volume_decrement"
}
]
},
{
"from": {
"key_code": "f12"
},
"to": [
{
"consumer_key_code": "volume_increment"
}
]
}
],
"name": "Default profile",
"parameters": {
"delay_milliseconds_before_open_device": 1000
},
"selected": true,
"simple_modifications": [
{
"from": {
"key_code": "f3"
},
"to": [
{
"apple_vendor_keyboard_key_code": "mission_control"
}
]
},
{
"from": {
"key_code": "f7"
},
"to": [
{
"consumer_key_code": "rewind"
}
]
},
{
"from": {
"key_code": "f8"
},
"to": [
{
"consumer_key_code": "play_or_pause"
}
]
},
{
"from": {
"key_code": "f9"
},
"to": [
{
"consumer_key_code": "fast_forward"
}
]
}
],
"virtual_hid_keyboard": {
"country_code": 0,
"indicate_sticky_modifier_keys_state": true,
"mouse_key_xy_scale": 100
}
}
]
}