UI Layer¶
Command-line interface and user interaction components.
CLI¶
cli ¶
Command-line interface for the Svalboard Keymap Image Maker tool.
This module provides the CLI entry points for the skim tool using Click. It defines the main command group and subcommands for generating keymap images and configuration files.
Commands
skim generate: Generate keymap visualization imagesskim configure: Generate or output configuration files
Example
Generate images from a keymap file::
$ skim generate --keymap layout.kbi --output-dir ./images
Generate with custom configuration::
$ skim -v INFO generate -k layout.vil -c config.yaml -f png
Create configuration from Keybard file::
$ skim configure -k layout.kbi -o skim-config.yaml
Read keymap from stdin::
$ qmk c2json -kb svalboard/trackball/pmw3389/right -km vial --no-cpp $QMK_ROOT/keyboards/svalboard/keymaps/vial/keymap.c | skim generate - -o ./out
AliasedGroup ¶
Bases: Group
Click Group that supports command name abbreviation.
Allows users to invoke commands using unique prefixes instead of
full command names. For example, skim gen matches generate
if no other command starts with "gen".
Example
$ skim gen --keymap foo.kbi # Matches 'generate' $ skim conf -k bar.kbi # Matches 'configure'
get_command ¶
Resolve a command by name or unique prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
Click context. |
required |
cmd_name
|
str
|
Command name or prefix to resolve. |
required |
Returns:
| Type | Description |
|---|---|
Command | None
|
Matching Command object, or None if not found. |
Raises:
| Type | Description |
|---|---|
UsageError
|
If prefix matches multiple commands. |
Source code in src/skim/cli.py
resolve_command ¶
Resolve command and return full name for help text.
main ¶
Svalboard Keymap Image Maker (skim).
Generate visual keyboard layout images from keymap configuration files. Supports Keybard (.kbi), Vial (.vil), and QMK c2json formats.
Use --verbosity to control output detail level
DEBUG: Detailed debug information INFO: Progress updates and summaries WARNING: Only warnings and errors (default) ERROR: Only errors CRITICAL: Only critical errors NONE: Silence all output
Source code in src/skim/cli.py
doctor ¶
Check system environment and dependencies.
Source code in src/skim/cli.py
generate ¶
generate(
config: Path | None,
keymap: Path | None,
output_dir: Path,
output_format: str,
layer: tuple,
force: bool,
use_system_fonts: bool,
render_engine: str | None,
no_special_keys: bool,
no_symbols: bool,
symbol_legend_flow: str | None,
symbol_legend_columns: int | None,
macros_scale: float | None,
tap_dances_scale: float | None,
symbols_scale: float | None,
title: str | None,
copyright_text: str | None,
double_south: bool,
width: float | None,
adjust_lightness: float | None,
adjust_saturation: float | None,
stdin_marker: str | None,
) -> None
Generate keymap visualization images.
Parses a keymap file and generates a keymap image for each layer. Optionally generates an overview image showing all layers.
The supported output formats depend on the dependencies installed. For non-vector images (PNG, JPEG, WEBP, and AVIF), the Playwright Chromium Browser, or the Cairo library must be installed in the system.
STDIN_MARKER: Pass '-' to read keymap from stdin instead of file.
Layer selection examples: -l overview Generate only the overview image -l macros Generate only the macros image -l tap-dances Generate only the tap-dances image -l special-keys Generate only the macros + tap-dances combined image -l symbols Generate only the symbols image -l 1 Generate only layer 1 -l 1-3 Generate layers 1, 2, and 3 -l 1 -l 3 -l 5 Generate layers 1, 3, and 5 -l all-layers Generate every individual layer -l all Generate every layer + overview + macros + tap-dances + symbols (skips the combined special-keys image; opt in explicitly with -l special-keys) (no -l) Generate every layer plus overview
Source code in src/skim/cli.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
configure ¶
configure(
ctx: Context,
interactive: bool,
config: Path | None,
keymap: Path | None,
output: Path | None,
force: bool,
adjust_lightness: float | None,
adjust_saturation: float | None,
title: str | None,
copyright: str | None,
double_south: bool,
width: float | None,
layer_count: int | None,
) -> None
Generate or edit a configuration file.
With no flags, shows this help message.
Use -i/--interactive to launch the TUI configuration editor. Optionally pass -c/--config to load an existing config file into the editor.
Use -k to extract metadata (layer colors, names, custom keycodes) from a Keybard file.
Color adjustments (--adjust-lightness, --adjust-saturation) are applied to all extracted colors to ensure readable contrast in generated images.
Source code in src/skim/cli.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
Logging Configuration¶
logging_config ¶
Logging configuration for Skim CLI output.
This module provides logging setup with colored output and emoji indicators for different log levels. The configuration is optimized for CLI usage with progress feedback and debug information.
Log level formatting
- DEBUG: Green with bug emoji (🐞)
- INFO: Normal with contextual emoji (from record.emoji)
- WARNING: Yellow with warning emoji (⚠️)
- ERROR/CRITICAL: Red with error emoji (🚨)
Example
ColoredFormatter ¶
Bases: Formatter
Custom log formatter with ANSI colors and emoji support.
Applies color coding based on log level and prepends optional emoji indicators to log messages. The emoji can be specified per-record using the "emoji" extra field.
ANSI color codes are used for terminal output
- DEBUG: Green
- INFO: Default (reset)
- WARNING: Yellow
- ERROR+: Red
Attributes:
| Name | Type | Description |
|---|---|---|
GREY |
ANSI code for gray text. |
|
GREEN |
ANSI code for green text. |
|
YELLOW |
ANSI code for yellow text. |
|
RED |
ANSI code for red text. |
|
BOLD_RED |
ANSI code for bold red text. |
|
BLUE |
ANSI code for blue text. |
|
RESET |
ANSI code to reset formatting. |
Example
formatter = ColoredFormatter() handler.setFormatter(formatter)
format ¶
Format a log record with color and emoji.
Determines the appropriate color based on log level and prepends an emoji if specified in the record's extra data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
LogRecord
|
The log record to format. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Formatted string with ANSI color codes and optional emoji. |
Source code in src/skim/application/logging_config.py
setup_logging ¶
Configure the logging system for CLI output.
Sets up the root logger with colored output to stderr. The verbosity level can be specified as a string matching standard logging levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbosity
|
str
|
Log level as string. Valid values: "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NONE" |
required |
quiet
|
bool
|
If True, suppresses all log output regardless of verbosity. Equivalent to setting verbosity to "NONE". |
required |
Example
Source code in src/skim/application/logging_config.py
TUI Configurator¶
app ¶
Main TUI application for skim configuration editing.
LayerAdded ¶
Bases: Message
Posted when a layer is added in either tab.
Source code in src/skim/tui/app.py
LayerRemoved ¶
Bases: Message
Posted when a layer is removed in either tab.
Source code in src/skim/tui/app.py
LayerUpdated ¶
QuitConfirmScreen ¶
Bases: ModalScreen[str | None]
Modal dialog for save-on-quit with unsaved changes.
Returns "save" to save and quit, "discard" to quit without saving, or None if dismissed.
BINDINGS
class-attribute
instance-attribute
¶
BINDINGS = [
Binding(
key="s",
action="save_quit",
description="Save & Quit",
show=False,
),
Binding(
key="d",
action="discard",
description="Discard",
show=False,
),
Binding(
key="escape",
action="dismiss_dialog",
description="Cancel",
show=False,
),
]
compose ¶
Source code in src/skim/tui/app.py
on_button_pressed ¶
action_save_quit ¶
action_discard ¶
SaveTargetScreen ¶
Bases: ModalScreen[str | None]
Modal dialog to choose where to save when -c was used without -o.
Returns "overwrite" to save back to the config file, "default" to save to skim-config.yaml in cwd, or None if dismissed.
Source code in src/skim/tui/app.py
BINDINGS
class-attribute
instance-attribute
¶
compose ¶
Source code in src/skim/tui/app.py
on_button_pressed ¶
on_key ¶
OverwriteConfirmScreen ¶
Bases: ModalScreen[bool]
Modal dialog to confirm overwriting an existing file.
Returns True to overwrite, False to cancel.
Source code in src/skim/tui/app.py
BINDINGS
class-attribute
instance-attribute
¶
compose ¶
Source code in src/skim/tui/app.py
on_button_pressed ¶
on_key ¶
ErrorDialog ¶
HelpScreen ¶
Bases: ModalScreen[None]
Modal dialog to show contextual help as rendered markdown.
Source code in src/skim/tui/app.py
BINDINGS
class-attribute
instance-attribute
¶
BINDINGS = [
Binding(
key="escape",
action="dismiss_help",
description="Close",
show=False,
),
Binding(
key="q",
action="dismiss_help",
description="Close",
show=False,
),
]
compose ¶
on_mount ¶
on_key ¶
Source code in src/skim/tui/app.py
SkimConfigApp ¶
SkimConfigApp(
config_data: dict[str, Any],
output_path: Path | None = None,
config_path: Path | None = None,
force: bool = False,
)
Bases: App
Interactive skim configuration editor.
Source code in src/skim/tui/app.py
CSS
class-attribute
instance-attribute
¶
CSS = "\n QuitConfirmScreen, SaveTargetScreen, OverwriteConfirmScreen, ErrorDialog, HelpScreen {\n align: center middle;\n }\n #quit-dialog, #save-target-dialog, #error-dialog {\n padding: 1 2;\n width: 55;\n height: auto;\n border: thick $background 80%;\n background: $surface;\n }\n #overwrite-dialog {\n padding: 1 2;\n width: 82;\n height: auto;\n border: thick $background 80%;\n background: $surface;\n }\n #question {\n text-align: center;\n width: 100%;\n height: auto;\n margin-bottom: 1;\n }\n #error-message {\n text-align: center;\n width: 100%;\n height: auto;\n margin-bottom: 1;\n }\n #quit-buttons, #overwrite-buttons, #error-buttons {\n width: 100%;\n height: auto;\n align-horizontal: center;\n }\n #quit-buttons Button, #overwrite-buttons Button, #error-buttons Button {\n margin: 0 1;\n padding: 0 3;\n }\n #help-dialog {\n padding: 0;\n width: 70;\n height: auto;\n max-height: 80%;\n border: thick $background 80%;\n background: $surface;\n }\n #help-dialog _HelpMarkdown {\n padding: 1 3;\n overflow-y: auto;\n max-height: 100%;\n }\n #help-dialog MarkdownH1 {\n background: transparent;\n margin: 0 0 1 0;\n }\n #help-dialog MarkdownH2,\n #help-dialog MarkdownH3 {\n background: transparent;\n }\n #save-target-buttons {\n width: 100%;\n height: auto;\n align-horizontal: center;\n }\n #save-target-buttons Button {\n width: 100%;\n margin: 0 0 1 0;\n }\n /* Global compact styling */\n Input {\n height: 3;\n width: 1fr;\n margin: 0;\n }\n Switch {\n height: auto;\n min-height: 1;\n }\n Select {\n width: 1fr;\n max-width: 30;\n }\n .field-row {\n height: auto;\n margin: 0;\n padding: 0;\n }\n .field-label {\n width: 22;\n height: 3;\n padding: 1 0 0 0;\n }\n .section-title {\n text-style: bold;\n color: $accent;\n margin: 1 0 0 0;\n }\n .section-title-first {\n margin: 0;\n }\n AutoComplete {\n & AutoCompleteList {\n border-left: wide $accent;\n }\n }\n ListItem {\n layout: horizontal;\n }\n ListItem > Static {\n text-wrap: nowrap;\n text-overflow: ellipsis;\n width: 1fr;\n }\n ListItem.moving {\n background: $accent 30%;\n }\n ListItem.moving > Static {\n color: $accent;\n }\n ListItem > .lc-swatch {\n width: 4;\n }\n ListItem > .move-indicator {\n dock: right;\n width: 3;\n color: $accent;\n }\n .list-buttons {\n height: auto;\n }\n .list-buttons Button {\n min-width: 12;\n margin: 0 1 0 0;\n }\n "
BINDINGS
class-attribute
instance-attribute
¶
BINDINGS = [
Binding(
key="ctrl+q",
action="request_quit",
description="Quit",
key_display="⌃Q",
),
Binding(
key="ctrl+s",
action="save",
description="Save",
key_display="⌃S",
),
Binding(
key="ctrl+p",
action="previous_tab",
description="Previous Tab",
key_display="⌃P",
priority=True,
),
Binding(
key="ctrl+n",
action="next_tab",
description="Next Tab",
key_display="⌃N",
priority=True,
),
Binding(
key="up",
action="focus_direction('up')",
show=False,
priority=True,
),
Binding(
key="down",
action="focus_direction('down')",
show=False,
priority=True,
),
Binding(
key="left",
action="focus_direction('left')",
show=False,
priority=True,
),
Binding(
key="right",
action="focus_direction('right')",
show=False,
priority=True,
),
Binding(
key="ctrl+e",
action="scroll_view('down')",
description="Scroll down",
key_display="⌃E",
priority=True,
),
Binding(
key="ctrl+y",
action="scroll_view('up')",
description="Scroll up",
key_display="⌃Y",
priority=True,
),
Binding(
key="f1",
action="show_help",
description="Help",
key_display="F1,⌥H",
priority=True,
),
Binding(
key="alt+h",
action="show_help",
show=False,
priority=True,
),
]
compose ¶
Source code in src/skim/tui/app.py
action_request_quit ¶
action_show_help ¶
Show contextual help for the currently focused widget.
Source code in src/skim/tui/app.py
action_previous_tab ¶
action_next_tab ¶
action_save ¶
Source code in src/skim/tui/app.py
on_layer_added ¶
on_layer_added(event: LayerAdded) -> None
Source code in src/skim/tui/app.py
on_layer_updated ¶
on_layer_updated(event: LayerUpdated) -> None
Source code in src/skim/tui/app.py
on_layer_removed ¶
on_layer_removed(event: LayerRemoved) -> None
Source code in src/skim/tui/app.py
action_scroll_view ¶
Scroll the VerticalScroll in the active tab (skip ListViews).
Source code in src/skim/tui/app.py
action_focus_direction ¶
Move focus to the nearest focusable widget in the given direction.
Source code in src/skim/tui/app.py
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | |
on_descendant_focus ¶
TUI Widgets¶
widgets ¶
Shared reusable TUI widgets for skim configuration editor.
SkimFooter ¶
Bases: Footer
Footer with controlled binding order and paired key display.
compose ¶
Source code in src/skim/tui/widgets.py
SkimStandaloneInput ¶
Bases: Input
Input for standalone fields outside edit panes.
Source code in src/skim/tui/widgets.py
ColorInput ¶
Bases: SkimStandaloneInput
SkimStandaloneInput with shortcuts to nudge the color's HSL channels.
alt+up / alt+down increase / decrease saturation; alt+right
/ alt+left increase / decrease lightness. Each press applies a
0.05 delta clamped into [0, 1]. Non-hex values (empty input,
named CSS colors, malformed strings) are silently ignored — the
binding is a no-op.
The footer renders two grouped cells using SkimFooter._PAIRS:
one for the saturation pair and one for the lightness pair, with
the standard yellow-key / white-description styling.
Source code in src/skim/tui/widgets.py
SkimInput ¶
Bases: Input
Input with footer bindings for edit-pane field navigation.
Source code in src/skim/tui/widgets.py
BINDINGS
class-attribute
instance-attribute
¶
BINDINGS = [
Binding(
"tab",
"focus_next",
"Next field",
key_display="↓,⇥",
show=True,
),
Binding(
"shift+tab",
"focus_previous",
"Previous field",
key_display="↑,⇤",
show=True,
),
Binding(
"enter",
"submit",
"Confirm changes",
key_display="⏎",
show=True,
),
Binding(
"escape",
"cancel_edit",
"Discard changes",
key_display="\U000f12b7",
show=True,
),
]
LayerColorInput ¶
SkimListView ¶
Bases: ListView
ListView with footer bindings for navigation and edit.
Source code in src/skim/tui/widgets.py
BINDINGS
class-attribute
instance-attribute
¶
BINDINGS = [
Binding("up", "cursor_up", "Prev item", show=True),
Binding("down", "cursor_down", "Next item", show=True),
Binding(
"enter",
"select_cursor",
"Edit",
key_display="⏎",
show=True,
),
Binding("m", "move_mode", "Move", show=True),
Binding("up", "move_up", "Move up", show=True),
Binding("down", "move_down", "Move down", show=True),
Binding(
"enter",
"confirm_move",
"Confirm position",
key_display="⏎",
show=True,
),
Binding(
"escape",
"cancel_move",
"Discard changes",
key_display="\U000f12b7",
show=True,
),
]
check_action ¶
Source code in src/skim/tui/widgets.py
action_move_mode ¶
action_move_up ¶
action_move_down ¶
action_confirm_move ¶
SkimButton ¶
Bases: Button
Button that responds to both Enter and Space.
Source code in src/skim/tui/widgets.py
SkimSwitch ¶
Bases: Switch
Switch with footer binding for toggle action.
Source code in src/skim/tui/widgets.py
SkimSelect ¶
Bases: Select
Select with footer binding for menu action.
Source code in src/skim/tui/widgets.py
BINDINGS
class-attribute
instance-attribute
¶
BINDINGS = [
Binding(
"enter",
"show_overlay",
"Show options",
key_display="⏎,␣",
show=True,
),
Binding(
"space", "show_overlay", "Show options", show=False
),
Binding(
"tab",
"focus_next",
"Next field",
key_display="↓,⇥",
show=True,
),
Binding(
"shift+tab",
"focus_previous",
"Previous field",
key_display="↑,⇤",
show=True,
),
Binding(
"escape",
"cancel_edit",
"Discard changes",
key_display="\U000f12b7",
show=True,
),
Binding("up", "skip_arrow", show=False),
Binding("down", "skip_arrow", show=False),
]
action_cancel_edit ¶
action_skip_arrow ¶
SkimVerticalScroll ¶
List Detail Pane¶
list_detail_pane ¶
Reusable list/detail pane base class for the skim TUI.
ListDetailPane ¶
Bases: Widget
Base class for a list/detail split pane.
Provides: horizontal layout with a list column (35%) and a detail pane, edit mode lifecycle (enter/exit/commit/cancel), snapshot/rollback, focus-out commit, and key handling (Enter/Escape/a/d).
Subclasses implement the abstract methods to supply data and fields.
Source code in src/skim/tui/list_detail_pane.py
DEFAULT_CSS
class-attribute
instance-attribute
¶
DEFAULT_CSS = "\n ListDetailPane {\n height: auto;\n }\n ListDetailPane .ldp-container {\n height: auto;\n }\n ListDetailPane .ldp-list-col {\n width: 35%;\n min-width: 25;\n height: 100%;\n }\n ListDetailPane .ldp-list {\n height: 1fr;\n border: solid $accent 50%;\n }\n ListDetailPane .ldp-buttons {\n height: auto;\n width: 100%;\n }\n ListDetailPane .ldp-buttons Button {\n width: 50%;\n }\n ListDetailPane .ldp-detail {\n padding: 0 1;\n height: auto;\n overflow-x: hidden;\n border: solid $accent 30%;\n }\n ListDetailPane .ldp-detail:focus-within {\n border: solid $accent;\n }\n "
move_enabled
property
¶
Whether this pane supports move mode. Override to enable.
EntryAdded ¶
EntryRemoved ¶
EntryUpdated ¶
Bases: Message
Posted after a successful commit.
compose ¶
Source code in src/skim/tui/list_detail_pane.py
get_entries
abstractmethod
¶
format_entry
abstractmethod
¶
compose_detail_fields
abstractmethod
¶
detail_field_ids
abstractmethod
¶
refresh_fields
abstractmethod
¶
clear_fields
abstractmethod
¶
create_entry
abstractmethod
¶
validate_and_apply ¶
Validate the edit, apply field values to the entry dict.
Return True if valid, False to revert and show error. Default implementation is a no-op that returns True.
Source code in src/skim/tui/list_detail_pane.py
rebuild_list ¶
Rebuild the entire list from get_entries().
Source code in src/skim/tui/list_detail_pane.py
update_all_list_items ¶
Update the text of all list items in place.
Source code in src/skim/tui/list_detail_pane.py
update_selected_list_item ¶
Update only the selected list item.
Source code in src/skim/tui/list_detail_pane.py
move_paired_lists ¶
Return additional lists that must be swapped in sync with entries.
Subclasses override this to return lists (e.g. palette layers,
keyboard layers) that are paired 1:1 with get_entries().
Source code in src/skim/tui/list_detail_pane.py
on_move_swap ¶
Hook called before swapping entries at pos and target.
Subclasses override this to adjust entry data (e.g. QMK indices) before the positional swap happens.
Source code in src/skim/tui/list_detail_pane.py
on_button_pressed ¶
on_list_view_selected ¶
Source code in src/skim/tui/list_detail_pane.py
on_list_view_highlighted ¶
Source code in src/skim/tui/list_detail_pane.py
on_key ¶
Handle move mode, Enter/Escape in edit mode, a/d/m shortcuts on list.
Source code in src/skim/tui/list_detail_pane.py
on_descendant_blur ¶
Commit edit when focus leaves the editing pane.
Keyboard Tab¶
keyboard_tab ¶
Keyboard tab widget for the skim TUI configuration editor.
LayerListPane ¶
Bases: ListDetailPane
List/detail pane for keyboard layers.
Source code in src/skim/tui/keyboard_tab.py
DEFAULT_CSS
class-attribute
instance-attribute
¶
get_entries ¶
format_entry ¶
Source code in src/skim/tui/keyboard_tab.py
compose_detail_fields ¶
Source code in src/skim/tui/keyboard_tab.py
detail_field_ids ¶
refresh_fields ¶
Source code in src/skim/tui/keyboard_tab.py
clear_fields ¶
create_entry ¶
Source code in src/skim/tui/keyboard_tab.py
validate_and_apply ¶
Validate index (0-31, no duplicates), apply fields, re-sort.
Source code in src/skim/tui/keyboard_tab.py
on_input_changed ¶
Source code in src/skim/tui/keyboard_tab.py
move_paired_lists ¶
on_move_swap ¶
Source code in src/skim/tui/keyboard_tab.py
KeyboardTab ¶
Bases: Widget
Keyboard configuration tab.
Shows an Information section, a Features section, and a Layers section with a LayerListPane for editing individual layer metadata.
Source code in src/skim/tui/keyboard_tab.py
DEFAULT_CSS
class-attribute
instance-attribute
¶
DEFAULT_CSS = "\n KeyboardTab {\n height: 1fr;\n padding: 0 1;\n }\n KeyboardTab #info-section {\n height: auto;\n }\n KeyboardTab #features-section {\n height: auto;\n }\n KeyboardTab #features-row {\n height: auto;\n }\n KeyboardTab #layers-section {\n height: auto;\n }\n "
compose ¶
Source code in src/skim/tui/keyboard_tab.py
on_mount ¶
on_switch_changed ¶
Source code in src/skim/tui/keyboard_tab.py
on_input_changed ¶
Source code in src/skim/tui/keyboard_tab.py
on_list_detail_pane_entry_added ¶
on_list_detail_pane_entry_added(event: EntryAdded) -> None
on_list_detail_pane_entry_removed ¶
on_list_detail_pane_entry_removed(
event: EntryRemoved,
) -> None
on_list_detail_pane_entry_updated ¶
on_list_detail_pane_entry_updated(
event: EntryUpdated,
) -> None
sync_layer_added ¶
Called when a layer color is added in the Style tab.
Source code in src/skim/tui/keyboard_tab.py
sync_layer_removed ¶
Called when a layer color is removed in the Style tab.
Source code in src/skim/tui/keyboard_tab.py
Keycodes Tab¶
keycodes_tab ¶
Keycodes tab widget for the skim TUI configuration editor.
KeycodeAutoComplete ¶
Bases: AutoComplete
Token-aware autocomplete for keycode/macro fields.
Splits input on separator characters so autocomplete works inside
macro arguments (e.g. LSFT(KC_SPC)). Macro completions like
LSFT() are inserted as LSFT( so the user can continue
filling in the argument.
Source code in src/skim/tui/keycodes_tab.py
get_search_string ¶
apply_completion ¶
Source code in src/skim/tui/keycodes_tab.py
should_show_dropdown ¶
Source code in src/skim/tui/keycodes_tab.py
OverrideTargetAutoComplete ¶
Bases: AutoComplete
Context-aware autocomplete for the Override Target field.
Detects @@ (keycode reference) and %% (NerdFont glyph) prefixes
at the cursor position and provides appropriate candidates.
On completion, inserts the value with a trailing ;.
Source code in src/skim/tui/keycodes_tab.py
get_search_string ¶
Source code in src/skim/tui/keycodes_tab.py
get_candidates ¶
Source code in src/skim/tui/keycodes_tab.py
apply_completion ¶
Source code in src/skim/tui/keycodes_tab.py
should_show_dropdown ¶
Source code in src/skim/tui/keycodes_tab.py
PreProcessListPane ¶
Bases: ListDetailPane
List/detail pane for pre-process keycode entries.
Source code in src/skim/tui/keycodes_tab.py
get_entries ¶
format_entry ¶
compose_detail_fields ¶
Source code in src/skim/tui/keycodes_tab.py
detail_field_ids ¶
refresh_fields ¶
Source code in src/skim/tui/keycodes_tab.py
clear_fields ¶
Source code in src/skim/tui/keycodes_tab.py
create_entry ¶
on_input_changed ¶
Source code in src/skim/tui/keycodes_tab.py
OverrideListPane ¶
Bases: ListDetailPane
List/detail pane for override keycode entries.
Source code in src/skim/tui/keycodes_tab.py
get_entries ¶
format_entry ¶
Source code in src/skim/tui/keycodes_tab.py
compose_detail_fields ¶
Source code in src/skim/tui/keycodes_tab.py
detail_field_ids ¶
refresh_fields ¶
Source code in src/skim/tui/keycodes_tab.py
clear_fields ¶
Source code in src/skim/tui/keycodes_tab.py
create_entry ¶
on_input_changed ¶
Source code in src/skim/tui/keycodes_tab.py
MacroListPane ¶
Bases: ListDetailPane
List/detail pane for macro definitions.
Source code in src/skim/tui/keycodes_tab.py
get_entries ¶
format_entry ¶
Source code in src/skim/tui/keycodes_tab.py
compose_detail_fields ¶
Source code in src/skim/tui/keycodes_tab.py
detail_field_ids ¶
refresh_fields ¶
Source code in src/skim/tui/keycodes_tab.py
clear_fields ¶
create_entry ¶
Source code in src/skim/tui/keycodes_tab.py
validate_and_apply ¶
Source code in src/skim/tui/keycodes_tab.py
on_input_changed ¶
Source code in src/skim/tui/keycodes_tab.py
TapDanceListPane ¶
Bases: ListDetailPane
List/detail pane for tap-dance definitions.
Source code in src/skim/tui/keycodes_tab.py
get_entries ¶
format_entry ¶
Source code in src/skim/tui/keycodes_tab.py
compose_detail_fields ¶
Source code in src/skim/tui/keycodes_tab.py
detail_field_ids ¶
refresh_fields ¶
Source code in src/skim/tui/keycodes_tab.py
clear_fields ¶
Source code in src/skim/tui/keycodes_tab.py
create_entry ¶
Source code in src/skim/tui/keycodes_tab.py
validate_and_apply ¶
Source code in src/skim/tui/keycodes_tab.py
on_input_changed ¶
Source code in src/skim/tui/keycodes_tab.py
KeycodesTab ¶
Bases: Widget
Keycodes configuration tab.
Shows four sections -- Pre-process, Overrides, Macros, and Tap-dances -- each using a ListDetailPane subclass for editing individual entries. The whole tab is wrapped in a SkimVerticalScroll so all four sections scroll together.
Source code in src/skim/tui/keycodes_tab.py
DEFAULT_CSS
class-attribute
instance-attribute
¶
DEFAULT_CSS = "\n KeycodesTab {\n height: 1fr;\n padding: 0 1;\n }\n KeycodesTab .keycodes-section {\n height: auto;\n }\n KeycodesTab .keycodes-section ListDetailPane .ldp-list-col {\n width: 35%;\n min-width: 25;\n height: auto;\n }\n KeycodesTab .keycodes-section ListDetailPane .ldp-list {\n height: 8;\n border: solid $accent 50%;\n }\n KeycodesTab .keycodes-section ListDetailPane .ldp-detail {\n padding: 0 1;\n height: auto;\n overflow-x: hidden;\n border: solid $accent 30%;\n }\n KeycodesTab .keycodes-section ListDetailPane .ldp-detail .field-row {\n height: auto;\n }\n KeycodesTab .keycodes-section ListDetailPane .ldp-detail:focus-within {\n border: solid $accent;\n }\n "
compose ¶
Source code in src/skim/tui/keycodes_tab.py
on_mount ¶
Source code in src/skim/tui/keycodes_tab.py
Output Tab¶
output_tab ¶
Output tab widget for the skim TUI configuration editor.
ColorAutoComplete ¶
Bases: AutoComplete
AutoComplete that re-posts Input.Changed after dropdown selection.
The base AutoComplete suppresses Input.Changed during completion
via self.prevent(Input.Changed). This subclass re-fires the
event so that parent widgets (e.g. swatch updates) react to the
new value.
Source code in src/skim/tui/output_tab.py
LayerColorListPane ¶
Bases: ListDetailPane
List/detail pane for layer colors.
Source code in src/skim/tui/output_tab.py
DEFAULT_CSS
class-attribute
instance-attribute
¶
DEFAULT_CSS = "\n LayerColorListPane {\n height: auto;\n }\n LayerColorListPane .lc-swatch {\n width: 4;\n height: 1;\n dock: right;\n margin: 0 0 0 1;\n }\n LayerColorListPane .color-swatch {\n width: 4;\n height: 1;\n margin: 1 1 0 0;\n content-align: center middle;\n }\n LayerColorListPane .swatch-spacer {\n width: 4;\n height: 1;\n margin: 1 1 0 0;\n }\n LayerColorListPane .gradient-swatch {\n width: 4;\n height: 3;\n content-align: center middle;\n }\n LayerColorListPane .gradient-preview {\n height: 3;\n width: auto;\n layout: horizontal;\n padding: 0 2;\n }\n LayerColorListPane .gradient-dark {\n background: #1b1b1b;\n margin: 0 0 0 2;\n }\n LayerColorListPane .gradient-light {\n background: #ffffff;\n margin: 0 0 0 1;\n }\n LayerColorListPane .lc-manual-step {\n display: none;\n }\n LayerColorListPane.manual-mode .lc-manual-step {\n display: block;\n }\n LayerColorListPane.manual-mode #lc-dynamic-color {\n display: none;\n }\n LayerColorListPane.manual-mode #lc-dynamic-preview {\n display: none;\n }\n "
get_entries ¶
format_entry ¶
Source code in src/skim/tui/output_tab.py
compose_detail_fields ¶
Source code in src/skim/tui/output_tab.py
detail_field_ids ¶
move_paired_lists ¶
on_move_swap ¶
Source code in src/skim/tui/output_tab.py
on_key ¶
Override to let Select handle keys normally.
Textual's on_key fires during event bubbling BEFORE the App-level binding system runs. We must stop the event (to prevent other handlers from interfering) and manually trigger binding checks.
Source code in src/skim/tui/output_tab.py
on_descendant_blur ¶
Suppress focus-out commit while Select overlay is open.
on_select_changed ¶
refresh_fields ¶
Source code in src/skim/tui/output_tab.py
clear_fields ¶
Source code in src/skim/tui/output_tab.py
create_entry ¶
on_input_changed ¶
Source code in src/skim/tui/output_tab.py
OutputTab ¶
Bases: Widget
Output configuration tab.
Has sections for layout, style, palette, and layer colors.
Source code in src/skim/tui/output_tab.py
DEFAULT_CSS
class-attribute
instance-attribute
¶
DEFAULT_CSS = "\n OutputTab {\n height: 1fr;\n padding: 0 1;\n }\n OutputTab .section {\n height: auto;\n border-bottom: solid $accent 20%;\n }\n OutputTab .color-swatch {\n width: 5;\n height: 1;\n margin: 1 1 0 0;\n content-align: center middle;\n }\n OutputTab .swatch-spacer {\n width: 4;\n height: 1;\n margin: 1 1 0 0;\n }\n "
compose ¶
Source code in src/skim/tui/output_tab.py
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | |
on_mount ¶
Source code in src/skim/tui/output_tab.py
on_list_detail_pane_entry_added ¶
on_list_detail_pane_entry_added(event: EntryAdded) -> None
on_list_detail_pane_entry_removed ¶
on_list_detail_pane_entry_removed(
event: EntryRemoved,
) -> None
sync_layer_added ¶
Called when a layer is added in the Keyboard tab.
Source code in src/skim/tui/output_tab.py
sync_layer_removed ¶
Called when a layer is removed in the Keyboard tab.
Source code in src/skim/tui/output_tab.py
on_input_changed ¶
Route input changes to the correct config path.