I am suffering at prolem 1 as well but there is the plugin called 'Slide for Keyboard' available and this solves the problem partially.
If activated, this plugin causes the keyboard to appear when doing an edge slide from the bottom of the screen.
Here is the link:
https://extensions.gnome.org/extension/993/slide-for-keyboard/
You may want another keyboard layout for vertical view. You can define your own keyboard layout using XML for that.
Take a look at the directory
/usr/share/caribou/layouts
Use the same XML Syntax as in some already existing layouts.
I use a German layout and my config for vertical keyboard looks like this:
<?xml version="1.0"?>
<layout xmlns:xi="http://www.w3.org/2001/XInclude">
<level mode="default" name="level1" xml:base="common/qwerty.xml">
<row>
<key name="Escape"/>
<key name="q"/>
<key name="w"/>
<key name="e">
<key name="e"/>
<key name="egrave"/>
<key name="eacute"/>
<key name="ecircumflex"/>
<key name="ediaeresis"/>
<key name="emacron"/>
</key>
<key name="r"/>
<key name="t"/>
<key name="z"/>
<key name="u">
<key name="u"/>
<key name="ugrave"/>
<key name="uacute"/>
<key name="ucircumflex"/>
<key name="udiaeresis"/>
<key name="umacron"/>
</key>
<key name="i">
<key name="i"/>
<key name="igrave"/>
<key name="iacute"/>
<key name="icircumflex"/>
<key name="idiaeresis"/>
<key name="imacron"/>
</key>
<key name="o">
<key name="o"/>
<key name="ograve"/>
<key name="oacute"/>
<key name="ocircumflex"/>
<key name="odiaeresis"/>
<key name="omacron"/>
</key>
<key name="p"/>
<key name="BackSpace" repeatable="yes"/>
</row>
<row align="right">
<key name="Tab" width="1.5"/>
<key name="a">
<key name="a"/>
<key name="agrave"/>
<key name="aacute"/>
<key name="acircumflex"/>
<key name="adiaeresis"/>
<key name="aring"/>
<key name="atilde"/>
<key name="ae"/>
<key name="amacron"/>
</key>
<key name="s"/>
<key name="d"/>
<key name="f"/>
<key name="g"/>
<key name="h"/>
<key name="j"/>
<key name="k"/>
<key name="l"/>
<key name="Return" width="1.5"/>
</row>
<row>
<key name="Caribou_ShiftUp" toggle="level2" width="1.5"/>
<key name="y"/>
<key name="x"/>
<key name="c">
<key name="c"/>
<key name="ccedilla"/>
</key>
<key name="v"/>
<key name="b"/>
<key name="n"/>
<key name="m"/>
<key name="comma"/>
<key name="period"/>
<key name="question"/>
</row>
<row>
<key align="left" name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
<key align="left" name="Control_L" width="1.5"/>
<key align="left" name="Alt_L" width="1.5"/>
<key align="left" name="space" width="5.0" repeatable="yes"/>
<key align="right" name="Caribou_Prefs"/>
</row>
</level>
<level mode="latched" name="level2" xml:base="common/qwerty.xml">
<row>
<key name="Escape"/>
<key name="Q"/>
<key name="W"/>
<key name="E">
<key name="E"/>
<key name="Egrave"/>
<key name="Eacute"/>
<key name="Ecircumflex"/>
<key name="Ediaeresis"/>
<key name="Emacron"/>
</key>
<key name="R"/>
<key name="T"/>
<key name="Z"/>
<key name="U">
<key name="U"/>
<key name="Ugrave"/>
<key name="Uacute"/>
<key name="Ucircumflex"/>
<key name="Udiaeresis"/>
<key name="Umacron"/>
</key>
<key name="I">
<key name="I"/>
<key name="Igrave"/>
<key name="Iacute"/>
<key name="Icircumflex"/>
<key name="Idiaeresis"/>
<key name="Imacron"/>
</key>
<key name="O">
<key name="O"/>
<key name="Ograve"/>
<key name="Oacute"/>
<key name="Ocircumflex"/>
<key name="Odiaeresis"/>
<key name="Omacron"/>
</key>
<key name="P"/>
<key name="BackSpace" repeatable="yes"/>
</row>
<row align="right">
<key name="Tab" width="1.5"/>
<key name="A">
<key name="A"/>
<key name="Agrave"/>
<key name="Aacute"/>
<key name="Acircumflex"/>
<key name="Adiaeresis"/>
<key name="Aring"/>
<key name="Atilde"/>
<key name="Ae"/>
<key name="Amacron"/>
</key>
<key name="S"/>
<key name="D"/>
<key name="F"/>
<key name="G"/>
<key name="H"/>
<key name="J"/>
<key name="K"/>
<key name="L"/>
<key name="Return" width="1.5"/>
</row>
<row>
<key name="Caribou_ShiftDown" toggle="level1" width="1.5"/>
<key name="Y"/>
<key name="X"/>
<key name="C">
<key name="C"/>
<key name="Ccedilla"/>
</key>
<key name="V"/>
<key name="B"/>
<key name="N"/>
<key name="M"/>
<key name="comma"/>
<key name="period"/>
<key name="question"/>
</row>
<row>
<key align="left" name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
<key align="left" name="Control_L" width="1.5"/>
<key align="left" name="Alt_L" width="1.5"/>
<key align="left" name="space" width="5.0" repeatable="yes"/>
<key align="right" name="Caribou_Prefs"/>
</row>
</level>
<level mode="locked" name="symbols1" xml:base="common/symbols.xml">
<row>
<key name="Escape"/>
<key name="1"/>
<key name="2"/>
<key name="3"/>
<key name="4"/>
<key name="5"/>
<key name="6"/>
<key name="7"/>
<key name="8"/>
<key name="9"/>
<key name="0"/>
<key name="BackSpace" repeatable="yes"/>
</row>
<row align="right">
<key name="Tab" width="1.5"/>
<key name="minus"/>
<key name="slash"/>
<key name="colon"/>
<key name="semicolon"/>
<key name="parenleft"/>
<key name="parenright"/>
<key name="ampersand"/>
<key name="at"/>
<key name="grave"/>
<key name="Return" width="1.5"/>
</row>
<row>
<key name="Caribou_Symbols_More" toggle="symbols2" width="2.0"/>
<key name="period" width="1.2"/>
<key name="comma" width="1.2"/>
<key name="question" width="1.2">
<key name="question"/>
<key name="questiondown"/>
</key>
<key name="exclam" width="1.2">
<key name="exclam"/>
<key name="exclamdown"/>
</key>
<key name="apostrophe" width="1.2"/>
<key name="quotedbl" width="1.2"/>
</row>
<row>
<key align="left" name="Caribou_Alpha" toggle="default" width="2.0"/>
<key align="left" name="Control_L" width="1.5"/>
<key align="left" name="Alt_L" width="1.5"/>
<key align="left" name="space" width="5.0" repeatable="yes"/>
<key align="right" name="Caribou_Prefs"/>
</row>
</level>
<level mode="locked" name="symbols2" xml:base="common/symbols.xml">
<row>
<key name="Escape"/>
<key name="bracketleft"/>
<key name="bracketright"/>
<key name="braceleft"/>
<key name="braceright"/>
<key name="numbersign"/>
<key name="percent"/>
<key name="asciicircum"/>
<key name="asterisk"/>
<key name="plus"/>
<key name="equal"/>
<key name="BackSpace" repeatable="yes"/>
</row>
<row align="right">
<key name="Tab" width="1.5"/>
<key align="right" name="underscore"/>
<key name="backslash"/>
<key name="bar"/>
<key name="asciitilde"/>
<key name="less"/>
<key name="greater"/>
<key name="dollar"/>
<key name="EuroSign"/>
<key name="sterling"/>
<key name="Return" width="1.5"/>
</row>
<row>
<key name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
<key name="period" width="1.2"/>
<key name="comma" width="1.2"/>
<key name="question" width="1.2">
<key name="question"/>
<key name="questiondown"/>
</key>
<key name="exclam" width="1.2">
<key name="exclam"/>
<key name="exclamdown"/>
</key>
<key name="apostrophe" width="1.2"/>
<key name="quotedbl" width="1.2"/>
</row>
<row>
<key align="left" name="Caribou_Alpha" toggle="default" width="2.0"/>
<key align="left" name="Control_L" width="1.5"/>
<key align="left" name="Alt_L" width="1.5"/>
<key align="left" name="space" width="5.0" repeatable="yes"/>
<key align="right" name="Caribou_Prefs"/>
</row>
</level>
</layout>
I just removed a few mostly unused keys.
Then trigger the following script on vertical (left or right) rotation:
gsettings set org.gnome.shell.keyboard keyboard-type <your-keyboard-layout-name>
And trigger the same script with the normal layout for normal and inverted rotation.
For problem 2, write a script to toggle the keyboard first.
The script shall look like this:
#!/bin/bash
device='AT Translated Set 2 keyboard'
oldstate=$(xinput list-props "$device" | grep 'Device Enabled' | rev | cut -b 1)
newstate=1
if [ "$oldstate" = "1" ]; then
newstate=0;
fi
xinput set-prop "$device" 'Device Enabled' "$newstate"
While 'AT Translated Set 2 keyboard' is the name of the keyboard.
Yours might have a similar name. Search for it with the command
xinput list | grep keyboard
and try to disable and reenable the printed devices.
(Install 'Slide for Keyboard' first so you're still able to type in the command line)
You should put this script either on a hotkey or as a launcher in your applications list because you might not be able to reenable the keyboard if the script is on a keyboard shortcut.
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.
Best Answer
I have an HP Pavilion 13 x360 and I have the same issues as you have. Currently, there is no official 'tablet mode' support nor is there even proper touch UI support in Ubuntu/Unity. Unity 8 is supposed to bring those features.
Until then, stick with Chrome and maybe check out this thread: Switch into tablet mode (in Gnome)
(albeit in gnome)