nix-config/modules/home-manager/desktop-xmonad/desktop_config.nix

250 lines
7.0 KiB
Nix

{ config, pkgs, fontSize ? "10", monoFontSize ? "9", ... }:
let
gruvbox-dark = {
bg = "#282828";
bg1 = "#3c3836";
bg2 = "#504945";
fg = "#ebdbb2";
fg0 = "#fbf1c7";
fg3 = "#bdae93";
red = "#cc241d";
green = "#98971a";
yellow = "#d79921";
blue = "#458588";
purple = "#b16286";
aqua = "#689d6a";
gray = "#a89984";
gray2 = "#928374";
red-light = "#fb4934";
green-light = "#b8bb26";
yellow-light = "#fabd2f";
blue-light = "#83a598";
purple-light = "#d3869b";
aqua-light = "#8ec07c";
};
colors = {
fg = gruvbox-dark.fg;
selFg = gruvbox-dark.fg0;
bg = gruvbox-dark.bg;
sel = gruvbox-dark.blue;
inactive = gruvbox-dark.gray;
inactiveBorder = gruvbox-dark.bg2;
urgent = gruvbox-dark.red;
};
rofiTransparency = "96";
font = {
name = "Inter";
size = fontSize;
};
monoFont = {
name = "Hack";
size = monoFontSize;
};
hmonitors = pkgs.haskellPackages.callPackage ./hmonitors.nix { };
hmonitorsQuery = "${hmonitors}/bin/hmonitors-query";
acpi = "${pkgs.acpi}/bin/acpi";
nmcli = "${pkgs.networkmanager}/bin/nmcli";
pamixer = "${pkgs.pamixer}/bin/pamixer";
in {
xsession.windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = haskellPackages: [
haskellPackages.monad-logger
haskellPackages.dbus
];
config = ./xmonad/xmonad.hs;
libFiles = {
"Bindings.hs" = ./xmonad/lib/Bindings.hs;
"DefaultConfig.hs" = ./xmonad/lib/DefaultConfig.hs;
"Layouts.hs" = ./xmonad/lib/Layouts.hs;
"ManageHook.hs" = ./xmonad/lib/ManageHook.hs;
"Prompts.hs" = ./xmonad/lib/Prompts.hs;
"Utils.hs" = ./xmonad/lib/Utils.hs;
"Xmobar.hs" = ./xmonad/lib/Xmobar.hs;
"HostConfig.hs" = pkgs.writeText "HostConfig.hs" ''
module HostConfig
( fontConfig
, colorConfig
, FontConfig (FontConfig)
, fontSize
, fontName
, ColorConfig (ColorConfig)
, fgColor
, selFgColor
, bgColor
, selColor
, inactiveColor
, inactiveBorderColor
, urgentColor
) where
fontConfig :: FontConfig
fontConfig = FontConfig
{ fontSize = ${font.size}
, fontName = "${font.name}"
}
colorConfig :: ColorConfig
colorConfig = ColorConfig
{ fgColor = "${colors.fg}"
, selFgColor = "${colors.selFg}"
, bgColor = "${colors.bg}"
, selColor = "${colors.sel}"
, inactiveColor = "${colors.inactive}"
, inactiveBorderColor = "${colors.inactiveBorder}"
, urgentColor = "${colors.urgent}"
}
data FontConfig = FontConfig
{ fontSize :: Int
, fontName :: String
} deriving Show
data ColorConfig = ColorConfig
{ fgColor :: String
, selFgColor :: String
, bgColor :: String
, selColor :: String
, inactiveColor :: String
, inactiveBorderColor :: String
, urgentColor :: String
} deriving Show
'';
};
};
programs.xmobar = {
enable = true;
extraConfig = ''
Config
{ font = "${font.name} ${font.size}"
, additionalFonts = ["mplus Nerd Font 12"]
, bgColor = "${colors.bg}"
, fgColor = "${colors.fg}"
, alignSep = "}{"
, sepChar = "%"
, template = "%StdinReader% }{ %vol%%bat%%net%%date%"
, lowerOnStart = True
, hideOnStart = False
, persistent = True
, allDesktops = True
, position = TopW L 100
, commands =
[ Run Com "${hmonitorsQuery}" ["date"] "date" 10
, Run Com "${hmonitorsQuery}" ["bat"] "bat" 10
-- , Run Com "${hmonitorsQuery}" ["net"] "net" 20
, Run Com "${hmonitorsQuery}" ["vol"] "vol" 5
, Run StdinReader
]
}
, wmClass = "xmobar"
, wmName = "xmobar"
, border = NoBorder
, borderColor = "${colors.bg}"
, pickBroadest = False
, alpha = 255
, iconRoot = "."
'';
};
services.dunst = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
settings = {
global = {
font = "${font.name} ${font.size}";
format = "<b>%s</b>\\n%b";
sort = "yes";
indicate_hidden = "yes";
alignment = "left";
bounce_freq = 0;
show_age_threshold = 60;
word_wrap = "yes";
ignore_newline = "no";
geometry = "300x5-30+20";
shrink = "yes";
transparency = 0;
idle_threshold = 10;
monitor = 0;
follow = "mouse";
sticky_history = "yes";
history_length = 20;
show_indicators = "yes";
line_height = 0;
separator_height = 2;
padding = 8;
horizontal_padding = 8;
separator_color = "frame";
startup_notification = false;
dmenu = "${pkgs.rofi}/bin/rofi -dmenu -p dunst:";
browser = "${pkgs.firefox}/bin/firefox";
icon_position = "left";
frame_width = 0;
frame_color = colors.inactive;
};
shortcuts = {
close = "ctrl+space";
close_all = "ctrl+shift+space";
context = "ctrl+shift+period";
};
urgency_low = {
background = "${colors.bg}${rofiTransparency}";
foreground = colors.fg;
timeout = 10;
};
urgency_normal = {
background = "${colors.sel}${rofiTransparency}";
foreground = colors.selFg;
timeout = 10;
};
urgency_critical = {
background = "${colors.urgent}${rofiTransparency}";
foreground = colors.selFg;
timeout = 10;
};
};
};
programs.zathura = {
enable = true;
options = {
font = "${monoFont.name} ${monoFont.size}";
default-bg = colors.bg;
default-fg = gruvbox-dark.bg1;
statusbar-fg = gruvbox-dark.fg3;
statusbar-bg = gruvbox-dark.bg2;
inputbar-bg = colors.bg;
inputbar-fg = colors.sel;
notification-bg = colors.bg;
notification-fg = colors.sel;
notification-error-bg = colors.bg;
notification-error-fg = gruvbox-dark.red-light;
notification-warning-bg = colors.bg;
notification-warning-fg = gruvbox-dark.red-light;
highlight-color = gruvbox-dark.yellow-light;
highlight-active-color = gruvbox-dark.blue-light;
completion-bg = gruvbox-dark.bg1;
completion-fg = gruvbox-dark.blue-light;
completion-highlight-fg = colors.selFg;
completion-highlight-bg = gruvbox-dark.blue-light;
recolor-lightcolor = colors.bg;
recolor-darkcolor = colors.fg;
recolor = false;
recolor-keephue = false;
};
};
}