Skip to content

Commit c0a4d4f

Browse files
committed
sway: tablet rotate mode for wacom touchscreen
1 parent 85a31da commit c0a4d4f

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed

setup_all.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ if [[ "$current_hostname" == "$laptop_hostname" ]]; then
626626
fi
627627

628628
declare -a systemd_units_laptop=(
629+
/usr/lib/systemd/system/acpid.service
629630
/usr/lib/systemd/system/open-fprintd-resume.service
630631
/usr/lib/systemd/system/open-fprintd-suspend.service
631632
/usr/lib/systemd/system/python3-validity.service
@@ -634,6 +635,18 @@ if [[ "$current_hostname" == "$laptop_hostname" ]]; then
634635
systemd_enable_start "${systemd_unit}"
635636
done
636637

638+
systemctl --user daemon-reload || {
639+
echo "failed to daemon-reload"
640+
exit 1
641+
}
642+
643+
declare -a systemd_user_units_laptop=(
644+
"$base_path"/sway/.config/systemd/user/tablet-rotate.service
645+
)
646+
for systemd_user_unit in "${systemd_user_units_laptop[@]}"; do
647+
systemd_user_enable_start "${systemd_user_unit}"
648+
done
649+
637650
echo "Copying laptop system configuration"
638651
rsync_system_config "$laptop_hostname"/
639652
elif [[ "$current_hostname" == "$desktop_hostname" ]]; then

sway/.config/sway/thinky/config

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# Specific Configuration, loaded on hostname "thinky"
22

33
output eDP-1 {
4-
mode 1920x1080@59.997Hz
4+
mode 3840x2160@60.000Hz
55
render_bit_depth 8
6+
scale 2
7+
}
8+
9+
input 1386:21033:Wacom_Pen_and_multitouch_sensor_Finger {
10+
events disabled
11+
}
12+
13+
input 1386:21033:Wacom_Pen_and_multitouch_sensor_Pen {
14+
map_to_output eDP-1
615
}
716

817
#
918
# Display brightness controls using light
1019
#
11-
bindsym XF86MonBrightnessUp exec exec swayosd-client --brightness raise
12-
bindsym XF86MonBrightnessDown exec swayosd-client --brightness lower
20+
bindsym XF86MonBrightnessUp exec exec swayosd-client --brightness +5
21+
bindsym XF86MonBrightnessDown exec swayosd-client --brightness -5
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Rotate display when gyro changes
3+
PartOf=graphical-session.target
4+
5+
[Service]
6+
Type=simple
7+
Restart=always
8+
RestartSec=1
9+
ExecStart=%h/.local/bin/gyro-rotate
10+
11+
[Install]
12+
WantedBy=sway-session.target

sway/.local/bin/tablet-rotate

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Rotates the display 90deg when in tablet mode
4+
5+
display=$(swaymsg -t get_outputs --raw | jq '. | map(select(.focused == true)) | .[0].name' -r)
6+
tablet_mode=false
7+
8+
acpi_listen | while IFS= read -r line; do
9+
if [[ "$line" = "video/tabletmode TBLT 0000008A 00000001" && $tablet_mode == false ]]; then
10+
tablet_mode=true
11+
notify-send "Tablet Mode"
12+
swaymsg output $display transform 90
13+
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
14+
elif [[ "$line" = "video/tabletmode TBLT 0000008A 00000000" && $tablet_mode == true ]]; then
15+
tablet_mode=false
16+
notify-send "Laptop Mode"
17+
swaymsg output $display transform 0
18+
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false
19+
fi
20+
done

0 commit comments

Comments
 (0)