nixos-config/home/x/i3.nix

122 lines
3.1 KiB
Nix
Raw Normal View History

2021-04-19 14:29:38 +02:00
{ config, lib, pkgs, ... }:
let
isEnabled = config.my.home.x.enable;
myTerminal =
# FIXME: fix when terminal is setup in home
# if config.my.home.terminal.program != null
if true
then "alacritty"
else "i3-sensible-terminal";
alt = "Mod1"; # `Alt` key
modifier = "Mod4"; # `Super` key
logoutMode = "[L]ogout, [S]uspend, [P]oweroff, [R]eboot";
2021-04-19 14:58:52 +02:00
# colors
colorBg = "#282828";
colorRed = "#cc241d";
colorGreen = "#98971a";
colorYellow = "#d79921";
colorBlue = "#458588";
colorPurple = "#b16286";
colorAqua = "#689d68";
colorGray = "#a89984";
colorDarkGray = "#1d2021";
2021-04-19 14:29:38 +02:00
in
{
config = lib.mkIf isEnabled {
2021-04-19 15:51:50 +02:00
my.home = {
flameshot.enable = true;
};
2021-04-19 14:29:38 +02:00
xsession.windowManager.i3 = {
enable = true;
config = {
inherit modifier;
bars =
2021-04-19 14:58:52 +02:00
let
barConfigPath =
config.xdg.configFile."i3status-rust/config-top.toml".target;
in
2021-04-19 14:29:38 +02:00
[
{
2021-04-19 14:58:52 +02:00
statusCommand = "i3status-rs ${barConfigPath}";
2021-04-19 14:29:38 +02:00
position = "top";
2021-04-19 16:28:45 +02:00
fonts = [ "DejaVu Sans Mono 9" ];
2021-04-19 14:58:52 +02:00
colors = {
background = colorBg;
statusline = colorYellow;
focusedWorkspace = {
border = colorAqua;
background = colorAqua;
text = colorDarkGray;
};
inactiveWorkspace = {
border = colorDarkGray;
background = colorDarkGray;
text = colorYellow;
};
activeWorkspace = {
border = colorAqua;
background = colorDarkGray;
text = colorYellow;
};
urgentWorkspace = {
border = colorRed;
background = colorRed;
text = colorBg;
};
};
2021-04-19 14:29:38 +02:00
}
];
focus = {
followMouse = true;
mouseWarping = true;
};
fonts = [
"DejaVu Sans Mono 8"
];
keybindings = lib.mkOptionDefault {
"${modifier}+Shift+e" = ''mode "${logoutMode}"'';
"${modifier}+i" = "exec emacsclient -c";
2021-04-19 14:29:38 +02:00
};
modes =
let
makeModeBindings = attrs: attrs // {
"Escape" = "mode default";
"Return" = "mode default";
};
in
{
"${logoutMode}" = makeModeBindings {
"l" = "exec --no-startup-id i3-msg exit, mode default";
"s" = "exec --no-startup-id systemctl suspend, mode default";
"p" = "exec --no-startup-id systemctl poweroff, mode default";
"r" = "exec --no-startup-id systemctl reboot, mode default";
};
};
startup = [
# FIXME: make it conditional on "nvidia" being part of video drivers
{
command = "nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=1'";
notification = false;
}
];
terminal = myTerminal;
};
};
};
}