Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement omb theme #620

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

RobLoach
Copy link
Contributor

@RobLoach RobLoach commented Oct 2, 2024

This introduces a themes plugin which allows changing the theme on the fly. This mimics the themes oh-my-zsh plugin.

Usage

theme <theme_name> - Changes the theme to specified theme.

theme - Changes the theme to some random theme.

lstheme - Lists installed themes.

@RobLoach RobLoach mentioned this pull request Oct 2, 2024
@akinomyoga
Copy link
Contributor

akinomyoga commented Oct 2, 2024

Thank you for the PR! I have a question. How is the upstream OMZ themes plugin different from omz theme [1]?

Since this is related to the OMB specific feature for themes, I feel this should be implemented as a subcommand of the omb command similar to omz theme. However, the upstream OMZ seems to contain quite similar features in two locations, plugins/themes and omz theme, which appears to be weird to me.

edit: If we switch to omb theme, you are going to replace the following stub code in lib/cli.bash:

oh-my-bash/lib/cli.bash

Lines 20 to 22 in e712342

function _omb_cmd_theme {
echo 'Not yet implemented'
}

@RobLoach
Copy link
Contributor Author

RobLoach commented Oct 2, 2024

Namespacing it within omb makes so much sense. Thanks for linking the stub.

Available commands:
  list          List all available themes
  set <theme>   Set the given theme in your .bashrc file
  use <theme>   Load the given theme
@RobLoach RobLoach changed the title plugins: Add Theme plugin Implement omb theme Oct 2, 2024
@RobLoach RobLoach marked this pull request as draft October 2, 2024 05:21
@RobLoach
Copy link
Contributor Author

RobLoach commented Oct 2, 2024

Not sure how I feel about manipulating the .bashrc file with omb theme set zork.

lib/cli.bash Outdated Show resolved Hide resolved
lib/cli.bash Outdated Show resolved Hide resolved
lib/cli.bash Outdated Show resolved Hide resolved
_comp_cmd_omb__get_available_themes
for i in "${available_themes[@]}"; do
if [ "$i" == "$theme" ]; then
_omb_module_require_theme "$theme"
Copy link
Contributor

Choose a reason for hiding this comment

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

_omb_module_require_theme is kind of "include once"; it checks whether the module is already loaded and loads the module only when it hasn't been loaded. So, with this implementation, one cannot switch to the theme that was loaded before.

To handle this, we may need to factorize a part of _omb_module_require (oh-my-bash.sh) into _omb_module_search and use it to obtain the location of the theme file.

lib/cli.bash Outdated Show resolved Hide resolved
lib/cli.bash Outdated Show resolved Hide resolved
lib/cli.bash Outdated Show resolved Hide resolved
RobLoach and others added 2 commits October 2, 2024 01:47
Co-authored-by: Koichi Murase <[email protected]>
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