Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Linux (GTK4)

Perry compiles TypeScript apps for Linux using GTK4.

Requirements

  • GTK4 development libraries:
    # Ubuntu/Debian
    sudo apt install libgtk-4-dev
    
    # Fedora
    sudo dnf install gtk4-devel
    
    # Arch
    sudo pacman -S gtk4
    
  • Cairo development libraries (for canvas):
    sudo apt install libcairo2-dev
    

Building

perry app.ts -o app --target linux
./app

UI Toolkit

Perry maps UI widgets to GTK4 widgets:

Perry WidgetGTK4 Widget
TextGtkLabel
ButtonGtkButton
TextFieldGtkEntry
SecureFieldGtkPasswordEntry
ToggleGtkSwitch
SliderGtkScale
PickerGtkDropDown
ProgressViewGtkProgressBar
ImageGtkImage
VStackGtkBox (vertical)
HStackGtkBox (horizontal)
ZStackGtkOverlay
ScrollViewGtkScrolledWindow
CanvasCairo drawing
NavigationStackGtkStack

Linux-Specific APIs

  • Menu bar: GMenu / set_menubar
  • Toolbar: GtkHeaderBar
  • Dark mode: GTK settings detection
  • Preferences: GSettings or file-based
  • Keychain: libsecret
  • Notifications: GNotification
  • File dialogs: GtkFileChooserDialog
  • Alerts: GtkMessageDialog

Styling

GTK4 styling uses CSS under the hood. Perry’s styling methods (colors, fonts, corner radius) are translated to CSS properties applied via CssProvider.

Next Steps