diff --git a/hosts/common/programs/deadd-notification-center/deadd.css b/hosts/common/programs/deadd-notification-center/deadd.css new file mode 100644 index 00000000..7a4b2124 --- /dev/null +++ b/hosts/common/programs/deadd-notification-center/deadd.css @@ -0,0 +1,139 @@ + +/* Notification center */ + +.blurredBG, #main_window, .blurredBG.low, .blurredBG.normal { + background: rgba(255, 255, 255, 1.0); +} + +.noti-center.time { + font-size: 32px; +} + +/* Notifications */ + +.notification.content { + margin-left: 15px; + margin-right: 15px; +} + +.title { + font-weight: bold; + font-size: 16px; +} + +.appname { + font-size: 12px; +} + +.time { + font-size: 12px; +} + +.blurredBG.notification { + background: rgba(255, 255, 255, 0.4); +} + +.blurredBG.notification.critical { + background: rgba(255, 0, 0, 0.5); +} + +.notificationInCenter.critical { + background: rgba(155, 0, 20, 0.5); +} + +/* Labels */ + +label { + color: #322; +} + +label.notification { + color: #322; +} + +label.critical { + color: #000; +} +.notificationInCenter label.critical { + color: #000; +} + + +/* Buttons */ + +button { + background: transparent; + color: #322; + border-radius: 3px; + border-width: 0px; + background-position: 0px 0px; + text-shadow: none; +} + +button:hover { + border-radius: 3px; + background: rgba(0, 20, 20, 0.2); + border-width: 0px; + border-top: transparent; + border-color: #f00; + color: #fee; +} + + +/* Custom Buttons */ + +.userbutton { + background: rgba(20,0,0, 0.15); +} + +.userbuttonlabel { + color: #222; + font-size: 12px; +} + +.userbutton:hover { + background: rgba(20, 0, 0, 0.2); +} + +.userbuttonlabel:hover { + color: #111; +} + +button.buttonState1 { + background: rgba(20,0,0,0.5); +} + +.userbuttonlabel.buttonState1 { + color: #fff; +} + +button.buttonState1:hover { + background: rgba(20,0,0, 0.4); +} + +.userbuttonlabel.buttonState1:hover { + color: #111; +} + +button.buttonState2 { + background: rgba(255,255,255,0.3); +} + +.userbuttonlabel.buttonState2 { + color: #111; +} + +button.buttonState2:hover { + background: rgba(20,0,0, 0.3); +} + +.userbuttonlabel.buttonState2:hover { + color: #000; +} + + +/* Images */ + +image.deadd-noti-center.notification.image { + margin-left: 20px; +} diff --git a/hosts/common/programs/deadd-notification-center/deadd.yml b/hosts/common/programs/deadd-notification-center/deadd.yml new file mode 100644 index 00000000..a6b8c30e --- /dev/null +++ b/hosts/common/programs/deadd-notification-center/deadd.yml @@ -0,0 +1,263 @@ +### Margins for notification-center/notifications +margin-top: 0 +margin-right: 0 + +### Margins for notification-center +margin-bottom: 0 + +### Width of the notification center/notifications in pixels. +width: 360 + +### Command to run at startup. This can be used to setup +### button states. +# startup-command: deadd-notification-center-startup + +### Monitor on which the notification center/notifications will be +### printed. If "follow-mouse" is set true, this does nothing. +monitor: 0 + +### If true, the notification center/notifications will open on the +### screen, on which the mouse is. Overrides the "monitor" setting. +follow-mouse: false + +notification-center: + ### Margin at the top/right/bottom of the notification center in + ### pixels. This can be used to avoid overlap between the notification + ### center and bars such as polybar or i3blocks. + margin-top: 40 + # margin-right: 0 + # margin-bottom: 0 + + ### Width of the notification center in pixels. + # width: 500 + + ### Monitor on which the notification center will be printed. If + ### "follow-mouse" is set true, this does nothing. + # monitor: 0 + + ### If true, the notification center will open on the screen, on which + ### the mouse is. Overrides the "monitor" setting. + # follow-mouse: false + + ### Notification center closes when the mouse leaves it + hide-on-mouse-leave: true + + ### If newFirst is set to true, newest notifications appear on the top + ### of the notification center. Else, notifications stack, from top to + ### bottom. + new-first: true + + ### If true, the transient field in notifications will be ignored, + ### thus the notification will be persisted in the notification + ### center anyways + ignore-transient: false + + ### Custom buttons in notification center + buttons: + ### Numbers of buttons that can be drawn on a row of the notification + ### center. + # buttons-per-row: 5 + + ### Height of buttons in the notification center (in pixels). + # buttons-height: 60 + + ### Horizontal and vertical margin between each button in the + ### notification center (in pixels). + # buttons-margin: 2 + + ### Button actions and labels. For each button you must specify a + ### label and a command. + actions: + # - label: VPN + # command: "sudo vpnToggle" + # - label: Bluetooth + # command: bluetoothToggle + # - label: Wifi + # command: wifiToggle + # - label: Screensaver + # command: screensaverToggle + # - label: Keyboard + # command: keyboardToggle + +notification: + ### If true, markup (, , , ) will be displayed properly + use-markup: true + + ### If true, html entities (& for &, % for %, etc) will be + ### parsed properly. This is useful for chromium-based apps, which + ### tend to send these in notifications. + parse-html-entities: true + + dbus: + + ### If noti-closed messages are enabled, the sending application + ### will know that a notification was closed/timed out. This can + ### be an issue for certain applications, that overwrite + ### notifications on status updates (e.g. Spotify on each + ### song). When one of these applications thinks, the notification + ### has been closed/timed out, they will not overwrite existing + ### notifications but send new ones. This can lead to redundant + ### notifications in the notification center, as the close-message + ### is send regardless of the notification being persisted. + send-noti-closed: false + + app-icon: + + ### If set to true: If no icon is passed by the app_icon parameter + ### and no application "desktop-entry"-hint is present, deadd will + ### try to guess the icon from the application name (if present). + guess-icon-from-name: true + + ### The display size of the application icons in the notification + ### pop-ups and in the notification center + icon-size: 20 + + image: + + ### The maximal display size of images that are part of + ### notifications for notification pop-ups and in the notification + ### center + size: 100 + + ### The margin around the top, bottom, left, and right of + ### notification images. + margin-top: 15 + margin-bottom: 15 + margin-left: 15 + margin-right: 0 + + ### Apply modifications to certain notifications: + ### Each modification rule needs a "match" and either a "modify" or + ### a "script" entry. + modifications: + ### Match: + ### Matches the notifications against these rules. If all of the + ### values (of one modification rule) match, the "modify"/"script" + ### part is applied. + # - match: + ### Possible match criteria: + # title: "Notification title" + # body: "Notification body" + # time: "12:44" + # app-name: "App name" + # urgency: "low" # "low", "normal" or "critical" + + # modify: + ### Possible modifications + # title: "abc" + # body: "abc" + # app-name: "abc" + # app-icon: "file:///abc.png" + ### The timeout has three special values: + ### timeout: 0 -> don't time out at all + ### timeout: -1 -> use default timeout + ### timeout: 1 -> don't show as pop-up + ### timeout: >1 -> milliseconds until timeout + # timeout: 1 + # margin-right: 10 + # margin-top: 10 + # image: "file:///abc.png" + # image-size: 10 + # transient: true + # send-noti-closed: false + ### Remove action buttons from notifications + # remove-actions: true + ### Set the action-icons hint to true, action labels will then + ### be intergreted as GTK icon names + # action-icons: true + ### List of actions, where the even elements (0, 2, ...) are the + ### action name and the odd elements are the label + # actions: + # - previous + # - media-skip-backward + # - play + # - media-playback-start + # - next + # - media-skip-forward + ### Action commands, where the keys (e.g. "play") is the action + ### name and the value is a program call that should be executed + ### on action. Prevents sending of the action to the application. + # action-commands: + # play: playerctl play-pause + # previous: playerctl previous + # next: playerctl next + + ### Add a class-name to the notification container, that can be + ### used for specific styling of notifications using the + ### deadd.css file + # class-name: "abc" + + # - match: + # app-name: "Chromium" + + ### Instead of modifying a notification directly, a script can be + ### run, which will receive the notification as JSON on STDIN. It + ### is expected to return JSON/YAML configuration that defines the + ### modifications that should be applied. Minimum complete return + ### value must be '{"modify": {}, "match": {}}'. Always leave the "match" + ### object empty (technical reasons, i.e. I am lazy). + # script: "linux-notification-center-parse-chromium" + - match: + app-name: "Spotify" + modify: + image-size: 80 + timeout: 1 + send-noti-closed: true + class-name: "Spotify" + action-icons: true + actions: + - previous + - media-skip-backward + - play + - media-playback-start + - next + - media-skip-forward + action-commands: + play: playerctl play-pause + previous: playerctl previous + next: playerctl next + + # - match: + # title: Bildschirmhelligkeit + # modify: + # image-size: 60 + popup: + + ### Default timeout used for notifications in milli-seconds. This can + ### be overwritten with the "-t" option (or "--expire-time") of the + ### notify-send command. + default-timeout: 10000 + + ### Margin above/right/between notifications (in pixels). This can + ### be used to avoid overlap between notifications and a bar such as + ### polybar or i3blocks. + margin-top: 50 + margin-right: 50 + margin-between: 20 + + ### Defines after how many lines of text the body will be truncated. + ### Use 0 if you want to disable truncation. + max-lines-in-body: 3 + + ### Determines whether the GTK widget that displays the notification body + ### in the notification popup will be hidden when empty. This is especially + ### useful for transient notifications that display a progress bar. + # hide-body-if-empty: false + + ### Monitor on which the notifications will be + ### printed. If "follow-mouse" is set true, this does nothing. + # monitor: 0 + + ### If true, the notifications will open on the + ### screen, on which the mouse is. Overrides the "monitor" setting. + # follow-mouse: false + + click-behavior: + + ### The mouse button for dismissing a popup. Must be either "mouse1", + ### "mouse2", "mouse3", "mouse4", or "mouse5" + dismiss: mouse1 + + ### The mouse button for opening a popup with the default action. + ### Must be either "mouse1", "mouse2", "mouse3", "mouse4", or "mouse5" + default-action: mouse3 diff --git a/hosts/common/programs/deadd-notification-center/default.nix b/hosts/common/programs/deadd-notification-center/default.nix new file mode 100644 index 00000000..63322ca2 --- /dev/null +++ b/hosts/common/programs/deadd-notification-center/default.nix @@ -0,0 +1,17 @@ +# docs are via README only: +# - +# reload config: +# - `notify-send a --hint=boolean:deadd-notification-center:true --hint=string:type:reloadStyle` +# toggle visibility: +# - `kill -s USR1 $(pidof deadd-notification-center)` +# clear notifications: +# - `notify-send a --hint=boolean:deadd-notification-center:true --hint=string:type:clearInCenter` +# set state of user button 0 to "highlighted" (true) +# - `notify-send a --hint=boolean:deadd-notification-center:true --hint=int:id:0 --hint=boolean:state:true --hint=type:string:buttons` +{ ... }: +{ + sane.programs.deadd-notification-center = { + fs.".config/deadd/deadd.css".symlink.target = ./deadd.css; + fs.".config/deadd/deadd.yml".symlink.target = ./deadd.yml; + }; +} diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index db0e24e6..9bf5ee41 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -21,6 +21,7 @@ ./conky ./cozy.nix ./dconf.nix + ./deadd-notification-center ./dialect.nix ./dino.nix ./element-desktop.nix diff --git a/hosts/common/programs/sway/sway-config b/hosts/common/programs/sway/sway-config index 05834fe5..a781e286 100644 --- a/hosts/common/programs/sway/sway-config +++ b/hosts/common/programs/sway/sway-config @@ -155,6 +155,14 @@ for_window [app_id="abaddon"] move container to workspace number 1 # desirable primarily to avoid slooow reflows when another app is opened. but also nice to have the book title rendered. for_window [app_id="KOReader"] border normal +for_window [app_id="deadd-notification-center"] { + border none + # anchor it to the right edge of the screen + # hardcoding the width here: keep in sync + move position 100 ppt 0 ppt + move left 360 +} + ### displays ## DESKTOP output "LG Electronics LG ULTRAWIDE 0x00004E94" {