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-dark.yml',
'alacritty.yml',
),
(
'~/.config/wofi',
'color-light',
'color-dark',
'color',
)
]

View file

@ -84,7 +84,7 @@ in
down = "r";
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";

View file

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

View file

@ -62,7 +62,7 @@
# Rofi command to pipe into, can add any options here
-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
--status)