moxnotify

moxnotify is a notification server for the mox desktop environment. It handles system notifications with customizable appearance, behavior, and sound options.

Configuration

Moxnotify's configuration is written in Lua and located at:

  • $XDG_CONFIG_HOME/moxnotify/config.lua or
  • ~/.config/moxnotify/config.lua

General Configuration

OptionDescriptionTypeDefault
marginMargin of the daemon surface. Can be a single integer for uniform margin or a map with top, right, bottom, and left values.int or map of int's0
scroll_sensitivitySensitivity of mouse scroll for notification interaction.float20.0
hint_charactersCharacters used for keyboard button hints.stringsadfjklewcmpgh
max_visibleMaximum amount of notifications visible on screen at once.int5
anchorPosition of the notifications on screen.Anchortop_right
layerLayer on which the notifications are rendered.Layeroverlay
queueOrder in which notifications are dismissed.Queueunordered
outputDetermines on which display output notifications will be rendered. Empty value means all outputs.string"" (empty)
icon_sizeSize of the notification icon in pixels.int64
app_icon_sizeSize of the application icon in pixels.int24
default_sound_filePath to default sound played on new notifications that don't provide their own sound. Can be specified per urgency level.path or map of paths by urgency"" (empty)
ignore_sound_fileWhen set to true, ignore sounds provided by notifications.boolfalse
default_timeoutDefault timeout in seconds if one isn't requested by notification. Can be specified per urgency level: urgency_low, urgency_normal, urgency_critical.int or map of ints by urgency{ urgency_low = 5, urgency_normal = 10, urgency_critical = 0 }
ignore_timeoutWhen set to true, ignore timeout requested by notification.boolfalse
history.sizeMaximum number of notifications to store in history.int1000
history.pathPath to the history database file.path~/.local/share/moxnotify/db.mox

Example General Configuration

general = {
  margin = 0,  -- Alternatively, you can use a table: { top = 0, right = 0, bottom = 0, left = 0 }
  history = {
    size = 1000,
    path = "~/.local/share/moxnotify/db.mox"
  },
  default_sound_file = "/run/current-system/sw/share/sounds/freedesktop/stereo/message.oga",  -- you can also use a table to map urgency levels if needed
  ignore_sound_file = false,
  hint_characters = "sadfjklewcmpgh",
  scroll_sensitivity = 20.0,
  max_visible = 5,
  icon_size = 64,
  app_icon_size = 24,
  anchor = "top_right",  -- Default anchor position
  layer = "overlay",     -- Default layer for notifications
  queue = "unordered",   -- Default queue type
  output = nil,          -- nil means notifications will display on output chosen by compositor (Usually the one currently focused)
  default_timeout = {
    urgency_low = 5,
    urgency_normal = 10,
    urgency_critical = 0
  },
  ignore_timeout = false
}

Keymaps

Moxnotify allows you to define custom keymaps for interacting with notifications inspired by vim. Each keymap consists of the following properties:

  • mode: The mode in which the keymap is active (e.g., "n" for normal mode).
  • keys: The key or combination of keys that trigger the action.
  • action: The command that is executed when the key(s) are pressed.

Keymap Modes

ModeDescription
nNormal mode – general interaction with notifications.
hHint mode – for pressing buttons with keypresses.

Keymap Actions

ActionDescription
dismiss_notificationDismisses the current notification.
next_notificationFocuses next notification
previous_notificationFocuses previous notification
first_notificationFocuses first notification.
last_notificationFocuses last notification.
unfocusUnfocuses surface
noopNo operation; placeholder that performs no action.
hint_modeActivates hint mode for keyboard-based notification selection.
normal_modeActivates normal mode
muteMutes all sounds coming from the daemon
unmuteUnmutes all sounds coming from the daemon
toggle_muteToggles mute state of the daemon
inhibitInhibits notifications
uninhibitUninhibits notifications
toggle_inhibitToggles inhibit state of notifications
show_historyViews history of notifications
hide_historyHides history of notifications
toggle_historyToggles history state

Example Keymaps Configuration

keymaps = {
  {
    mode = "n";
    keys = "d";
    action = "dismiss_notification";
  },
  {
    mode = "n";
    keys = "<C-g>";
    action = "last_notification";
  },
  {
    mode = "n";
    keys = "gw";
    action = "hint_mode";
  },
  {
    mode = "n";
    keys = "f";
    action = "noop";
  }
}

Styling System

Each style rule customizes notifications based on a selector (which notifications it applies to) and an optional state (interaction state).

Style Rule Properties

