Alerts
Shoji displays visual feedback when changing layouts. Alerts appear briefly and fade out automatically. This page covers alert behavior and examples. For the complete list of configuration options, see Configuration overview.
Configuration
Section titled “Configuration”spoon.Shoji:configure({ show_layout_alerts = true, -- Default: true alert_duration = 0.5, -- Default: 0.5 seconds})The alert shows the layout’s displayName (or name if no display name is
set) plus context such as window count and ratio. Layouts with icons display
their icon in the alert.
Disable alerts
Section titled “Disable alerts”spoon.Shoji:configure({ show_layout_alerts = false,})Longer alert duration
Section titled “Longer alert duration”spoon.Shoji:configure({ alert_duration = 1.0, -- 1 second})Alert behavior
Section titled “Alert behavior”Shoji uses Hammerspoon’s alert system (hs.alert.showWithImage() when an
icon exists, otherwise hs.alert.show()):
- Alerts appear centered on the current screen.
- Fade in and out automatically.
- Do not steal focus or interrupt workflow.
- Stack when multiple appear in quick succession.
Custom styling
Section titled “Custom styling”Hammerspoon allows global alert customization. Add this to
~/.hammerspoon/init.lua before loading Shoji:
-- Dark translucent backgroundhs.alert.defaultStyle.strokeColor = { white = 0, alpha = 0 }hs.alert.defaultStyle.fillColor = { white = 0, alpha = 0.75 }hs.alert.defaultStyle.textColor = { white = 1, alpha = 1 }
-- Typographyhs.alert.defaultStyle.textFont = ".AppleSystemUIFont"hs.alert.defaultStyle.textSize = 24
-- Shape and animationhs.alert.defaultStyle.radius = 10hs.alert.defaultStyle.fadeInDuration = 0.15hs.alert.defaultStyle.fadeOutDuration = 0.15
-- Position: 0 = center, 1 = top edge, 2 = bottom edgehs.alert.defaultStyle.atScreenEdge = 0These settings affect all Hammerspoon alerts, not just Shoji’s.
Custom alert logic
Section titled “Custom alert logic”For full control over layout notifications, disable built-in alerts and use a hook:
spoon.Shoji:configure({ show_layout_alerts = false, hooks = { layout_changed = function(spaceID, layout, prevLayout) -- Custom notification logic hs.alert.show("Layout: " .. layout, 0.3) end, },})The layout_changed hook receives:
spaceID: The macOS Space ID where the layout changedlayout: The new layout nameprevLayout: The previous layout name (ornilon first set)
See Hooks reference for event callbacks.