nix-system/ui.nix
2024-12-03 21:44:32 +01:00

317 lines
7.9 KiB
Nix

{ lib, config, pkgs, variant, ... }:
let
defaultTerminal = "alacritty";
alacrittyLightTheme = "${pkgs.alacritty-theme}/night_owlish_light.toml";
alacrittyDarkTheme = "${pkgs.alacritty-theme}/monokai_charcoal.toml";
in
{
imports = [
./bar.nix
./hyprland.nix
./gui-software.nix
];
home.sessionVariables = {
TERMINAL = defaultTerminal;
};
home.packages = with pkgs; [
gentium
(nerdfonts.override { fonts = [ "CascadiaCode" "Noto" "Hack" ]; })
inter
emojione
bluetuith
keepmenu
rofimoji
libnotify
wtype
wl-clipboard
pamixer
pulsemixer
(catppuccin-gtk.override {
accents = [ "pink" ];
size = "compact";
tweaks = [ "black" ];
variant = "mocha";
})
];
xsession.enable = true;
fonts.fontconfig.enable = true;
fonts.fontconfig.defaultFonts = {
serif = [ "Gentium Plus" ];
sansSerif = [ "Inter" ];
monospace = [ "CaskaydiaCove Nerd Font Mono" ];
# monospace = [ "CascadiaCode" ];
# monospace = [ "Hack Nerd Font Mono" ];
emoji = [ "Noto Color Emoji" "OpenMoji Color" ];
};
programs.kitty = {
enable = true;
font.name = "CaskaydiaCove NFM Regular";
font.size = 12;
settings = {
cursor_shape = "block";
default_pointer_shape = "arrow";
pointer_shape_when_dragging = "arrow";
enable_audio_bell = false;
placement_strategy = "top-left";
remember_window_size = false;
initial_window_width = 1300;
initial_window_height = 800;
confirm_os_window_close = 0;
resize_debounce_time = "0.1 0.1";
};
keybindings = {
"ctrl+shift+equal" = "change_font_size all +0.5";
"ctrl+shift+plus" = "change_font_size all +0.5";
"ctrl+shift+kp_add" = "change_font_size all +0.5";
"ctrl+shift+minus" = "change_font_size all -0.5";
"ctrl+shift+kp_subtract" = "change_font_size all -0.5";
};
shellIntegration.enableFishIntegration = true;
shellIntegration.mode = "no-cursor";
extraConfig = ''
include colors.conf
bold_font CaskaydiaCove NFM Bold
italic_font CaskaydiaCove NFM Italic
bold_italic_font CaskaydiaCove NFM Bold Italic
text_composition_strategy 1.4 4
font_features CaskaydiaCoveNF-Italic +calt +ss01
'';
};
programs.alacritty = {
enable = true;
settings = {
font = {
size = 12.0;
};
general.import = [
alacrittyLightTheme # default to white
"~/.config/alacritty/colors.toml"
];
};
};
xdg = {
mimeApps.defaultApplications."TerminalEmulator" = "Alacritty.desktop";
};
services.swayidle =
let swaylock-bin = (if variant == "allegro"
then "/usr/bin/swaylock"
else "${config.programs.swaylock.package}/bin/swaylock");
in
{
enable = true;
events = [
{
event = "before-sleep";
command = "${swaylock-bin} -defF";
}
{
event = "after-resume";
command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on";
}
{
event = "lock";
command = "${swaylock-bin} -defF";
}
];
timeouts = [
{
timeout = 900;
command = "${swaylock-bin} -defF";
}
{
timeout = 900;
command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off";
}
];
};
programs.swaylock = {
enable = (variant != "allegro");
package = pkgs.swaylock-effects;
settings = {
screenshots = true;
# clock = true;
font = "Sans:bold";
disable-caps-lock-text = true;
effect-blur = "7x5";
text-color = "ffffff";
layout-text-color = "ffffff";
ring-color = "000000";
key-hl-color = "dddddd";
line-color = "00000000";
inside-color = "00000088";
separator-color = "00000000";
ring-clear-color = "00000000";
line-clear-color = "00000000";
inside-clear-color = "00000000";
text-clear-color = "00000000";
};
};
services.dunst.enable = true;
services.dunst.settings = {
global = {
geometry = "750x5-20+20";
horizontal_padding = 8;
indicate_hidden = true;
shrink = true;
transparency = 20;
separator_height = 2;
frame_width = 3;
frame_color = "#000000";
font = "Monospace 11";
alignment = "left";
show_age_threshold = 60;
background = "#ffffff";
foreground = "#000000";
};
urgency_critical = {
background = "#ff9999";
};
};
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ];
theme = "theme.rasi";
};
qt = {
enable = true;
platformTheme.name = "kde";
};
gtk = {
enable = true;
font = {
package = pkgs.inter;
name = "Inter";
};
theme = {
name = "Catppuccin-Latte-Compact-Pink-Light";
# name = "Catppuccin-Mocha-Compact-Pink-Dark";
package = pkgs.catppuccin-gtk.override {
accents = [ "pink" ];
size = "compact";
tweaks = [ ];
variant = "latte";
};
};
iconTheme = {
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
};
cursorTheme = {
name = "Hackneyed";
package = pkgs.hackneyed;
};
};
services.darkman = {
lightModeScripts = {
gtk-theme = ''
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
'';
set-background = ''
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
'';
set-rofi-colors = ''
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi
'';
set-kitty-colors = ''
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty)
'';
set-alacritty-colors = ''
rm -f ~/.config/alacritty/colors.toml
ln -s ${alacrittyLightTheme} ~/.config/alacritty/colors.toml
'';
notify = "${pkgs.libnotify}/bin/notify-send \"Light mode\"";
};
darkModeScripts = {
gtk-theme = ''
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
'';
set-background = ''
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
'';
set-rofi-colors = ''
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi
'';
set-kitty-colors = ''
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty)
'';
set-alacritty-colors = ''
rm -f ~/.config/alacritty/colors.toml
ln -s ${alacrittyDarkTheme} ~/.config/alacritty/colors.toml
'';
notify = "${pkgs.libnotify}/bin/notify-send \"Dark mode\"";
};
};
systemd.user.services = {
battery-notify = {
Unit = {
Description = "Send notification when battery is low";
Wants = "battery-timer.timer";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.writers.writeBash "battery-notify" ''
if [[ $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) -lt 10 ]]; then
${pkgs.libnotify}/bin/notify-send -u critical "Battery is low"
fi
'' }";
};
};
};
systemd.user.timers = {
battery-timer = {
Unit = {
Description = "Execute battery-notify every minute";
};
Install = {
# enable the service
# WantedBy = [ "default.target" ];
};
Timer = {
Unit = "battery-notify.service";
OnCalendar = "*-*-* *:*:00";
};
};
};
}