aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Langé <lqp1@users.noreply.github.com>2020-10-15 08:56:52 +0200
committerThomas Langé <lqp1@users.noreply.github.com>2020-10-15 09:00:48 +0200
commit616b2089e8fec55f610e03b0186ee90c48cdf49a (patch)
treeba285f875e38304cff4384c21bfdedb3cbff33b6
parent7cdfd0e61bc512cf863bfe1986b4c2e64b28c28f (diff)
downloadautotiling-616b2089e8fec55f610e03b0186ee90c48cdf49a.tar.gz
Allow autotiling to be run as a script directly
-rw-r--r--autotiling/main.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/autotiling/main.py b/autotiling/main.py
index f3644a7..3f6969e 100644
--- a/autotiling/main.py
+++ b/autotiling/main.py
@@ -18,7 +18,12 @@ from functools import partial
from i3ipc import Connection, Event
-from .__about__ import __version__
+
+try:
+ from .__about__ import __version__
+except ImportError:
+ __version__ = "unknown"
+
def switch_splitting(i3, e, debug):
@@ -84,3 +89,8 @@ def main():
i3 = Connection()
i3.on(Event.WINDOW_FOCUS, handler)
i3.main()
+
+
+if __name__ == "__main__":
+ # execute only if run as a script
+ main()