Clone
5
berry.ui
SpookyDervish edited this page 2025-10-30 17:58:59 +11:00

Documentation for interfacing with the different UI functions.

Attributes

app

berry.app

A variable that lets you interface with the Textual app from Lua. It has all the Python functions available.

Methods

notify

berry.ui.notify(message, title?, severity?, timeout?)

Display a notification in the bottom right corner of the screen.

Parameters:

Name Type Description Default
message string The message to be displayed required
title string The title to be displayed at the top of the notification. nil
severity string The severity of the notification. Options: information, warning, error information
timeout number How many seconds the notification will be on screen before automatically disappearing. 5

createAction

berry.ui.createAction(actionName, func)

Create an action and run a function whenever that action occurs in the UI.

Parameters:

Name Type Description Default
actionName string The name of the new action. You can override an existing action if you want. required
func function The function to call when this action occurs. required

addBind

berry.ui.addBind(actionName, key, description, show?)

Bind a key to an action.

Parameters:

Name Type Description Default
actionName string The name of the action you want to bind the key to. required
key string The key to bind the action to. You can set this to things like ctrl+f or ctrl+shift+t to create key sequences. required
description string The description to be shown at the bottom of the screen. Leave empty if you will set show to false. required
show boolean Whether or not the show the keybind at the bottom of the screen. true

runAction

berry.ui.runAction(actionName)

Run an action.

Name Type Description Default
actionName string The action to run. required

setTheme

berry.ui.setTheme(theme)

Forcefully change the theme of the UI.

Parameters:

Name Type Description Default
theme string The name of the theme. required

createWindow

berry.ui.createWindow(title, icon?, showTitle?, canClose?, canMaximize?, canResize?, startHorizontal?, startVertical?)

Create a draggable window.

Parameters:

Name Type Description Default
title string The title of the window. required
icon string The icon of the window. ""
showTitle boolean Should the title of the window be visible? true
canClose boolean Should the window be closable? true
canMaximize boolean Should the window be maximizable? true
canResize boolean Should you be able to resize the window? true
startHorizontal string Where on the screen horizontally should the window start? Options: left, centerleft, center, centerright, right "center"
startVertical string Where on the screen vertically should the window start? Options: bottom, lowermiddle, middle, uppermiddle, top "middle"

Returns

Name Type Description
window Window A handle to the window from which you can call Python functions.