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

Cannot change win and alt keys with Xresources #504

Open
3 tasks
hugorichard opened this issue Nov 11, 2020 · 14 comments · May be fixed by regolith-linux/regolith-i3-gaps-config#33
Open
3 tasks

Cannot change win and alt keys with Xresources #504

hugorichard opened this issue Nov 11, 2020 · 14 comments · May be fixed by regolith-linux/regolith-i3-gaps-config#33
Labels
bug Something isn't working configuration Issue with custom configuration of Regolith verified Problem has been reproduced by Regolith contributor

Comments

@hugorichard
Copy link

Describe the bug
A clear and concise description of what the bug is.
New installation of Regolith
Change alt and key using Xresource as described in
https://regolith-linux.org/docs/getting-started/configuration/
Get i3 config error

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration file(s)
Please attach or mention any customization you've done to configuration files which might have an impact on the bug you are describing. It'll help us determine the root cause of your issue.

Installation Details

  • Regolith Install Type: [ISO/PPA]
  • Regolith Version: [e.g. 1.4]
  • PPA url: [default: ppa:regolith-linux/release]
  • Host OS (for PPA): [e.g. Ubuntu 20.04]

Additional context
Add any other context about the problem here.

@hugorichard hugorichard added bug Something isn't working needs-triage Any bug that requires classification by a contributor labels Nov 11, 2020
@moritzheiber
Copy link
Contributor

I'm sorry, but could you please add a little more detail to this bug report and make sure your issue isn't covered by the documentation? Otherwise I'll be forced to close it.

Thanks!

@moritzheiber moritzheiber added configuration Issue with custom configuration of Regolith and removed bug Something isn't working needs-triage Any bug that requires classification by a contributor labels Nov 11, 2020
@hugorichard
Copy link
Author

hugorichard commented Nov 11, 2020

I am pretty sure this issue is not covered by the documentation.
I recently upgraded from 1.3 to 1.5 by cleaning everything and re-install everything as said in the Reinstallation section of
https://regolith-linux.org/docs/getting-started/install/
Everything seems to work fine. Then I create the file
~/.config/regolith/Xresources
and add the lines

i3-wm.mod: Mod1
i3-wm.alt: Mod4

save and press windows-shift-r to reload the configuration.

I get: "You have an error in your i3 config file!"

When I click on "show error" I get

"ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym space, command "exec rofi -show find -modi find:/usr/share/rofi/modi/finder.sh"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym l, command "focus right"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym Right, command "workspace next"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym Left, command "workspace prev"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym grave, command "exec --no-startup-id /usr/share/i3xrocks/next-workspace --startnum 1 --move-window-and-follow"
ERROR: FYI: You are using i3 version 4.18.2 (2020-07-26)
ERROR: Received ConfigureNotify for unknown window 0x02e00000
ERROR: Received ConfigureNotify for unknown window 0x02e00003
ERROR: Received ExposeEvent for unknown window 0x02e00003
ERROR: Received ConfigureNotify for unknown window 0x02e00003
ERROR: Received ConfigureNotify for unknown window 0x02e00006
ERROR: Received ExposeEvent for unknown window 0x02e00006
ERROR: Received ConfigureNotify for unknown window 0x02e00006
ERROR: Received ConfigureNotify for unknown window 0x02e00009
ERROR: Received ExposeEvent for unknown window 0x02e00009
ERROR: Received ConfigureNotify for unknown window 0x02e00009
ERROR: Received ConfigureNotify for u/run/user/1001/i3/errorlog.3106
"

@kgilmer
Copy link
Member

kgilmer commented Nov 12, 2020

Hi @hugorichard , looks like you've uncovered a new bug. We've expanded upon how keybindings are defined such that in more cases, users can use overrides to change keybindings, rather than a full i3 copy. However some of the defaults in the i3 file conflict if alt and super are swapped.

A general fix will take some time, but for now making your ~/.config/regolith/Xresources file look like this should resolve the errors you have reported:

i3-wm.mod: Mod1
i3-wm.alt: Mod4
i3-wm.binding.file_search: Mod4
i3-wm.binding.ws_next2: Mod4+Right
i3-wm.binding.ws_prev2: Mod4+Left
i3-wm.binding.take_next_free: Mod4+grave
i3-wm.binding.look_selector: Mod4+l

I would appreciate knowing if you apply this fix and it does or does not resolve the issue for you.

@moritzheiber moritzheiber added bug Something isn't working verified Problem has been reproduced by Regolith contributor labels Nov 12, 2020
@hugorichard
Copy link
Author

hugorichard commented Nov 12, 2020

Hi thanks for your answer.
I took a deeper look at it yesterday night and I changed the default i3 config file by replacing alt with $alt and then did
i3-wm.mod: Mod1 i3-wm.alt: Mod4
in the Xresources file.
I think your solution would also work but now that I have changed the default i3 file i cannot try it anymore.

@kgilmer kgilmer added this to To Do in Regolith 1.5.1 Nov 24, 2020
@e4r7hbug
Copy link

e4r7hbug commented Dec 9, 2020

