Commit Graph

148 Commits

Author SHA1 Message Date
Keith Hubbard
2bdf9e20a5
command: support repeating keyboard mappings
Repeating mappings are created using the -repeat option to the map
command:

    % riverctl map normal $mod+Mod1 K -repeat move up 10

- repeating is only supported for key press (not -release) mappings
- unlike -release, -repeat does not create distinct mappings: mapping a
  key with -repeat will replace an existing bare mapping and vice-versa

Resolves #306
2021-08-15 14:49:11 +02:00
Isaac Freund
e752555969
config: fix leak of default layout namespace 2021-08-09 16:48:51 +02:00
Isaac Freund
8a1e96cddc
config: change color format to 0xRRGGBBAA
The current format of #RRGGBBAA is problematic as # starts a comment
in POSIX compliant shells, requiring escaping/quoting and increasing
complexity.

This is a breaking change.
2021-07-26 20:36:46 +02:00
Isaac Freund
6f91011895
river: fix crash on parsing empty string as color 2021-07-24 10:39:38 +02:00
Isaac Freund
f86291169e
cursor: allow commands to override cursor operations
Now that we properly handle state changes during cursor operations,
blocking these commands if the target view is the target of a cursor
operation is unnecessary complexity. It is also inconsistent as we
don't block changing the tags of the view.
2021-07-23 17:11:43 +02:00
Isaac Freund
b7e15a8ef6
river: make spawn command take only one argument
Currently the spawn command takes any number of arguments and naively
joins them together with spaces before passing them as the single
argument of `/bin/sh -c`. This however produces unexpected results as
soon as shell quoting gets involved in the arguments passed to spawn.
For example, running

riverctl spawn foo "bar baz"

will execute `/bin/sh -c "foo bar baz"`, unexpectedly splitting bar and
baz into separate arguments. To avoid this confusion, make the spawn
command take only a single argument, forcing the user to quote properly
to spawn multi-argument commands.
2021-07-21 14:07:49 +02:00
Isaac Freund
2635f3299a
river-layout: update to v3
- Remove advertise_view and advertise_done events. Using the information
provided by these for any purpose would make the layout far less
predictable. Futhermore, in the months this has been available for use,
to my knowledge nobody has actually used it for anything useful.

- Replace the set/mod layout value events with a single user_command
event. This simplifies the protocol and is more flexible for clients.

- Add a layout_name argument to the commit request. This name is an
arbitrary, user-facing string that might, for example, be displayed by a
status bar. This was present in early drafts of the protocol, but was
removed in favor of river-options. Since river-options itself has since
been removed and this feature is nice to have, re-add it.

- Rename main factor to main ratio in rivertile. The "factor" name was
just legacy from dwm, "ratio" is much more accurate.
2021-07-20 10:48:11 +02:00
Isaac Freund
96e1082156 river: remove opacity command
This code is complex and increases maintenance burden but doesn't
add any functionality, only eye-candy.

Futhermore, neither I nor any of the core contributors use it.

There may be a place in river for such eye-candy down the line, in which
case this code could be revived. Currently river is early enough in its
development that our focus should be on core functionality instead.
2021-07-20 08:47:02 +00:00
Viktor Nagy
28fc8792d7 river: add focus-previous-tags command 2021-07-15 12:00:22 +00:00
Isaac Freund
604cf98047
command: make args type 0-terminated
Since we often need to pass these args back C code, keeping the 0 byte
around saves some allocations.
2021-07-15 13:32:33 +02:00
Isaac Freund
7b18b4944e config: use hash sets for filters, clean up code 2021-07-12 17:57:01 +00:00
Leon Henrik Plickat
968aef3459 river: make CSD-filters apply to existing views 2021-07-12 17:57:01 +00:00
Leon Henrik Plickat
9ec04c764e river: add commands to remove filter entries 2021-07-12 17:57:01 +00:00
Leon Henrik Plickat
085cca0d5e cursor: add option to warp on output change
On output change, if the cursor is not already on the newly focused
output, it will now be warped to its center. The check is necessary,
since focusing outputs with the pointer will be implemented in
the future.
2021-06-26 19:03:49 +02:00
Leon Henrik Plickat
d3a9e96f7d Add spacial output operations
List based output operations are tedious for complex output layouts.
2021-06-23 12:47:20 +02:00
Isaac Freund
5daec347c0
render: damage on background/border color change 2021-06-16 17:42:09 +00:00
Leon Henrik Plickat
a267262a17 Add list-input-configs command 2021-06-13 10:37:36 -07:00
Leon Henrik Plickat
3f4fd97b6e Add list-inputs command 2021-06-13 10:37:36 -07:00
Leon Henrik Plickat
833248e805 Add basic input configuration 2021-06-13 10:37:36 -07:00
novakane
2e7c1dbe6a config: make attach-mode global 2021-06-08 18:26:36 +00:00
Isaac Freund
c0a2286847
code: update to zig 0.8.0 2021-06-05 17:29:58 +00:00
Isaac Freund
c8b1017923
river: remove Seat.input_manager
This is no longer needed as server is global.
2021-05-13 15:13:17 +02:00
Isaac Freund
ece465b7ed
river: remove InputManager.server
The server is now global so this is no longer needed.
2021-05-13 14:53:08 +02:00
Isaac Freund
ac27db236a
river: remove Output.root
The server is now global so this is no longer needed.
2021-05-13 14:35:36 +02:00
Isaac Freund
89e0d4c083
river: remove Root.server
The server is now global so this is no longer needed.
2021-05-13 14:26:27 +02:00
Isaac Freund
e80b883a47 river-layout: update to v2
This implements the changes to the river-layout protocol proposed
in the previous commit removing river-options.
2021-04-27 00:10:20 +02:00
Isaac Freund
a6f908d7eb river: get rid of all server-created options
- Replace the layout option with new default-layout and output-layout
commands.
- Remove the ability to get/set the output title entirely.
2021-04-27 00:10:20 +02:00
Leon Henrik Plickat
f72656b72e river-layout: create and implement protocol
Replace the current layout mechanism based on passing args to a child
process and parsing it's stdout with a new wayland protocol. This much
more robust and allows for more featureful layout generators.

