Skip to main content

A tool to design and run dynamic, customizable dashboards directly inside your terminal.

Project description


🖥 Terminal Widgets

This tool lets you design and run dynamic, customizable dashboards directly inside your terminal. It combines modular widgets, real-time data updates, and flexible layout management for a highly interactive CLI experience.

Getting startedConfigurationAdding new widgetsLicense


Example Image of Terminal Widgets

Stats Stats Stats Stats Stats


🚀 1. Getting started

Installation from PyPI

  1. Install: pip install twidgets
  2. Initialize: twidgets init
  3. Run: twidgets

⚠️ Requires Python Version 3.10+

Installation from Source

  1. Clone this repository
  2. Install dependencies: pip install -r requirements.txt
  3. Initialize configuration: python -m twidgets init
  4. Run: python -m twidgets

⚠️ Requires Python Version 3.10+

For full documentation see Setup Guide


2. Configuration

2.1 Changing standard colors and configuration in ~/.config/twidgets/base.yaml

If you remove anything or let anything blank, it will just fall back to the standard configuration.
However, you will get warned.

Example:

use_standard_terminal_background: False

background_color:
  r: 31  # Red value
  g: 29  # Green value
  b: 67  # Blue value
  
...

2.2 Configure your secrets in: ~/.config/twidgets/secrets.env

Example:

WEATHER_API_KEY='your_api_key'
WEATHER_CITY='Berlin,DE'
WEATHER_UNITS='metric'
NEWS_FEED_URL='https://feeds.bbci.co.uk/news/rss.xml?edition=uk'
NEWS_FEED_NAME='BCC'

2.3 Adjust widgets and layouts in: ~/.config/twidgets/widgets/*.yaml

Example:

name: 'clock'
title: '  Clock'
enabled: True
interval: 1
height: 5
width: 30
y: 4
x: 87

weekday_format: '%A'  # day of the week
date_format: '%d.%m.%Y'  # us: '%m.%d.%Y', international: '%Y-%m-%d'
time_format: '%H:%M:%S'  # time

For full documentation see [Configuration Guide] (https://github.com/IceWizard7/terminal-widgets/blob/main/docs/configuration_guide.md)


3. Adding new widgets

Adding a new widget to terminal-widgets is very easy—just create two files! For a simple, static content widget, you only need to define a configuration and a single Python function.

3.1. ⚙️ Define Configuration (.yaml)

Create the configuration file at ~/.config/twidgets/widgets/custom.yaml and set interval = 0 for simple widgets:

name: custom
title: My Custom Widget
enabled: true
interval: 0 # For static content
height: 7
width: 30
y: 1
x: 1

3.2. 🐍 Write the Widget Logic (.py)

Note: Make sure to name the .yaml and .py files the same way (excluding suffixes)

Create the widget's Python file at ~/.config/twidgets/py_widgets/custom_widget.py

For a simple widget, you primarily need to define the draw function and use add_widget_content

Example:

from twidgets.core.base import Widget, draw_widget, add_widget_content, Config, UIState, BaseConfig
import typing

# 1. Define the draw function for content
def draw(widget: Widget, ui_state: UIState, base_config: BaseConfig) -> None:
    # Initialize the widget title, borders, etc.
    draw_widget(widget, ui_state, base_config)

    # Add your content (list of strings)
    content: list[str] = [
        'Welcome to my new widget!',
        'This is a test.',
        'It was very easy to create.'
    ]
    add_widget_content(widget, content)

# 2. Define the build function
def build(stdscr: CursesWindowType, config: Config) -> Widget:
    return Widget(
        config.name, config.title, config, draw, config.interval, config.dimensions, stdscr,
        update_func=None,
        mouse_click_func=None,
        keyboard_func=None,
        init_func=None
    )

For full documentation see Widget Guide


🧩 4. Contributing

Help the project grow: create an issue or pull request!


📜 5. License

See License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twidgets-1.1.8.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twidgets-1.1.8-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file twidgets-1.1.8.tar.gz.

File metadata

  • Download URL: twidgets-1.1.8.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for twidgets-1.1.8.tar.gz
Algorithm Hash digest
SHA256 f2ed1e936febc8a07f0c141e5e36654035833db2939b223821f0f9a268fd12c9
MD5 13c9d29f185897553637a65a7011daaa
BLAKE2b-256 35e6244a66c6e43e2e0564e48a6d7b9f968e3817756800e0607acf12927b6d4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for twidgets-1.1.8.tar.gz:

Publisher: publish.yml on IceWizard7/terminal-widgets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file twidgets-1.1.8-py3-none-any.whl.

File metadata

  • Download URL: twidgets-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for twidgets-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 48f0c1241d13a0eb7476c894fe84c415881faa00e11b25c54ed63218ac130651
MD5 cd439d189d2cfa63864e64f026a1ecc9
BLAKE2b-256 ea610f94e98ab6cb3ea0bc416947da5a6e85964e1152f503f3ea959b6a6fea19

See more details on using hashes here.

Provenance

The following attestation bundles were made for twidgets-1.1.8-py3-none-any.whl:

Publisher: publish.yml on IceWizard7/terminal-widgets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page