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

taskwarrior: add support #223

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

Conversation

trueNAHO
Copy link
Collaborator

@trueNAHO trueNAHO commented Jan 19, 2024

This module themes the Taskwarrior (programs.taskwarrior.enable) Home Manager package.

However, I am unsure how to properly interpolate the Stylix colors into the current draft theme at modules/taskwarrior/template.theme.mustache. I am unsure whether {{base00-hex}} or {{base00-rgb-r}} are appropriate in this case: https://www.systutorials.com/docs/linux/man/5-task-color.

Once this PR merges, we could try to patch the theme upstream, and then remove it from this repo in a follow up PR.

Note that the current state properly applies the (non-Stylix) colors in my Home Manager setup.

@trueNAHO
Copy link
Collaborator Author

However, I am unsure how to properly interpolate the Stylix colors into the current draft theme at modules/taskwarrior/template.theme.mustache. I am unsure whether {{base00-hex}} or {{base00-rgb-r}} are appropriate in this case: https://www.systutorials.com/docs/linux/man/5-task-color.

Considering that GothenburgBitFactory/taskwarrior#2415 had no activity in the last three years, it seems like Taskwarrior does not support conventional RGB values.

Upon deep investigation, I realised that Taskwarrior represents the traditional RGB range of [0-255][0-255][0-255] with rgb[0-5][0-5][0-5]:

A value of 0 means none of this component color, and a value of 5 means the most intense component color.

(Source: https://www.systutorials.com/docs/linux/man/5-task-color)

Consequently, e73c494 adds local variables mapping the traditional RGB range (0--255) to Taskwarrior's RGB range (0--5).

However, now I am stuck because I don't know how to interpolate the new variables in the template:

https://github.com/trueNAHO/stylix/blob/e73c494cc1fc1b40f6f81021e1f9dfabc203cf23/modules/taskwarrior/hm.nix#L35-L37

@danth
Copy link
Owner

danth commented Jan 20, 2024

config.lib.stylix.colors comes from an external library which doesn't currently provide a way to add custom variables.

Your best option is to implement that functionality upstream, which would be helpful for some other features in Stylix too.

Alternatively we could call mustache directly with all of the values the template needs.

@trueNAHO
Copy link
Collaborator Author

Seems like config.lib.stylix.colors depends on base16.nix:

stylix/stylix/palette.nix

Lines 125 to 130 in a9e3ce0

config = {
# This attrset can be used like a function too, see
# https://github.com/SenchoPens/base16.nix#mktheme
lib.stylix.colors = (base16.mkSchemeAttrs cfg.base16Scheme).override override;
lib.stylix.scheme = base16.mkSchemeAttrs cfg.base16Scheme;
};

Maybe one of the following procedures allows specifying local variables:

https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#-how-to

trueNAHO added a commit to trueNAHO/dotfiles that referenced this pull request Jan 28, 2024
Replace the 'todo' task manager with Taskwarrior because the
unstructured data format no longer scales my needs.

Requires: danth/stylix#223
Reverts: 493d995
@trueNAHO trueNAHO changed the title feat(modules/taskwarrior): add support taskwarrior: add support Feb 9, 2024
@trueNAHO trueNAHO mentioned this pull request Feb 8, 2025
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