nixos-config/modules/programs/wofi.nix
2023-11-06 02:01:49 -05:00

103 lines
2.2 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
inherit (config.lib.formats.rasi) mkLiteral; # Theme.rasi alternative. Add Theme here
colors = import ../themes/colors.nix;
in {
home = {
packages = with pkgs; [
wofi
];
};
home.file = {
".config/wofi/config" = {
text = ''
width=280
lines=10
xoffset=5
yoffset=5
location=1
prompt=Search...
filter_rate=100
allow_markup=false
no_actions=true
halign=fill
orientation=vertical
content_halign=fill
insensitive=true
allow_images=true
image_size=20
hide_scroll=true
'';
};
".config/wofi/style.css" = {
text = ''
window {
margin: 0px;
background-color: #${config.colorScheme.colors.base00};
}
#input {
all: unset;
min-height: 20px;
padding: 4px 10px;
margin: 4px;
border: none;
color: #${config.colorScheme.colors.base08};
font-weight: bold;
background-color: #${config.colorScheme.colors.base00};
outline: #fff;
}
#inner-box {
font-weight: bold;
border-radius: 0px;
}
#outer-box {
margin: 0px;
padding: 3px;
border: none;
border-radius: 10px;
border: 3px solid #${config.colorScheme.colors.base05};
}
#text {
color: #${config.colorScheme.colors.base09};
}
#text:selected {
color: #${config.colorScheme.colors.base08};
background-color: transparent;
}
#entry:selected {
background-color: #${config.colorScheme.colors.base05};
}
'';
};
".config/wofi/power.sh" = {
executable = true;
text = ''
#!/bin/sh
entries=" Suspend\n Reboot\n Shutdown"
selected=$(echo -e $entries|wofi --dmenu --cache-file /dev/null | awk '{print tolower($2)}')
case $selected in
suspend)
exec systemctl suspend;;
reboot)
exec systemctl reboot;;
shutdown)
exec systemctl poweroff -i;;
esac
'';
};
};
}