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
#+date: 2025-11-24
#+filetags: emacs hamacs
#+lastmod: [2026-02-04 Wed]
#+lastmod: [2026-06-15 Mon]
A literate programming file for configuring Hammerspoon.
@ -32,12 +32,8 @@ To create special key bindings, I can:
hs.application.launchOrFocus("Slack")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "W", function()
hs.application.launchOrFocus("Spotify")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "F", function()
hs.application.launchOrFocus("Firefox")
hs.application.launchOrFocus("Safari")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "C", function()
@ -53,14 +49,14 @@ To create special key bindings, I can:
hs.application.launchOrFocus("zoom.us")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "A", function()
hs.application.launchOrFocus("Cursor")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "Q", function()
hs.application.launchOrFocus("KeepassXC")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "W", function()
hs.application.launchOrFocus("VLC")
end)
hs.hotkey.bind({"alt", "ctrl", "shift"}, "E", function()
hs.execute("FOR_WORK=yes open -a /Applications/Emacs.app")
end)
@ -214,23 +210,32 @@ My company gave me a nice monitor … maybe a little too nice, as I dont care
function centerWindow()
local win = hs.window.focusedWindow()
local app = win:application()
local f = win:frame()
if not win then return end -- Safety check in case no window is focused
-- Magic numbers figured out by trial and error:
f.x = 600
f.y = 30
f.w = 2200
f.h = 1470
local app = win:application()
local screen = hs.screen.find("DELL P3424WE")
local maxBounds = screen:frame() -- This gets the absolute coordinates of that specific monitor
-- 2. Define your desired size
local desiredW = 2200
local desiredH = 1470
if app then
local name = app:name()
-- If the application is Slack, adjust the height
if name == "Slack" or name == "iTerm2" then
f.h = 1200
desiredH = 1200
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)
hs.alert.show("Centered Window")
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 /)
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
;; 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
tab q w e r t y u i o p [ ] \
@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)
;; The other layer is our `symbols' which allows me to hold down the