Co-authored-by: Isaac Freund <ifreund@ifreund.xyz>
2021-04-20 18:27:03 +02:00
Isaac Freund
6470d8c776
command: silently ignore re-declaring a mode
This change is made in the interest of allowing users to simply re-run
their init script at runtime without errors. Making this an error
doesn't really gain us anything.
2021-02-14 18:13:15 +01:00
Isaac Freund
5c0be25142
command: allow map/map-pointer overwrite existing
The ergonomics of remapping keys are currently quite bad as unmap
must first be called for every mapping before defining a new one.
Any benefit that might be gained by the current strictness of map/
map-pointer is outweighed by this fact.

In a similar spirit, silently ignore unmapping a non-existent mapping.
2021-02-14 18:08:55 +01:00
Alexey Yerin
945b7dc986 swap: use correct direction for it_wrap
Always using .forward results in a crash when running `swap previous` on
the first view in stack which should be wrapped.
2021-02-10 10:53:00 +01:00
Isaac Freund
a586c1ad71
code: remove unneeded c.zig @import()s 2021-01-12 10:28:11 +01:00
Marten Ringwelski
30ba87fa15
command: Implement spawn-tagmask 2021-01-02 11:39:09 +01:00
Isaac Freund
4984944c60
Config: move opacity settings to sub struct 2020-12-31 15:52:03 +01:00
Isaac Freund
ba9df86472
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.
2020-12-30 18:15:47 +01:00
Isaac Freund
5f4ba06566
docs: improve explanation of tags
"tagmask" is a misleading term as the arguments are used much more like
a set of tags than a mask.
2020-12-30 14:25:37 +01:00
Isaac Freund
c51f2176b3
view: unify clamped move logic, fix overflow 2020-12-27 01:06:18 +01:00
Isaac Freund
1732c69442
keyboard: set repeat_info to config values on creation 2020-12-26 19:17:24 +01:00
Isaac Freund
20d804cdb5 code: switch to custom wlroots/libwayland bindings
This is a big step up over @cImport() for ergonomics and type safety.
Nearly all void pointer casts have been eliminated!
2020-12-13 22:53:33 +01:00
Bonicgamer
cbd4a2807b
control: implement set-repeat 2020-11-18 15:28:33 +01:00
Isaac Freund
f80992e329
meta: make copyright headers more maintainable
- list all files as copyright "The River Developers"
- add an AUTHORS file to acknowledge contributors
2020-11-11 20:33:43 +01:00
Marten Ringwelski
9a2e11620c Implement unmap-pointer 2020-10-27 00:32:20 +01:00
Marten Ringwelski
882a271d81 Implement unmap 2020-10-27 00:32:20 +01:00
Marten Ringwelski
3f1b0dfaa9
control: implement swap 2020-10-25 12:41:19 +01:00
Marten Ringwelski
16c8752de2
code: Remove allocator argument from Mapping.init 2020-10-25 12:22:25 +01:00
Isaac Freund
e179690a9c
code: update os.waitpid usage for breaking change 2020-10-22 18:20:09 +02:00
Leon Henrik Plickat
03a2da9690 Introduce mode "locked"
This mode is automatically entered when the screen is locked.
2020-10-19 16:00:17 +02:00
Leon Henrik Plickat
4b4f7c464c Allow "None" as modifier string for bindings without modifiers
This is more userfriendly than the empty string approach.
2020-10-18 16:36:11 +02:00
Leon Henrik Plickat
d4ca5d7a88 introduce Output.getEffectiveResolution() 2020-10-07 21:03:59 +02:00
Leon Henrik Plickat
b2f13f5bcc Implement "move", "snap" and "resize" commands 2020-10-07 21:03:59 +02:00
Leon Henrik Plickat
b67ea748a3 Implement configurable view opacity with fade effect 2020-10-05 23:03:57 +02:00
Isaac Freund
27b666dbba
code: update to zig master in prep for 0.7.0
This commit makes the minimal necessary changes to get things working,
there are further changes which can be made to take advantage of new
features.
2020-10-02 20:34:24 +02:00
Isaac Freund
2b77be8c87
seat: start transaction on focus-output
This fixes a delay due to the missing startTransaction() call causing
unapplied pending state.
2020-09-30 11:16:27 +02:00
Isaac Freund
3e955935eb
docs: use foot in the example config.sh 2020-09-28 22:57:22 +02:00
Marten Ringwelski
52cd871151 Implement map -release 2020-09-15 15:58:54 +02:00
Marten Ringwelski
7e02fb679c Implement focus-follows-cursor 2020-09-15 15:15:55 +02:00
Isaac Freund
989e7aaeda
config: implement map-pointer command
This command takes a mode, modifiers, button/event name, and pointer
action as arguments. It stores these in the config data structure.

