YASBDocs

Notifications Widget Configuration#

Displays the number of unread Windows notifications in your status bar. Clicking it opens the Windows Action Center, and you can set it to auto-hide when you have no new notifications.

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.
class_name string "" Additional CSS class name for the widget.
tooltip boolean true Whether to show the tooltip on hover.
icons dict {'new': '\udb80\udc9e', 'default': '\udb80\udc9a'} Icons for different notification states.
hide_empty boolean false Whether to hide the widget when there are no notifications.
keybindings list [] Optional hotkeys. See Keybindings.
callbacks dict See below Callbacks for mouse events on the notifications widget.

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"

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 and the {icon} placeholder which will be replaced with the icon representing the notification state.
  • 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 and the {icon} placeholder which will be replaced with the icon representing the notification state.
  • class_name: Additional CSS class name for the widget. This allows for custom styling.
  • tooltip: Whether to show the tooltip on hover.
  • icons: A dictionary specifying the icons for different notification states. It contains two keys: new and default. The values are the icons to be used for new notifications and the default state, respectively.
  • hide_empty: Whether to hide the widget when there are no notifications.
  • keybindings: A list of global hotkeys for this widget. See Keybindings.
  • callbacks: Mouse event callbacks. See Callbacks.

Available Callbacks#

The callbacks option maps mouse buttons (on_left, on_middle, on_right) to actions. All keys are optional, the values shown are the defaults.

callbacks:
  on_left: "toggle_label"
  on_middle: "do_nothing"
  on_right: "do_nothing"

Available actions:

  • toggle_notification: Toggles the notification panel.
  • toggle_label: Toggles the label between the default and alternative format.
  • do_nothing: A placeholder callback that does nothing.
  • clear_notifications: Clears all notifications.

Example Style#

.notification-widget {
    padding: 0 0px 0 4px;
}
.notification-widget.your_class {} /* If you are using class_name option */
.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;
}