feat: add tofi module

nixos
Moritz Böhme 2024-03-24 13:15:17 +01:00
parent ac9b136e6c
commit 006c4394f3
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
5 changed files with 67 additions and 1 deletions

View File

@ -31,6 +31,12 @@
}: }:
{ {
my.programs.tofi.settings = {
text-color = "#${text}";
prompt-color = "#${red}";
selection-color = "#${yellow}";
background-color = "#${base}";
};
home-manager.users.moritz = { home-manager.users.moritz = {
programs = { programs = {
fzf.colors = { fzf.colors = {

View File

@ -31,6 +31,20 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
my.programs.tofi.settings = {
font-size = "20";
font =
let
fontBasePath = pkgs.nerdfonts.override {
fonts = [ "FiraCode" ];
};
in
"${fontBasePath}/share/fonts/truetype/NerdFonts/FiraCodeNerdFont-Regular.ttf";
height = "360";
width = "720";
outline-width = "0";
border-width = "0";
};
home-manager.users.moritz = { home-manager.users.moritz = {
services.polybar = { services.polybar = {
config = { config = {

View File

@ -54,6 +54,7 @@ in
".local/share/nvim" ".local/share/nvim"
".local/share/zoxide" ".local/share/zoxide"
".local/state/nvim" ".local/state/nvim"
".local/state/tofi-history"
".mozilla" ".mozilla"
"Documents" "Documents"
"Downloads" "Downloads"

View File

@ -30,7 +30,7 @@ in
programs = { programs = {
wallpaper.enable = true; wallpaper.enable = true;
foot.enable = true; foot.enable = true;
rofi.enable = true; tofi.enable = true;
}; };
wallpapers.enable = true; wallpapers.enable = true;
services = { services = {
@ -59,6 +59,7 @@ in
"Super Q" = "close"; "Super Q" = "close";
"Super Return" = "spawn footclient"; "Super Return" = "spawn footclient";
"Super+Shift Return" = "spawn foot"; "Super+Shift Return" = "spawn foot";
"Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' '';
}; };
}; };
}; };

44
modules/programs/tofi.nix Normal file
View File

@ -0,0 +1,44 @@
{ config
, lib
, pkgs
, ...
}:
with lib;
let
cfg = config.my.programs.tofi;
configText =
let
settingsStrings = mapAttrsToList (name: value: "${name} = ${value}") cfg.settings;
in
concatLines settingsStrings;
in
{
options.my.programs.tofi = {
enable = mkEnableOption "tofi";
settings = mkOption {
type = with types; attrsOf str;
default = { };
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
(lib.mkIf config.networking.networkmanager.enable networkmanager_dmenu)
# (lib.mkIf config.hardware.bluetooth.enable rofi-bluetooth)
# rofi-power-menu
];
home-manager.users.moritz = {
home.packages = with pkgs; [ tofi ];
xdg = {
enable = true;
configFile."tofi/config".text = configText;
configFile."networkmanager-dmenu/config.ini".text = ''
[dmenu]
dmenu_command = tofi
'';
};
};
};
}