Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sway: i3keys web - Supporting symbol key names starting with a capital letter. #39

Open
junaruga opened this issue Oct 5, 2023 · 3 comments · May be fixed by #40
Open

sway: i3keys web - Supporting symbol key names starting with a capital letter. #39

junaruga opened this issue Oct 5, 2023 · 3 comments · May be fixed by #40

Comments

@junaruga
Copy link

junaruga commented Oct 5, 2023

Hi, thanks for providing and maintaining this nice tool!

My environment

I am using sway on Fedora Linux 38.

$ sway --version
sway version 1.8.1

I am using the i3keys on the current latest master branch 99e368e.

The issue summary

In sway, it's possible to define symbol keys as the name starting with a capital letter first such as Return, Space, Semicolon, Comma, Period, Slash. I can see these keys are not shown as occupied (red color) on the page by the i3keys web.

I don't see the capital letter first names worked in i3 config except "Return". But it's nice if i3keys considers the capital letter first key names.

I am using this sway config.
https://github.com/junaruga/framework-laptop-config/blob/main/home/.config/sway/config

set $mod Mod4
...
bindsym $mod+Return exec $term
...
bindsym $mod+Shift+Semicolon exec $term
...
# KEY_DELETE 111
bindsym $mod+Comma exec "sudo ydotool key 111:1 111:0"
# KEY_INSERT 110
bindsym $mod+Period exec "sudo ydotool key 110:1 110:0"
# KEY_ENTER 28
bindsym $mod+Slash exec "sudo ydotool key 28:1 28:0"
...
bindsym $mod+Semicolon mode "symbol"
bindsym $mod+Shift+Space mode "symbol"

I was able to see the following $mod+minus was shown as occupied.

bindsym $mod+minus scratchpad show

Here is the actual screenshot. You can see these capital letter first keys are not shown as occupied (red).

screenshot-i3keys-sway

@junaruga junaruga changed the title sway: i3keys web - Supproting capital letter first symbol keys. sway: i3keys web - Supproting symbol key names starting with a capital letter. Oct 5, 2023
@elder-n00b
Copy link
Contributor

I confirm. Quick fix is normalizing case in

if symbol == key.Key {

if strings.ToLower(symbol) == strings.ToLower(key.Key)

There may be a better way but this seems to work.

On a side note, key symbols are always capitalized in

p := strings.Title(item)

but /usr/include/X11/keysymdef.h, which is parsed to generate
var KeySyms = map[string]string{
uses inconsistent capitalization.
That should explain why XK_space has the problem but XK_Return does not.

@junaruga junaruga changed the title sway: i3keys web - Supproting symbol key names starting with a capital letter. sway: i3keys web - Supporting symbol key names starting with a capital letter. Oct 6, 2023
@junaruga
Copy link
Author

junaruga commented Oct 6, 2023

I confirm. Quick fix is normalizing case in

if symbol == key.Key {

if strings.ToLower(symbol) == strings.ToLower(key.Key)

There may be a better way but this seems to work.

Thank you for taking a look at this issue, and suggesting the fix!

On a side note, key symbols are always capitalized in

p := strings.Title(item)

but /usr/include/X11/keysymdef.h, which is parsed to generate

var KeySyms = map[string]string{

uses inconsistent capitalization.
That should explain why XK_space has the problem but XK_Return does not.

Oh, I see. Thank you for providing this info. Now I understood why there are inconsistent symbol names in i3 config. It had been a mystery in my mind for a long term.

@junaruga junaruga linked a pull request Oct 16, 2023 that will close this issue
@junaruga
Copy link
Author

I sent the PR #40!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants