No description
Find a file
Beat Küng 0e409d4a52
Improve multi-monitor handling under wayland (#1276)
* fix: improve multi-monitor handling under wayland

When a monitor gets disconnected, the destroy event of all associated
windows gets called, and the window gets removed.

This patch changes that behavior: the window is still closed but the
configuration is kept using the existing reload mechanism.
In addition, a callback is added to listen for new monitors, triggering
a reload when a new monitor gets connected.

This logic also reloads already running windows, which has a positive and
negative effect:
- positive: if currently running e.g. on the second monitor specified in
  the list, the window can get moved to the first monitor
- negative: if reloading starts it on the same monitor, it gets reset
  (e.g. graphs)

I also had to work around an issue: the monitor model is not yet available
immediately when a new monitor callback triggers. Waiting in the callback
does not help (I tried 10 seconds). However, waiting outside, it always
became available after 10ms.

Tested with a dual monitor setup under KDE through a combinations of:
- enabling/disabling individual monitors
- switching between monitors
- specifying a specific monitor in the yuck config
- specifying a list of specific monitors in the yuck config

In all these cases the behavior is as expected, and the widget gets loaded
on the first available monitor (or stays unloaded until one becomes
available).
It also works when opening a window without any of the configured monitors
being available.

There is one remaining error from GTK when closing the window:
GLib-GObject-CRITICAL **: 20:06:05.912: ../gobject/gsignal.c:2684: instance '0x55a4ab4be2d0' has no handler with id '136'
This comes from the `self.gtk_window.disconnect(handler_id)` call. To
prevent that we'd have to reset `destroy_event_handler_id`.

* fix: do not call gtk::main_iteration_do while waiting for monitor model

Executors that poll a future cannot be called recursively (in this case
glib::main_context_futures::TaskSource::poll).
So we cannot call gtk::main_iteration_do here, which in some cases led to
the future being polled again, which raised a panic in the form of:
thread 'main' panicked at glib/src/main_context_futures.rs:238:56:
called `Result::unwrap()` on an `Err` value: EnterError

We can just remove it as tokio::time::sleep() ensures the main thread
continues to process (gtk) events during that time.
2025-06-17 09:48:34 +02:00
.github fix bug_report issue template even more 2024-10-11 15:36:21 +02:00
crates Improve multi-monitor handling under wayland (#1276) 2025-06-17 09:48:34 +02:00
docs fix documentation of ceil and floor (fixes #1319) 2025-05-13 23:09:23 +02:00
examples feat: Add support for on-demand window focus on wayland (#1215) 2024-12-27 00:44:06 +01:00
.editorconfig CI/CD & Formatting (#6) 2020-10-18 23:25:00 +02:00
.gitignore heavily refactor nix flake (#532) 2022-08-21 23:09:54 +02:00
Cargo.lock Fix crash on invalid formattime (#1317) 2025-05-18 15:39:46 +02:00
Cargo.toml revert: zbus 4 -> 3 (#1203) 2024-09-26 19:22:24 +02:00
CHANGELOG.md Improve multi-monitor handling under wayland (#1276) 2025-06-17 09:48:34 +02:00
default.nix nix: update flake-compat (#1197) 2024-10-10 19:25:09 +02:00
flake.lock feat: update toolchain to 1.81.0 (#1195) 2024-10-10 19:26:00 +02:00
flake.nix nix: update flake-compat (#1197) 2024-10-10 19:25:09 +02:00
gen-docs.ts Fix some types missing in widget docs 2022-05-26 15:00:34 +02:00
LICENSE Add MIT license 2020-10-18 23:25:48 +02:00
README.md Add wikipedia link to widget essay 2025-04-27 00:47:45 +02:00
rust-toolchain.toml feat: update toolchain to 1.81.0 (#1195) 2024-10-10 19:26:00 +02:00
rustfmt.toml Remove nightly options from rustfmt.toml 2024-02-17 14:14:46 +01:00
shell.nix nix: update flake-compat (#1197) 2024-10-10 19:25:09 +02:00
YUCK_MIGRATION.md Clean up example bar 2021-08-18 16:21:04 +02:00

dependency status

Eww

Elkowars Wacky Widgets is a standalone widget system made in Rust that allows you to implement your own, custom widgets in any window manager.

Documentation and instructions on how to install can be found here.

Dharmx also wrote a nice, beginner friendly introductory guide for eww here.

Check out another cool project by me

I'm currently busy working yolk, which is a dotfile management solution that supports a unique spin on templating: templating without template files.

To find out more, check out the website and documentation!

Examples

(Note that some of these still make use of the old configuration syntax.)

Rxyhn-rice

eww-top-bar

Activate Linux

Contribewwting

If you want to contribute anything, like adding new widgets, features, or subcommands (including sample configs), you should definitely do so.

Steps

  1. Fork this repository
  2. Install dependencies
  3. Smash your head against the keyboard from frustration (coding is hard)
  4. Write down your changes in CHANGELOG.md
  5. Open a pull request once you're finished

Widget

https://en.wikipedia.org/wiki/Wikipedia:Widget