Skip to content

Conversation

@Rejdukien
Copy link

@Rejdukien Rejdukien commented Dec 15, 2025

  • Adds support for yasbc toggle-widget ai_chat
  • Adds an auto focus input option, configured via yaml, defaults to false
  • Add a default model selection, also configured via yaml, default: true added to the respective model. Only affects initial initialization, if the widget is opened, model/provider changed, closed and opened back up the default model doesn't affect it.
    Also, should more than one model be declared as default, first model is selected as default.

Just started using yasb, figured I'd implement the changes I'd like to see myself. Should make it easier to use the widget via hotkeys.

Tested behavior with "old" yaml before the change, no breaking changes from what I could see.

Copilot AI review requested due to automatic review settings December 15, 2025 14:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds three new features to the AI Chat widget to improve usability when controlling the widget via keyboard shortcuts:

  • Toggle widget visibility via CLI command (yasbc toggle-widget ai_chat)
  • Auto-focus input field option when chat window opens
  • Default model selection for initial widget initialization

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/core/widgets/yasb/ai_chat.py Implements toggle-widget CLI handling, auto-focus input functionality, and default model selection logic
src/core/widgets/base.py Adds widget_config_name property to BaseWidget for identifying widgets in CLI commands
src/core/validation/widgets/yasb/ai_chat.py Adds validation schemas for new auto_focus_input and default configuration options
src/core/utils/widget_builder.py Sets widget_config_name on widget instances during construction
docs/widgets/(Widget)-Ai-Chat.md Documents the new features and their configuration options

@Rejdukien
Copy link
Author

I went ahead and made it possible to toggle specific instances of the widget by adding a widget_config_name attribute to the base widget, which gets populated by the widget builder. This name can be referenced when calling toggle-widget - at least for this widget, haven't touched the _handle_widget_cli method of other ones. Don't think it'd make much sense to have multiple launchpads, wallpaper managers or power menu widgets.
Figured it's not a bad idea, since technically it's possible to add multiple widgets of the same type.

@amnweb
Copy link
Owner

amnweb commented Dec 15, 2025

Interesting, Ai makes Ai widget xD

@Rejdukien
Copy link
Author

Ayy, not gonna lie, for smaller changes in an unfamiliar codebase it's pretty decent - as long as you verify afterwards. 😛

@amnweb
Copy link
Owner

amnweb commented Dec 15, 2025

I will check all this when I have some free time, probably this weekend

* Allows widgets to refer to their name defined in the yaml, for example to differentiate multiple instances, without adding extra attributes to the config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants