433 lines
13 KiB
Nix
433 lines
13 KiB
Nix
{ lib, config, options, pkgs, ... }:
|
|
let
|
|
defaultTerminal = "st";
|
|
alacrittyLightTheme = "${pkgs.alacritty-theme}/night_owlish_light.toml";
|
|
alacrittyDarkTheme = "${pkgs.alacritty-theme}/monokai_charcoal.toml";
|
|
in
|
|
{
|
|
imports = [
|
|
./bar.nix
|
|
./hyprland.nix
|
|
./gui-software.nix
|
|
];
|
|
|
|
options = {
|
|
swaylock-bin = lib.mkOption {
|
|
default = "${config.programs.swaylock.package}/bin/swaylock";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
home.file = {
|
|
".config/kitty/light.conf".source = dotfiles/kitty/light.conf;
|
|
".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf;
|
|
|
|
".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi;
|
|
".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi;
|
|
".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi;
|
|
|
|
".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini;
|
|
|
|
".bin/runmenu".source = pkgs.writers.writeBash "runmenu" ''
|
|
${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run
|
|
'';
|
|
|
|
".bin/notifications".source = bin/notifications;
|
|
|
|
".bin/window_dir".source = pkgs.writers.writeBash "window_dir" ''
|
|
PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2)
|
|
PID=$(echo $(ps --ppid $PID -o pid | tail -n1))
|
|
cwd=$(readlink /proc/"$PID"/cwd)
|
|
echo "$cwd"
|
|
'';
|
|
|
|
".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} ''
|
|
# run command whjen a newline is added to stdin
|
|
import subprocess
|
|
from sys import stdin, argv
|
|
cmd = argv[1:]
|
|
subprocess.call(cmd, shell=True)
|
|
while stdin.readline():
|
|
subprocess.call(cmd, shell=True)
|
|
'';
|
|
|
|
".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs;
|
|
|
|
".bin/ocrzone".source = pkgs.writers.writeBash "ocrzone" ''
|
|
${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot save area - | \
|
|
${pkgs.tesseract}/bin/tesseract -l fra - - | \
|
|
${pkgs.wl-clipboard}/bin/wl-copy
|
|
'';
|
|
|
|
".bin/wifi-toggle".source = pkgs.writers.writeBash "wifi-toggle" ''
|
|
if [[ $(nmcli radio wifi) == "enabled" ]]; then
|
|
nmcli radio wifi off
|
|
else
|
|
nmcli radio wifi on
|
|
fi
|
|
'';
|
|
|
|
".bin/rofi-udisk".source = pkgs.writers.writeBash "rofi-udisk" ''
|
|
device=$(${pkgs.udiskie}/bin/udiskie-info -a -o "{ui_label} {in_use}" -f is_filesystem | \
|
|
${pkgs.gnused}/bin/sed 's/True$/[Mounted]/' | \
|
|
${pkgs.gnused}/bin/sed 's/False$//' | \
|
|
${config.programs.rofi.package}/bin/rofi -dmenu | \
|
|
${pkgs.coreutils}/bin/cut -d':' -f1)
|
|
|
|
if [ -n "$device" ] ; then
|
|
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then
|
|
${pkgs.libnotify}/bin/notify-send "Unmounting $device..."
|
|
output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1)
|
|
if [ $? -eq 0 ] ; then
|
|
${pkgs.libnotify}/bin/notify-send "Device successfully unmounted."
|
|
else
|
|
${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output"
|
|
fi
|
|
else
|
|
${pkgs.libnotify}/bin/notify-send "Mounting $device..."
|
|
output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1)
|
|
if [ $? -eq 0 ] ; then
|
|
${pkgs.libnotify}/bin/notify-send "Device successfully mounted."
|
|
else
|
|
${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output"
|
|
fi
|
|
fi
|
|
fi
|
|
'';
|
|
|
|
".bin/mount-android".source = pkgs.writers.writeBash "mount-android" ''
|
|
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep $(realpath ~/android); then
|
|
umount $(realpath ~/android)
|
|
${pkgs.libnotify}/bin/notify-send "Android unmounted"
|
|
elif ${pkgs.simple-mtpfs}/bin/simple-mtpfs $(realpath ~/android); then
|
|
${pkgs.libnotify}/bin/notify-send "Android mounted in ~/android"
|
|
else
|
|
${pkgs.libnotify}/bin/notify-send "Can't find Android device"
|
|
fi
|
|
'';
|
|
|
|
".bin/dark".source = (import ./bin/dark.nix) pkgs; # deprecated, prefer darkman
|
|
};
|
|
|
|
home.sessionVariables = {
|
|
TERMINAL = defaultTerminal;
|
|
};
|
|
|
|
home.packages = with pkgs; [
|
|
gentium
|
|
nerd-fonts.noto
|
|
nerd-fonts.hack
|
|
nerd-fonts.jetbrains-mono
|
|
nerd-fonts.caskaydia-cove
|
|
cascadia-code
|
|
inter
|
|
emojione
|
|
|
|
bluetuith
|
|
keepmenu
|
|
rofimoji
|
|
ydotool
|
|
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" ];
|
|
};
|
|
|
|
services.gnome-keyring.enable = true;
|
|
|
|
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 =
|
|
{
|
|
enable = true;
|
|
events = [
|
|
{
|
|
event = "before-sleep";
|
|
command = "${config.swaylock-bin} -defF";
|
|
}
|
|
{
|
|
event = "after-resume";
|
|
command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on";
|
|
}
|
|
{
|
|
event = "lock";
|
|
command = "${config.swaylock-bin} -defF";
|
|
}
|
|
];
|
|
|
|
timeouts = [
|
|
{
|
|
timeout = 900;
|
|
command = "${config.swaylock-bin} -defF";
|
|
}
|
|
{
|
|
timeout = 900;
|
|
command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off";
|
|
}
|
|
];
|
|
};
|
|
|
|
programs.swaylock = {
|
|
enable = (config.swaylock-bin == options.swaylock-bin.default);
|
|
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 = {
|
|
width = "(0, 1000)";
|
|
height = "(0, 1000)";
|
|
offset = "(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 = let
|
|
reload-hyprland = ''
|
|
${pkgs.hyprland}/bin/hyprctl reload
|
|
'';
|
|
reload-st = ''
|
|
kill -SIGUSR1 $(pgrep st) # reload st config
|
|
'';
|
|
reload-neovim = ''
|
|
kill -SIGUSR1 $(pgrep nvim)
|
|
'';
|
|
in {
|
|
enable = true;
|
|
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\"";
|
|
inherit reload-hyprland;
|
|
inherit reload-st;
|
|
inherit reload-neovim;
|
|
};
|
|
|
|
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\"";
|
|
inherit reload-hyprland;
|
|
inherit reload-st;
|
|
inherit reload-neovim;
|
|
};
|
|
};
|
|
|
|
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";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|