dotfiles/nix/modules/nixos/i3.nix

154 lines
3.8 KiB
Nix
Raw Normal View History

2024-11-10 00:14:55 +00:00
{
inputs,
pkgs,
self,
username,
...
}:
let
theme = import "${self}/nix/lib/theme" { inherit pkgs; };
2024-11-10 00:14:55 +00:00
modifier = "Mod4";
in
{
services = {
2024-11-25 08:03:59 +00:00
cron = {
enable = true;
systemCronJobs = [
2024-11-27 19:00:42 +00:00
"* * * * * opdavies ${pkgs.notify-battery}/bin/notify-battery"
2024-11-25 08:03:59 +00:00
];
};
2024-11-10 00:14:55 +00:00
displayManager.defaultSession = "none+i3";
xserver = {
displayManager.lightdm.enable = true;
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
i3status
i3lock
i3blocks
];
};
};
};
2024-11-20 21:49:33 +00:00
environment.systemPackages = with pkgs; [
2024-11-25 08:03:59 +00:00
acpi
libnotify
2024-11-20 21:49:33 +00:00
nitrogen
];
2024-11-20 17:58:57 +00:00
2024-11-10 00:14:55 +00:00
home-manager.users.${username} = {
xsession.windowManager.i3 = {
enable = true;
config = {
assigns = {
"7" = [ { class = "vlc"; } ];
"8" = [ { class = "0ad"; } ];
"9" = [
{ class = "Slack"; }
{ class = "discord"; }
];
};
defaultWorkspace = "workspace number 1";
modifier = modifier;
keybindings = inputs.nixpkgs.lib.mkOptionDefault {
2024-11-25 08:03:59 +00:00
"${modifier}+d" = "exec rofi -show drun";
2024-11-10 00:14:55 +00:00
"${modifier}+Shift+b" = "exec ${pkgs.firefox}/bin/firefox";
"${modifier}+Shift+f" = "exec ${pkgs.xfce.thunar}/bin/thunar";
# Change focus.
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
# Move focused window.
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
"${modifier}+Shift+s" = "exec ${pkgs.flameshot}/bin/flameshot gui";
"${modifier}+Shift+p" = "exec ${pkgs.autorandr}/bin/autorandr --change";
"${modifier}+Shift+y" = "exec ${pkgs.copyq}/bin/copyq toggle";
"XF86AudioRaiseVolume" = "exec pamixer -ui 2 && pamixer --get-volume";
"XF86AudioLowerVolume" = "exec pamixer -ud 2 && pamixer --get-volume";
"XF86AudioMute" = ''exec pamixer --toggle-mute && ( [ "$(pamixer --get-mute)" = "true" ] && echo 0'';
"XF86MonBrightnessDown" = "exec brightnessctl set 5%- | sed -En 's/.*(([0-9]+)%).*/1/p'";
"XF86MonBrightnessUp" = "exec brightnessctl set +5% | sed -En 's/.*(([0-9]+)%).*/1/p'";
};
terminal = "alacritty";
};
extraConfig = ''
set $laptop eDP-1
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
2024-11-20 17:58:57 +00:00
exec_always --no-startup-id ${pkgs.nitrogen}/bin/nitrogen --restore &
2024-11-10 00:14:55 +00:00
exec_always --no-startup-id caffeine
2024-11-20 23:59:01 +00:00
exec_always --no-startup-id ${pkgs.autorandr}/bin/autorandr --change
2024-11-10 00:14:55 +00:00
smart_borders on
smart_gaps on
2024-11-29 16:28:37 +00:00
for_window [class="copyq"] floating enable
2024-11-10 00:14:55 +00:00
for_window [class="zoom"] floating enable
# xprop | grep -i class
'';
config = {
bars = [
{
position = "bottom";
statusCommand = "${pkgs.i3status}/bin/i3status";
trayOutput = "none";
}
];
fonts.names = [ "${theme.fonts.monospace.name}" ];
gaps = {
smartBorders = "on";
smartGaps = true;
};
};
};
programs.i3status = {
enable = true;
2024-11-20 11:01:38 +00:00
general.colors = false;
2024-11-10 00:14:55 +00:00
modules = {
"battery all".settings.last_full_capacity = true;
"tztime local".settings.format = "%d-%m-%Y %H:%M:%S";
cpu_temperature.enable = false;
ipv6.enable = false;
load.enable = false;
};
};
2024-11-25 08:03:59 +00:00
services.dunst = {
enable = true;
settings.global.follow = "keyboard";
};
2024-11-10 00:14:55 +00:00
};
}