donbowman / kde-auto-rotate

Autorotate the display & pointers on a convertible laptop
Apache License 2.0
54 stars 24 forks source link

additions #14

Open FelixJoehnk opened 4 years ago

FelixJoehnk commented 4 years ago

Hy first of all its working nicely and thanks a lot! I wrote basicaly the same script in python but its nice to have 90 Degree turns and the exception for the attached monitor ! Just one thing i would recomend or atleast commend into the code. If the detection for SW_TABLET_MODE is not working properly on the device but the keyboard and touchpad are disabled when the display is rotated one could add a screen keyboard and turn it on/off if switching to normal or any other mode. In my case (i use onboard) i simply added

start_onboard(){
    if ! pgrep -x "onboard" > /dev/null
    then
        # not Running
        onboard &
    fi
}

and then "killall onboard" if turned to normal and "start_onboard" if rotated any other direction :)

anyways nice work and thanks :)

legop3 commented 3 years ago

nice addition. i plan on using onboard. also, it would be really nice if i were able to switch between Kwin and i3 automatically with, maybe an addition to your addition.

would you mind posting your full addition? with the part that opens and kills onboard?

thanks.

FelixJoehnk commented 3 years ago

hey i actually changed my setup a bit since it was anoying that onboard would only start if the screen is rotated (90,180,270deg) but not if i only "fold" the device. Therefor i checked if my device has a output if i just fold the screen which happens to be true! Now i am using this in a sh file for the onboard part:


line2=""
line3=""

xinput test-xi2 --root 3 | while read -r line
do  
    if [[ $line == *"detail: 201" ]]; then
        if [[ $line3 == *"RawKeyPress"* ]]; then
            onboard &
            #echo "start onboard"
        fi

    fi
    if [[ $line == *"detail: 200" ]]; then
        if [[ $line3 == *"RawKeyPress"* ]]; then
            killall onboard
            #echo "start onboard"
        fi

    fi    
    line3=$line2
    line2=$line

done
exit 0

I just start this on boot (.bashrc) and it does the trick but maybe you would need to check if the button press is different for you ! I would also guess that the change you wanted to do from Kwin to i3 and back is simple to add here but i dont mind the default window manager if one sets it up nicely :) Right now i have an issue with the accelerometer (iio-sensor-proxy) resulting in unusability of monitor sensor (no output) therefor the automatic screen rotation is not working :/ But if you dont want to use the aboth solution or there is no button press on your device you can try using "killall onboard" in the "normal" case (line62 of auto-rotate) and in every other case either just start onboard (line 70,78,86 auto-rotate) or use the script in the first post so you only start onboard if its not running.

Hope this helps and good luck :)