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

pyWal support and terminal coloring #99

Open
ca5ua1 opened this issue May 9, 2023 · 4 comments
Open

pyWal support and terminal coloring #99

ca5ua1 opened this issue May 9, 2023 · 4 comments
Labels
feature A new feature or a feature request

Comments

@ca5ua1
Copy link
Contributor

ca5ua1 commented May 9, 2023

with pywal and it's -R flag you can apply colors to I guess any terminal. There is other wal programs that works with wal colors such as wal-telegram. There is my approach of doing that:

home.nix

  home.file = {
	".cache/colors.json".source = config.lib.stylix.colors {
	        template = builtins.readFile ./pywal.json.mustache;
	        extension = ".json";
	      };
};
home.activation =  #ALSO ACTIVATES AT REBOOT
      {
        generate_pywal_colors = lib.hm.dag.entryAfter ["writeBoundary"] ''
         $DRY_RUN_CMD ${pkgs.pywal}/bin/wal -f ~/.cache/colors.json
         $DRY_RUN_CMD ${pkgs.pywal}/bin/wal -R
       '';
telegram-colors = lib.hm.dag.entryAfter ["writeBoundary"] ''
#         $DRY_RUN_CMD      rm -rf ~/.cache/.wal-telegram-git
         $DRY_RUN_CMD ${pkgs.git}/bin/git clone --depth 1 https://github.com/guillaumeboehm/wal-telegram ~/.cache/.wal-telegram-git || PATH=/run/wrappers/bin:/.local/bin:/root/.nix-profile/bin:/etc/profiles/per-user/root/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin          /usr/bin/env bash -i -c '~/.cache/.wal-telegram-git/wal-telegram --wal -g -r -b ~/Pictures/wallpaper.jpg' && PATH=/run/wrappers/bin:/.local/bin:/root/.nix-profile/bin:/etc/profiles/per-user/root/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin          /usr/bin/env bash -i -c '~/.cache/.wal-telegram-git/wal-telegram --wal -g -r -b ~/Pictures/wallpaper.jpg'
       '';
};

pywal.json.mustache

{
    "special": {
        "background": "#{{base00-hex}}",
        "foreground": "#{{base07-hex}}",
        "cursor": "#{{base07-hex}}"
    },
    "colors": {
        "color0": "#{{base00-hex}}",
        "color1": "#{{base01-hex}}",
        "color2": "#{{base02-hex}}",
        "color3": "#{{base03-hex}}",
        "color4": "#{{base04-hex}}",
        "color5": "#{{base05-hex}}",
        "color6": "#{{base06-hex}}",
        "color7": "#{{base07-hex}}",
        "color8": "#{{base08-hex}}",
        "color9": "#{{base09-hex}}",
        "color10": "#{{base0A-hex}}",
        "color11": "#{{base0B-hex}}",
        "color12": "#{{base0C-hex}}",
        "color13": "#{{base0D-hex}}",
        "color14": "#{{base0E-hex}}",
        "color15": "#{{base0F-hex}}"
    }
}

@danth danth added the feature A new feature or a feature request label May 18, 2023
@KiaraGrouwstra
Copy link

home-manager's programs.pywal module is also setting some settings there.
i feel that can get kinda so big they might not be the best place for that, which makes me wonder if this could be a better place as well.

the basic process seems to be about ensuring there's a template file for the application in question, then from nix having the application's actual style/configuration file include a dynamic include to that (presuming their format supports this), e.g. see my attempt for Zathura.

i feel like we could do stuff like that here, so maybe the question would be if it's in scope. if anything tho, it would seem desirable to have these play nice, i.e. ensuring stylix wouldn't like override its colors with static ones, so that could be an argument in favor of handling this from the stylix repo.

@99linesofcode
Copy link

Hey @KiaraGrouwstra,

I stumbled upon this issue and I was wondering whether you were aware that stylix has builtin support for generating colorschemes based on the wallpaper similarly to what pywal does (although the details elude me):

https://stylix.danth.me/configuration.html#generated-schemes

@KiaraGrouwstra
Copy link

@99linesofcode thanks for mentioning that.

i guess the unfortunate part of stylix for this purpose tho would be having to rebuild your nixos config just to change wallpaper, which seems like a bunch of unnecessary cpu cycles.
delegating the theme generation stuff to the likes of pywal for that would alleviate that need.

@trueNAHO
Copy link
Collaborator

trueNAHO commented Sep 3, 2024

i guess the unfortunate part of stylix for this purpose tho would be having to rebuild your nixos config just to change wallpaper, which seems like a bunch of unnecessary cpu cycles.

In the future, this operation would mostly happen at runtime: #477 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or a feature request
Projects
None yet
Development

No branches or pull requests

5 participants