NixOS-Config/modules/home/programs/gui/rofi/default.nix

164 lines
5.4 KiB
Nix
Raw Normal View History

2024-10-15 02:40:43 -04:00
{ pkgs, config, ... }:
2024-10-09 03:36:08 -04:00
{
2024-08-24 22:16:51 -04:00
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
terminal = "foot";
2024-10-15 02:40:43 -04:00
font = "${config.look.fonts.main} 14";
2024-08-24 22:16:51 -04:00
theme = let
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
lightbg = mkLiteral "#EEE8D5";
lightfg = mkLiteral "#586875";
blue = mkLiteral "#268BD2";
red = mkLiteral "#DC322F";
background-color = mkLiteral "#00000000";
separatorcolor = mkLiteral "#00000000";
2024-10-15 02:40:43 -04:00
normal-foreground = mkLiteral "#${config.look.colors.text}";
normal-background = mkLiteral "#${config.look.colors.dark}1A";
urgent-foreground = mkLiteral "#${config.look.colors.urgent}";
active-foreground = mkLiteral "#${config.look.colors.split}";
selected-active-foreground = mkLiteral "#${config.look.colors.prime}";
2024-10-16 00:04:56 -04:00
background = mkLiteral "#${config.look.colors.dark}D9";
2024-10-15 02:40:43 -04:00
bordercolor = mkLiteral "#${config.look.colors.prime}";
2024-08-24 22:16:51 -04:00
selected-normal-foreground = mkLiteral "#FFFFFF";
2024-10-15 02:40:43 -04:00
selected-normal-background = mkLiteral "#${config.look.colors.prime}80";
border-color = mkLiteral "#${config.look.colors.prime}";
urgent-background = mkLiteral "#${config.look.colors.accent}26";
active-background = mkLiteral "#${config.look.colors.accent}26";
selected-active-background = mkLiteral "#${config.look.colors.split}54";
2024-08-24 22:16:51 -04:00
};
"#window" = {
background-color = mkLiteral "@background";
width = 500;
2024-10-15 02:40:43 -04:00
border = mkLiteral "${config.look.border.string}";
2024-08-24 22:16:51 -04:00
padding = 5;
};
"#message" = {
border = mkLiteral "1px dash 0px 0px";
border-color = mkLiteral "@separatorcolor";
padding = 1;
};
"#textbox" = {
text-color = mkLiteral "@normal-foreground";
};
"#listview" = {
fixed-height = 0;
border-color = mkLiteral "@separatorcolor";
scrollbar = mkLiteral "false";
columns = 2;
};
"#element" = {
border = 0;
padding = 1;
};
"#element-text" = {
background-color = mkLiteral "inherit";
text-color = mkLiteral "inherit";
};
"#element.normal.normal" = {
text-color = mkLiteral "@normal-foreground";
};
"#element.normal.urgent" = {
text-color = mkLiteral "@urgent-foreground";
};
"#element.normal.active" = {
background-color = mkLiteral "@active-background";
text-color = mkLiteral "@active-foreground";
};
"#element.selected.normal" = {
background-color = mkLiteral "@selected-normal-background";
text-color = mkLiteral "@selected-normal-foreground";
};
"#element.selected.urgent" = {
background-color = mkLiteral "@urgent-background";
text-color = mkLiteral "@urgent-foreground";
};
"#element.selected.active" = {
background-color = mkLiteral "@selected-active-background";
text-color = mkLiteral "@selected-active-foreground";
};
"#element.alternate.normal" = {
text-color = mkLiteral "@normal-foreground";
};
"#element.alternate.urgent" = {
text-color = mkLiteral "@urgent-foreground";
};
"#element.alternate.active" = {
background-color = mkLiteral "@active-background";
text-color = mkLiteral "@active-foreground";
};
"#mode-switcher" = {
border = mkLiteral "2px dash 0px 0px";
border-color = mkLiteral "@separatorcolor";
};
"#button.selected" = {
background-color = mkLiteral "@selected-normal-background";
text-color = mkLiteral "@selected-normal-foreground";
};
"#case-indicator" = {
spacing = mkLiteral "0";
text-color = mkLiteral "@normal-foreground";
};
"#entry" = {
spacing = 0;
text-color = mkLiteral "@normal-foreground";
};
"#prompt" = {
spacing = 0;
text-color = mkLiteral "@normal-foreground";
};
"#inputbar" = {
spacing = 0;
text-color = mkLiteral "@normal-foreground";
padding = 1;
children = map mkLiteral ["prompt" "textbox-prompt-colon" "entry"];
};
"#textbox-prompt-colon" = {
expand = false;
str = ":";
margin = mkLiteral "0px 0.3em 0em 0em";
text-color = mkLiteral "@normal-foreground";
};
};
};
2024-11-22 20:28:52 -05:00
home.packages = with pkgs; [
(pkgs.writeScriptBin "rofiscripts" ''
2024-08-24 22:16:51 -04:00
# Scratchpad function
scratchpads() {
SCRATCHPADS=$(echo -e "Btop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads")
2024-08-24 22:16:51 -04:00
case $SCRATCHPADS in
Btop) foot -a btop -T Btop btop;;
2024-08-24 22:16:51 -04:00
Music) foot -a music -T Music ncmpcpp;;
Sound) foot -a sound -T Sound pulsemixer;;
esac
}
# Lock menu
power() {
2024-08-24 22:16:51 -04:00
POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | rofi -dmenu -i -p "Power")
case $POWER in
Shutdown) poweroff;;
Reboot) reboot;;
Sleep) sleep-$XDG_CURRENT_DESKTOP &;;
2024-08-24 22:16:51 -04:00
Lock) swaylock &;;
Kill) pkill -9 $XDG_CURRENT_DESKTOP;;
2024-08-24 22:16:51 -04:00
esac
}
# Check for command-line arguments
if [ "$1" == "--scratchpads" ]; then
scratchpads
2024-08-24 22:16:51 -04:00
elif [ "$1" == "--power" ]; then
power
2024-08-24 22:16:51 -04:00
else
echo "Please --scratchpads or --power."
2024-08-24 22:16:51 -04:00
fi
'')
2024-08-24 22:16:51 -04:00
rofi-bluetooth
bemoji
];
}