feat(home): i3!
This commit is contained in:
parent
293ac4b407
commit
8eed342bdd
3 changed files with 180 additions and 2 deletions
28
modules/home/services/screen-locker/default.nix
Normal file
28
modules/home/services/screen-locker/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib) mkEnableOption mkIf;
|
||||||
|
|
||||||
|
cfg = config.marleyos.services.screen-locker;
|
||||||
|
hasXorg = config.xsession.enable;
|
||||||
|
hasI3 = config.xsession.windowManager.i3.enable;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.marleyos.services.screen-locker.enable = mkEnableOption "screen-locker";
|
||||||
|
|
||||||
|
config = mkIf (cfg.enable && hasXorg) {
|
||||||
|
services.screen-locker = {
|
||||||
|
enable = true;
|
||||||
|
inactiveInterval = 20;
|
||||||
|
|
||||||
|
# exec xss-lock {xss-lock.extraOptions} -- {lockCmd}
|
||||||
|
xss-lock.extraOptions = [ "--transfer-sleep-lock" ];
|
||||||
|
lockCmd = if hasI3 then "${pkgs.i3lock}/bin/i3lock --nofork" else "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
BIN
modules/home/xorg/i3/bg.jpg
Normal file
BIN
modules/home/xorg/i3/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 MiB |
|
@ -1,10 +1,19 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkIf;
|
inherit (lib)
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
concatMapAttrs
|
||||||
|
map
|
||||||
|
range
|
||||||
|
listToAttrs
|
||||||
|
getExe
|
||||||
|
;
|
||||||
inherit (lib.marleyos) enabled;
|
inherit (lib.marleyos) enabled;
|
||||||
|
|
||||||
cfg = config.marleyos.xorg.i3;
|
cfg = config.marleyos.xorg.i3;
|
||||||
|
@ -16,9 +25,150 @@ in
|
||||||
marleyos = {
|
marleyos = {
|
||||||
programs.rofi = enabled;
|
programs.rofi = enabled;
|
||||||
services = {
|
services = {
|
||||||
|
dunst = enabled;
|
||||||
picom = enabled;
|
picom = enabled;
|
||||||
polybar = enabled;
|
polybar = enabled;
|
||||||
dunst = enabled;
|
screen-locker = enabled;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
networkmanagerapplet
|
||||||
|
feh
|
||||||
|
];
|
||||||
|
|
||||||
|
xsession.windowManager.i3 = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.nixGL.wrap pkgs.i3;
|
||||||
|
|
||||||
|
extraConfig = "tiling_drag modifier titlebar";
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
directions = {
|
||||||
|
left = "h";
|
||||||
|
down = "j";
|
||||||
|
up = "k";
|
||||||
|
right = "l";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
focus.followMouse = false;
|
||||||
|
window.border = 0;
|
||||||
|
floating.border = 0;
|
||||||
|
|
||||||
|
window.titlebar = false;
|
||||||
|
|
||||||
|
gaps = {
|
||||||
|
smartBorders = "no_gaps";
|
||||||
|
inner = 10;
|
||||||
|
top = 50;
|
||||||
|
};
|
||||||
|
|
||||||
|
bars = [ ];
|
||||||
|
|
||||||
|
# Startup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
startup = with pkgs; [
|
||||||
|
{ command = "${getExe feh} --no-fehbg --bg-fill ${./bg.jpg}"; }
|
||||||
|
{ command = "${getExe networkmanagerapplet}"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
# Keybindings - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
modifier = "Mod4";
|
||||||
|
|
||||||
|
keybindings =
|
||||||
|
let
|
||||||
|
mod = config.xsession.windowManager.i3.config.modifier;
|
||||||
|
workspaces = range 1 10;
|
||||||
|
getI = i: if i == 10 then "0" else toString i;
|
||||||
|
inherit (config.xdg) configHome;
|
||||||
|
isGenericLinux = config.targets.genericLinux.enable;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"${mod}+Shift+c" = "reload";
|
||||||
|
"${mod}+Shift+r" = "restart";
|
||||||
|
"${mod}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
|
||||||
|
|
||||||
|
"${mod}+e" = "layout toggle split";
|
||||||
|
"${mod}+Control+h" = "split -";
|
||||||
|
"${mod}+Control+v" = "split |";
|
||||||
|
|
||||||
|
"${mod}+f" = "fullscreen toggle";
|
||||||
|
|
||||||
|
"${mod}+Shift+space" = "floating toggle";
|
||||||
|
|
||||||
|
"${mod}+Control+r" = "mode resize";
|
||||||
|
|
||||||
|
"${mod}+q" = "kill";
|
||||||
|
|
||||||
|
"${mod}+r" = "exec ${configHome}/rofi/launchers/type-1/launcher.sh";
|
||||||
|
"${mod}+Return" = "exec ${if isGenericLinux then "wezterm" else "${pkgs.wezterm}/bin/wezterm"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
# PulseAudio Volume - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// (concatMapAttrs
|
||||||
|
(key: cmd: {
|
||||||
|
"${key}" = "exec --no-startup-id pactl ${cmd} && killall -SIGUSR1 i3status";
|
||||||
|
})
|
||||||
|
{
|
||||||
|
XF86AudioRaiseVolume = "set-sink-volume @DEFAULT_SINK@ +10%";
|
||||||
|
XF86AudioLowerVolume = "set-sink-volume @DEFAULT_SINK@ -10%";
|
||||||
|
XF86AudioMute = "set-sink-mute @DEFAULT_SINK@ toggle";
|
||||||
|
XF86AudioMicMute = "set-source-mute @DEFAULT_SOURCE@ toggle";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Focus & Movement - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// (concatMapAttrs (direction: key: {
|
||||||
|
"${mod}+${key}" = "focus ${direction}";
|
||||||
|
"${mod}+Shift+${key}" = "move ${direction}";
|
||||||
|
}) directions)
|
||||||
|
|
||||||
|
# Switch Workspaces - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// (listToAttrs (
|
||||||
|
(map (i: {
|
||||||
|
name = "${mod}+${getI i}";
|
||||||
|
value = "workspace number ${toString i}";
|
||||||
|
}))
|
||||||
|
workspaces
|
||||||
|
))
|
||||||
|
|
||||||
|
# Move Windows Between Workspaces - - - - - - - - - - - - - - - - - -
|
||||||
|
// (listToAttrs (
|
||||||
|
(map (i: {
|
||||||
|
name = "${mod}+Shift+${getI i}";
|
||||||
|
value = "move container to workspace number ${toString i}";
|
||||||
|
}))
|
||||||
|
workspaces
|
||||||
|
));
|
||||||
|
|
||||||
|
# Resize Windows - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
modes.resize =
|
||||||
|
let
|
||||||
|
mod = config.xsession.windowManager.i3.config.modifier;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
Return = "mode default";
|
||||||
|
Escape = "mode default";
|
||||||
|
"${mod}+Control+r" = "mode default";
|
||||||
|
}
|
||||||
|
// (concatMapAttrs
|
||||||
|
(key: action: {
|
||||||
|
"${key}" = "resize ${action} 10 px or 10 ppt";
|
||||||
|
})
|
||||||
|
rec {
|
||||||
|
Left = "shrink width";
|
||||||
|
Down = "shrink height";
|
||||||
|
Up = "grow height";
|
||||||
|
Right = "grow width";
|
||||||
|
"${directions.left}" = Left;
|
||||||
|
"${directions.down}" = Down;
|
||||||
|
"${directions.up}" = Up;
|
||||||
|
"${directions.right}" = Right;
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue