From b800d8f1eb659a19e2870932449c0605e369901a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 7 Mar 2023 11:05:15 +0100 Subject: [PATCH] desktop: Add flavours program to set colors Switching from my custom, brittle, styling implementation `styler` to the wonder `flavours` program which does exactly the same only with more clarity, faster and - I would presume - more stable. --- bootstrap/packages_stable.tsv | 1 + desktop/.config/flavours/config.toml | 84 +++++++++++++++++++ .../templates/nvim/templates/default.mustache | 29 +++++++ .../wezterm/templates/default.mustache | 32 +++++++ desktop/.config/mako/config | 7 -- desktop/.config/river/init | 2 +- 6 files changed, 147 insertions(+), 8 deletions(-) create mode 100644 desktop/.config/flavours/config.toml create mode 100644 desktop/.config/flavours/templates/nvim/templates/default.mustache create mode 100644 desktop/.config/flavours/templates/wezterm/templates/default.mustache diff --git a/bootstrap/packages_stable.tsv b/bootstrap/packages_stable.tsv index b1a2864..e8cf5fe 100644 --- a/bootstrap/packages_stable.tsv +++ b/bootstrap/packages_stable.tsv @@ -68,6 +68,7 @@ fasd Command-line productivity booster, offers quick access to files and directo fd Simple, fast and user-friendly alternative to find R ffmpegthumbnailer Lightweight video thumbnailer that can be used by file managers R firefox Standalone web browser from mozilla.org R +flavours A simple and easy cli to build and use base16 schemes A fonts-cjk Linux 下的免费商用字体包 A freerdp Free implementation of the Remote Desktop Protocol (RDP) R fwupd Simple daemon to allow session software to update firmware R diff --git a/desktop/.config/flavours/config.toml b/desktop/.config/flavours/config.toml new file mode 100644 index 0000000..c971cc1 --- /dev/null +++ b/desktop/.config/flavours/config.toml @@ -0,0 +1,84 @@ +# Configuration for flavours +# https://github.com/Misterio77/flavours +# +# This file should contain a [[items]] section for each application you want themed +# You can also set a shell (outside items) on which to run hooks +# Check flavours repository for more information and examples + + +# Explanation and default values for keys: + +# # Through which shell command hooks will run. The command will be replaced in '{}' +shell = "bash -c '{}'" +# +# [[items]] +# # File to inject to, supports tilde and env var expansion. required +# file = "~/.config/example" +# # Template to use. required +# template = "example" +# +# # Subtemplate to use +# subtemplate = "default" +# # If not rewriting, on which line (usually a comment) to start replacing +# start = "# Start flavours" +# # If not rewriting, on which line (usually a comment) to stop replacing +# end = "# End flavours" +# # Should we rewrite the entire file, instead of using the above delimiters? +# rewrite = false +# # Command to execute after injecting (goes through shell) +# hook = "" +# # Whether this hook should be executed when flavours is ran with lightweight flag +# light = true + +[[items]] +template = "waybar" +file = "~/.local/state/waybar/colorscheme.css" +rewrite = true +light = false +hook = "killall -SIGUSR2 waybar" + +[[items]] +# Uses custom nvim template to work together with +# RRethy base16 neovim plugin +template = "nvim" +file = "~/.local/state/nvim/colorscheme.lua" +rewrite = true + +[[items]] +# For newer wezterm versions (missing cursor= field) +# make use of my custom wezterm template +template = "wezterm" +file = "~/.local/state/wezterm/colors.toml" +rewrite = true + +[[items]] +template = "zathura" +file = "~/.local/state/zathura/zathurarc" +rewrite = true + +[[items]] +template = "qutebrowser" +subtemplate = "minimal" +file = "~/.local/state/qutebrowser/colorscheme.py" +rewrite = true +light = false +hook = "pgrep -x qutebrowser && qutebrowser :config-source" + +# CSS Webpage styling in qutebrowser +[[item]] +file = "~/.config/qutebrowser/stylesheets/stylesheet.css" +template = "styles" +subtemplate = "css-variables" +rewrite = false +start = "/* Start flavours */" +end = "/* End flavours */" + +[[items]] +# MAKO DOES NOT SUPPORT INCLUDES YET +template = "mako" +file = "~/.config/mako/config" +light = false +rewrite = false +start = "# Start flavours" +end = "# End flavours" +hook = "killall mako" diff --git a/desktop/.config/flavours/templates/nvim/templates/default.mustache b/desktop/.config/flavours/templates/nvim/templates/default.mustache new file mode 100644 index 0000000..08baf2c --- /dev/null +++ b/desktop/.config/flavours/templates/nvim/templates/default.mustache @@ -0,0 +1,29 @@ +-- base16-nvim (https://github.com/wincent/base16-nvim) +-- by Greg Hurrell (https://github.com/wincent) +-- based on +-- base16-vim (https://github.com/chriskempson/base16-vim) +-- by Chris Kempson (https://github.com/chriskempson) +-- using nvim-base16 neovim plugin +-- by RRethy (https://github.com/RRethy/nvim-base16) +-- {{scheme-name}} scheme by {{scheme-author}} + +require('base16-colorscheme').setup({ + base00 = '#{{base00-hex}}', + base01 = '#{{base01-hex}}', + base02 = '#{{base02-hex}}', + base03 = '#{{base03-hex}}', + base04 = '#{{base04-hex}}', + base05 = '#{{base05-hex}}', + base06 = '#{{base06-hex}}', + base07 = '#{{base07-hex}}', + base08 = '#{{base08-hex}}', + base09 = '#{{base09-hex}}', + base0A = '#{{base0A-hex}}', + base0B = '#{{base0B-hex}}', + base0C = '#{{base0C-hex}}', + base0D = '#{{base0D-hex}}', + base0E = '#{{base0E-hex}}', + base0F = '#{{base0F-hex}}' +}) + +-- vim: filetype=lua diff --git a/desktop/.config/flavours/templates/wezterm/templates/default.mustache b/desktop/.config/flavours/templates/wezterm/templates/default.mustache new file mode 100644 index 0000000..5f2c202 --- /dev/null +++ b/desktop/.config/flavours/templates/wezterm/templates/default.mustache @@ -0,0 +1,32 @@ +# Base16 {{scheme-name}} - wezterm color config +# Scheme by {{scheme-author}} + +[colors] +foreground = "#{{base05-hex}}" +background = "#{{base00-hex}}" +cursor_bg = "#{{base05-hex}}" +cursor_border = "#{{base05-hex}}" +selection_bg = "#{{base05-hex}}" +selection_fg = "#{{base00-hex}}" + +ansi = [ + "#{{base00-hex}}", + "#{{base08-hex}}", + "#{{base0B-hex}}", + "#{{base0A-hex}}", + "#{{base0D-hex}}", + "#{{base0E-hex}}", + "#{{base0C-hex}}", + "#{{base05-hex}}" +] + +brights = [ + "#{{base03-hex}}", + "#{{base08-hex}}", + "#{{base0B-hex}}", + "#{{base0A-hex}}", + "#{{base0D-hex}}", + "#{{base0E-hex}}", + "#{{base0C-hex}}", + "#{{base07-hex}}" +] diff --git a/desktop/.config/mako/config b/desktop/.config/mako/config index 2a53616..7182376 100644 --- a/desktop/.config/mako/config +++ b/desktop/.config/mako/config @@ -1,25 +1,18 @@ sort=-time layer=overlay -background-color=#2e3440 width=300 height=110 border-size=2 -border-color=#88c0d0 border-radius=15 max-icon-size=64 default-timeout=5000 ignore-timeout=1 font=monospace 14 -[urgency=low] -border-color=#cccccc -[urgency=normal] -border-color=#d08770 [urgency=critical] #on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga -border-color=#bf616a default-timeout=0 [mode=do-not-disturb] diff --git a/desktop/.config/river/init b/desktop/.config/river/init index 1fea9e0..5e6ce83 100755 --- a/desktop/.config/river/init +++ b/desktop/.config/river/init @@ -71,7 +71,7 @@ riverctl map normal $mod+Shift T spawn "bemenu-translate" # Desktop theming # shellcheck disable=SC2016 -riverctl map normal $mod+Shift S spawn 'styler set $(styler list themes | bemenu)' +riverctl map normal $mod+Shift S spawn 'flavours list -l | bemenu | xargs flavours apply' # Password dropdown frontend riverctl map normal $mod+Shift P spawn "pass-pick"