PropertyDescriptionTypeDefault
selectorTarget(s) for this style rule. Can be a string (e.g. "notification") or an array of strings (e.g. {"dismiss", "hints"}).Selector or Selector[]empty
stateInteraction state when this rule applies (e.g. "hover", "container_hover").State"default"
styleThe style overrides (fonts, colors, backgrounds, borders, etc.)Style{}
default_timeoutOverride global timeout (in seconds) for matching notificationsnumbernil
ignore_timeoutWhether to ignore timeouts for matching notificationsbooleannil
default_sound_fileOverride default sound file for matching notificationsstring (SoundFile)nil
ignore_sound_fileWhether to silence sounds for matching notificationsbooleannil

Style Properties

PropertyDescriptionType
backgroundColor of backgroundhex or map of hex by urgency
min_widthMinimum width of the elementint or auto
widthWidth of the elementint or auto
max_widthMaximum width of the elementint or auto
min_heightMinimum height of the elementint or auto
heightHeight of the elementint or auto
max_heightMaximum width of the elementint or auto
font.sizeSize of the fontint
font.familyFamily of the fontstring
font.colorColor of the fontstring
border.sizeSize of the borderint
border.colorColor of the borderhex or map of hex by urgency
border.radiusRadius of the borderint
margin.leftMargin left of the elementint
margin.rightMargin right of the elementint
margin.topMargin top of the elementint
margin.bottomMargin bottom of the elementint
padding.leftPadding left of the elementint
padding.rightPadding right of the elementint
padding.topPadding top of the elementint
padding.bottomPadding bottom of the elementint

Example Styles Configuration

styles = {
  {
    selector = "*",
    style = {
      border = {
        color = {
          urgency_critical = "#f38ba8",
          urgency_low = "#a6e3a1",
          urgency_normal = "#cba6f7"
        }
      },
      font = {
        color = "#cdd6f4",
        family = "DejaVu Sans",
        size = 10
      }
    }
  },
  {
    selector = {
      "next_counter",
      "prev_counter",
      "notification",
      "hints"
    },
    style = {
      background = {
        urgency_critical = "#181825FF",
        urgency_low = "#1e1e2eFF",
        urgency_normal = "#181825FF"
      }
    }
  },
  {
    selector = "notification",
    state = "hover",
    style = {
      background = {
        urgency_critical = "#313244FF",
        urgency_low = "#313244FF",
        urgency_normal = "#313244FF"
      }
    }
  },
  {
    selector = "action",
    state = "hover",
    style = {
      background = {
        urgency_critical = "#f38ba8",
        urgency_low = "#f2cdcd",
        urgency_normal = "#f2cdcd"
      }
    }
  },
  {
    selector = "progress",
    style = {
      background = {
        urgency_critical = "#f38ba8",
        urgency_low = "#f2cdcd",
        urgency_normal = "#f2cdcd"
      }
    }
  },
  {
    selector = "dismiss",
    style = {
      font = {
        color = "#00000000"
      }
    }
  },
  {
    selector = "dismiss",
    state = "container_hover",
    style = {
      font = {
        color = "#000000"
      }
    }
  }
}

Special Types

Queue

  • unordered: Every notification expires independently without order
  • fifo: Notifications expire one by one in the order they arrived (First In, First Out)

Anchor

  • top_right: Notifications appear in the top-right corner
  • top_center: Notifications appear at the top
  • top_left: Notifications appear in the top-left corner
  • bottom_left: Notifications appear in the bottom-left corner
  • bottom_center: Notifications appear at the bottom
  • bottom_right: Notifications appear in the bottom-right corner
  • center-right: Notifications appear at the right of the screen
  • center: Notifications appear in the center of the screen
  • center-left: Notifications appear at the left of the screen

Layer

  • background: Notifications appear behind regular windows
  • bottom: Notifications appear above background but below regular windows
  • top: Notifications appear above regular windows
  • overlay: Notifications appear above all other windows

Selector

  • all: Every element
  • prev_counter: The "previous" badge
  • next_counter: The "next" badge
  • all_notifications: The whole notification list
  • notification = <string>: A specific notification instance
  • action_button: Any action button
  • dismiss_button: The dismiss ("×") button
  • progress: Progress bar
  • icon: The notification's icon
  • hints: Keyboard hint overlays

States

The State enum controls when a style fires:

  • default: Normal, resting state
  • hover: When the mouse is over the target
  • container_hover: When the mouse is anywhere over the notification container
  • container_hover = <string>: Hover state for a container with a specific name