Fixed a bug in the Kanata keyboard layout

This commit is contained in:
Howard Abrams 2026-06-15 14:53:34 -07:00
parent 590bc6f567
commit d3065fb559
2 changed files with 74 additions and 69 deletions

View file

@ -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.
@ -32,12 +32,8 @@ To create special key bindings, I can:
hs.application.launchOrFocus("Slack") hs.application.launchOrFocus("Slack")
end) end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "W", function()
hs.application.launchOrFocus("Spotify")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "F", function() hs.hotkey.bind({"alt", "ctrl", "shift"}, "F", function()
hs.application.launchOrFocus("Firefox") hs.application.launchOrFocus("Safari")
end) end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "C", function() hs.hotkey.bind({"alt", "ctrl", "shift"}, "C", function()
@ -53,14 +49,14 @@ To create special key bindings, I can:
hs.application.launchOrFocus("zoom.us") hs.application.launchOrFocus("zoom.us")
end) end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "A", function()
hs.application.launchOrFocus("Cursor")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "Q", function() hs.hotkey.bind({"alt", "ctrl", "shift"}, "Q", function()
hs.application.launchOrFocus("KeepassXC") hs.application.launchOrFocus("KeepassXC")
end) end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "W", function()
hs.application.launchOrFocus("VLC")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "E", function() hs.hotkey.bind({"alt", "ctrl", "shift"}, "E", function()
hs.execute("FOR_WORK=yes open -a /Applications/Emacs.app") hs.execute("FOR_WORK=yes open -a /Applications/Emacs.app")
end) end)
@ -214,23 +210,32 @@ My company gave me a nice monitor … maybe a little too nice, as I dont care
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 -- 2. Define your desired size
local desiredW = 2200
local desiredH = 1470
if app then if app then
local name = app:name() local name = app:name()
-- If the application is Slack, adjust the height
if name == "Slack" or name == "iTerm2" then if name == "Slack" or name == "iTerm2" then
f.h = 1200 desiredH = 1200
end end
end end
-- 3. Calculate relative position based on the external monitor's bounds
-- 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) win:setFrame(f)
hs.alert.show("Centered Window") hs.alert.show("Centered Window")
end end

View file

@ -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