startx no keyboard or mouse (exwm)
I know using startx is taboo with nixos. Basically I'm running exwm, and I have to pass some special configuration lines to get Java apps working. The only way I've ever got this working is with using startx.
If I do startx, I get no keyboard and mouse as root or as user. I also tried chmod 777'ing stuff in /dev/input, but to no avail. How can I get startx keyboard + mouse input working?
Here's my working (but w\o user input).xinitrc below...
# Disable access control for the current user.
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager.
wmname LG3D
export _JAVA_AWT_WM_NONREPARENTING=1
# Set default cursor.
xsetroot -cursor_name left_ptr
# Set keyboard repeat rate.
xset r rate 200 60
# Finally start Emacs
exec emacs
Relevant installed packages include:
xorg.xf86inputkeyboard xorg.xf86inputlibinput xorg.xf86inputmouse xorg.xf86inputevdev xorg.xhost wmname
I've tried to do things the nixos way by running the above commands , but for some reason these commands only work when executed through the .xinitrc and startx.
# services.xserver = {
# enable = true;
# layout = "us";
# xkbVariant = "dvp";
# libinput = {
# enable = true;
# };
# desktopManager = {
# default = "emacs";
# session = [ {
# manage = "desktop";
# name = "emacs";
# start = ''
# xhost +SI:localuser:$USER &
# wmname LG3D &
# export _JAVA_AWT_WM_NONREPARENTING=1 &
# xsetroot -cursor_name left_ptr &
# xset r rate 200 60 &
# ${pkgs.emacs}/bin/emacs &
# waitPID=$!
# '';
# } ];
# };
# };
Posted Jan 19, 2020, 5:06 AM UTC
Update 2:
I finally got startx working. I referenced this link https://nixos.wiki/wiki/Using_X_without_a_Display_Manager
I changed to my X setup to:
services.xserver = { enable = true; layout = "us"; xkbVariant = "dvp"; libinput = { enable = true; }; displayManager = { startx.enable = true; }; };
I believe you need to specifically enable startx in the config, otherwise it won't work.
I also prepended my .xinitrc with:
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then eval $(dbus-launch --exit-with-session --sh-syntax) fi systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then dbus-update-activation-environment DISPLAY XAUTHORITY fi
Regardless, everything is fully functional now.