Implement dynamic colors for wofi

This commit is contained in:
Jakob Lechner 2023-11-16 02:48:00 +00:00
parent 64205ebebc
commit d5ed797712
No known key found for this signature in database
GPG key ID: 996082EFB5906C10
4 changed files with 83 additions and 52 deletions

View file

@ -13,6 +13,12 @@ let
'alacritty-light.yml', 'alacritty-light.yml',
'alacritty-dark.yml', 'alacritty-dark.yml',
'alacritty.yml', 'alacritty.yml',
),
(
'~/.config/wofi',
'color-light',
'color-dark',
'color',
) )
] ]

View file

@ -84,7 +84,7 @@ in
down = "r"; down = "r";
terminal = "${terminalEmulator}"; terminal = "${terminalEmulator}";
menu = "${pkgs.wofi}/bin/wofi --allow-images --show drun"; menu = "${pkgs.wofi}/bin/wofi --allow-images --show drun --color=$HOME/.config/wofi/color";
output."*".bg = "${wallpaper} fill"; output."*".bg = "${wallpaper} fill";

View file

@ -4,61 +4,86 @@ let
solarized = import ../solarized.nix; solarized = import ../solarized.nix;
in in
{ {
xdg.configFile."wofi/style.css".text = xdg.configFile."wofi/color-light".text = lib.strings.concatLines (map (c: solarized."${c}".hex) [
let "base3"
# adding it to the header doesnt work since the defaults overwrite it "base2"
commonConfig = /* ini */ '' "base1"
background=${lib.substring 1 6 solarized.base3} "base0"
border-bottom=${lib.substring 1 6 solarized.base2} "base00"
border=${lib.substring 1 6 solarized.base2} "base01"
button-background=${lib.substring 1 6 solarized.base3} "base02"
button-text=${lib.substring 1 6 solarized.base00} "base03"
''; "red"
in "orange"
/* css */ '' "yellow"
window { "green"
margin: 0px; "cyan"
border: 3px solid ${solarized.base02.hex}; "blue"
border-radius: 8px; "violet"
background-color: rgba(${solarized.base03.rgb},0.8); "magenta"
} ]);
xdg.configFile."wofi/color-dark".text = lib.strings.concatLines (map (c: solarized."${c}".hex) [
"base03"
"base02"
"base01"
"base00"
"base0"
"base1"
"base2"
"base3"
"red"
"orange"
"yellow"
"green"
"cyan"
"blue"
"violet"
"magenta"
]);
xdg.configFile."wofi/style.css".text = ''
window {
margin: 0px;
border: 3px solid --wofi-color1;
border-radius: 8px;
background-color: rgba(--wofi-rgb-color0,0.8);
}
#input { #input {
margin: 5px; margin: 5px;
border: none; border: none;
color: ${solarized.base0.hex}; color: --wofi-color4;
background-color: rgba(${solarized.base02.rgb},0.8); background-color: rgba(--wofi-rgb-color1,0.8);
} }
#inner-box { #inner-box {
margin: 5px; margin: 5px;
border: none; border: none;
background: none; background: none;
} }
#outer-box { #outer-box {
margin: 5px; margin: 5px;
border: none; border: none;
background: none; background: none;
} }
#scroll { #scroll {
margin: 0px; margin: 0px;
border: none; border: none;
} }
#text { #text {
margin: 5px; margin: 5px;
border: none; border: none;
color: ${solarized.base0.hex}; color: --wofi-color4;
} }
#entry:selected { #entry:selected {
background-color: rgba(${solarized.base02.rgb},0.8); background-color: rgba(--wofi-rgb-color1,0.8);
} }
#entry:selected #text{ #entry:selected #text{
color: ${solarized.green.hex}; color: --wofi-color11;
} }
''; '';
} }

View file

@ -62,7 +62,7 @@
# Rofi command to pipe into, can add any options here # Rofi command to pipe into, can add any options here
-rofi_command="rofi -dmenu $* -p" -rofi_command="rofi -dmenu $* -p"
+wofi_command="wofi -d -i -p" +wofi_command="wofi --color=$HOME/.config/wofi/color -d -i -p "
case "$1" in case "$1" in
--status) --status)