The currently available pointer actions are move-view and resize-view,
which replace the previously hard-coded functionality.

Closing the hovered view with middle click has temorarily been removed
until it is decided if we wish to make this another special pointer
action or perhaps allow running any arbitrary command (which would of
course include close).
2020-08-24 18:57:43 +02:00
Isaac Freund
fd8c5e6410
style: attach_mode() -> attachMode() 2020-08-24 11:50:38 +02:00
Isaac Freund
db416eb119 view stack: rework iteration for flexibility
There is now a single iter() function which accepts a filter and context
allowing users of the api to filter the views in any arbitrary way. This
change allowed for a good amount of code cleanup, and this commit also
ensures that the correct properties are checked in each case, including
the new View.destroying field added in the previous commit. This fixes
at least one crash involving switching focus to a destroying view.
2020-08-21 16:31:39 +02:00
Leon Henrik Plickat
59d6432332 Implement "attach-mode" 2020-08-18 11:00:51 +02:00
Isaac Freund
7a6ac8eb6e seat: set focus before starting transactions
Focus was made double-buffered in 96a91fd. However, much of the code
still behaved as if focus was separate from the transaction system.
This commit completes the work started in 96a91fd and ensures that
focus is applied consistently in a single transaction.
2020-08-13 11:17:15 +02:00
Isaac Freund
2669a615b6 root: refactor transaction initiation
- require the caller to use Root.startTransaction() directly
- introduce View.applyPending() to unify logic
- introduce View.shouldTrackConfigure() to unify more logic
- update all callsites to intelligently rearrange only what is necessary
2020-08-13 11:17:15 +02:00
Isaac Freund
ef4efbcadf
view: fix xdg_toplevel fullscreen request handling 2020-08-01 19:56:34 +02:00
Isaac Freund
d2ebd5e4e2
view: remember floating dimesions
When a floating view is returned to the layout or made fullscreen, it
now saves the dimesions it had while floating and returns to that same
position/size if made to float again.
2020-07-31 20:22:37 +02:00
Isaac Freund
7a244092e5 view: sidestep transaction for float/fullscreen
Transactions are only useful when multiple views need to atomically
change size together. Float/fullscreen views are independant of the
layout and should bypass the transaction system.
2020-07-31 17:06:26 +02:00
Isaac Freund
d87356c93a view: forbid mode change if cursor target
Making a floating view tiled during a resize breaks things badly.
2020-07-31 17:06:26 +02:00
Leon Henrik Plickat
a93c263502 Implement csd-filter-add and float-filter-add commands 2020-07-16 21:24:08 +02:00
Isaac Freund
101f47d78f
code: use a tagged union to store focus
This simplifies the code and is more robust than two separate pointers.
2020-07-15 14:15:17 +02:00
Isaac Freund
8afe7c2c87
code: simplify direction parsing 2020-07-15 13:03:28 +02:00
Isaac Freund
2b2b78dd4d
command: split set-option into "toplevel" commands
`riverctl set-option view_padding 10` becomes `riverctl view-padding 10`

