diff --git a/trick.py b/trick.py index 0f7e2ac..0bb75d0 100644 --- a/trick.py +++ b/trick.py @@ -33,11 +33,13 @@ class Trick(ABC): from tricks.glorify_goose import GlorifyGooseTrick from tricks.anim_ascii import AnimAsciiTrick from tricks.reflection import ReflectionTrick + from tricks.rotation import RotationTrick tricks = [ LaughingGooseTrick, GlorifyGooseTrick, #AnimAsciiTrick, - ReflectionTrick + ReflectionTrick, + RotationTrick ] return random.choice(tricks)() diff --git a/tricks/rotation.py b/tricks/rotation.py new file mode 100644 index 0000000..001f112 --- /dev/null +++ b/tricks/rotation.py @@ -0,0 +1,26 @@ +import time +import os + +from trick import Trick + + +class RotationTrick(Trick): + @property + def name(self): + return "Rotation" + + @property + def delay(self): + return 5 + + @property + def is_reversible(self): + return False + + def revert(self): + pass + + def run(self): + os.system("xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --rotation inverted") + time.sleep(5) + os.system("xrandr --output $(xrandr -q | grep ' connected' | cut -f 1 -d ' ' | cut -f 1 -d '\n') --rotation normal")