2022-05-12 12:44:03 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2022-05-17 23:17:36 +00:00
|
|
|
lockUpdate =
|
2022-11-03 01:29:14 +00:00
|
|
|
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
2022-05-12 12:44:03 +00:00
|
|
|
|
2022-11-03 01:29:14 +00:00
|
|
|
in {
|
2022-04-29 01:56:21 +00:00
|
|
|
|
2022-12-21 21:18:03 +00:00
|
|
|
config = lib.mkIf pkgs.stdenv.isLinux {
|
2022-04-29 02:55:42 +00:00
|
|
|
|
2022-05-02 03:16:03 +00:00
|
|
|
services.xserver.windowManager = {
|
2023-01-21 15:44:39 +00:00
|
|
|
i3 = { enable = config.services.xserver.enable; };
|
2022-05-02 03:16:03 +00:00
|
|
|
};
|
2022-04-29 01:56:21 +00:00
|
|
|
|
2022-04-30 02:29:50 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
feh # Wallpaper
|
|
|
|
playerctl # Media control
|
|
|
|
];
|
|
|
|
|
2022-05-17 23:17:36 +00:00
|
|
|
home-manager.users.${config.user} = {
|
|
|
|
xsession.windowManager.i3 = {
|
2022-10-29 03:58:33 +00:00
|
|
|
enable = config.services.xserver.enable;
|
2022-11-03 01:29:14 +00:00
|
|
|
config = let
|
|
|
|
modifier = "Mod4"; # Super key
|
|
|
|
ws1 = "1:I";
|
|
|
|
ws2 = "2:II";
|
|
|
|
ws3 = "3:III";
|
|
|
|
ws4 = "4:IV";
|
|
|
|
in {
|
|
|
|
modifier = modifier;
|
|
|
|
assigns = {
|
|
|
|
"${ws1}" = [{ class = "Firefox"; }];
|
2023-04-01 13:41:45 +00:00
|
|
|
"${ws2}" = [
|
|
|
|
{ class = "kitty"; }
|
|
|
|
{ class = "aerc"; }
|
|
|
|
{ class = "obsidian"; }
|
|
|
|
];
|
2022-11-03 01:29:14 +00:00
|
|
|
"${ws3}" = [{ class = "discord"; }];
|
|
|
|
"${ws4}" = [{ class = "Steam"; }];
|
|
|
|
};
|
|
|
|
bars = [{ command = "echo"; }]; # Disable i3bar
|
|
|
|
colors = let
|
|
|
|
background = config.theme.colors.base00;
|
|
|
|
inactiveBackground = config.theme.colors.base01;
|
|
|
|
border = config.theme.colors.base01;
|
|
|
|
inactiveBorder = config.theme.colors.base01;
|
|
|
|
text = config.theme.colors.base07;
|
|
|
|
inactiveText = config.theme.colors.base04;
|
|
|
|
urgentBackground = config.theme.colors.base08;
|
|
|
|
indicator = "#00000000";
|
|
|
|
in {
|
|
|
|
background = config.theme.colors.base00;
|
|
|
|
focused = {
|
|
|
|
inherit background indicator text border;
|
|
|
|
childBorder = background;
|
|
|
|
};
|
|
|
|
focusedInactive = {
|
|
|
|
inherit indicator;
|
|
|
|
background = inactiveBackground;
|
|
|
|
border = inactiveBorder;
|
|
|
|
childBorder = inactiveBackground;
|
|
|
|
text = inactiveText;
|
|
|
|
};
|
|
|
|
# placeholder = { };
|
|
|
|
unfocused = {
|
|
|
|
inherit indicator;
|
|
|
|
background = inactiveBackground;
|
|
|
|
border = inactiveBorder;
|
|
|
|
childBorder = inactiveBackground;
|
|
|
|
text = inactiveText;
|
2022-05-17 23:17:36 +00:00
|
|
|
};
|
2022-11-03 01:29:14 +00:00
|
|
|
urgent = {
|
|
|
|
inherit text indicator;
|
|
|
|
background = urgentBackground;
|
|
|
|
border = urgentBackground;
|
|
|
|
childBorder = urgentBackground;
|
2022-05-17 23:17:36 +00:00
|
|
|
};
|
2022-11-03 01:29:14 +00:00
|
|
|
};
|
|
|
|
floating.modifier = modifier;
|
|
|
|
focus = {
|
|
|
|
mouseWarping = true;
|
|
|
|
newWindow = "urgent";
|
|
|
|
followMouse = false;
|
|
|
|
};
|
|
|
|
keybindings = {
|
|
|
|
# Resizing
|
|
|
|
"${modifier}+r" = ''mode "resize"'';
|
|
|
|
"${modifier}+Control+Shift+h" =
|
|
|
|
"resize shrink width 10 px or 10 ppt";
|
|
|
|
"${modifier}+Control+Shift+j" =
|
|
|
|
"resize grow height 10 px or 10 ppt";
|
|
|
|
"${modifier}+Control+Shift+k" =
|
|
|
|
"resize shrink height 10 px or 10 ppt";
|
|
|
|
"${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt";
|
2022-05-17 23:17:36 +00:00
|
|
|
};
|
2022-11-03 01:29:14 +00:00
|
|
|
modes = { };
|
|
|
|
startup = [
|
|
|
|
{
|
|
|
|
command = "feh --bg-fill ${config.wallpaper}";
|
|
|
|
always = true;
|
|
|
|
notification = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
command =
|
|
|
|
"i3-msg workspace ${ws2}, move workspace to output right";
|
|
|
|
notification = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
command =
|
|
|
|
"i3-msg workspace ${ws1}, move workspace to output left";
|
|
|
|
notification = false;
|
|
|
|
}
|
|
|
|
];
|
2023-07-02 20:37:56 +00:00
|
|
|
terminal = config.terminal;
|
2022-11-03 01:29:14 +00:00
|
|
|
window = {
|
|
|
|
border = 0;
|
|
|
|
hideEdgeBorders = "smart";
|
|
|
|
titlebar = false;
|
|
|
|
};
|
|
|
|
workspaceAutoBackAndForth = false;
|
|
|
|
workspaceOutputAssign = [ ];
|
|
|
|
};
|
2022-05-17 23:17:36 +00:00
|
|
|
extraConfig = "";
|
|
|
|
};
|
|
|
|
|
2023-07-02 20:37:56 +00:00
|
|
|
lockScreenCommand =
|
|
|
|
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
|
|
|
|
2022-05-17 23:17:36 +00:00
|
|
|
programs.fish.functions = {
|
2022-10-29 03:58:33 +00:00
|
|
|
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
2022-05-17 23:17:36 +00:00
|
|
|
description = "Update lockscreen with wallpaper";
|
|
|
|
body = lockUpdate;
|
2022-04-30 12:42:08 +00:00
|
|
|
};
|
2022-04-30 02:29:50 +00:00
|
|
|
};
|
2022-05-17 23:17:36 +00:00
|
|
|
|
2022-06-18 00:50:12 +00:00
|
|
|
# Update lock screen cache only if cache is empty
|
|
|
|
home.activation.updateLockScreenCache =
|
2022-06-20 12:39:41 +00:00
|
|
|
let cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
|
2022-11-03 01:29:14 +00:00
|
|
|
in lib.mkIf config.services.xserver.enable
|
|
|
|
(config.home-manager.users.${config.user}.lib.dag.entryAfter
|
|
|
|
[ "writeBoundary" ] ''
|
2022-10-29 03:58:33 +00:00
|
|
|
if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then
|
|
|
|
$DRY_RUN_CMD ${lockUpdate}
|
|
|
|
fi
|
|
|
|
'');
|
2022-06-18 00:50:12 +00:00
|
|
|
|
2022-04-30 02:29:50 +00:00
|
|
|
};
|
|
|
|
|
2022-05-19 12:47:43 +00:00
|
|
|
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
2022-05-17 12:43:47 +00:00
|
|
|
systemd.services.lock = {
|
2022-10-29 03:58:33 +00:00
|
|
|
enable = config.services.xserver.enable;
|
2023-07-02 20:37:56 +00:00
|
|
|
description = "Lock the screen before suspend";
|
2022-05-17 12:43:47 +00:00
|
|
|
before = [ "sleep.target" "suspend.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
User = config.user;
|
2022-05-19 12:47:43 +00:00
|
|
|
Type = "simple";
|
2022-05-17 12:43:47 +00:00
|
|
|
Environment = "DISPLAY=:0";
|
2022-05-19 12:47:43 +00:00
|
|
|
TimeoutSec = "infinity";
|
2023-07-02 20:37:56 +00:00
|
|
|
ExecStart = config.lockScreenCommand;
|
2022-05-19 12:47:43 +00:00
|
|
|
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
|
2022-05-17 12:43:47 +00:00
|
|
|
};
|
|
|
|
wantedBy = [ "sleep.target" "suspend.target" ];
|
|
|
|
};
|
|
|
|
|
2022-04-30 02:29:50 +00:00
|
|
|
};
|
2022-04-29 02:12:16 +00:00
|
|
|
|
2022-04-29 01:56:21 +00:00
|
|
|
}
|