Skip to content

(Widget) Notifications

github-actions edited this page Jan 31, 2025 · 1 revision

Notifications Widget Configuration

Option Type Default Description
label string "{count} new notifications" The format string for the notifications widget.
label_alt string "{count} new notifications"' The alternative format string for the notifications widget.
tooltip boolean True Whether to show the tooltip on hover.
hide_empty boolean False Whether to hide the widget when there are no notifications.
callbacks dict {'on_left': 'toggle_label', 'on_middle': 'do_nothing', 'on_right': 'do_nothing'} Callbacks for mouse events on the memory widget.
container_padding dict {'top': 0, 'left': 0, 'bottom': 0, 'right': 0} Explicitly set padding inside widget container.
animation dict {'enabled': True, 'type': 'fadeInOut', 'duration': 200} Animation settings for the widget.
container_padding dict {'top': 0, 'left': 0, 'bottom': 0, 'right': 0} Explicitly set padding inside widget container.

Example Configuration

  notifications:
    type: "yasb.notifications.NotificationsWidget"
    options:
      label: "<span>\uf476</span> {count}"
      label_alt: "{count} notifications"
      hide_empty: true
      tooltip: false
      callbacks:
        on_left: "toggle_notification"
        on_right: "do_nothing"
        on_middle: "toggle_label"
      container_padding:
        top: 0
        left: 8
        bottom: 0
        right: 8

Description of Options

  • label: The format string for the notifications widget. The string can contain the {count} placeholder which will be replaced with the number of notifications.
  • label_alt: The alternative format string for the notifications widget. The string can contain the {count} placeholder which will be replaced with the number of notifications.
  • tooltip: Whether to show the tooltip on hover.
  • hide_empty: Whether to hide the widget when there are no notifications.
  • callbacks: Callbacks for mouse events on the memory widget. The following callbacks are available:
    • on_left: Callback for left-click event.
    • on_middle: Callback for middle-click event.
    • on_right: Callback for right-click event.
  • container_padding: Explicitly set padding inside widget container. The padding can be set for each side of the container.
  • animation: A dictionary specifying the animation settings for the widget. It contains three keys: enabled, type, and duration. The type can be fadeInOut and the duration is the animation duration in milliseconds.

Example Style

.notification-widget {
    padding: 0 0px 0 4px;
}
.notification-widget .widget-container {
	background-color:rgba(17, 17, 27, 0.75);
	margin: 3px 0 3px 0;
	border-radius: 12px;
    border: 1px solid #45475a;
}
.notification-widget .icon {
    font-size: 12px;
}
.notification-widget .icon.new-notification {
    color: #89b4fa;
}
.notification-widget .label.new-notification {
    color: #89b4fa;
}
Clone this wiki locally