dotfiles/actuator/uzui/set_win_mode
2023-10-06 01:41:47 -04:00

32 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
WINDOW_MODE=$(cat "${XDG_CACHE_HOME}/window_mode")
if [ "$1" == "portrait" ] && [ "${WINDOW_MODE}" != "portrait" ]; then
echo "portrait" > "${XDG_CACHE_HOME}"/window_mode
rotate-screen eDP-1 left;
xinput set-prop 9 --type=float "Coordinate Transformation Matrix" 0 -1 0 1 0 0 0 0 1
xinput set-prop 10 --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
xinput set-prop 17 --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
pkill actuator;
actuator "${XDG_CONFIG_HOME}/actuator/uzui/portrait.toml" &
elif [ "$1" == "landscape" ] && [ "${WINDOW_MODE}" != "landscape" ]; then
echo "landscape" > "${XDG_CACHE_HOME}"/window_mode
rotate-screen eDP-1 normal;
xinput set-prop 9 --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
xinput set-prop 10 --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
xinput set-prop 17 --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
pkill actuator;
actuator "${XDG_CONFIG_HOME}/actuator/uzui/landscape.toml" &
elif [ "$1" == "tablet" ] && [ "${WINDOW_MODE}" != "tablet" ]; then
echo "tablet" > "${XDG_CACHE_HOME}"/window_mode
rotate-screen eDP-1 inverted;
xinput set-prop 9 --type=float "Coordinate Transformation Matrix" -1 0 0 0 -1 0 0 0 1
xinput set-prop 10 --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop 17 --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
pkill actuator;
actuator "${XDG_CONFIG_HOME}/actuator/uzui/tablet.toml" &
fi