Having set-option doesn't really gain us anything and is more verbose as
well as being slightly inaccurate as the changes instantly apply.
2020-07-15 12:42:20 +02:00
Isaac Freund
6bdb152808
cursor: make xcursor theme configurable
- add a new command to set the theme
- export the theme of the default seat through environment variables
2020-07-14 17:34:29 +02:00
Isaac Freund
f3d4e5ac53
command/spawn: use _exit(2) instead of exit(3)
Something in exit(3) is causing the intermediate fork to segfault.
2020-07-12 12:16:05 +02:00
Isaac Freund
cbf645d468
command/spawn: clean up and disown children
- Call setsid
- Clean up the signal mask.
- Use a double fork so that processes get inherited by init.
2020-07-08 14:00:51 +02:00
Isaac Freund
86386e84bc
output: introduce state struct
This simplifies the handling of the current/pending tags and will be
used in the future for atomic layout updates involving layer surface
exclusive zones.
2020-07-02 21:56:26 +02:00
Isaac Freund
34d42d9e8c
xdg-shell: honor fullscreen requests 2020-06-29 11:52:53 +02:00
Isaac Freund
c78d31acf4
view: save and restore floating dimensions
When a floating view is fullscreened and returned to floating, it should
remember its previous floating size/position.
2020-06-29 11:15:55 +02:00
Isaac Freund
acd08840ab
command: disable focus-view in fullscreen 2020-06-29 01:04:37 +02:00
Isaac Freund
3cbd95fadc
river: implement toggle-fullscreen
The command works, but behaves a little strangely. Also, fullscreen
views are not yet rendered on an opqaue backdrop.
2020-06-29 01:00:57 +02:00
Isaac Freund
5b96d831d3
view: replace mode with float/fullscreen bools
The enum would be awkward here since if a view is fullscreened while
floating it should still be floating when defullscreened.
2020-06-28 20:30:12 +02:00
Isaac Freund
9dfcec72a8
view: simplify default float dimension handling 2020-06-27 23:48:04 +02:00
Isaac Freund
c04112b81a
view: introduce state struct to simplify code
The state struct holds all of the state that is double-buffered and
applied through transactions. This more explicit handling simplifies
much of the code, and will allow for easier implementation of new
feature such as fullscreen.
2020-06-27 23:18:41 +02:00
Isaac Freund
89d0fb012d
view: use a mode enum instead of floating bool
This is in preperation for fullscreen support which will add another
mode to this enum.

This commit also fixes a bug that allowed clicking floating views though
layout views in some cases.
2020-06-27 18:12:18 +02:00
Isaac Freund
40597f184d
command: allow output on success, refactor 2020-06-26 17:57:03 +02:00
Isaac Freund
dfb03fd0cb
command: dupe mode name memory
The hashmap doesn't take ownership of the memory pointer to by these
slices, so we need to dupe them to avoid use-after-free.
2020-06-26 12:46:18 +02:00
Isaac Freund
ebc661f4a7
command: add background_color option
This is trivial to support and allows basic customization without
running a layer-shell program such as swaybg. This is especially useful
in low memory situations.
2020-06-19 18:44:28 +02:00
Leon Henrik Plickat
5de21d0d23 Commands: rework layout command 2020-06-16 15:48:53 +02:00
Isaac Freund
c2d32a44c3
command: add view_padding option 2020-06-13 13:32:35 +02:00
Isaac Freund
4f029aa5c7
command: allow alpha in colors, simplify code 2020-06-13 13:09:43 +02:00
Isaac Freund
40c62577e1
code: simplify option handling 2020-06-13 12:14:36 +02:00
lazy-dolphin
efe2c2ce4b command: add border_focused_color and border_unfocused_color options 2020-06-13 11:53:39 +02:00
Isaac Freund
8839ae7335
command: don't zoom floating views 2020-06-11 01:15:01 +02:00
lazy-dolphin
1b7c1c7b2c command: implement set-option
Only border and padding options are currently available.
2020-06-10 18:08:21 +02:00
Isaac Freund
2b10720366
map: allow creating mappings with no modifiers 2020-06-05 10:54:39 +02:00
Isaac Freund
5aa7fe8af8
river-status: implement protocol 2020-06-04 16:56:58 +02:00
Isaac Freund
ea7f5d4064
Use tag masks for tag commands and clean up 2020-06-02 16:38:23 +02:00
Isaac Freund
0e9ecb6051
Rename focus -> focus-view 2020-06-02 14:04:23 +02:00
Isaac Freund
c63420cf45
Use + instead of | to separate modifiers
Although | makes more logical sense, it has another meaning in most
shells.
2020-06-01 20:50:22 +02:00
Isaac Freund
939beef168
Split river and riverctl directories 2020-06-01 15:56:50 +02:00