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 theshow_screen_number()
function to display a number on each one.screens_get_by_number(screen_number: int) -> ui.Screen
: This action returns aui.Screen
object for a given screen number.screens_get_previous(screen: ui.Screen) -> ui.Screen
: This action returns aui.Screen
object representing the screen before the one provided.screens_get_next(screen: ui.Screen) -> ui.Screen
: This action returns aui.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 byscreens_get_previous()
andscreens_get_next()
, calculating theui.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 aCanvas
on the specified screen and displays the number on it using theon_draw()
callback. The canvas is displayed for three seconds before being closed.