# Virtual console keyboard shortcuts versus desktop environment keyboard shortcuts



## guidok (Jun 12, 2019)

I'm using Mate as my desktop environment (X being started using `startx`). To open the "Run Application" dialog in Mate I press the keyboard shortcut `Alt-F2`. However that switches me to the second virtual console. To get back to my X session (9th virtual console) I need to press `Alt-F9`. When I do that, I do get back my Mate desktop environment and I do see the "Run Application" dialog, but the intermediary switch to the second virtual console is really annoying.

Is there a way to assign a different keyboard shortcut to virtual consoles? Or for the desktop environment keyboard shortcuts to take precedence to the virtual console ones?

Running FreeBSD 12-stable, using the vt(4) console as suggested by section 5.4.3 of the FreeBSD Handbook


----------



## shkhln (Jun 12, 2019)

Switching from X is handled by X server itself. Also it's _alt+shift+f[1-12]_ rather than _alt+f[1-12]_.



guidok said:


> Or for the desktop environment keyboard shortcuts to take precedence to the virtual console ones?



Virtual terminal doesn't (or at least shouldn't) receive any input.


----------



## guidok (Jun 12, 2019)

shkhln said:


> Switching from X is handled by X server itself. Also it's _alt+shift+f[1-12]_ rather than _alt+f[1-12]_.



I've read that too, but in my case `alt+f[1-8]` really does drop me to one of the virtual consoles. Maybe that's due to using vt(4) instead of sc(4)?


----------



## shkhln (Jun 12, 2019)

guidok said:


> in my case `alt+f[1-8]` really does drop me to one of the virtual consoles.



Start X without desktop environment with `X -retro` and see whether it still misbehaves.


----------



## guidok (Jun 13, 2019)

shkhln said:


> Start X without desktop environment with `X -retro` and see whether it still misbehaves.



`X -retro` starts X: grey background with an X as a mouse cursor, though nothing else. However `Alt+F[1-8]` still switches to the virtual consoles. 

`Alt-F1` switches to the virtual console I started X (`X -retro` or `startx`) from. It says (not sure if it is relevant):

```
(II) AIGLX: Suspending AIGLX clients for VT switch
```

Oh, and I'm running with: `kern.evdev.rcpt_mask=12` in sysctl.conf and the xorg-server patched with the xorg-server-udev.patch patch from *Bug 222609* - x11-servers/xorg-server: Add UDEV option to support evdev devices autodetection


----------



## guidok (Jun 13, 2019)

This whole evdev/libinput thing might be the, self inflicted, cause. I think I'll need this patch as well  *Bug 220562*      - [patch] x11-servers/xorg-server: fix terminal initialization in absence of xf86-input-keyboard driver    

Will try that soon, and report back.


----------



## guidok (Jun 17, 2019)

With a regular, unpatched `xorg-server`, the issue goes away. Keyboard combination for switching to a virtual console now is `Ctrl-Alt-F[1-8]` instead of `Alt-F[1-8]`. Downside is that I've lost an out-of-the-box configured and *usable* touchpad. Touchpad tab, for further tweaking, in Mate Mouse Settings is gone too.

Tried the `xf86-input-synaptics` driver with xorg config suggested by the FreeBSD FAQ but that could not detect my Synaptics touchpad. The `moused` solution from the Wiki does work, but requires lots of sysctl tweaking to get something usable (touchpad still doesn't work as comfortably as the out-of-the-box experience provided by the patched evdev/libinput `xorg-server`)

Anyway still I'd like to know if there is a way to assign a different keyboard shortcuts to switching virtual consoles? As it is I'd like to use some of the `Ctrl-Alt-F[1-8]`combinations for my IDE. I guess I could also limit the number of virtual consoles in `/etc/ttys` to free up some of the `Ctrl-Alt-F[1-8]` keyboard shortcuts.


----------



## shkhln (Jun 17, 2019)

Oh, crap. It is indeed _alt_+_ctrl_ rather than _alt_+_shift_. I'm not sure what I was thinking when I typed that.



guidok said:


> Anyway still I'd like to know if there is a way to assign a different keyboard shortcuts to switching virtual consoles?



Probably something like https://unix.stackexchange.com/questions/34158/rebinding-disabling-ctrlaltf and https://forums.freebsd.org/threads/chvt-analog.17695/.


----------



## guidok (Jun 17, 2019)

shkhln said:


> Probably something like https://unix.stackexchange.com/questions/34158/rebinding-disabling-ctrlaltf and https://forums.freebsd.org/threads/chvt-analog.17695/.



Ah, that looks promising. Thank you!


----------



## Phishfry (Jun 17, 2019)

X -retro needs to have a .xinitrc with at least one xterm line


----------

