keyd icon indicating copy to clipboard operation
keyd copied to clipboard

# sign on uk mac keyboards

Open codecowboy opened this issue 3 months ago • 2 comments

On a UK extended Mac keyboard. left option + 3 should produce a '#' but I can't seem to replicate this on linux. Right option + 3 does output a '#'. I've tried a number of different permutations but nothing seems to work. I'm just trying to preserve muscle memory between systems if possible.

Here's what I have at the moment:

# Keyd configuration for UK layout Macintosh extended keyboard on Linux
# Place this file in /etc/keyd/ with a .conf extension (e.g., mac-uk.conf)

[ids]
# You'll need to replace this with your actual keyboard ID
# Run 'sudo keyd monitor' and press a key to find your keyboard's ID
# For now using wildcard - you may want to specify exact ID for your Mac keyboard
*

[aliases]
# Swap the grave/tilde key with the 102nd key (backslash key next to left shift on UK keyboards)
# This keeps the tilde in the same physical position as on Mac
grave = 102nd
102nd = grave

[main]
# Mac Command keys (seen as meta/super by Linux) activate control layer
# This makes Cmd+C/V/X work as Ctrl+C/V/X for copy/paste/cut
leftmeta = layer(control)
rightmeta = layer(control)

# Mac Option keys (seen as alt by Linux) activate special character layers
# Using :A to preserve Alt for undefined keys like tab
leftalt = layer(alt_uk)
rightalt = layer(altgr)

# Shift keys for UK layout support
leftshift = layer(shift)
rightshift = layer(shift)

[control:C]
# When Command key is held, this layer is active
# The :C modifier means undefined keys get Control added
# So Command+C sends Control+C, Command+V sends Control+V, etc.

[alt_uk:A]
# UK Mac keyboard special characters with left Option (Alt) key
# The :A means undefined keys still get Alt (for things like Alt-Tab)
# But explicitly defined keys send exactly what we specify

# Number row with option key (UK Mac layout)
1 = ¡
2 = €
3 = #
4 = ¢
5 = ∞
6 = §
7 = ¶
8 = •
9 = ª
0 = º

# Top row letters with option
q = œ
w = ∑
e = ®
r = ¥
t = †
y = ¨
u = ü
i = ˆ
o = ø
p = π

# Middle row letters with option
a = å
s = ß
d = ∂
f = ƒ
g = ©
h = ˙
j = ∆
k = ˚
l = ¬

# Bottom row letters with option
z = Ω
x = ≈
c = ç
v = √
b = ∫
n = ñ
m = µ

# Special characters
minus = –      # en dash
equal = ≠
leftbrace = "
rightbrace = '
semicolon = …
apostrophe = æ
backslash = «
comma = ≤
dot = ≥
slash = ÷

# The physical key that's grave on US keyboards (now swapped to 102nd position)
102nd = §      # Option + physical tilde key = section sign (Mac UK behavior)

# Tab is not defined, so it will get Alt modifier from :A
# This preserves Alt-Tab for app switching

[altgr:G]
# Right option key behavior (if different from left option)
# On Mac UK keyboards, right option often behaves the same as left option

[shift:S]
# UK keyboard shift layer adjustments
2 = "          # quotation mark instead of @
apostrophe = @
3 = £          # pound sign with shift+3

# After the swap, these refer to the physical positions:
grave = ~      # The key next to left shift (after swap) with shift gives tilde
102nd = ¬      # The key left of 1 (after swap) with shift gives not sign

[shift+alt_uk]
# Shift + Option combinations for UK Mac layout
# This composite layer handles when both shift and option are pressed

3 = ‹          # shift+option+3
4 = ›
5 = fi
6 = fl
7 = ‡
8 = °
9 = ·
0 = ‚

# Add more shift+option combinations as needed
a = Å
s = Í
d = Î
f = Ï
g = ˝
o = Ø

[global]
# Optional global settings
chord_timeout = 50
oneshot_timeout = 0

codecowboy avatar Sep 01 '25 18:09 codecowboy

If right option+3 produces the symbol you want, I'd wager that 3 = G-3 in the alt_uk layer will do what you want.

As for why the backslash for # doesn't work, I assume that the keycode corresponding to backslash isn't actually the one that produces the keysym # in the UK layout (but I am currently unencumbered by knowledge on the UK layout :P). Have you checked (maybe using keyd monitor with a keyboard that has that key) that it is?

On September 1, 2025 8:50:46 PM GMT+02:00, Luke Mackenzie @.***> wrote:

