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
|
|
|
|
2021-04-21 10:30:05 +02:00
|
|
|
i3Theme = config.my.theme.i3Theme;
|
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
|
|
|
|
2021-04-20 00:47:23 +02:00
|
|
|
home.packages = with pkgs; [
|
|
|
|
betterlockscreen
|
|
|
|
];
|
|
|
|
|
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-05-04 16:00:21 +02:00
|
|
|
fonts = {
|
|
|
|
names = [ "DejaVuSansMono" "FontAwesome5Free" ];
|
|
|
|
size = 9.0;
|
|
|
|
};
|
2021-04-19 14:58:52 +02:00
|
|
|
|
2021-04-21 04:07:18 +02:00
|
|
|
colors = i3Theme.bar;
|
2021-04-24 02:46:17 +02:00
|
|
|
|
|
|
|
# disable mouse scroll wheel in bar
|
|
|
|
extraConfig = ''
|
|
|
|
bindsym button4 nop
|
|
|
|
bindsym button5 nop
|
|
|
|
'';
|
2021-04-19 14:29:38 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-04-20 01:05:53 +02:00
|
|
|
colors = {
|
2021-04-21 04:07:18 +02:00
|
|
|
inherit (i3Theme)
|
|
|
|
focused
|
|
|
|
focusedInactive
|
|
|
|
unfocused
|
|
|
|
urgent
|
|
|
|
;
|
2021-04-20 01:05:53 +02:00
|
|
|
};
|
|
|
|
|
2021-04-19 14:29:38 +02:00
|
|
|
focus = {
|
|
|
|
followMouse = true;
|
|
|
|
mouseWarping = true;
|
|
|
|
};
|
|
|
|
|
2021-04-22 01:25:37 +02:00
|
|
|
workspaceAutoBackAndForth = true;
|
|
|
|
|
2021-05-04 16:00:21 +02:00
|
|
|
fonts = {
|
|
|
|
names = [ "DejaVu Sans Mono" ];
|
|
|
|
size = 8.0;
|
|
|
|
};
|
2021-04-19 14:29:38 +02:00
|
|
|
|
|
|
|
keybindings = lib.mkOptionDefault {
|
|
|
|
"${modifier}+Shift+e" = ''mode "${logoutMode}"'';
|
2021-04-19 15:05:52 +02:00
|
|
|
"${modifier}+i" = "exec emacsclient -c";
|
2021-04-20 00:38:08 +02:00
|
|
|
|
|
|
|
# Volume handling
|
|
|
|
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
|
|
|
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%";
|
|
|
|
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
|
|
|
"XF86AudioMicMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
2021-04-20 00:47:23 +02:00
|
|
|
|
2021-07-25 16:28:06 +02:00
|
|
|
"XF86MonBrightnessDown" = "exec --no-startup-id light -U 5";
|
|
|
|
"XF86MonBrightnessUp" = "exec --no-startup-id light -A 5";
|
2021-07-30 23:34:06 +02:00
|
|
|
"${modifier}+XF86MonBrightnessDown" = "exec --no-startup-id light -U 0.1";
|
|
|
|
"${modifier}+XF86MonBrightnessUp" = "exec --no-startup-id light -A 0.1";
|
2021-07-25 16:28:06 +02:00
|
|
|
|
2021-04-20 00:47:23 +02:00
|
|
|
"${modifier}+l" = "exec --no-startup-id betterlockscreen --lock";
|
2021-07-29 11:22:39 +02:00
|
|
|
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show run";
|
2021-04-19 14:29:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
modes =
|
|
|
|
let
|
|
|
|
makeModeBindings = attrs: attrs // {
|
|
|
|
"Escape" = "mode default";
|
|
|
|
"Return" = "mode default";
|
|
|
|
};
|
|
|
|
in
|
2021-04-20 00:47:37 +02:00
|
|
|
lib.mkOptionDefault {
|
|
|
|
"${logoutMode}" = makeModeBindings {
|
|
|
|
"l" = "exec --no-startup-id i3-msg exit, mode default";
|
|
|
|
"s" = "exec --no-startup-id betterlockscreen --suspend, mode default";
|
|
|
|
"p" = "exec --no-startup-id systemctl poweroff, mode default";
|
|
|
|
"r" = "exec --no-startup-id systemctl reboot, mode default";
|
|
|
|
};
|
2021-04-19 14:29:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
terminal = myTerminal;
|
2021-04-20 00:52:36 +02:00
|
|
|
|
|
|
|
assigns = {
|
|
|
|
"10" = [
|
|
|
|
{ class = "Slack"; }
|
2021-04-22 03:24:27 +02:00
|
|
|
{ class = "discord"; }
|
2021-04-20 00:52:36 +02:00
|
|
|
];
|
|
|
|
};
|
2021-04-22 16:08:11 +02:00
|
|
|
|
|
|
|
window.commands = [
|
|
|
|
{ command = "border pixel 2"; criteria = { class = "Alacritty"; }; }
|
2021-04-23 18:08:41 +02:00
|
|
|
|
|
|
|
# NOTE: should be done with an assign command, but Spotify doesn't set
|
|
|
|
# its class until after initialization, so has to be done this way.
|
|
|
|
#
|
|
|
|
# See https://i3wm.org/docs/userguide.html#assign_workspace
|
2021-06-11 13:08:54 +02:00
|
|
|
{
|
|
|
|
criteria = { class = "Spotify"; };
|
|
|
|
command = "move --no-auto-back-and-forth to workspace 8";
|
|
|
|
}
|
2021-04-22 16:08:11 +02:00
|
|
|
];
|
2021-04-19 14:29:38 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|