Skip to content

Conversation

@stefanpricopie
Copy link

@stefanpricopie stefanpricopie commented Oct 28, 2025

Summary

This PR extends TTY switching support from F1-F4 to F1-F6 for Chromebook keyboards. Previously only Ctrl+Alt+F1-F4 worked; this adds F5-F6 support.

Changes

Added key mappings in the [control+alt] section for both modes:

Non-inverted mode (default behavior - Chrome keys):

  • Maps Chrome keys to TTY switches: back→F1, forward→F2, refresh→F3, zoom→F4, scale→F5, brightnessdown→F6, brightnessup→F7, mute→F8

Inverted mode (-i flag - F-keys as default):

  • Maps F-keys directly to TTY switches: F1→F1, F2→F2, etc.

This ensures Ctrl+Alt+F1-F6 works in both configuration modes. F7-F8 are also mapped but typically unused since Linux defaults to 6 TTYs (they will work if additional TTYs are configured).

Improvements

  • Extended range: F1-F4 → F1-F6 (covers all standard Linux TTYs)
  • Better UX: Can now hold Ctrl+Alt and switch between TTYs fluidly (e.g., 2→3→2) without releasing modifiers. Previously required pressing Ctrl+Alt for each switch.

Use Case

TTY switching is essential for:

  • Troubleshooting graphics or desktop environment issues
  • Accessing recovery consoles when GUI fails
  • Server management on Chromebook hardware
  • Standard Linux workflow expectations

Testing

Tested on Arch Linux + Hyprland with both keyboard configurations. TTY switching now works smoothly for F1-F6 with improved modifier key behavior.

@stefanpricopie stefanpricopie changed the title Add TTY switching support (Ctrl+Alt+F1-F8) Add TTY switching support (Ctrl+Alt+F1-F6) Oct 28, 2025
@stefanpricopie stefanpricopie changed the title Add TTY switching support (Ctrl+Alt+F1-F6) Extend TTY switching support to F5-F6 (Ctrl+Alt+F1-F6) Oct 28, 2025
@WeirdTreeThing
Copy link
Owner

This will not work with all vivaldi keyboards since the keys are not consistently the same. I'd also prefer if this covered all top row keys, even if most setups don't create VTs past 7 or so. FWIW you can already swtich VTs with super + ctrl + alt + (top row key) but it would be easier to do without having to press super.

Enable Ctrl+Alt+F1-F8 TTY switching for both keyboard modes:
- Inverted mode: F-keys map directly to TTY switches
- Non-inverted mode: Chrome keys (back/forward/refresh/etc) map to TTY switches

This allows proper virtual console access on Chromebooks running Linux,
which is essential for troubleshooting, recovery, and server management.
- Add get_tty_switching() function to generate mappings based on physmap
- Remove hardcoded key mappings (brightnessdown, brightnessup, mute)
- Support all top row keys dynamically (10-12 keys vs previous 8)
- Ensure compatibility with all Chromebook vivaldi keyboard layouts
- Works for both inverted and non-inverted keyboard modes
@stefanpricopie
Copy link
Author

Thanks for the feedback! I've refactored the implementation:

Changes:

  • Added get_tty_switching(physmap) function to dynamically generate mappings based on actual keyboard layout
  • Removed hardcoded keys (brightnessdown, brightnessup, mute) - now loops through entire physmap
  • Covers all top row keys (10-12 keys vs previous 8)
  • Works with both inverted and non-inverted modes

@WeirdTreeThing
Copy link
Owner

Can you send an example of the output with this change?

@stefanpricopie
Copy link
Author

Sure! Here's the generated output from my Chromebook (10-key top row):

Physmap: EA E9 E7 91 92 94 95 A0 AE B0

Generated TTY switching section:

[control+alt]
backspace = C-A-delete
f1 = C-A-f1
f2 = C-A-f2
f3 = C-A-f3
f4 = C-A-f4
f5 = C-A-f5
f6 = C-A-f6
f7 = C-A-f7
f8 = C-A-f8
f9 = C-A-f9
f10 = C-A-f10
back = C-A-f1
forward = C-A-f2
refresh = C-A-f3
zoom = C-A-f4
scale = C-A-f5
brightnessdown = C-A-f6
brightnessup = C-A-f7
mute = C-A-f8
volumedown = C-A-f9
volumeup = C-A-f10

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 this pull request may close these issues.

2 participants