{"record":{"id":"f852eaaf1f9125de","repo":"elkowar/eww","slug":"could-not-get-default-display","errorCode":null,"errorMessage":"could not get default display","messagePattern":"could not get default display","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eww/src/app.rs","lineNumber":153,"sourceCode":"    pub phantom: PhantomData<B>,\n}\n\nimpl<B: DisplayBackend> std::fmt::Debug for App<B> {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.debug_struct(\"App\")\n            .field(\"scope_graph\", &*self.scope_graph.borrow())\n            .field(\"eww_config\", &self.eww_config)\n            .field(\"open_windows\", &self.open_windows)\n            .field(\"failed_windows\", &self.failed_windows)\n            .field(\"window_arguments\", &self.instance_id_to_args)\n            .field(\"paths\", &self.paths)\n            .finish()\n    }\n}\n\n/// Wait until the .model() is available for all monitors (or there is a timeout)\nasync fn wait_for_monitor_model() {\n    let display = gdk::Display::default().expect(\"could not get default display\");\n    let start = std::time::Instant::now();\n    loop {\n        let all_monitors_set =\n            (0..display.n_monitors()).all(|i| display.monitor(i).and_then(|monitor| monitor.model()).is_some());\n        if all_monitors_set {\n            break;\n        }\n        tokio::time::sleep(Duration::from_millis(10)).await;\n        if std::time::Instant::now() - start > Duration::from_millis(500) {\n            log::warn!(\"Timed out waiting for monitor model to be set\");\n            break;\n        }\n    }\n}\n\nimpl<B: DisplayBackend> App<B> {\n    /// Handle a [`DaemonCommand`] event, logging any errors that occur.\n    pub async fn handle_command(&mut self, event: DaemonCommand) {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/elkowar/eww/blob/48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa/crates/eww/src/app.rs#L135-L171","documentation":"`wait_for_monitor_model` polls the GDK display until every connected monitor reports a model string, which eww uses to build its monitor model. `gdk::Display::default()` returned `None`, meaning no default display is available in this process, and the `expect` panics with this message. Without a display there is nothing to wait on.","triggerScenarios":"Calling `try_handle_command` → `wait_for_monitor_model` in an environment where GTK/GDK cannot open a default display: no X server/Wayland compositor, or DISPLAY/WAYLAND_DISPLAY unset.","commonSituations":"Running `eww` commands from a systemd service, cron job, SSH session, or TTY where `DISPLAY` is not set; starting eww before the compositor/X server.","solutions":["Ensure `DISPLAY` (X11) or `WAYLAND_DISPLAY`/`XDG_RUNTIME_DIR` env vars are set to a live session before invoking eww.","Run eww inside the graphical session, e.g. via `systemctl --user import-environment DISPLAY WAYLAND_DISPLAY` or launching from the compositor's autostart.","Retry after the window manager/session is up; the call will succeed once a display exists."],"exampleFix":"// before (crontab/systemd unit)\nExecStart = eww daemon\n// after\nExecStart = /bin/sh -c '. $HOME/.profile && exec eww daemon'  # with DISPLAY exported","handlingStrategy":"try-catch","validationCode":"if std::env::var(\"DISPLAY\").is_err() && std::env::var(\"WAYLAND_DISPLAY\").is_err() {\n    eprintln!(\"no graphical session: set DISPLAY or WAYLAND_DISPLAY before running eww\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"match gdk::Display::default() {\n    Some(display) => /* poll monitors */,\n    None => eprintln!(\"no default display; is the graphical session running?\"),\n}","preventionTips":["Launch eww from within the graphical session or a systemd user unit that imports DISPLAY/WAYLAND_DISPLAY.","Delay eww start until the compositor/X server is up.","Check `echo $DISPLAY` / `$WAYLAND_DISPLAY` in the exact environment eww runs in."],"tags":[],"backgroundTag":null,"analyzedSha":"48f5aa8b379adf29da0b0bb9ca04164f65d8bdaa","analyzedAt":"2026-09-08T03:13:26.897Z","contentChangedAt":"2026-09-08T03:13:26.897Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}