switch from xmonad to i3

This commit is contained in:
Ingolf Wagner 2022-10-12 16:58:38 +02:00
parent 046af0c9a9
commit dc6e79e08c
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
6 changed files with 323 additions and 6 deletions

View file

@ -452,16 +452,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1651519540, "lastModified": 1665475263,
"narHash": "sha256-3k6p8VsTwwRPQjE8rrMh+o2AZACZn/eeYJ7ivdQ/Iro=", "narHash": "sha256-T4at7d+KsQNWh5rfjvOtQCaIMWjSDlSgQZKvxb+LcEY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d93d56ab8c1c6aa575854a79b9d2f69d491db7d0", "rev": "17208be516fc36e2ab0ceb064d931e90eb88b2a3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-21.11", "ref": "release-22.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }

View file

@ -33,7 +33,7 @@
#inputs.emacs-overlay.follows = "emacs-overlay"; #inputs.emacs-overlay.follows = "emacs-overlay";
}; };
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-21.11"; url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
home-manager-utils = { home-manager-utils = {

View file

@ -0,0 +1,42 @@
{
solarized = {
dark.hex = {
base03 = "#002b36";
base02 = "#073642";
base01 = "#586e75";
base00 = "#657b83";
base0 = "#839496";
base1 = "#93a1a1";
base2 = "#eee8d5";
base3 = "#fdf6e3";
yellow = "#b58900";
orange = "#cb4b16";
red = "#dc322f";
magenta = "#d33682";
violet = "#6c71c4";
blue = "#268bd2";
cyan = "#2aa198";
green = "#859900";
};
light.hex = {
base03 = "#fdf6e3";
base02 = "#eee8d5";
base01 = "#93a1a1";
base00 = "#839496";
base0 = "#657b83";
base1 = "#586e75";
base2 = "#073642";
base3 = "#002b36";
yellow = "#b58900";
orange = "#cb4b16";
red = "#dc322f";
magenta = "#d33682";
violet = "#6c71c4";
blue = "#268bd2";
cyan = "#2aa198";
green = "#859900";
};
};
}

View file

@ -34,7 +34,8 @@ in
# window-manager : Xmonad # window-manager : Xmonad
# ----------------------- # -----------------------
displayManager = { displayManager = {
defaultSession = lib.mkDefault "none+xmonad"; #defaultSession = lib.mkDefault "none+xmonad";
defaultSession = lib.mkDefault "none+i3";
autoLogin.enable = lib.mkDefault true; autoLogin.enable = lib.mkDefault true;
autoLogin.user = cfg.autoLoginUser; autoLogin.user = cfg.autoLoginUser;
lightdm.enable = lib.mkDefault true; lightdm.enable = lib.mkDefault true;

View file

@ -33,6 +33,7 @@ in
./home-manager/doom-emacs.nix ./home-manager/doom-emacs.nix
./home-manager/ssh.nix ./home-manager/ssh.nix
./home-manager/xmonad.nix ./home-manager/xmonad.nix
./home-manager/i3.nix
]; ];

View file

@ -0,0 +1,273 @@
{ config, lib, pkgs, ... }:
let
cfg = config.home-manager.users.mainUser.xsession.windowManager.i3;
colorTheme =
let
theme = (import ../../../library/colorThemes.nix).solarized.light.hex;
in
theme // {
forground = theme.base3;
background = theme.base03;
};
in
{
home-manager.users.mainUser = {
programs.i3status-rust.enable = true;
xsession.windowManager.i3 = {
enable = true;
config = {
modifier = "Mod4";
startup = [
{ command = "${pkgs.albert}/bin/albert"; always = true; }
# { command = "systemctl --user restart polybar"; always = true; notification = false; }
];
bars =
[{
mode = "hide";
hiddenState = "hide";
#modifier = "Mod4";
position = "bottom";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.users.users.mainUser.home}/.config/i3status-rust/config-default.toml";
fonts = {
names = [ "monospace" ];
size = 8.0;
};
trayOutput = "primary";
colors = {
background = "#000000";
statusline = "#ffffff";
separator = "#666666";
focusedWorkspace = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
};
activeWorkspace = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
};
inactiveWorkspace = {
border = "#333333";
background = "#222222";
text = "#888888";
};
urgentWorkspace = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
bindingMode = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
};
}];
keybindings = {
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
"${cfg.config.modifier}+Shift+q" = "kill";
"${cfg.config.modifier}+Left" = "focus left";
"${cfg.config.modifier}+Down" = "focus down";
"${cfg.config.modifier}+Up" = "focus up";
"${cfg.config.modifier}+Right" = "focus right";
"${cfg.config.modifier}+j" = "focus next";
"${cfg.config.modifier}+k" = "focus prev";
"${cfg.config.modifier}+Shift+Left" = "move left";
"${cfg.config.modifier}+Shift+Down" = "move down";
"${cfg.config.modifier}+Shift+Up" = "move up";
"${cfg.config.modifier}+Shift+Right" = "move right";
"${cfg.config.modifier}+h" = "split h";
"${cfg.config.modifier}+v" = "split v";
"${cfg.config.modifier}+f" = "fullscreen toggle";
"${cfg.config.modifier}+s" = "layout stacking";
"${cfg.config.modifier}+w" = "layout tabbed";
"${cfg.config.modifier}+e" = "layout toggle split";
#"${cfg.config.modifier}+Shift+space" = "floating toggle";
#"${cfg.config.modifier}+space" = "focus mode_toggle";
"${cfg.config.modifier}+a" = "focus parent";
"${cfg.config.modifier}+Shift+minus" = "move scratchpad";
"${cfg.config.modifier}+minus" = "scratchpad show";
"${cfg.config.modifier}+1" = "workspace number 1";
"${cfg.config.modifier}+2" = "workspace number 2";
"${cfg.config.modifier}+3" = "workspace number 3";
"${cfg.config.modifier}+4" = "workspace number 4";
"${cfg.config.modifier}+5" = "workspace number 5";
"${cfg.config.modifier}+6" = "workspace number 6";
"${cfg.config.modifier}+7" = "workspace number 7";
"${cfg.config.modifier}+8" = "workspace number 8";
"${cfg.config.modifier}+9" = "workspace number 9";
"${cfg.config.modifier}+0" = "workspace number 10";
"${cfg.config.modifier}+Escape" = "workspace back_and_forth";
"${cfg.config.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.config.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.config.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.config.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.config.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.config.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.config.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.config.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.config.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.config.modifier}+Shift+0" = "move container to workspace number 10";
"${cfg.config.modifier}+Shift+c" = "reload";
"${cfg.config.modifier}+Shift+r" = "restart";
"${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${cfg.config.modifier}+r" = "mode resize";
# hide and show polybar
# enable-ipc = true; <-- is needed for this command
#"${cfg.config.modifier}+grave" = "exec ${pkgs.polybar}/bin/polybar-msg cmd toggle";
#"${cfg.config.modifier}+equal" = "exec ${pkgs.polybar}/bin/polybar-msg cmd toggle";
};
};
};
# polybar
services.polybar = {
enable = false;
#package = pkgs.polybar.override {
# i3Support = true;
# #alsaSupport = true;
# iwSupport = true;
# pulseSupport = true;
# #githubSupport = true;
#};
package = pkgs.polybarFull;
config = {
"bar/top" = {
# needed for polybar-msg cmd toggle
enable-ipc = true;
width = "100%";
# Background ARGB color (e.g. #f00, #ff992a, #ddff1023)
background = colorTheme.background;
# Foreground ARGB color (e.g. #f00, #ff992a, #ddff1023)
foreground = colorTheme.forground;
radius = 0;
overline-size = 0;
overline-color = colorTheme.background;
underline-size = 3;
underline-color = colorTheme.background;
border-size = 0;
# Padding (number of spaces, pixels, or points) to add at the beginning/end of
# the bar
padding = 0;
module-margin = 1;
modules-center = "date battery";
modules-left = "i3";
tray-position = "right";
};
"module/i3" = {
type = "internal/i3";
# Available tokens:
# %mode%
label-mode = "%mode%";
label-mode-background = colorTheme.red;
label-mode-padding = 2;
# Available tokens:
# %name%
# %icon%
# %index%
# %output%
label-focused = "%index%";
label-focused-underline = colorTheme.red;
label-focused-padding = 1;
# Available tokens:
# %name%
# %icon%
# %index%
# %output%
label-unfocused = "%index%";
label-unfocused-padding = 1;
# Available tokens:
# %name%
# %icon%
# %index%
# %output%
label-visible = "%index%";
label-visible-underline = colorTheme.yellow;
label-visible-padding = 1;
# Available tokens:
# %name%
# %icon%
# %index%
# %output%
label-urgent = "%index%";
label-urgent-padding = 1;
};
"module/date" = {
type = "internal/date";
internal = 5;
date = "%Y-%m-%d";
time = "%H:%M";
label = "%date% %time%";
};
"module/battery" = {
type = "internal/battery";
# This is useful in case the battery never reports 100% charge
# Default: 100
full-at = 99;
# format-low once this charge percentage is reached
# Default: 10
# New in version 3.6.0
low-at = 5;
# Use the following command to list batteries and adapters:
# $ ls -1 /sys/class/power_supply/
battery = "BAT0";
adapter = "AC";
# If an inotify event haven't been reported in this many
# seconds, manually poll for new values.
#
# Needed as a fallback for systems that don't report events
# on sysfs/procfs.
#
# Disable polling by setting the interval to 0.
#
# Default: 5
poll-interval = 5;
};
};
script = ''
polybar top &
'';
};
};
}