diff --git a/flake.lock b/flake.lock index d773fad..a091d96 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,27 @@ { "nodes": { + "alejandra": { + "inputs": { + "flakeCompat": "flakeCompat", + "nixpkgs": [ + "wired", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1652974241, + "narHash": "sha256-0AolxQtKj3Oek0WSbODDpPVO5Ih8PXHOA3qXEKPB4dQ=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "0be1462419fc73270a5dc0f84f8092603890b029", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "repo": "alejandra", + "type": "github" + } + }, "dedsec-grub-theme": { "inputs": { "nixpkgs": [ @@ -52,6 +74,22 @@ "type": "github" } }, + "flakeCompat": { + "flake": false, + "locked": { + "lastModified": 1648199409, + "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -116,6 +154,27 @@ "url": "https://git.pleshevski.ru/mynix/neovim" } }, + "naersk": { + "inputs": { + "nixpkgs": [ + "wired", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1652722411, + "narHash": "sha256-FxzNgYiH9c91hUVAntcjrqY//KOTUPP2a4e8Wyuysxg=", + "owner": "nix-community", + "repo": "naersk", + "rev": "94beb7a3edfeb3bcda65fa3f2ebc48ec6b40bf72", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "nil": { "inputs": { "flake-utils": "flake-utils", @@ -179,7 +238,8 @@ "myneovim": "myneovim", "nil": "nil", "nixpkgs": "nixpkgs", - "vnetod": "vnetod" + "vnetod": "vnetod", + "wired": "wired" } }, "rust-overlay": { @@ -286,6 +346,21 @@ "type": "github" } }, + "utils_4": { + "locked": { + "lastModified": 1652776076, + "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "vnetod": { "inputs": { "nixpkgs": [ @@ -306,6 +381,29 @@ "type": "git", "url": "https://git.pleshevski.ru/pleshevskiy/vnetod" } + }, + "wired": { + "inputs": { + "alejandra": "alejandra", + "naersk": "naersk", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils_4" + }, + "locked": { + "lastModified": 1660441826, + "narHash": "sha256-JF6pG997ygEOQmvmH4oYyksdIZlWRaZi4AJtLLNcYfI=", + "owner": "Toqozz", + "repo": "wired-notify", + "rev": "a91ba83f314a6922858436828befa3b07ffea323", + "type": "github" + }, + "original": { + "owner": "Toqozz", + "repo": "wired-notify", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 9f6aa5d..506c3f0 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + wired = { + url = "github:Toqozz/wired-notify"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + dedsec-grub-theme = { url = "gitlab:VandalByte/dedsec-grub-theme"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/home/home.nix b/home/home.nix index addae57..78543fd 100644 --- a/home/home.nix +++ b/home/home.nix @@ -113,7 +113,6 @@ in }; }; - home.file = { "scripts" = { source = ../scripts; @@ -128,6 +127,11 @@ in xdg.enable = true; + services.wired = { + enable = true; + config = ./wired.ron; + }; + # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage # when a new Home Manager release introduces backwards diff --git a/home/wired.ron b/home/wired.ron new file mode 100644 index 0000000..6fb1673 --- /dev/null +++ b/home/wired.ron @@ -0,0 +1,171 @@ +( + // Maximum number of notifications to show at any one time. + // A value of 0 means that there is no limit. + max_notifications: 3, + + // The default timeout, in miliseconds, for notifications that don't have an initial timeout set. + // 1000ms = 1s. + timeout: 2500, + + // `poll_interval` decides decides how often (in milliseconds) Wired checks for new notifications, events, + // draws notifications (if necessary), etc. + // Note that when no notifications are present, Wired always polls at 500ms. + // 16ms ~= 60hz / 7ms ~= 144hz. + poll_interval: 16, + + // Wired will pause notifications if you are idle (no mouse or keyboard input) for longer than + // `idle_threshold` seconds. + // Note that notifications will not be automatically unpaused on wake, and will need to be manually + // cleared, unless `unpause_on_input` is set to true. + // Also note that no distinction is made between manually paused and idle paused notifications. + // If `idle_threshold` is not specified, the behavior will be disabled entirely. + //idle_threshold: 3600, + + // Notifications will spawn paused, and have to be manually unpaused or cleared by the user, + // unless `unpause_on_input` is also set. + //notifications_spawn_paused: false, + + // Unpause notifications when we receive any input after being idle for longer than 1 second. + // Note that no distinction is made between manually paused notifications and idle paused/spawned notifications. + //unpause_on_input: false, + + // Enable/disable replacement functionality. + // If this is disabled, replacement requests will just send a new notification. + // E.g., with replacing_enabled: true, Pidgin will only show the latest message from each contact, + // instead of sending a new one for each message. + // Default: true + //replacing_enabled: true, + + // Whether a notification should reset its timeout when it is replaced. + // No effect if replacing_enabled is set to false. + // Default: false + //replacing_resets_timeout: false, + + // Some apps/programs close notifications on their own by sending a request to dbus. + // Sometimes this is not desired. + // Default: true + //closing_enabled: true, + + // How many notifications are kept in history. + // Each notification is roughly 256 bytes (excluding buffers!), so there's some math to do here. + // Default: 10 + //history_length: 10, + + // When a `NotificationBlock` has monitorr: -1 (i.e. should follow active monitor), then what input + // should we use to determine the active monitor? + // Options: Mouse, Window + // Default: Mouse + //focus_follows: Mouse, + + // Enable printing notification data to a file. + // Useful for scripting purposes. + // The data is written as JSON. + // Default: None + //print_to_file: "/tmp/wired.log", + + // Minimum window width and height. This is used to create the base rect that the notification + // grows within. + // The notification window will never be smaller than this. + // A value of 1 means that the window will generally always resize with notification, unless + // you have a 1x1 pixel notification... + // Generally, you shouldn't need to set this. + //min_window_width: 1, + //min_window_height: 1, + + // Enable/disable debug rendering. + debug: false, + debug_color: Color(r: 0.0, g: 1.0, b: 0.0, a: 1.0), // Primary color for debug rectangles. + debug_color_alt: Color(r: 1.0, g: 0.0, b: 0.0, a: 1.0), // Secondary color for debug rectangles. + + layout_blocks: [ + // Layout 1, when an image is present. + ( + name: "root", + parent: "", + hook: Hook(parent_anchor: BL, self_anchor: BL), + 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: 1.0, + border_rounding: 0.0, + background_color: Color(hex: "#ffffff"), + border_color: Color(hex: "#2e9afe"), + border_color_low: Color(hex: "#7f7f7f"), + border_color_critical: Color(hex: "#ea4300"), + border_color_paused: Color(hex: "#9058c7"), + + gap: Vec2(x: 0.0, y: -8.0), + notification_hook: Hook(parent_anchor: TL, self_anchor: BL), + )), + ), + + ( + name: "image", + parent: "root", + hook: Hook(parent_anchor: TL, self_anchor: TL), + offset: Vec2(x: 0.0, y: 0.0), + // https://github.com/Toqozz/wired-notify/wiki/ImageBlock + params: ImageBlock(( + image_type: Hint, + // We actually want 4px padding, but the border is 3px. + padding: Padding(left: 7.0, right: 0.0, top: 7.0, bottom: 7.0), + rounding: 3.0, + scale_width: 48, + scale_height: 48, + filter_mode: Lanczos3, + )), + ), + + ( + name: "summary", + parent: "image", + hook: Hook(parent_anchor: MR, self_anchor: BL), + offset: Vec2(x: 0.0, y: 0.0), + // https://github.com/Toqozz/wired-notify/wiki/TextBlock + params: TextBlock(( + text: "%s", + font: "sans-serif Bold 11", + ellipsize: Middle, + color: Color(hex: "#17182b"), + color_hovered: Color(hex: "#2e9afe"), + padding: Padding(left: 16.0, right: 16.0, top: 12.0, bottom: 0.0), + dimensions: (width: (min: 100, max: 150), height: (min: 0, max: 0)), + )), + ), + + ( + name: "body", + parent: "summary", + hook: Hook(parent_anchor: BL, self_anchor: TL), + offset: Vec2(x: 0.0, y: -3.0), + // https://github.com/Toqozz/wired-notify/wiki/ScrollingTextBlock + params: ScrollingTextBlock(( + text: "%b", + font: "sans-serif 11", + color: Color(hex: "#17182b"), + color_hovered: Color(hex: "#17182b"), + padding: Padding(left: 16.0, right: 16.0, top: 7.0, bottom: 12.0), + width: (min: 150, max: 250), + scroll_speed: 0.1, + lhs_dist: 35.0, + rhs_dist: 35.0, + scroll_t: 1.0, + )), + ), + ], + + // https://github.com/Toqozz/wired-notify/wiki/Shortcuts + shortcuts: ShortcutsConfig ( + notification_interact: 1, + notification_close: 2, + // notification_closeall: 99, + // notification_pause: 99, + + notification_action1: 3, + // notification_action2: 99, + // notification_action3: 99, + // notification_action4: 99, + ), +) diff --git a/outputs/home.nix b/outputs/home.nix index b4fefa5..7087ad6 100644 --- a/outputs/home.nix +++ b/outputs/home.nix @@ -7,6 +7,7 @@ let inherit system; overlays = [ + inputs.wired.overlays.${system} inputs.myneovim.overlays.${system} inputs.vnetod.overlays.${system} (f: p: { nil = inputs.nil.packages.${system}.nil; }) @@ -18,6 +19,7 @@ in inherit pkgs; modules = [ + inputs.wired.homeManagerModules.default ../home/home.nix ]; };