Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

rot8 configuration not working #8

Open
techtino opened this issue Jan 12, 2021 · 1 comment
Open

rot8 configuration not working #8

techtino opened this issue Jan 12, 2021 · 1 comment

Comments

@techtino
Copy link

techtino commented Jan 12, 2021

The rot8 configuration in the sway config file does not work, likely because x-file and y-file are not valid arguments apparently.

This is because the git clone command doesn't clone the forked version with the added args. This should be specified in the readme.

@nimbin2
Copy link

nimbin2 commented May 18, 2021

not sure if its the right way, but i modified the sxmo rotate script a bit so its usable with sway.
with systemd you can start a user service

https://wiki.archlinux.org/title/Sway#Manage_Sway-specific_daemons_with_systemd

#!/usr/bin/env sh

ROTATONLOG="/tmp/isrotated.log"
GRAVITY="16374"
THRESHOLD="400"
POLL_TIME=1
RIGHT_SIDE_UP="$(echo "$GRAVITY - $THRESHOLD" | bc)"
UPSIDE_DOWN="$(echo "-$GRAVITY + $THRESHOLD" | bc)"
FILE_X="$(find /sys/bus/iio/devices/iio:device*/ -iname in_accel_x_raw)"
FILE_Y="$(find /sys/bus/iio/devices/iio:device*/ -iname in_accel_y_raw)"

touch $ROTATONLOG

rotationlog() {
   echo $1 > $ROTATONLOG
}


while true; do
   getrotation=$(cat $ROTATONLOG)
   y_raw="$(cat "$FILE_Y")"
   x_raw="$(cat "$FILE_X")"

   if  [ "$x_raw" -ge "$RIGHT_SIDE_UP" ] && [ "$getrotation" != "norm" ]; then
      rotationlog "norm"
      swaymsg output DSI-1 transform 0
   elif [ "$y_raw" -le "$UPSIDE_DOWN" ] && [ "$getrotation" != "left" ]; then
      rotationlog "left"
      swaymsg output DSI-1 transform 90
   elif [ "$y_raw" -ge "$RIGHT_SIDE_UP" ] && [ "$getrotation" != "right" ]; then
      rotationlog "right"
      swaymsg output DSI-1 transform 270
   fi
   sleep "$POLL_TIME"
done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants