Skip to content

screens

The community/core/screens directory contains files for managing and displaying information about multiple screens connected to a computer.

The screens.talon file at https://github.com/talonhub/community/blob/main/core/screens/screens.talon provides a command for showing screen numbers using the user.screens_show_numbering() action.

The screens.py file at https://github.com/talonhub/community/blob/main/core/screens/screens.py implements the actions used in screens.talon using the Talon API. It defines a number of functions and actions:

  • screens_show_numbering(): This action iterates through the available screens, then calls the show_screen_number() function to display a number on each one.
  • screens_get_by_number(screen_number: int) -> ui.Screen: This action returns a ui.Screen object for a given screen number.
  • screens_get_previous(screen: ui.Screen) -> ui.Screen: This action returns a ui.Screen object representing the screen before the one provided.
  • screens_get_next(screen: ui.Screen) -> ui.Screen: This action returns a ui.Screen object representing the screen after the one provided.
  • get_screen_by_offset(screen: ui.Screen, offset: int) -> ui.Screen: This helper function is used by screens_get_previous() and screens_get_next(), calculating the ui.Screen object that is offset by the given amount from the current one.
  • show_screen_number(screen: ui.Screen, number: int): This helper function creates a Canvas on the specified screen and displays the number on it using the on_draw() callback. The canvas is displayed for three seconds before being closed.