Commit Graph

647 Commits

Author SHA1 Message Date
Eon S. Jeon
d73fd9ea4e prevent duplicated adjustment of LayoutPart
A problem with adjusting nested LayoutPart was that adjustments were
"duplicated". For example, if two HalfSplit parts were nested, resizing
one window will adjust both parts instead of one. This behavior is not
desirable.

So, to fix this, ILayoutPart#adjust now returns a RectDelta, to change
how outer parts behave. For example, an inner part can remove a field in
RectDelta(e.g. north) to prevent outer parts from reusing the field for
another adjustment. So, the duplicated adjustment can be fixed by
"consuming" delta values in inner parts.
2020-07-27 20:15:43 +09:00
Eon S. Jeon
57be00d17e add license notification to layoutpart.ts 2020-07-27 08:28:36 +09:00
Eon S. Jeon
f2b624f704 implement Fibonacci-Spiral layout (WIP)
Implemented only `apply`. Need to work on `adjust` and shortcuts.

It's unclear if the split ratio values should be derived from window
weights, or keep them independently in the layout. I think the latter is
more practical. Maybe both, but let's see what can be done.
2020-07-24 08:09:14 +09:00
Eon S. Jeon
eadea76c57 rotatable HalfSplitLayoutPart 2020-07-24 08:09:06 +09:00
Eon S. Jeon
87bf403f6d implement Rotate Part for master of Tile layout
This implements rotation of master of Tile layout. Not implementing
rotation for stack at this point, because it requires an access to
window list, which isn't possible atm.
2020-07-21 22:56:37 +09:00
Eon S. Jeon
5cdfd9d59f add Rotate Part shortcut key 2020-07-21 22:56:23 +09:00
Eon S. Jeon
011a68fea6 migrate Tile layout to generic ILayoutPart 2020-07-21 22:35:25 +09:00
Eon S. Jeon
5510982ae8 make HalfSplit, Rotate layout parts generic
This reduces verbosity from casting types and keeping track of
intermediate parts.
2020-07-21 22:30:38 +09:00
Eon S. Jeon
430b5a634e safeguard WrapperMap#add from duplicated insert 2020-07-18 14:22:07 +09:00
Eon S. Jeon
7fdbdc2667 make the script work without compositor (#46)
This is a little timer-based hack that make the script work without
compositor.

This is not a "true" solution, because, rarely, it takes longer than
50ms to get "windowShown" signal after "windowAdded", and, if this
happens, the window *might* freeze. If the delay is longer, it ruins the
experience.

I also tried to get the state of compositor through
`option.compositingInitialized`, but it seems like the property is
removed in the actual code. I couldn't find any other reasonable
methods.
2020-07-18 14:08:13 +09:00
Eon S. Jeon
aa8cb36446 simplify ILayout 2020-07-16 23:31:49 +09:00
Eon S. Jeon
7ec2af2a7e simplify Layout ordering method
The original logic relied on the fact that each layout instance carries
around predefined class IDs. However, this is cumbersome and pretty
hacky in terms of design. Also, it's not easy to declare multiple
layouts using a single layout class(ILayout).

In the new method, IConfig instances are reponsible for providing ID,
order, and factory of each layout. That is, the mapping b/w the
layout ID and the actual layout is only known to IConfig. This allow
clear separation of responsibility.

Note: there's another solution which might work better: layout
expression. This is an over-engineering in the current state of the
script, but once the support for external config file is implemented,
this can be pretty useful.
2020-07-12 10:22:33 +09:00
Eon S. Jeon
9548f3bf3f implement layout rotation in Tile layout 2020-07-08 08:17:18 +09:00
Eon S. Jeon
1704740d01 add rotate method to RotateLayoutPart 2020-07-08 08:17:04 +09:00
Eon S. Jeon
0346ae33e1 add "Rotate" shortcut 2020-07-08 08:16:41 +09:00
Eon S. Jeon
c2bf027e13 implement RotateLayoutPart
RotateLayoutPart allows rotating its child LayoutPart (and also supports
layout adjustment).

Note that "rotation" here isn't real degree-based rotation. This is an
intentional decision to preserve stack-growing direction (top-to-bottom,
left-to-right).
2020-07-07 21:41:36 +09:00
Eon S. Jeon
2b377f213d regress: tile layout adjusts both stacks
Resizing one window adjusted windows in both stacks. This was because
all tiles were passed for adjustment to either ones. This was fixed by
passing only tiles that belong to each of the stack.
2020-07-06 00:39:07 +09:00
Eon S. Jeon
1ec3085d66 refactor Tile layout using LayoutParts 2020-07-05 20:54:57 +09:00
Eon S. Jeon
81ed83a7e8 implement LayoutPart stuffs 2020-07-05 20:54:40 +09:00
Eon S. Jeon
de271a72e6 make actualGeometry read-only 2020-07-05 20:54:25 +09:00
Eon S. Jeon
d11741adb4 simplify CascadeLayout.decomposeDirection 2020-07-03 08:13:18 +09:00
Eon S. Jeon
47fa847f7e make Rect mutable and use Readonly<Rect> instead
Although readonly is quite a joke in Typescript, this is a better
approach which allows both mutable and immutable patterns.
2020-07-02 06:52:01 +09:00
Eon S. Jeon
2d5e981171 fix Rect signature 2020-07-01 22:06:58 +09:00
Eon S. Jeon
c878120074 bump version to 0.8 2020-06-01 00:35:08 +09:00
Eon S. Jeon
b9d3b2fe0a option: put new window as master (#83) 2020-06-01 00:26:55 +09:00
Eon S. Jeon
ad25afb88f moving floating windows w/ shortcut (#41)
Allow moving floating windows with swap shortcuts.
2020-05-11 09:29:13 +09:00
Eon S. Jeon
f7e047c421 resizing floating windows w/ shortcut (#41)
Allow resizing floating windows with resize shortcuts.
2020-05-11 09:28:51 +09:00
Eon S. Jeon
a4488a836f names and doc for shortcut-related window actions 2020-05-09 19:08:19 +09:00
Eon S. Jeon
ea0e0d7f94 proper handle window started in fullscreen (#76)
Krohnkite implements a policy that automatically floats all
non-resizable windows to prevent breaking layouts. However, when a
window is started directly in fullscreen, KWin naturally reports that
the window is not resizable, even when it' resizable in non-fullscreen.
This causes confusion in Krohnkite, and the script wrongfully floats
such windows.

This commit fixes this by delaying the application of the policy as much
as possible. New windows are initially marked "undecided", and the test
will be performed only when it's required.
2020-05-09 16:42:36 +09:00
Eon S. Jeon
b804adc9c8 better names and readability for WindowState
- Use terms that are aligned with the documentation
 - Some comments
 - more readable Window#commit
2020-05-09 16:42:14 +09:00
Eon S. Jeon
70e4204f82 Use separate layouts by default (#71)
The previous default behavior was derived from dwm. It totally make
sense for dwm, because it has "tag" system instead of virtual desktop.
However, most people are more used to virtual desktop system and
consider each desktp as physically independent entity.  Thus, it makes
more sense to turn this on by default.
2020-05-09 11:50:31 +09:00
Eon S. Jeon
18e8b62173 debug print wndow state 2020-04-11 11:34:50 +09:00
Eon S. Jeon
2ba4fb0418 implement Cascade layout (disabled)
This layout is to replace Spread and Stair layout, but is tucked away
for now.
2020-04-11 11:30:32 +09:00
Eon S. Jeon
dab4b89cdc let KWin decide the size of maximized windows
This allows backends to decide what "maximization" actually is. This is
better than directly controlling maximized windows in Engine, because:

 1. This works well with the KWin maximization animation effect.
 2. The logic is simpler and more adaptable.
2020-04-06 20:03:31 +09:00
Eon S. Jeon
70599520a5
Merge pull request #69 from shocklateboy92/update-doc
Add note to maximize sole window option
2020-04-05 18:27:15 +09:00
Eon S. Jeon
4ac5360633 support KWin native maximization (#64)
This feature is implemented by adding a new window state: Maximized.
It's almost like FullScreen, but window geometry should be manually set
by Engine.
2020-04-04 22:23:41 +09:00
Lasath Fernando
1ad861816d Add note to maximize sole window option
It now mentions the relevant breeze option to prevent windows from
being stuck without borders when this is enabled.
2020-04-03 21:17:19 -07:00
Eon S. Jeon
f1b0d1b373 bugfix: fullscreening messes up keepAbove state
Fixed by not touching keepAbove when window is in fullscreen state.
2020-03-21 16:56:48 +09:00
Eon S. Jeon
7d1d4946a0 store window weights in Window, not in layouts.
Do not keep weight map in layout side, because they grow infinitely for
there's no way to shrink them back.
2020-03-08 18:14:09 +09:00
Eon S. Jeon
2b7909f7f1 fix TCL adjustment
1. master-stack ratio when 2-column
 2. L-stack adjustment size
2020-03-08 18:14:09 +09:00
Eon S. Jeon
1afbc08950 refactor Tile layout to use LayoutUtils 2020-03-08 18:14:09 +09:00
Eon S. Jeon
0d52097630
Merge pull request #62 from shocklateboy92/master
Minor improvement to README
2020-03-07 13:33:00 +09:00
Lasath Fernando
b50beb65ba Minor improvement to README
Adds a nice `kwriteconfig5` commands that can be easily pasted into
a shell to adjust the breeze border colors.
2020-03-02 23:27:34 -08:00
Eon S. Jeon
2ea7feeb2f bugfix: cycling layout breaks layout shortcut 2020-03-01 19:20:34 +09:00
Eon S. Jeon
924f759d41 overhaul config UI
* use groupbox instead of labels to split sections
 * improve sentences
 * item reorganization
 * etc...
2020-03-01 18:48:48 +09:00
Eon S. Jeon
bba40f37bf implement tile width limit 2020-03-01 18:48:39 +09:00
Eon S. Jeon
ed1eab73dd toggle Monocle layout 2020-02-28 21:38:04 +09:00
Eon S. Jeon
2170037dc0 allow resizing south/east-most windows 2020-02-28 12:50:11 +09:00
Eon S. Jeon
829ba91c92 make TCL w/ multiple masters adjustable 2020-02-28 12:41:49 +09:00
Eon S. Jeon
cf8b2ed161 implement diretional swap 2020-02-28 12:06:40 +09:00