Toqozz / wired-notify

Lightweight notification daemon with highly customizable layout blocks, written in Rust.
MIT License
608 stars 28 forks source link

Feature: Display notifications on both/multiple/all monitors #67

Closed Swivelgames closed 2 years ago

Swivelgames commented 2 years ago

I noticed that there's support for focus following the mouse, some notifications are still missed. Having a multi-monitor setup, I often miss notifications if I'm looking at another screen.

To keep this ticket/story/request short and sweet, it would be great to have the ability to display notifications on all monitors simultaneously.

Toqozz commented 2 years ago

This is possible, just duplicate your layout but set the monitor differently! I'll update this with an example once I'm home.

Admittedly a bit cumbersome, but gives you more control over the position etc for each monitor.

Toqozz commented 2 years ago

So that'd look something like this:

// wired.ron
// ...
layout_blocks: [
    // First layout, to appear on monitor 0.
    (
        name: "root_0",
        parent: "",
        hook: Hook(parent_anchor: TL, self_anchor: TL),
        offset: Vec2(x: 7.0, y: 7.0),
        //render_criteria: [HintImage],
        // https://github.com/Toqozz/wired-notify/wiki/NotificationBlock
        params: NotificationBlock((
            monitor: 0,          // <---------------------------------------------------------------------------
            border_width: 3.0,
            border_rounding: 3.0,
            //background_color: Color(r: 0.15686, g: 0.15686, b: 0.15686, a: 1.0),
            background_color: Color(hex: "#282828"),
            border_color: Color(hex: "#ebdbb2"),
            border_color_low: Color(hex: "#282828"),
            border_color_critical: Color(hex: "#fb4934"),
            border_color_paused: Color(hex: "#fabd2f"),

            gap: Vec2(x: 0.0, y: 8.0),
            notification_hook: Hook(parent_anchor: BL, self_anchor: TL),
        )),
    ),
    (
        name: "summary_0",
        parent: "root_0",
        hook: Hook(parent_anchor: TL, self_anchor: TL),
        offset: Vec2(x: 0.0, y: 0.0),
        params: TextBlock((
            text: "%s",
            font: "Arial Bold 11",
            ellipsize: Middle,
            color: Color(hex: "#ebdbb2"),
            color_hovered: Color(hex: "#fbf1c7"),
            padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 0.0),
            dimensions: (width: (min: 50, max: 150), height: (min: 0, max: 0)),
        )),
    ),
    (
        name: "body_0",
        parent: "summary_0",
        hook: Hook(parent_anchor: BL, self_anchor: TL),
        offset: Vec2(x: 0.0, y: -3.0),
        params: ScrollingTextBlock((
            text: "%b",
            font: "Arial 11",
            color: Color(hex: "#ebdbb2"),
            color_hovered: Color(hex: "#fbf1c7"),
            padding: Padding(left: 7.0, right: 7.0, top: 3.0, bottom: 7.0),
            width: (min: 150, max: 250),
            scroll_speed: 0.1,
            lhs_dist: 35.0,
            rhs_dist: 35.0,
            scroll_t: 1.0,
        )),
    ),

    // Second layout, to appear on monitor 1.
    (
        name: "root_1",
        parent: "",
        hook: Hook(parent_anchor: TL, self_anchor: TL),
        offset: Vec2(x: 7.0, y: 7.0),
        //render_criteria: [HintImage],
        // https://github.com/Toqozz/wired-notify/wiki/NotificationBlock
        params: NotificationBlock((
            monitor: 1,          // <---------------------------------------------------------------------------
            border_width: 3.0,
            border_rounding: 3.0,
            //background_color: Color(r: 0.15686, g: 0.15686, b: 0.15686, a: 1.0),
            background_color: Color(hex: "#282828"),
            border_color: Color(hex: "#ebdbb2"),
            border_color_low: Color(hex: "#282828"),
            border_color_critical: Color(hex: "#fb4934"),
            border_color_paused: Color(hex: "#fabd2f"),

            gap: Vec2(x: 0.0, y: 8.0),
            notification_hook: Hook(parent_anchor: BL, self_anchor: TL),
        )),
    ),
    (
        name: "summary_1",
        parent: "root_1",
        hook: Hook(parent_anchor: TL, self_anchor: TL),
        offset: Vec2(x: 0.0, y: 0.0),
        params: TextBlock((
            text: "%s",
            font: "Arial Bold 11",
            ellipsize: Middle,
            color: Color(hex: "#ebdbb2"),
            color_hovered: Color(hex: "#fbf1c7"),
            padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 0.0),
            dimensions: (width: (min: 50, max: 150), height: (min: 0, max: 0)),
        )),
    ),
    (
        name: "body_1",
        parent: "summary_1",
        hook: Hook(parent_anchor: BL, self_anchor: TL),
        offset: Vec2(x: 0.0, y: -3.0),
        params: ScrollingTextBlock((
            text: "%b",
            font: "Arial 11",
            color: Color(hex: "#ebdbb2"),
            color_hovered: Color(hex: "#fbf1c7"),
            padding: Padding(left: 7.0, right: 7.0, top: 3.0, bottom: 7.0),
            width: (min: 150, max: 250),
            scroll_speed: 0.1,
            lhs_dist: 35.0,
            rhs_dist: 35.0,
            scroll_t: 1.0,
        )),
    ),
],