diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-12-30 18:15:47 +0100 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-12-30 18:15:47 +0100 |
| commit | ba9df864729c7ffba6171ce7be5eb0e91399e6da (patch) | |
| tree | a0d8b825e7997611d4dcd0795d500e60b509102d /contrib/tiled.py | |
| parent | 5f4ba065668089e7d5b158f60f26dd0be893ccf8 (diff) | |
| download | river-ba9df864729c7ffba6171ce7be5eb0e91399e6da.tar.gz river-ba9df864729c7ffba6171ce7be5eb0e91399e6da.tar.xz | |
command: s/master/main/g (breaking change)
main is a better term to use here for several reasons:
1. It is more accurate: "master" implies that the designated views have
some kind of control over the other views, which is not the case. "main"
better expresses that the difference between the "main" view and others
is one of importance/focus.
2. It is a shorter word. 2 whole characters saved!
3. It reduces the chance of future development time being lost to
good-intentioned people complaining about usage of the word master as
has recently happened with regards to the default git branch name.
Diffstat (limited to 'contrib/tiled.py')
| -rwxr-xr-x | contrib/tiled.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/contrib/tiled.py b/contrib/tiled.py index 2bec975..325854c 100755 --- a/contrib/tiled.py +++ b/contrib/tiled.py @@ -4,7 +4,7 @@ from sys import argv # This is an implementation of the default "tiled" layout of dwm # -# With 4 views and one master, the layout looks something like this: +# With 4 views and one main view, the layout looks something like this: # # +-----------------------+------------+ # | | | @@ -23,46 +23,46 @@ from sys import argv # Assign the arguments to variables. The order and meaning of the arguments # is explained in the river-layouts(7) man page num_views = int(argv[1]) -master_count = int(argv[2]) -master_factor = float(argv[3]) +main_count = int(argv[2]) +main_factor = float(argv[3]) output_width = int(argv[4]) output_height = int(argv[5]) -secondary_count = num_views - master_count +secondary_count = num_views - main_count -# handle the cases where there are no master or no secondary views -master_width = 0 +# handle the cases where there are no main or no secondary views +main_width = 0 secondary_width = 0 -if master_count > 0 and secondary_count > 0: - master_width = int(master_factor * output_width) - secondary_width = output_width - master_width -elif master_count > 0: - master_width = output_width +if main_count > 0 and secondary_count > 0: + main_width = int(main_factor * output_width) + secondary_width = output_width - main_width +elif main_count > 0: + main_width = output_width elif secondary_count > 0: secondary_width = output_width # for each view, output the location/dimensions separated by spaces on a new line for i in range(num_views): - if i < master_count: - # to make things pixel-perfect, we make the first master and first secondary + if i < main_count: + # to make things pixel-perfect, we make the first main and first secondary # view slightly larger if the height is not evenly divisible - master_height = output_height // master_count - master_height_rem = output_height % master_count + main_height = output_height // main_count + main_height_rem = output_height % main_count x = 0 - y = i * master_height + (master_height_rem if i > 0 else 0) - width = master_width - height = master_height + (master_height_rem if i == 0 else 0) + y = i * main_height + (main_height_rem if i > 0 else 0) + width = main_width + height = main_height + (main_height_rem if i == 0 else 0) print(x, y, width, height) else: secondary_height = output_height // secondary_count secondary_height_rem = output_height % secondary_count - x = master_width - y = (i - master_count) * secondary_height + (secondary_height_rem if i > master_count else 0) + x = main_width + y = (i - main_count) * secondary_height + (secondary_height_rem if i > main_count else 0) width = secondary_width - height = secondary_height + (secondary_height_rem if i == master_count else 0) + height = secondary_height + (secondary_height_rem if i == main_count else 0) print(x, y, width, height) |
