### RON: Wired Configuration Example Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks A configuration snippet in RON format showing how to define layout blocks, including a `TextBlockDemo` with specific text, font, color, padding, and dimensions. ```ron // ~/.config/wired/wired.ron ...layout_blocks: [ ( name: "root", parent: "", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 7.0, y: 7.0), params: NotificationBlock(( ... )), ), ( name: "summary", parent: "root", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 0.0, y: 0.0), params: TextBlockDemo(( text: "%s", font: "Arial Bold 10", color: Color(hex: "#ebdbb2"), padding: Padding(left: 20.0, right: 20.0, top: 20.0, bottom: 20.0), dimensions: (width: 150.0, height: 50.0), // struct names are optionally omitted in config. )), ), ... ], ... ``` -------------------------------- ### NetBSD Installation of Wired-Notify Source: https://github.com/toqozz/wired-notify/blob/master/README.md Instructions for installing Wired-Notify on NetBSD using the 'pkgin' package manager or by building from source via 'pkgsrc'. ```Shell $ pkgin install wired-notify ``` ```Shell $ cd /usr/pkgsrc/x11/wired-notify $ make install ``` -------------------------------- ### Build Wired Notify Project with Cargo Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Builds the Wired Notify project using the Cargo build tool. This command verifies the Rust installation and checks for project dependencies. Failures may indicate an outdated Rust installation, missing dependencies, or project configuration issues. ```sh $ cargo build ``` -------------------------------- ### Install Wired via AUR (Shell) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Commands to install Wired from the Arch User Repository (AUR) using yay. Includes installation for the stable version and a `-git` version tracking the master branch. ```Shell yay -S wired yay -S wired-git ``` -------------------------------- ### Shell: Sending a Notification Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Demonstrates how to send a simple notification using the `notify-send` command-line utility. ```sh $ notify-send "Just the summary." ``` -------------------------------- ### Clone Wired Notify Repository Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Clones the forked Wired Notify repository from GitHub and navigates into the project directory. This is the first step in setting up the development environment. ```sh $ git clone https://github.com//wired-notify.git $ cd ./wired_notify ``` -------------------------------- ### Install Wired to User Profile (Nix) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Command to install Wired to the user's profile using Nix. Note that the systemd service will not be available with this installation method. ```Nix nix profile install 'github:Toqozz/wired-notify' ``` -------------------------------- ### ButtonBlock Configuration Example Source: https://github.com/toqozz/wired-notify/wiki/ButtonBlock Demonstrates the basic configuration of a ButtonBlock with required properties like padding, action, text, and styling. It also shows optional properties for hover effects and text alignment. ```rust ButtonBlock { padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 7.0), action: DefaultAction, text: "%a", font: "Arial Bold 10", border_width: 3.0, border_rounding: 3.0, text_color: Color(hex: "#ebdbb2"), border_color: Color(hex: "#ebdbb2"), background_color: Color(hex: "#282828"), dimensions: (width: (min: 0, max: 150), height: (min: 0, max: 0)), text_color_hovered: Color(hex: "#fbf1c7"), border_color_hovered: Color(hex: "#fbf1c7"), background_color_hovered: Color(hex: "#fbf1c7"), ellipsize: Middle, align: Center } ``` -------------------------------- ### Create Text Block File Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks This command creates a new Rust file for the TextBlock within the project's source directory. ```sh $ touch ./src/rendering/blocks/text_block_demo.rs ``` -------------------------------- ### Fedora/RHEL Wired-Notify Installation Script Source: https://github.com/toqozz/wired-notify/blob/master/README.md This snippet demonstrates how to execute the installation script for Wired-Notify on Fedora, CentOS, and other RHEL-based distributions. It includes changing directory, making the script executable, and running it with sudo. ```Shell $ cd wired-notify $ chmod +x installer.sh $ sudo ./installer.sh ``` -------------------------------- ### Shell: Running Wired Application Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Provides the command to compile and run the Wired application using Cargo. It also shows how to handle potential conflicts with existing notification daemons. ```sh $ cargo run Compiling wired v0.8.0 (/home/toqoz/code/rust/wired) Finished dev [unoptimized + debuginfo] target(s) in 4.51s Running `target/debug/wired` In queue for notification bus name -- is another notification daemon running? ``` ```sh $ pkill wired $ cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.06s Running `target/debug/wired` Acquired notification bus name. DBus Init Success. ``` -------------------------------- ### Running Wired Application via Autostart Source: https://github.com/toqozz/wired-notify/blob/master/README.md This shows the command to add to your autostart script to launch the Wired application in the background when your session starts. ```Shell /path/to/wired & ``` -------------------------------- ### Predict Rect and Initialize TextBlock Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Calculates the initial position and size of the TextBlock, including text replacement and padding. This method is called once at window creation. ```rust use crate::maths_utility::{Vec2, Rect}; use crate::rendering::layout::{DrawableLayoutElement, LayoutBlock, Hook}; use crate::rendering::text::EllipsizeMode; use crate::config::Config; impl DrawableLayoutElement for TextBlockDemoParameters { fn predict_rect_and_init(&mut self, hook: &Hook, offset: &Vec2, parent_rect: &Rect, window: &NotifyWindow) -> Rect { // Replace our text in the config with notification text. // This has a bug, so don't use it in production. // See https://github.com/Toqozz/wired-notify/blob/master/src/rendering/blocks/text_block.rs for details. let text = self.text.clone().replace("%s", &window.notification.summary).replace("%b", &window.notification.body); // Every window has a text render component attached to help with some text operations: https://github.com/Toqozz/wired-notify/blob/master/src/rendering/text.rs window.text.set_text(&text, &self.font, self.dimensions.width, self.dimensions.height, &EllipsizeMode::default()); // Get the rect surrounding this text, plus padding. let mut rect = window.text.get_sized_padded_rect(&self.padding, &self.dimensions.width, &self.dimensions.height); // Cache the text, so we don't have to do string replacement every iteration. self.real_text = text; // Lastly we need to position our rect correctly. To do this, just feed `find_anchor_pos()` the provided parameters and // your new rect, and it will find the appropriate x, y coordinates. let pos = LayoutBlock::find_anchor_pos(hook, offset, parent_rect, &rect); rect.set_xy(pos.x, pos.y); rect } fn draw(&self, _hook: &Hook, _offset: &Vec2, parent_rect: &Rect, window: &NotifyWindow) -> Rect { // For drawing, wired uses rust bindings for the Cairo 2D graphics library. // Check out the documentation (https://www.cairographics.org/documentation/) and the rust bindings (https://docs.rs/cairo-rs/0.9.1/cairo/struct.Context.html) to learn more. // All drawing from this point should draw over the background. window.context.set_operator(cairo::Operator::Over); window.text.set_text(&self.real_text, &self.font, &self.dimensions.width, &self.dimensions.height as i32, &EllipsizeMode::default()); // Since our rect doesn't update or move, it would be more efficient to cache this rect and just use that, but we're lazy. ``` -------------------------------- ### ScrollingTextBlock Configuration Example Source: https://github.com/toqozz/wired-notify/wiki/ScrollingTextBlock This snippet demonstrates how to configure the ScrollingTextBlock with various properties like text, font, color, and scrolling distances. ```rust ScrollingTextBlock { padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 7.0), text: "%s", font: "Arial Bold 10", color: Color(hex: "#ebdbb2"), width: (min: 150, max: 250), scroll_speed: 0.1, lhs_dist: 35.0, rhs_dist: 35.0, scroll_t: 1.0, color_hovered: Color(hex: "#fbf1c7"), width_image_hint: (min: 150, max: 250), width_image_app: (min: 150, max: 250), width_image_both: (min: 150, max: 250), backtrack_scroll_pos: true, } ``` -------------------------------- ### Rust: Paint Text with Padding Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Demonstrates how to paint text with applied padding using the `paint_padded` function in Rust. It calculates the position and then renders the text, ensuring correct spacing. ```rust let mut rect = window.text.get_sized_padded_rect(&self.padding, &self.dimensions.width, &self.dimensions.height); let mut pos = LayoutBlock::find_anchor_pos(hook, offset, parent_rect, &rect); // Text is rendered starting from the top left hand corner of the provided position. Since our rect has padding applied, we need // to add that padding to actually draw with padding. // `paint_padded()` does this work for you. window.text.paint_padded(&window.context, &pos, &self.color, &self.padding); rect.set_xy(pos.x, pos.y); rect } } ``` -------------------------------- ### Install Wired for All Users in NixOS (Nix) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Configuration snippet for NixOS to install Wired for all users, specifying the Nixpkgs channel and the Wired repository. Requires Nix 2.8+ with experimental features enabled. ```Nix { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; wired.url = "github:Toqozz/wired-notify"; }; outputs = { self, nixpkgs, wired }: let std = nixpkgs.lib; system = "x86_64-linux"; in { nixosConfigurations.alice = std.nixosSystem { inherit system; modules = [ ./configuration.nix { environment.systemPackages = [ wired.packages.${system}.wired ]; } ]; }; }; } ``` -------------------------------- ### Rust: Exporting New Blocks in mod.rs Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Shows how to export newly created block modules in `src/rendering/blocks/mod.rs`. This makes the new blocks accessible to other parts of the application. ```rust pub mod notification_block; pub mod text_block; pub mod scrolling_text_block; pub mod image_block; pub mod button_block; pub mod text_block_demo; // same as the name of our file: text_block_demo.rs pub use notification_block::*; pub use text_block::*; pub use scrolling_text_block::*; pub use image_block::*; pub use button_block::*; pub use text_block_demo::*; // as above ``` -------------------------------- ### Enabling Wired systemd User Service Source: https://github.com/toqozz/wired-notify/blob/master/README.md Instructions for enabling and starting the Wired application using its provided systemd user service file. This involves copying the service file and then using 'systemctl' to manage it. ```Shell $ systemctl enable --now --user wired.service ``` -------------------------------- ### Configure Wired with Home-Manager (Nix) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Example of integrating Wired into a standalone Home-Manager configuration. This enables the Wired service and allows specifying a custom configuration file. ```Nix { outputs = { self, nixpkgs, home-manager, wired, ... }: { homeConfigurations.alice = let system = "x86_64-linux"; in home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { inherit system; overlays = [ wired.overlays.default ]; }; modules = [ wired.homeManagerModules.default ({ ... }: { services.wired = { enable = true; config = ./wired.ron; }; }) ]; }; }; }; } ``` -------------------------------- ### Implement DrawableLayoutElement for TextBlock Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Implements the DrawableLayoutElement trait for the TextBlock, defining the required predict_rect_and_init and draw methods, along with optional methods like update, clicked, and hovered. ```rust use crate::maths_utility::{Vec2, Rect}; use crate::rendering::layout::{DrawableLayoutElement, Hook}; impl DrawableLayoutElement for TextBlockDemoParameters { // Required fn predict_rect_and_init(&mut self, hook: &Hook, offset: &Vec2, parent_rect: &Rect, window: &NotifyWindow) -> Rect { } fn draw(&self, hook: &Hook, offset: &Vec2, parent_rect: &Rect, window: &NotifyWindow) -> Rect { } // Optional fn update(&mut self, delta_time: Duration, window: &NotifyWindow) -> bool { } fn clicked(&mut self, _window: &NotifyWindow) -> bool { } fn hovered(&mut self, _entered: bool, _window: &NotifyWindow) -> bool { } } ``` -------------------------------- ### Use Wired in Nix Flakes (Nix) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Example of how to include Wired as an input in a Nix flake configuration, allowing it to be used in other Nix projects. ```Nix { inputs = { wired.url = "github:Toqozz/wired-notify"; }; } ``` -------------------------------- ### Define TextBlockDemoParameters Struct Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Defines the properties for a TextBlock, including padding, text content, font, dimensions, and color. It requires implementing Debug, Deserialize, and Clone traits. ```rust use serde::Deserialize; use crate::config::{Padding, Color}; // A custom struct for these parameters will make things clearer in configuration. #[derive(Debug, Deserialize, Clone)] pub struct WidthHeight { width: i32, height: i32, } #[derive(Debug, Deserialize, Clone)] pub struct TextBlockDemoParameters { pub padding: Padding, pub text: String, pub font: String, pub dimensions: WidthHeight, pub color: Color, // Cached property example. #[serde(skip)] real_text: String, } ``` -------------------------------- ### Rust: Adding LayoutElement Enum Entry Source: https://github.com/toqozz/wired-notify/wiki/Making-Your-Own-Blocks Illustrates how to add a new entry to the `LayoutElement` enum in `layout.rs` to include the new block. This allows the block to be used within the layout system. ```rust pub enum LayoutElement { NotificationBlock(NotificationBlockParameters), TextBlock(TextBlockParameters), ScrollingTextBlock(ScrollingTextBlockParameters), ImageBlock(ImageBlockParameters), TextBlockDemo(TextBlockDemoParameters), } ``` -------------------------------- ### ProgressBlock Configuration with Rounding Artifact Source: https://github.com/toqozz/wired-notify/wiki/ProgressBlock This Rust code snippet shows an example configuration for the ProgressBlock where the `fill_rounding` is set to the same value as `border_rounding`, leading to potential rendering artifacts due to the border width. This configuration is intended to illustrate a problem that needs correction. ```rust params: ProgressBlock(( padding: Padding(left: 3.0, right: 3.0, top: 3.0, bottom: 3.0), border_width: 10.0, border_rounding: 50.0, fill_rounding: 50.0, border_color: Color(hex: "#ebdbb2"), background_color: Color(hex: "#ff0000"), fill_color: Color(hex: "#00ff00"), width: -1.0, height: 100.0, border_color_hovered: Color(hex: "#fbf1c7"), background_color_hovered: Color(hex: "#3c3836"), fill_color_hovered: Color(hex: "#fbf1c7"), )), ``` -------------------------------- ### Text Ellipsization with Wired Notify Source: https://github.com/toqozz/wired-notify/wiki/TextBlock Illustrates different text ellipsization modes (None, Start, Middle, End) and their impact on text display within Wired Notify, particularly when width constraints are applied. ```JSON /* Example configuration for ellipsization */ // Ellipsize: Middle, dimensions: (width: min: 50, max: -1), height: (min: 0, max: 0) { "ellipsize": "Middle", "dimensions": { "width": {"min": 50, "max": -1}, "height": {"min": 0, "max": 0} } } // Ellipsize: None, dimensions: (width: (min: 50, max: 150), height: (min: 0, max: 0)) { "ellipsize": "None", "dimensions": { "width": {"min": 50, "max": 150}, "height": {"min": 0, "max": 0} } } // Ellipsize: Start, dimensions: { "ellipsize": "Start", "dimensions": { "width": {"min": 50, "max": 150}, "height": {"min": 0, "max": 0} } } // Ellipsize: Middle, dimensions: { "ellipsize": "Middle", "dimensions": { "width": {"min": 50, "max": 150}, "height": {"min": 0, "max": 0} } } // Ellipsize: End, dimensions: { "ellipsize": "End", "dimensions": { "width": {"min": 50, "max": 150}, "height": {"min": 0, "max": 0} } } ``` -------------------------------- ### Build and Run Wired (Shell) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Instructions to clone the Wired repository, build the release version using Cargo, and run the daemon. Requires Rust, dbus, cairo, pango, glib2, x11, and xss. ```Shell git clone https://github.com/Toqozz/wired-notify.git cd wired-notify cargo build --release ./target/release/wired ``` -------------------------------- ### Wired Notify: Text Markup for Display Source: https://github.com/toqozz/wired-notify/wiki/Useful-tools-to-help-you-do-things-with-Wired Illustrates how to use Wired's custom text markup and Pango markup within configuration files to format notification text. It includes placeholders like %s for summary and %b for body, and demonstrates Pango markup for styling text with colors and fonts. ```rust name: "summary", parent: "root", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 0.0, y: 0.0), params: TextBlock(( text: "%s -- %b", font: "Arial Bold 20", ellipsize: Middle, color: Color(hex: "#ebdbb2"), color_hovered: Color(hex: "#fbf1c7"), padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 7.0), dimensions: (width: (min: 50, max: 350), height: (min: 0, max: 0)), )), ``` -------------------------------- ### Run Wired from Nix (Nix) Source: https://github.com/toqozz/wired-notify/blob/master/README.md Command to run Wired directly from its GitHub repository using Nix, assuming Nix version 2.4 or higher with experimental features enabled. ```Nix nix run 'github:Toqozz/wired-notify' ``` -------------------------------- ### ImageBlock Configuration Source: https://github.com/toqozz/wired-notify/wiki/ImageBlock This snippet demonstrates the configuration of an ImageBlock, specifying properties like image type, padding, rounding, scaling dimensions, and filter mode for image resizing. It also includes optional minimum dimensions. ```rust image_type: Hint, padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 7.0), rounding: 3.0, scale_width: 64, scale_height: 64, filter_mode: Triangle, min_width: 0, min_height: 0 ``` -------------------------------- ### Pango Layout Width and Height Configuration Source: https://github.com/toqozz/wired-notify/wiki/TextBlock Demonstrates how to configure text block dimensions using Pango's layout functions. Positive max values truncate text, while -1 allows unlimited width. Height settings control line count. ```C /* Example usage of Pango layout functions */ // Setting maximum width for text truncation layout_set_width(layout, max_width); // Setting maximum height to control line count layout_set_height(layout, max_height); // Setting minimum width for precise sizing layout_set_width(layout, min_width); // Setting minimum height for precise sizing layout_set_height(layout, min_height); ``` -------------------------------- ### Rust: Basic Notification Layout Blocks Source: https://github.com/toqozz/wired-notify/wiki/Blocks Demonstrates a basic notification layout configuration in Rust, consisting of a root NotificationBlock and two TextBlocks for summary and body text. It illustrates how blocks are nested and connected using parent-child relationships and hook points. ```Rust layout_blocks: [ // Base block -- all layouts must have this. ( name: "root", parent: "", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 7.0, y: 7.0), params: NotificationBlock(( ... )), ), // Summary block. ( name: "summary", parent: "root", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 0.0, y: 0.0), params: TextBlock(( text: "%s", ... )), ), // Body block. ( name: "body", parent: "summary", hook: Hook(parent_anchor: MR, self_anchor: ML), offset: Vec2(x: 0.0, y: 0.0), params: TextBlock(( text: "%b", ... )) ), ] ``` -------------------------------- ### TextBlock Properties Source: https://github.com/toqozz/wired-notify/wiki/TextBlock This snippet outlines the required and optional properties for the TextBlock component. It details properties like padding, text content with markup support, font description, color, and dimensions, along with optional properties for hover colors and image-related dimension hints. ```dart Padding padding String text String font Color color Dimensions dimensions Color color_hovered Dimensions dimensions_image_hint Dimensions dimensions_image_app Dimensions dimensions_image_both EllipsizeMode ellipsize AlignMode align ``` -------------------------------- ### Wired CLI: Usage and Options Source: https://github.com/toqozz/wired-notify/wiki/Useful-tools-to-help-you-do-things-with-Wired Provides the help output for the Wired command-line interface (CLI). It outlines available commands and options for managing notifications, such as dropping, acting on, or showing notifications, and controlling do not disturb mode. ```sh $ wired --help Usage: wired [options] IDX refers to the Nth most recent notification, unless it is prefixed by 'id', in which case it refers to a notification via its ID. E.g.: `wired --drop 0` vs `wired --drop id2589` Options: -h, --help print this help menu -z, --dnd [on|off] enable/disable do not disturb mode -d, --drop [latest|all|IDX] drop/close a notification -a, --action [latest|IDX]:[default|1|2|3] execute a notification's action -s, --show N show the last N notifications -r, --run run the wired daemon -v, --version print the version of wired and leave ``` -------------------------------- ### Wired Notify: Tagging Notifications Source: https://github.com/toqozz/wired-notify/wiki/Useful-tools-to-help-you-do-things-with-Wired Demonstrates how to tag notifications using `notify-send` with the `wired-tag` hint. Tagging allows notifications with the same tag and application name to replace each other, overriding the `replacing_enabled` configuration. ```sh notify-send "Summary" "Body" --hint="string:wired-tag:tag_name" notify-send "Summary" "A different body" --hint="string:wired-tag:tag_name" ``` -------------------------------- ### Define Focus Follow Mode for Notifications Source: https://github.com/toqozz/wired-notify/wiki/Config Specifies the input mode used to determine the active monitor for notifications that are set to follow the active monitor (monitor: -1). Supported modes include Mouse and Window. ```Configuration focus_follows: Mouse ``` ```Configuration focus_follows: Window ``` -------------------------------- ### NixOS Home-Manager Configuration for Wired-Notify Source: https://github.com/toqozz/wired-notify/blob/master/README.md This snippet shows how to add the Wired-Notify overlay and home-manager module to your NixOS configuration when using home-manager. This makes the 'services.wired' configuration available. ```Nix nixpkgs.overlays = [ inputs.wired-notify.overlays.default ]; home-manager.sharedModules = [ inputs.wired-notify.homeManagerModules.default ]; ``` -------------------------------- ### Configure Notification Layout Blocks in Rust Source: https://github.com/toqozz/wired-notify/wiki/Blocks This Rust code defines the structure for notification layout blocks, including root, image, summary, and body elements. It specifies parameters like borders, gaps, image types, padding, text content, fonts, colors, and render criteria for conditional rendering. ```rust layout_blocks: [ ( name: "root", parent: "", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 7.0, y: 7.0), params: NotificationBlock(( border_width: 3.0, gap: Vec2(x: 0.0, y: 8.0), ... )), ), ( name: "image", parent: "root", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 0.0, y: 0.0), params: ImageBlock(( image_type: App, padding: Padding(left: 20.0, right: 20.0, top: 20.0, bottom: 20.0), ... )), ), ( name: "summary", parent: "image", hook: Hook(parent_anchor: TR, self_anchor: TL), offset: Vec2(x: 0.0, y: 0.0), params: TextBlock(( text: "%s", font: "Arial 30", color: Color(r: 0.92157, g: 0.858824, b: 0.698039, a: 1.0), padding: Padding(left: 20.0, right: 20.0, top: 20.0, bottom: 20.0), ... )), ), ( name: "body", parent: "summary", hook: Hook(parent_anchor: BL, self_anchor: TL), offset: Vec2(x: 10.0, y: 0.0), // This block is only rendered when both a Summary and a Body field exist in the notification. render_criteria: [Summary, Body], params: ScrollingTextBlock(( text: "%b", font: "Arial 30", color: Color(r: 0.92157, g: 0.858824, b: 0.698039, a: 1.0), padding: Padding(left: 20, right: 20.0, top: 20.0, bottom: 20.0), ... )), ), ], ``` -------------------------------- ### Send Progress Data with notify-send Source: https://github.com/toqozz/wired-notify/wiki/ProgressBlock This command-line snippet demonstrates how to send progress updates to the ProgressBlock using the `notify-send` command with the `-h int:value:` hint. The `` value should be an integer between 0 and 100. ```sh notify-send -h int:value: "Working..." "I'm working on something." ``` -------------------------------- ### ProgressBlock Configuration with Corrected Rounding Source: https://github.com/toqozz/wired-notify/wiki/ProgressBlock This Rust code snippet provides a corrected configuration for the ProgressBlock. It addresses the rounding artifact issue by setting `fill_rounding` to `border_rounding - border_width`, ensuring proper rendering when using rounded corners with borders. ```rust params: ProgressBlock(( ... border_width: 10.0, border_rounding: 50.0, fill_rounding: 40.0, ... )), ``` -------------------------------- ### Enable Printing Notification Data to File Source: https://github.com/toqozz/wired-notify/wiki/Config Activates the logging of notification data to a specified file in JSON format, useful for scripting. By default, this feature is disabled (None). ```Configuration print_to_file: "/tmp/wired.log" ``` -------------------------------- ### Set Minimum Window Width for Notifications Source: https://github.com/toqozz/wired-notify/wiki/Config Defines the minimum width for a notification window. This, along with `min_window_height`, establishes the base dimensions for notification windows, preventing them from becoming smaller. A value of 1 allows the window to resize dynamically with the notification content. The default is 1. ```Configuration min_window_width: 1 ``` -------------------------------- ### Set Minimum Window Height for Notifications Source: https://github.com/toqozz/wired-notify/wiki/Config Defines the minimum height for a notification window, working in conjunction with `min_window_width` to set the base dimensions. The default value is 1. ```Configuration min_window_height: 1 ``` -------------------------------- ### Configure Mouse Shortcuts for Notification Actions Source: https://github.com/toqozz/wired-notify/wiki/Config Sets mouse button bindings for predefined notification actions. The values correspond to mouse buttons: Left Mouse (1), Right Mouse (2), Middle Mouse (3), and other buttons like side buttons (e.g., 7, 8). ```Configuration shortcuts: { "close": 2, "dismiss": 3 } ``` -------------------------------- ### Conditional Image Rendering with AppImage Source: https://github.com/toqozz/wired-notify/wiki/Render-Criteria This snippet demonstrates how to use `render_criteria` to conditionally render an image block. The `AppImage` criterion ensures the block is only displayed when an application image is present in the notification. It includes details on image type, padding, and other parameters. ```Rust ... ( name: "image", parent: "root", hook: Hook(parent_anchor: TL, self_anchor: TL), offset: Vec2(x: 0.0, y: 0.0), render_criteria: [AppImage], // Only render this block when an AppImage is present. params: ImageBlock(( image_type: App, padding: Padding(left: 20.0, right: 20.0, top: 20.0, bottom: 20.0), ... )), ), ... ``` -------------------------------- ### Control Initial Notification State (Paused) Source: https://github.com/toqozz/wired-notify/wiki/Config When enabled, notifications will initially spawn in a paused state and require manual unpausing or clearing, unless `unpause_on_input` is also configured. The default is false. ```Configuration notifications_spawn_paused: false ``` -------------------------------- ### Wired Notify: Adding Notes to Notifications Source: https://github.com/toqozz/wired-notify/wiki/Useful-tools-to-help-you-do-things-with-Wired Shows how to associate 'note' data with notifications using `notify-send`. This data is useful for identifying notifications, such as indicating a muted state, and is primarily used with render criteria. ```sh $ notify-send "Volume" --hint="string:wired-note:mute" # or maybe... $ notify-send "Volume" --hint="string:wired-tag:volume" --hint="string:wired-note:mute" ``` -------------------------------- ### Configure Notification History Length Source: https://github.com/toqozz/wired-notify/wiki/Config Sets the maximum number of notifications to retain in the history. Each notification consumes approximately 256 bytes, excluding buffers. The default value is 10. ```Configuration history_length: 10 ``` -------------------------------- ### Enable/Disable Debug Rendering Source: https://github.com/toqozz/wired-notify/wiki/Config Toggles the display of debug rendering elements. The default value is false. ```Configuration debug: false ``` -------------------------------- ### Enable/Disable Notification Replacement Source: https://github.com/toqozz/wired-notify/wiki/Config Controls whether replacement functionality is active. If enabled, new notifications with the same identifier will replace existing ones. If disabled, replacement requests will result in new notifications being sent. The default is true. ```Configuration replacing_enabled: true ``` -------------------------------- ### Enable/Disable Wired Notify Do Not Disturb Mode Source: https://github.com/toqozz/wired-notify/wiki/Useful-tools-to-help-you-do-things-with-Wired This snippet demonstrates how to toggle the Do Not Disturb (DnD) mode for Wired Notify using command-line arguments. 'wired --dnd on' enables DnD, preventing notifications, while 'wired --dnd off' disables it, resuming notification delivery. ```sh $ wired --dnd on $ wired --dnd off ``` -------------------------------- ### Set Primary Debug Color Source: https://github.com/toqozz/wired-notify/wiki/Config Configures the primary color used for debug rectangles. The default color is green (r: 0.0, g: 1.0, b: 0.0, a: 1.0). ```Configuration debug_color: Color(r: 0.0, g: 1.0, b: 0.0, a: 1.0) ``` -------------------------------- ### Set Secondary Debug Color Source: https://github.com/toqozz/wired-notify/wiki/Config Configures the secondary color used for debug rectangles. The default color is red (r: 1.0, g: 0.0, b: 0.0, a: 1.0). ```Configuration debug_color_alt: Color(r: 1.0, g: 0.0, b: 0.0, a: 1.0) ```