aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Langhard <matthias.langhard@ecologic.ch>2021-01-07 15:18:49 +0100
committerMatthias Langhard <matthias.langhard@ecologic.ch>2021-01-07 15:20:00 +0100
commitf1df829964ae71336756f41a6e698fd361241977 (patch)
tree93269b2ad9ad047a60b4b5fcf71ab98af268117c
parentccc1d594615399e2c2092645682a9684d8057037 (diff)
downloadautotiling-f1df829964ae71336756f41a6e698fd361241977.tar.gz
adds --workspace cli argument to restrict autotiling to certain workspaces
-rw-r--r--autotiling/main.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/autotiling/main.py b/autotiling/main.py
index 3f6969e..cf03c04 100644
--- a/autotiling/main.py
+++ b/autotiling/main.py
@@ -26,10 +26,10 @@ except ImportError:
-def switch_splitting(i3, e, debug):
+def switch_splitting(i3, e, debug, workspaces):
try:
con = i3.get_tree().find_focused()
- if con:
+ if con and (con.workspace().name in workspaces):
if con.floating:
# We're on i3: on sway it would be None
# May be 'auto_on' or 'user_on'
@@ -83,9 +83,21 @@ def main():
version="%(prog)s {}, Python {}".format(__version__, sys.version),
help="display version information",
)
+ parser.add_argument(
+ "--workspaces",
+ "-w",
+ help="Restricts autotiling to certain workspaces. Example: autotiling --workspaces 8 9",
+ nargs="*",
+ type=str,
+ default=[],
+ )
args = parser.parse_args()
- handler = partial(switch_splitting, debug=args.debug)
+
+ if args.debug and args.workspaces:
+ print("autotiling is only active on workspaces:", ','.join(args.workspaces))
+
+ handler = partial(switch_splitting, debug=args.debug, workspaces=args.workspaces)
i3 = Connection()
i3.on(Event.WINDOW_FOCUS, handler)
i3.main()