I'm experiencing this issue as well. To help verify the suggested workaround, my ~/.config/regolith/Xresources before:

! ~/.config/regolith/Xresources
i3-wm.alt: Mod4
i3-wm.mod: Mod1

Produces errors that look the same:

ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym space, command "exec rofi -show find -modi find:/usr/share/rofi/modi/finder.sh"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym l, command "focus right"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym Right, command "workspace next"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym Left, command "workspace prev"
ERROR: Duplicate keybinding in config file:
  state mask 0x8 with keysym grave, command "exec --no-startup-id /usr/share/i3xrocks/next-workspace --startnum 1 --move-window-and-follow"
ERROR: FYI: You are using i3 version 4.18.2 (2020-07-26)
/run/user/1000/i3/errorlog.8245 (END)

No more errors after adding the configurations.

  1. Adding the suggested block to ~/.config/regolith/Xresources from Cannot change win and alt keys with Xresources #504 (comment)
    ! ~/.config/regolith/Xresources
    i3-wm.mod: Mod1
    i3-wm.alt: Mod4
    i3-wm.binding.file_search: Mod4
    i3-wm.binding.ws_next2: Mod4+Right
    i3-wm.binding.ws_prev2: Mod4+Left
    i3-wm.binding.take_next_free: Mod4+grave
    i3-wm.binding.look_selector: Mod4+l
    
  2. Logging out
  3. Logging in
  4. No more errors pop up

Thank you for the workaround configuration!

@kgilmer
Copy link
Member

kgilmer commented Dec 9, 2020

FWIW the root of this issue is:
"Variables are directly replaced in the file when parsing. Variables expansion is not recursive so it is not possible to define a variable with a value containing another variable."

The only solution I can see is to pull all references to modifier keys directly into the keybinding expression. The downside of this change is that for those keybindings, the modifier key sequences cannot be overridden by Xresource settings and will need direct edits to the config file. However, I see this as less serious as that limitation is already the case in the sense that Mod/Alt cannot be selectively changed without changing the config file itself. I guess the question becomes, what will occur more often: users wanting to swap alt and super, or users wanting tochange the keybindings for the 5 sequences above that happen to use both alt and super?

kgilmer added a commit to regolith-linux/regolith-i3-gaps-config that referenced this issue Dec 9, 2020
@kgilmer
Copy link
Member

kgilmer commented Dec 26, 2020

Given that this change will result in breaking changes for i3 config customizers, this fix will be moved to the next major version release.

@a-crate
Copy link

a-crate commented Dec 5, 2021

@kgilmer Have you given any thought to dynamically setting the comments above each keybinding so that they're updated for the swap? If it was part of a script (regolith-look swap-mod-keys or regolith-look set-primary-modkey Mod1 something) it could edit comments as well as make the swap easier for users.

@kgilmer
Copy link
Member

kgilmer commented Dec 6, 2021

A script would probably work, but would need to write into the user directory. Another approach is to provide an alternative set of i3 config partials specifically to handle alt as super. Actually, with config partials it may be possible to achieve this by swapping out a single partial. I'll have to experiment but if it works probably the best approach.

@GlenHenshaw
Copy link

I just tried this, and I still get an error even after the suggested modification to Xresources. Specifically, I am getting a single duplicate keybinding:

  state mask 0x8 with keysym space, command "exec rofi -show find -modi find:/usr/share/rofi/modi/finder.sh"

My Xresource file:

i3-wm.mod: Mod1
i3-wm.alt: Mod4
i3-wm.binding.file-search: Mod4
i3-wm.binding.ws_next2: Mod4+Right
i3-wm.binding.ws_prev2: Mod4+Left
i3-wm.binding.take_next_free: Mod4+grave
i3-wm.binding.look_selector: Mod4+l

@kgilmer
Copy link
Member

kgilmer commented Apr 12, 2022

are you on Regolith 2 @GlenHenshaw?

@GlenHenshaw
Copy link

GlenHenshaw commented Apr 12, 2022 via email

@GlenHenshaw
Copy link

GlenHenshaw commented Apr 13, 2022

I'm going to need some help to solve this. I've been trying random key binding combinations for an hour now, and the error message I get back is always exactly the same. Clearly I'm missing something.

@kgilmer
Copy link
Member

kgilmer commented Apr 15, 2022

@GlenHenshaw ,

state mask 0x8 with keysym space, command "exec rofi -show find -modi find:/usr/share/rofi/modi/finder.sh"

The line associated with this error: https://github.com/regolith-linux/regolith-i3-gaps-config/blob/master/config#L124

You're overriding i3-wm.binding.file-search. The keybinding by default is: Mod1+space and you're setting it to just Mod4, making the complete keybinding Mod1+Mod4 which I am not sure is supported by i3. You'll need to set it to something that is not already used and (I think) need ot use a key other than a modifier key. If that doesn't help unravel the problem kindly share your i3 config file.

@kgilmer kgilmer moved this from To do to Done in Regolith 2.0 May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working configuration Issue with custom configuration of Regolith verified Problem has been reproduced by Regolith contributor
Projects
No open projects
6 participants