Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
5488f154e1 | |||
5a8657d7ca | |||
45b5790e79 | |||
902e5bebe4 | |||
8b0a4c954c | |||
c1914511ee |
8 changed files with 67 additions and 22 deletions
25
README.md
25
README.md
|
@ -1,26 +1,13 @@
|
||||||
# tablet-mode
|
# Chuwi Minibook tablet mode switch
|
||||||
|
|
||||||
Allow users to toggle a convertible laptop between laptop and tablet mode.
|
Allow users to toggle a Chuwi Minibook laptop between laptop and tablet mode.
|
||||||
|
This is based on https://github.com/conqp/tablet-mode.
|
||||||
|
|
||||||
## Configuration
|
## Installation
|
||||||
|
|
||||||
The devices to be deactivated in either *tablet* or *laptop* mode must be specified in `/etc/tablet-mode.json`.
|
Just run `install.sh` on your Debian system and enter the name of you local user account.
|
||||||
You can specify whether desktop notifications shall be send when changing the mode using the `notify` flag.
|
Reboot after successful installation.
|
||||||
If specified, you can override `sudo` to provide another program that accepts commands to be run as root without a password
|
|
||||||
by the current user to elevate privileges, such as *doas*.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"tablet": [
|
|
||||||
"/dev/input/by-path/platform-i8042-serio-0-event-kbd",
|
|
||||||
"/dev/input/by-path/platform-i8042-serio-1-event-mouse"
|
|
||||||
],
|
|
||||||
"notify": false,
|
|
||||||
"sudo": "/usr/bin/doas"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
You must be a member of the group `tablet` to toggle between tablet and laptop mode.
|
|
||||||
You can toggle between tablet and laptop mode by running `setsysmode toggle` or use the desktop icon provided with this package.
|
You can toggle between tablet and laptop mode by running `setsysmode toggle` or use the desktop icon provided with this package.
|
||||||
|
|
35
install.sh
Executable file
35
install.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
GROUP=tablet
|
||||||
|
|
||||||
|
if ! [ $(getent group "$GROUP") ]; then
|
||||||
|
echo "Add tablet group..."
|
||||||
|
/usr/sbin/groupadd tablet
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "Enter your local username: " user
|
||||||
|
|
||||||
|
if ! [ $(groupmems -g "$GROUP" -l | grep "$user" ) ]; then
|
||||||
|
echo "Add user to group..."
|
||||||
|
usermod -a -G tablet "$user"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Copy files..."
|
||||||
|
cp -r tabletmode/ /usr/local/lib/python3.11/dist-packages
|
||||||
|
cp tablet-mode.service /etc/systemd/system
|
||||||
|
cp laptop-mode.service /etc/systemd/system
|
||||||
|
cp tablet-mode.json /etc/
|
||||||
|
cp tablet-mode.desktop /home/"$user"/.local/applications
|
||||||
|
cp tablet-mode.sudoers /etc/sudoers.d/tablet-mode
|
||||||
|
cp setsysmode /usr/local/bin
|
||||||
|
chmod +x /usr/local/bin/setsysmode
|
||||||
|
cp sysmoded /usr/local/bin
|
||||||
|
chmod +x /usr/local/bin/sysmoded
|
||||||
|
|
||||||
|
echo "Reload systemd..."
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
echo "Install packages..."
|
||||||
|
apt install evtest -y
|
|
@ -3,7 +3,7 @@ Description=Configure system for laptop mode
|
||||||
Conflicts=tablet-mode.service
|
Conflicts=tablet-mode.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/sysmoded laptop
|
ExecStart=/usr/local/bin/sysmoded laptop
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
8
setsysmode
Normal file
8
setsysmode
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#! /usr/bin/env python3
|
||||||
|
"""Sets the system mode."""
|
||||||
|
|
||||||
|
from tabletmode.cli import main
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
8
sysmoded
Normal file
8
sysmoded
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#! /usr/bin/env python3
|
||||||
|
"""System mode daemon."""
|
||||||
|
|
||||||
|
from tabletmode.daemon import main
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -2,6 +2,6 @@
|
||||||
Comment=Toggle tablet mode
|
Comment=Toggle tablet mode
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Name=Tablet Mode
|
Name=Tablet Mode
|
||||||
Exec=/usr/bin/setsysmode toggle
|
Exec=/usr/local/bin/setsysmode toggle
|
||||||
Type=Application
|
Type=Application
|
||||||
Icon=pda-symbolic
|
Icon=pda-symbolic
|
||||||
|
|
7
tablet-mode.json
Normal file
7
tablet-mode.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"tablet": [
|
||||||
|
"/dev/input/by-path/platform-i8042-serio-0-event-kbd",
|
||||||
|
"/dev/input/by-path/pci-0000:00:14.0-usb-0:9:1.0-event-mouse"
|
||||||
|
],
|
||||||
|
"notify": false
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ Description=Configure system for tablet mode
|
||||||
Conflicts=laptop-mode.service
|
Conflicts=laptop-mode.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/sysmoded tablet
|
ExecStart=/usr/local/bin/sysmoded tablet
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
Loading…
Reference in a new issue