Custom Modules
This special module type lets you extend the functionality of Ashell by creating your own simple components.
A custom module allows you to:
- Display the output of a command (live).
- Run a command when the module is clicked.
- Change icons dynamically based on output.
- Show an alert indicator based on specific conditions.
Configurationβ
To define a custom module, use the following fields:
name
: Name of the module. Use this to refer to it in the modules definitions.icon
: Icon displayed in the status bar.command
: Command to execute when the module is clicked.listen_cmd
(optional): Command to run in the background to update the moduleβs display.icons
(optional): Regex-to-icon mapping to change the icon based on thelisten_cmd
output.alert
(optional): Regex to trigger a red alert dot on the icon when matched in thelisten_cmd
output.
listen_cmd
β
The listen_cmd
should output JSON in
the Waybar format,
using text
and alt
fields.
Example Outputβ
{
"text": "3",
"alt": "notification"
}
Dynamic Iconsβ
You can change the icon depending on the value of alt
in the listen_cmd
output.
Icons Exampleβ
icons.'dnd.*' = "ο·"
This will change the icon to ο·
when alt
matches dnd.*
.
Alertsβ
Use the alert
field to show a red dot on the module icon if the output
matches a given regex.
Alerts Exampleβ
alert = ".*notification"
Examplesβ
Notifications (with swaync-client)β
[[CustomModule]]
name = "CustomNotifications"
icon = "ο’"
command = "swaync-client -t -sw"
listen_cmd = "swaync-client -swb"
icons.'dnd.*' = "ο·"
alert = ".*notification"
App Launcher (with walker)β
[[CustomModule]]
name = "AppLauncher"
icon = "σ±Ό"
command = "walker"