aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md37
-rw-r--r--autotiling/main.py17
2 files changed, 34 insertions, 20 deletions
diff --git a/README.md b/README.md
index 2601c77..a66dfb2 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ but not on even ones:
Another option you can try, is setting `--limit` and only use stacking or
tabbing on the lowest level. A good place to start would be `--limit 2`. Open
four windows with the third and fourth window in the same container as two. This
-might mimic a master-stack layout and you should now be able to switch to
+might mimic a master-stack layout, and you should now be able to switch to
stacking or tabbed. Beware that the decision on how to split is still based on
the height / width ratio.
@@ -55,23 +55,37 @@ Installing manually:
```text
$ autotiling -h
-usage: autotiling [-h] [-d] [-v] [-w [WORKSPACES ...]] [-e [EVENTS ...]]
+usage: main.py [-h] [-d] [-v] [-o [OUTPUTS ...]] [-w [WORKSPACES ...]]
+ [-l LIMIT] [-sw SPLITWIDTH] [-sh SPLITHEIGHT] [-sr SPLITRATIO]
+ [-e [EVENTS ...]]
-optional arguments:
+options:
-h, --help show this help message and exit
-d, --debug print debug messages to stderr
-v, --version display version information
-o [OUTPUTS ...], --outputs [OUTPUTS ...]
- restricts autotiling to certain output; example: autotiling --output DP-1
- HDMI-0
+ restricts autotiling to certain output; example:
+ autotiling --output DP-1 HDMI-0
-w [WORKSPACES ...], --workspaces [WORKSPACES ...]
- restricts autotiling to certain workspaces; example: autotiling --workspaces 8
- 9
+ restricts autotiling to certain workspaces; example:
+ autotiling --workspaces 8 9
-l LIMIT, --limit LIMIT
- limit how often autotiling will split a container; try "2", if you like
- master-stack layouts; default: 0 (no limit)
+ limit how often autotiling will split a container; try
+ "2" if you like master-stack layouts; default: 0 (no
+ limit)
+ -sw SPLITWIDTH, --splitwidth SPLITWIDTH
+ set the width of the vertical split (as factor);
+ default: 1.0;
+ -sh SPLITHEIGHT, --splitheight SPLITHEIGHT
+ set the height of the horizontal split (as factor);
+ default: 1.0;
+ -sr SPLITRATIO, --splitratio SPLITRATIO
+ Split direction ratio - based on window height/width;
+ default: 1;try "1.61", for golden ratio - window has
+ to be 61% wider for left/right split; default: 1.0;
-e [EVENTS ...], --events [EVENTS ...]
- list of events to trigger switching split orientation; default: WINDOW MODE
+ list of events to trigger switching split orientation;
+ default: WINDOW MODE
```
### Events
@@ -79,5 +93,4 @@ optional arguments:
Changing event subscription has already been the objective of several pull request. To avoid doing this again and again,
starting from v1.6 you may specify them in the `-e` | `--events` argument. If no value given, the script will subscribe
to `Event.WINDOW` and `Event.MODE`, as if it was executed with `autotiling -e WINDOW MODE`. See
-[altdesktop/i3ipc-python`](https://github.com/altdesktop/i3ipc-python/blob/a670f24e7e04f509de8161cf760afe929c22ae93/i3ipc/events.py#L12)
-for event enumeration.
+[altdesktop/i3ipc-python`](https://github.com/altdesktop/i3ipc-python/blob/a670f24e7e04f509de8161cf760afe929c22ae93/i3ipc/events.py#L12) for event enumeration.
diff --git a/autotiling/main.py b/autotiling/main.py
index 4fd9e97..9096617 100644
--- a/autotiling/main.py
+++ b/autotiling/main.py
@@ -103,7 +103,7 @@ def switch_splitting(i3, e, debug, outputs, workspaces, depth_limit, splitwidth,
and not is_stacked
and not is_tabbed
and not is_full_screen):
- new_layout = "splitv" if con.rect.height > con.rect.width/splitratio else "splith"
+ new_layout = "splitv" if con.rect.height > con.rect.width / splitratio else "splith"
if new_layout != con.parent.layout:
result = i3.command(new_layout)
@@ -112,13 +112,13 @@ def switch_splitting(i3, e, debug, outputs, workspaces, depth_limit, splitwidth,
elif debug:
print(f"Error: Switch failed with err {result[0].error}", file=sys.stderr)
- if e.change in ["new","move"] and con.percent:
- if con.parent.layout == "splitv" and splitheight != 1.0: # top / bottom
+ if e.change in ["new", "move"] and con.percent:
+ if con.parent.layout == "splitv" and splitheight != 1.0: # top / bottom
# print(f"split top fac {splitheight*100}")
- i3.command(f"resize set height {int(con.percent*splitheight*100)} ppt")
- elif con.parent.layout == "splith" and splitwidth != 1.0: # top / bottom: # left / right
+ i3.command(f"resize set height {int(con.percent * splitheight * 100)} ppt")
+ elif con.parent.layout == "splith" and splitwidth != 1.0: # top / bottom: # left / right
# print(f"split right fac {splitwidth*100} ")
- i3.command(f"resize set width {int(con.percent*splitwidth*100)} ppt")
+ i3.command(f"resize set width {int(con.percent * splitwidth * 100)} ppt")
elif debug:
print("Debug: No focused container found or autotiling on the workspace turned off", file=sys.stderr)
@@ -140,7 +140,8 @@ def main():
parser.add_argument("-w", "--workspaces", nargs="*", type=str, default=[],
help="restricts autotiling to certain workspaces; example: autotiling --workspaces 8 9")
parser.add_argument("-l", "--limit", type=int, default=0,
- help='limit how often autotiling will split a container; try "2" if you like master-stack layouts; default: 0 (no limit)')
+ help='limit how often autotiling will split a container; '
+ 'try "2" if you like master-stack layouts; default: 0 (no limit)')
parser.add_argument("-sw",
"--splitwidth",
help='set the width of the vertical split (as factor); default: 1.0;',
@@ -154,7 +155,7 @@ def main():
parser.add_argument("-sr",
"--splitratio",
help='Split direction ratio - based on window height/width; default: 1;'
- 'try "1.61", for golden ratio - window has to be 61%% wider for left/right split; default: 1.0;',
+ 'try "1.61", for golden ratio - window has to be 61%% wider for left/right split; default: 1.0;',
type=float,
default=1.0, )