3

so I got ubuntu installed and figured out the sound issue and a few other problems but when I rotate my screen to the back so the laptop is in tablet mode, the touchpad is still active. Ubuntu disables the keys automatically (I think this happened when I upgraded to 15.10), but it doesn't disable the mousepad. I also don't get an onscreen keyboard when in tablet mode.

I tried looking it up but everything I found was for other laptops (mostly Lenovo and Dell models) and I couldn't understand the acpi stuff well enough to figure out how to get it to work for mine. Does anyone have any suggestions? I know how to manually disable the touchpad and enable the onscreen keyboard from the command line, but I want it to happen automatically when I rotate the screen to the back.

5

Ideally there is an event that we can respond to and have this happen automatically, but it looks like this is still an open issue:
https://bugs.launchpad.net/ubuntu/+source/udev/+bug/1535008
Also see: https://askubuntu.com/a/732830/519324

So I'm going to combine the following answers:

1. Find keyboard & trackpad IDs
Find the IDs for your keyboard/trackpad or what ever you want to disable using the following command. Mine is 12 for keyboard and 13 for Touchpad. Write it down.

xinput list

2. Find your display ID

Run the followiing command to find the connected screen, it's the ID that's followed by "connected". Mine is "eDP1".

xrandr

3. Write tablet mode script

sudo nano /usr/local/bin/tablet-mode.sh

Fill with the following script. Change 12 and 13 to your keyboard/trackpad IDs and change eDP1 to your display ID.

#!/bin/bash
xinput set-int-prop 12 "Device Enabled" 8 0 #Disable Keyboard
xinput set-int-prop 13 "Device Enabled" 8 0 #Disable Pad
xrandr --output eDP1 --rotate inverted #Rotate screen
onboard & #Turn on onscreen keyboard

Give it executable rights:

sudo chmod +x /usr/local/bin/tablet-mode.sh

4. Write laptop mode script

sudo nano /usr/local/bin/laptop-mode.sh

Fill with:

#!/bin/bash
xinput set-int-prop 12 "Device Enabled" 8 1 #Enable Keyboard
xinput set-int-prop 13 "Device Enabled" 8 1 #Enable Pad
xrandr --output eDP1 --rotate normal #Rotate screen back
killall onboard #Turn off onscreen keyboard

Give it executable rights:

sudo chmod +x /usr/local/bin/laptop-mode.sh

5. Create tablet mode icon

sudo nano /usr/share/applications/tablet-mode.desktop

Fill with:

[Desktop Entry]
Type=Application
Terminal=false
Name=Tablet Mode
Icon=/usr/share/icons/Adwaita/32x32/actions/media-playback-stop.png
Exec=/usr/local/bin/tablet-mode.sh

6. Create laptop mode icon

sudo nano /usr/share/applications/laptop-mode.desktop

Fill with:

[Desktop Entry]
Type=Application
Terminal=false
Name=Laptop Mode
Icon=/usr/share/icons/Adwaita/32x32/actions/media-playback-stop.png
Exec=/usr/local/bin/laptop-mode.sh

You probably need to re-login to get the icons.

  • This works on Ubuntu 16.10 too. I use /usr/share/icons/suru/devices/scalable/{computer-laptop,input-tablet}-symbolic.svg for icons. Nice hack! +1 – nekketsuuu Mar 24 '17 at 22:43
0

I had a similar problem with my Pavilion X360 so here is what I did for a work around to disable the keyboard and pad and to rotate my screen so I can use it as a tablet. This might work for you.

First I created a icon.

sudo vim /usr/share/applications/Keyboard-OFF.desktop

[Desktop Entry]
Type=Application
Terminal=true
Name=Tablet Mode
Icon=/usr/share/icons/Adwaita/32x32/actions/media-playback-stop.png
Exec=/bin/KeyboardOff.sh

Feel Free to change the icon I used pause stop left and right so I can rotate my screen in different directions and pinned them to the bar.

Then

xinput list

Find your the ID for your keyboard/trackpad or what ever you want to disable Note it down. Mine is 12 for keyboard and 13 for Touchpad

for display run

xrandr

find your display mine is eDP1

then

sudo vim /bin/KeyboardOff.sh

Change 12 and 13 to your ID Change eDP1 to your display

#!/bin/bash
echo "EnterPasswordHere" | sudo -S xinput set-int-prop 12 "Device Enabled" 8 0 #Disable Keyboard
echo "EnterPasswordHere" | sudo -S xinput set-int-prop 13 "Device Enabled" 8 0 #Disable Pad
echo "EnterPasswordHEre" | sudo -S xrandr --output eDP1 --rotate inverted
onboard & #Turn on onscreen keyboard
echo ""
echo "Keyboard is off"

Then create and pin another to turn it back on

sudo vim /usr/share/applications/Keyboard-ON.desktop

[Desktop Entry]
Type=Application
Terminal=true
Name=Laptop Mode On
Icon=/usr/share/icons/Adwaita/32x32/actions/media-playback-pause.png
Exec=/bin/KeyboardOn.sh

sudo vim /bin/KeyboardOn.sh

#!/bin/bash
echo "YourPasswordHere" | sudo -S xinput set-int-prop 12 "Device Enabled" 8 1
echo "YourPasswordHere" | sudo -S xinput set-int-prop 13 "Device Enabled" 8 1
echo "YourPasswordHere" | sudo -S xrandr --output eDP1 --rotate normal
echo ""
echo "Keyboard is back on"
exit

Remember to change 12 and 13 and eDP1 to your keyboard/pad & display the 0 or 1 at the end turns it on and off you can also create more icons to rotate left and right by changing --rotate normal to --rotate right or left

I know this does not answer your question specifically but I found being able to select these rather than going to tablet mode seems to be easier as tablet mode seems to be a bit unstable as of now.

Hope this helps you or anyone else running into this. Sorry for the response being a bit crude.

  • I tried the command xrandr --output eDP1 --rotate inverted and the screen did invert but the touch went crazy, even after I did xrandr --output eDP1 --rotate normal.Do you know a fix? – Mina Michael Oct 2 '16 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.