140 lines
2.8 KiB
Nix
140 lines
2.8 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
let
|
|
cfg = config.nix-config.style;
|
|
|
|
wofiPowerMenu = pkgs.writeShellScriptBin "wofi-power-menu" ''
|
|
#!/usr/bin/env bash
|
|
|
|
options=" Power Off\n Reboot\n Lock\n Suspend"
|
|
selected=$(echo -e "$options" | wofi --dmenu --prompt "Power Menu")
|
|
# --width 300 --height 250
|
|
|
|
case "$selected" in
|
|
" Power Off") systemctl poweroff ;;
|
|
" Reboot") systemctl reboot ;;
|
|
" Lock") hyprlock ;;
|
|
" Suspend") systemctl suspend ;;
|
|
*) exit 1 ;;
|
|
esac
|
|
'';
|
|
|
|
wofiFilePicker = pkgs.writeShellScriptBin "wofi-file-picker" ''
|
|
#!/usr/bin/env bash
|
|
initial=$(find $HOME -maxdepth 2 -type f)
|
|
selected=$(printf "%s\n" $initial | wofi --dmenu --prompt "Select a file")
|
|
|
|
if [ -n "$selected" ]; then
|
|
xdg-open "$selected"
|
|
else
|
|
echo "No file selected"
|
|
exit 1
|
|
fi
|
|
'';
|
|
in
|
|
{
|
|
|
|
options.nix-config = {
|
|
powerMenu = lib.mkOption {
|
|
description = "Package to use as a power menu";
|
|
type = lib.types.package;
|
|
default = wofiPowerMenu;
|
|
};
|
|
};
|
|
|
|
config = {
|
|
programs.wofi = {
|
|
enable = true;
|
|
|
|
settings = {
|
|
# global layout
|
|
width = "50%";
|
|
height = "50%";
|
|
orientation = "vertical";
|
|
hide_scroll = true;
|
|
line_wrap = "off";
|
|
dynamic_lines = true;
|
|
|
|
# search behaviour
|
|
matching = "fuzzy";
|
|
single_click = true;
|
|
|
|
|
|
show = "drun";
|
|
prompt = "Launch...";
|
|
# normal_window = true;
|
|
layer = "top";
|
|
term = "foot";
|
|
halign = "fill";
|
|
|
|
# Rich rendering
|
|
allow_markup = true;
|
|
allow_images = true;
|
|
image_size = 24;
|
|
|
|
|
|
exec_search = false;
|
|
hide_search = false;
|
|
parse_search = false;
|
|
insensitive = true;
|
|
no_actions = true;
|
|
|
|
|
|
filter_rate = 100;
|
|
key_expand = "Tab";
|
|
key_exit = "Escape";
|
|
|
|
};
|
|
|
|
|
|
style = ''
|
|
* {
|
|
font-family: ${cfg.monospaceFont};
|
|
font-size: ${builtins.toString (cfg.fontSizes.desktop + 8)}px;
|
|
color: white;
|
|
background: transparent;
|
|
}
|
|
|
|
#window {
|
|
background: rgba(1, 1, 1, 0.5);
|
|
margin: auto;
|
|
padding: 10px;
|
|
}
|
|
|
|
#input {
|
|
padding: 10px;
|
|
margin-bottom: 10px;
|
|
border-radius: 15px;
|
|
}
|
|
|
|
#outer-box {
|
|
padding: 20px;
|
|
}
|
|
|
|
#img {
|
|
margin-right: 6px;
|
|
}
|
|
|
|
#entry {
|
|
padding: 10px;
|
|
border-radius: 15px;
|
|
}
|
|
|
|
#entry:selected {
|
|
background-color: #2e3440;
|
|
outline: none;
|
|
border: none;
|
|
}
|
|
|
|
#text {
|
|
margin: 2px;
|
|
}
|
|
'';
|
|
};
|
|
|
|
home.packages = with pkgs; [
|
|
wofiPowerMenu
|
|
wofi-emoji
|
|
];
|
|
};
|
|
}
|