Skip to content

Commit 9933463

Browse files
committed
Octopus Merge PRs: rbreaves#661, rbreaves#724, rbreaves#732, rbreaves#744, & rbreaves#867 from, respectively: RedBear/patch-46 (via donaldguy/661-on-forced-master), RedBear/patch-40 (via donaldguy/harmonize-724-and-719), RedBearAK/patch-59, RedBearAK/mac_numpad_feature (via donaldguy/harmonize-744-and-724) & RedBearAK/patch-70
w/ menu order of OptSpecialChars, then Mac Numpad, then Media Arrows Fix & kinto.ahk logic blocks in that same order. (Grand)parents are: - @^1 rbreaves/master@{2025-04-25 19:00} [= @^2^1 = @^3~4 = @^4~2 = @^5~3] (bed5f37~..4a3bfe7) - @^2^2 rbreaves#661: [Win] Enable Cmd+Grave (backtick) same application window switching (3799224~..66ccab5) - @^2 ^^ fixed for force push of rbreaves/master on 2022-05-14 (95e92b4) - @^3 rbreaves#732: [Win] Enhance OptSpecialChars dead keys processing (2a65285~..dab20fd) - @^4~^2 rbreaves#724: [Win] Optional fix for media arrow keys (new) (e3e912f~..cea4111) - @^4~ ^^ merge with rbreaves#719, choosing arrows fix after OptSpecialChars (3d9670b) - @^4^2 rbreaves#744: Mac Numpad Features (7f3c95e~..d0d0bd1) - @^4 ^^ merge with rbreaves#722+rbreaves#719, chosing numpad between arrows & chars (b0ee59a) - @^5 rbreaves#867: [Win] New Fixes for Finder Mods (2024-06)
5 parents 4a3bfe7 + 95e92b4 + dab20fd + b0ee59a + 044017e commit 9933463

2 files changed

Lines changed: 368 additions & 111 deletions

File tree

linux/kinto.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,63 @@
281281
K("Super-c"): K("LC-c"), # Sigints - interrupt
282282
},"Jetbrains")
283283

284+
#########################################################
285+
########### START OF MAC NUMPAD FEATURE #############
286+
#########################################################
287+
# Force the numpad to always be a numpad, like a Mac keyboard on macOS
288+
# Numlock key becomes "Clear" key for use with calculator (sends Escape)
289+
# Toggle feature on/off with Option+Numlock (Fn+Numlock might work on Apple keyboards)
290+
# Set _mac_numpad var to "False" (no quotes) to disable by default
291+
_mac_numpad = True
292+
293+
def mac_numpad_alert():
294+
"""Show notification of state of Kinto's Mac Numpad feature"""
295+
from subprocess import run
296+
if _mac_numpad:
297+
run('notify-send ALERT \
298+
"Kinto Mac Numpad feature is now ENABLED.\
299+
\rNumlock becomes "Clear" key (Escape)\
300+
\rDisable with Option+Numlock."', shell=True)
301+
print("(DD) Kinto Mac Numpad feature is now ENABLED.", flush=True)
302+
# Don't show pointless alert on startup if feature is set to be disabled by default
303+
if not _mac_numpad:
304+
run('notify-send ALERT \
305+
"Kinto Mac Numpad feature is now DISABLED.\
306+
\rRe-enable with Option+Numlock."', shell=True)
307+
print("(DD) Kinto Mac Numpad feature is now DISABLED.", flush=True)
308+
309+
310+
def toggle_mac_numpad():
311+
"""Toggle the value of the _mac_numpad variable"""
312+
def _toggle_mac_numpad():
313+
global _mac_numpad
314+
_mac_numpad = not _mac_numpad
315+
mac_numpad_alert()
316+
317+
return _toggle_mac_numpad
318+
319+
320+
define_keymap(lambda wm_class: wm_class.casefold() not in remotes,{
321+
C("Alt-Numlock"): toggle_mac_numpad(),
322+
C("Fn-Numlock"): toggle_mac_numpad(),
323+
},"Mac Numpad toggle")
324+
325+
define_keymap(lambda wm_class: wm_class.casefold() not in remotes and _mac_numpad is True,{
326+
C("KP1"): C("1"),
327+
C("KP2"): C("2"),
328+
C("KP3"): C("3"),
329+
C("KP4"): C("4"),
330+
C("KP5"): C("5"),
331+
C("KP6"): C("6"),
332+
C("KP7"): C("7"),
333+
C("KP8"): C("8"),
334+
C("KP9"): C("9"),
335+
C("KP0"): C("0"),
336+
C("KPDot"): C("Dot"),
337+
C("Numlock"): C("Esc"),
338+
},"Mac Numpad")
339+
340+
284341
##############################################
285342
### START OF FILE MANAGER GROUP OF KEYMAPS ###
286343
##############################################

0 commit comments

Comments
 (0)