Set Window Title
The set-window-title example sets the terminal window title.
- Preview
- Code

pkgs/artisanal/example/tui/examples/set-window-title/main.dart
/// Set window title example ported from Bubble Tea.
library;
import 'package:artisanal/tui.dart' as tui;
class SetTitleModel implements tui.Model {
const SetTitleModel();
tui.Cmd? init() => tui.Cmd.setWindowTitle('artisanal Table Example');
(tui.Model, tui.Cmd?) update(tui.Msg msg) {
if (msg is tui.KeyMsg) {
return (this, tui.Cmd.quit());
}
return (this, null);
}
String view() => '\nPress any key to quit.';
}
Future<void> main() async {
await tui.runProgram(
const SetTitleModel(),
options: const tui.ProgramOptions(altScreen: false, hideCursor: false),
);
}
Run it
dart run pkgs/artisanal/example/tui/examples/set-window-title/main.dart