codecowboy created an issue (rvaiya/keyd#1094)

On a UK extended Mac keyboard. left option + 3 should produce a '#' but I can't seem to replicate this on linux. Right option + 3 does output a '#'. I've tried a number of different permutations but nothing seems to work. I'm just trying to preserve muscle memory between systems if possible.

Here's what I have at the moment:

# Keyd configuration for UK layout Macintosh extended keyboard on Linux
# Place this file in /etc/keyd/ with a .conf extension (e.g., mac-uk.conf)

[ids]
# You'll need to replace this with your actual keyboard ID
# Run 'sudo keyd monitor' and press a key to find your keyboard's ID
# For now using wildcard - you may want to specify exact ID for your Mac keyboard
*

[aliases]
# Swap the grave/tilde key with the 102nd key (backslash key next to left shift on UK keyboards)
# This keeps the tilde in the same physical position as on Mac
grave = 102nd
102nd = grave

[main]
# Mac Command keys (seen as meta/super by Linux) activate control layer
# This makes Cmd+C/V/X work as Ctrl+C/V/X for copy/paste/cut
leftmeta = layer(control)
rightmeta = layer(control)

# Mac Option keys (seen as alt by Linux) activate special character layers
# Using :A to preserve Alt for undefined keys like tab
leftalt = layer(alt_uk)
rightalt = layer(altgr)

# Shift keys for UK layout support
leftshift = layer(shift)
rightshift = layer(shift)

[control:C]
# When Command key is held, this layer is active
# The :C modifier means undefined keys get Control added
# So Command+C sends Control+C, Command+V sends Control+V, etc.

[alt_uk:A]
# UK Mac keyboard special characters with left Option (Alt) key
# The :A means undefined keys still get Alt (for things like Alt-Tab)
# But explicitly defined keys send exactly what we specify

# Number row with option key (UK Mac layout)
1 = ¡
2 = €
3 = backslash    # On UK PC layout, backslash key produces # (and ~ with shift)
4 = ¢
5 = ∞
6 = §
7 = ¶
8 = •
9 = ª
0 = º

# Top row letters with option
q = œ
w = ∑
e = ®
r = ¥
t = †
y = ¨
u = ü
i = ˆ
o = ø
p = π

# Middle row letters with option
a = å
s = ß
d = ∂
f = ƒ
g = ©
h = ˙
j = ∆
k = ˚
l = ¬

# Bottom row letters with option
z = Ω
x = ≈
c = ç
v = √
b = ∫
n = ñ
m = µ

# Special characters
minus = –      # en dash
equal = ≠
leftbrace = "
rightbrace = '
semicolon = …
apostrophe = æ
backslash = «
comma = ≤
dot = ≥
slash = ÷

# The physical key that's grave on US keyboards (now swapped to 102nd position)
102nd = §      # Option + physical tilde key = section sign (Mac UK behavior)

# Tab is not defined, so it will get Alt modifier from :A
# This preserves Alt-Tab for app switching

[altgr:G]
# Right option key behavior (if different from left option)
# On Mac UK keyboards, right option often behaves the same as left option

[shift:S]
# UK keyboard shift layer adjustments
2 = "          # quotation mark instead of @
apostrophe = @
3 = £          # pound sign with shift+3

# After the swap, these refer to the physical positions:
grave = ~      # The key next to left shift (after swap) with shift gives tilde
102nd = ¬      # The key left of 1 (after swap) with shift gives not sign

[shift+alt_uk]
# Shift + Option combinations for UK Mac layout
# This composite layer handles when both shift and option are pressed

3 = ‹          # shift+option+3
4 = ›
5 = fi
6 = fl
7 = ‡
8 = °
9 = ·
0 = ‚

# Add more shift+option combinations as needed
a = Å
s = Í
d = Î
f = Ï
g = ˝
o = Ø

[global]
# Optional global settings
chord_timeout = 50
oneshot_timeout = 0

-- Reply to this email directly or view it on GitHub: https://github.com/rvaiya/keyd/issues/1094 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

nsbgn avatar Sep 01 '25 19:09 nsbgn

@nsbgn thanks! that worked. I guess I'll need to do it for the other symbols on the numbers row as at the moment they are outputting characters like 00x, 5pa. I got claude to write the config as the man page didn't make a whole lot of sense to me but I've now got something that mostly works. Thanks again!

Edit - I believe I may have a missing compose file. That wasn't created when I installed from source.

codecowboy avatar Sep 02 '25 10:09 codecowboy