yusefnapora / pixelbook-linux

262 stars 50 forks source link

Keyboard shortcuts in 19.10 #30

Closed ranalabs closed 4 years ago

ranalabs commented 5 years ago

I upgraded from 19.04 to 19.10 and the only thing to break was the custom eve keyboard layout. I couldn't get it to work again - *edit: see latest post below for fix.

flantel commented 5 years ago

I was actually considering trying an upgrade to 19.10 as your post came in! Did you re-run the pixelbook-linux install after the upgrade, or was that no necessary?

ranalabs commented 5 years ago

The upgrade for me was painless - no need to run the install script after. This is the only issue I've had to address.

After posting this I realized the xmodmap doesn't survive a reboot. Perhaps others here have a suggestion for how to fix that? Or a better way to map the brightness keys?

flantel commented 5 years ago

You can create an ~/.xmodmaprc with these settings, or a shell script and set it to autostart on login

flantel commented 5 years ago

Just a follow-up. I upgraded. No issue, as you report!

On the keyboard mappings, The .xmodmaprc, .Xmodmap etc did not work for me. What did work was creating a shell script like ~/bin/xmodmap.sh :

#!/bin/bash
xmodmap -e "keycode 133 = Super_R"
xmodmap -e "keycode 134 = Super_L"

...and then a startupfile in .config/autostart/xmodmap.desktop:

[Desktop Entry]
Name=Xmodmap
Comment=xmodmap
Exec=~/bin/xmodmap.sh
Icon=application-default-icon
X-GNOME-Autostart-enabled=true
Type=Application

Log out and back in.

I am thinking I wouldn't mind remapping all the Function keys to match their labels, and use Ctrl-Fx for the actual function keys. Anybody have a readymade mapping file for those?

ranalabs commented 5 years ago

Yes, that works! Thanks - great solution.

I've been happily using the keyboard shortcuts for each function key - things like play, pause, volume up / down etc all work with a quick tweak in Settings. I'm sure there's a better way though!

flantel commented 5 years ago

If you map play, pause, etc then you lose the F1..F12 keys. I want them mapped to Ctrl-F1 .. Ctrl-F12

flantel commented 5 years ago

That wasn't so hard after all. The following keymaps create the correct function for the pixelbook top keys, while shift- or ctrl- gives you the Fx keys.

keycode  67 = XF86Back F1 F1 F1 F1 F1 XF86Switch_VT_1 F1 F1 XF86Switch_VT_1
keycode  68 = F5 F2 F2 F2 F2 F2 XF86Switch_VT_2 F2 F2 XF86Switch_VT_2
keycode  69 = F11 F3 F3 F3 F3 F3 XF86Switch_VT_3 F3 F3 XF86Switch_VT_3
keycode  70 = Print F4 F4 F4 F4 F4 XF86Switch_VT_4 F4 F4 XF86Switch_VT_4
keycode  71 = XF86MonBrightnessDown F5 F5 F5 F5 F5 XF86Switch_VT_5 F5 F5 XF86Switch_VT_5
keycode  72 = XF86MonBrightnessUp F6 F6 F6 F6 F6 XF86Switch_VT_6 F6 F6 XF86Switch_VT_6
keycode  73 = Pause F7 F7 F7 F7 F7 XF86Switch_VT_7 F7 F7 XF86Switch_VT_7
keycode  74 = XF86AudioMute F8 F8 F8 F8 F8 XF86Switch_VT_8 F8 F8 XF86Switch_VT_8
keycode  75 = XF86AudioLowerVolume F9 F9 F9 F9 F9 XF86Switch_VT_9 F9 F9 XF86Switch_VT_9
keycode  76 = XF86AudioRaiseVolume F10 F10 F10 F10 F10 XF86Switch_VT_10 F10 F10 XF86Switch_VT_10
keycode  95 = F11 F11 F11 F11 F11 F11 XF86Switch_VT_11 F11 F11 XF86Switch_VT_11
keycode  96 = F12 F12 F12 F12 F12 F12 XF86Switch_VT_12 F12 F12 XF86Switch_VT_12

Note: I use the "overview" key as PrintScr so I can map it to screen capture as I already have the CrOS Search key set to overview.

ranalabs commented 5 years ago

This is excellent - many thanks for sharing, it works perfectly. And funny enough, I was using that same key for print screen.

flantel commented 5 years ago

This is close now to a perfect laptop for me. Once sound is supported on a mainline kernel we'll be golden!

omfgnuts commented 5 years ago

This is close now to a perfect laptop for me. Once sound is supported on a mainline kernel we'll be golden!

You think sound support will come to mainline kernel after all? Any hints on it actually happening in the foreseeable future?

flantel commented 5 years ago

You think sound support will come to mainline kernel after all? Any hints on it actually happening in the foreseeable future?

I have no idea, apart from the fact that support comes to everything in time!

flantel commented 5 years ago

@ranalabs I have discovered that the xmodmap has two big issues:

  1. It does not work on Wayland
  2. It does not survive a suspend/resume.

Usin the udev hwdb seems to solve both of these. Here is my /lib/udev/hwdb.d/61-eve-keyboard.hwdb file:

# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
#
# Special keyboard mapping for Eve project. The keyboard has extra
# "Assistant" and "Hamburger" keys.
#
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnGoogle:pnEve:pvr*
# KEYBOARD_KEY_5d=controlpanel
 KEYBOARD_KEY_d8=rightmeta
 KEYBOARD_KEY_db=leftmeta
 KEYBOARD_KEY_3b=back
 KEYBOARD_KEY_3c=f5
 KEYBOARD_KEY_3d=f11
 KEYBOARD_KEY_3e=print
 KEYBOARD_KEY_3f=brightnessdown
 KEYBOARD_KEY_40=brightnessup
 KEYBOARD_KEY_41=playpause
 KEYBOARD_KEY_42=mute
 KEYBOARD_KEY_43=volumedown
 KEYBOARD_KEY_44=volumeup
ranalabs commented 5 years ago

I arrived at the same realization. Great to have the eve keyboard layout, thanks. In my case I switch between this eve keyboard and a traditional Spanish layout, but the region selector keyboard layout UI in Settings is borked for some reason. It's quite easy to switch between them with setxkbmap though.