Fixed a bug in the Kanata keyboard layout
This commit is contained in:
parent
590bc6f567
commit
d3065fb559
2 changed files with 74 additions and 69 deletions
139
hammerspoon.org
139
hammerspoon.org
|
|
@ -2,7 +2,7 @@
|
||||||
#+author: Howard X. Abrams
|
#+author: Howard X. Abrams
|
||||||
#+date: 2025-11-24
|
#+date: 2025-11-24
|
||||||
#+filetags: emacs hamacs
|
#+filetags: emacs hamacs
|
||||||
#+lastmod: [2026-02-04 Wed]
|
#+lastmod: [2026-06-15 Mon]
|
||||||
|
|
||||||
A literate programming file for configuring Hammerspoon.
|
A literate programming file for configuring Hammerspoon.
|
||||||
|
|
||||||
|
|
@ -21,69 +21,65 @@ I’ve created left and right ~Meh~ keys on my Moonlanders:
|
||||||
|
|
||||||
To create special key bindings, I can:
|
To create special key bindings, I can:
|
||||||
#+BEGIN_SRC lua
|
#+BEGIN_SRC lua
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
-- Launcher replaces iCanHazShortcuts
|
-- Launcher replaces iCanHazShortcuts
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "T", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "T", function()
|
||||||
hs.application.launchOrFocus("iTerm")
|
hs.application.launchOrFocus("iTerm")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "S", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "S", function()
|
||||||
hs.application.launchOrFocus("Slack")
|
hs.application.launchOrFocus("Slack")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "W", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "F", function()
|
||||||
hs.application.launchOrFocus("Spotify")
|
hs.application.launchOrFocus("Safari")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "F", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "C", function()
|
||||||
hs.application.launchOrFocus("Firefox")
|
-- hs.osascript.applescriptFromFile("~/bin/chrome.scr")
|
||||||
end)
|
hs.execute("~/bin/chrome.scr")
|
||||||
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "C", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "B", function()
|
||||||
-- hs.osascript.applescriptFromFile("~/bin/chrome.scr")
|
hs.application.launchOrFocus("Microsoft Outlook")
|
||||||
hs.execute("~/bin/chrome.scr")
|
end)
|
||||||
end)
|
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "B", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "Z", function()
|
||||||
hs.application.launchOrFocus("Microsoft Outlook")
|
hs.application.launchOrFocus("zoom.us")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "Z", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "Q", function()
|
||||||
hs.application.launchOrFocus("zoom.us")
|
hs.application.launchOrFocus("KeepassXC")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "A", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "W", function()
|
||||||
hs.application.launchOrFocus("Cursor")
|
hs.application.launchOrFocus("VLC")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "Q", function()
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "E", function()
|
||||||
hs.application.launchOrFocus("KeepassXC")
|
hs.execute("FOR_WORK=yes open -a /Applications/Emacs.app")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "E", function()
|
-- Special Emacs Guys
|
||||||
hs.execute("FOR_WORK=yes open -a /Applications/Emacs.app")
|
-- Right Meh key:
|
||||||
end)
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "X", function()
|
||||||
|
hs.execute("~/bin/emacs-capture")
|
||||||
|
end)
|
||||||
|
|
||||||
-- Special Emacs Guys
|
-- Left Meh key:
|
||||||
-- Right Meh key:
|
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "X", function()
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "X", function()
|
hs.execute("~/bin/emacs-capture-clock")
|
||||||
hs.execute("~/bin/emacs-capture")
|
end)
|
||||||
end)
|
|
||||||
|
|
||||||
-- Left Meh key:
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "M", function()
|
||||||
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "X", function()
|
hs.execute("~/bin/emacs-capture-meeting")
|
||||||
hs.execute("~/bin/emacs-capture-clock")
|
end)
|
||||||
end)
|
|
||||||
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "M", function()
|
-- Current music system is actually in Emacs:
|
||||||
hs.execute("~/bin/emacs-capture-meeting")
|
hs.hotkey.bind({"alt", "ctrl", "shift"}, "R", function()
|
||||||
end)
|
hs.execute("/opt/homebrew/bin/emacsclient -s work -e '(ready-player-toggle-play-stop)'")
|
||||||
|
end)
|
||||||
-- Current music system is actually in Emacs:
|
|
||||||
hs.hotkey.bind({"alt", "ctrl", "shift"}, "R", function()
|
|
||||||
hs.execute("/opt/homebrew/bin/emacsclient -s work -e '(ready-player-toggle-play-stop)'")
|
|
||||||
end)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Zoom
|
* Zoom
|
||||||
Library extensions to Hammerspoon are called /spoons/, and most of these are a simple Lua script, =init.lua= stored in the =Spoons= subdirectory. We grab these with a =git clone=, typically. To use the Zoom spoon, clone it:
|
Library extensions to Hammerspoon are called /spoons/, and most of these are a simple Lua script, =init.lua= stored in the =Spoons= subdirectory. We grab these with a =git clone=, typically. To use the Zoom spoon, clone it:
|
||||||
|
|
@ -213,26 +209,35 @@ My company gave me a nice monitor … maybe a little too nice, as I don’t care
|
||||||
-- Centering a window on the large monitors at Work:
|
-- Centering a window on the large monitors at Work:
|
||||||
|
|
||||||
function centerWindow()
|
function centerWindow()
|
||||||
local win = hs.window.focusedWindow()
|
local win = hs.window.focusedWindow()
|
||||||
local app = win:application()
|
if not win then return end -- Safety check in case no window is focused
|
||||||
local f = win:frame()
|
|
||||||
|
|
||||||
-- Magic numbers figured out by trial and error:
|
local app = win:application()
|
||||||
f.x = 600
|
local screen = hs.screen.find("DELL P3424WE")
|
||||||
f.y = 30
|
local maxBounds = screen:frame() -- This gets the absolute coordinates of that specific monitor
|
||||||
f.w = 2200
|
|
||||||
f.h = 1470
|
|
||||||
|
|
||||||
if app then
|
-- 2. Define your desired size
|
||||||
local name = app:name()
|
local desiredW = 2200
|
||||||
-- If the application is Slack, adjust the height
|
local desiredH = 1470
|
||||||
if name == "Slack" or name == "iTerm2" then
|
|
||||||
f.h = 1200
|
if app then
|
||||||
end
|
local name = app:name()
|
||||||
|
if name == "Slack" or name == "iTerm2" then
|
||||||
|
desiredH = 1200
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
win:setFrame(f)
|
-- 3. Calculate relative position based on the external monitor's bounds
|
||||||
hs.alert.show("Centered Window")
|
-- This centers the window perfectly on the target screen
|
||||||
|
local f = {
|
||||||
|
x = maxBounds.x + ((maxBounds.w - desiredW) / 2),
|
||||||
|
y = maxBounds.y, -- + ((maxBounds.h - desiredH) / 2),
|
||||||
|
w = desiredW,
|
||||||
|
h = desiredH
|
||||||
|
}
|
||||||
|
|
||||||
|
win:setFrame(f)
|
||||||
|
hs.alert.show("Centered Window")
|
||||||
end
|
end
|
||||||
|
|
||||||
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "Y", centerWindow)
|
hs.hotkey.bind({"cmd", "alt", "ctrl", "shift"}, "Y", centerWindow)
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
mn (multi lsft lctl lalt lmet n) mm (multi lsft lctl lalt lmet m) m, (multi lsft lctl lalt lmet ,) m. (multi lsft lctl lalt lmet .) m/ (multi lsft lctl lalt lmet /)
|
mn (multi lsft lctl lalt lmet n) mm (multi lsft lctl lalt lmet m) m, (multi lsft lctl lalt lmet ,) m. (multi lsft lctl lalt lmet .) m/ (multi lsft lctl lalt lmet /)
|
||||||
|
|
||||||
m (tap-hold $tap-time $hold-time m (layer-while-held HYPER))
|
m (tap-hold $tap-time $hold-time m (layer-while-held HYPER))
|
||||||
c (tap-hold $tap-time $hold-time c (layer-while-held MEGA)))
|
v (tap-hold $tap-time $hold-time v (layer-while-held MEGA)))
|
||||||
|
|
||||||
;; The base layer is fairly normal, except we all out aliases defined
|
;; The base layer is fairly normal, except we all out aliases defined
|
||||||
;; above, os the @a is both a `tap-hold' feature as well as a regular
|
;; above, os the @a is both a `tap-hold' feature as well as a regular
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
` 1 2 3 4 5 6 7 8 9 0 - = bspc
|
` 1 2 3 4 5 6 7 8 9 0 - = bspc
|
||||||
tab q w e r t y u i o p [ ] \
|
tab q w e r t y u i o p [ ] \
|
||||||
@caps @a @s @d @f @g @h @j @k @l @; ' ret
|
@caps @a @s @d @f @g @h @j @k @l @; ' ret
|
||||||
lsft z x @c v b n @m , . / rsft
|
lsft z x c @v b n @m , . / rsft
|
||||||
@h lctl lalt lmet spc rmet ralt)
|
@h lctl lalt lmet spc rmet ralt)
|
||||||
|
|
||||||
;; The other layer is our `symbols' which allows me to hold down the
|
;; The other layer is our `symbols' which allows me to hold down the
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue