feat: assign some programs to specific workspaces, and enable the per-workspace-layout tool

This commit is contained in:
oddlama 2023-10-02 16:05:03 +02:00
parent 8f1773fdd0
commit c93a5d63a9
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
2 changed files with 73 additions and 9 deletions

View file

@ -28,8 +28,9 @@
appimage-run
chromium
feh
pinentry # For yubikey
gamescope
pavucontrol
pinentry # For yubikey
thunderbird
xdg-utils
xdragon
@ -37,6 +38,7 @@
zathura
];
# TODO pavucontrol shortcut or bar button
# TODO audible bell in qt pinentry drives me nuts
# TODO secureboot -> use pam yubikey login
# TODO keyboard stays lit on poweroff -> add systemd service to disable it on shutdown

View file

@ -14,6 +14,21 @@
bindWithModifier = mapAttrs' (k: nameValuePair (cfg.modifier + "+" + k));
cfg = config.xsession.windowManager.i3.config;
i3-per-workspace-layout = pkgs.rustPlatform.buildRustPackage rec {
pname = "i3-per-workspace-layout";
version = "1.0.0";
src = ./i3-per-workspace-layout;
cargoHash = "sha256-bO/ZTkQLCeJajiW7cZoEBIIWDCyxYp4rO6ulbcu21YQ=";
meta = with lib; {
description = "A helper utility to allow assigning a layout to each workspace in i3";
license = licenses.mit;
maintainers = with maintainers; [oddlama];
mainProgram = "i3-per-workspace-layout";
};
};
in {
xsession.numlock.enable = true;
xsession.windowManager.i3 = {
@ -130,7 +145,7 @@ in {
"f" = "floating toggle";
"Return" = "fullscreen toggle";
"Space" = "focus mode_toggle";
# "a" = "focus parent";
"a" = "focus parent";
# "s" = "layout stacking";
# "w" = "layout tabbed";
# "e" = "layout toggle split";
@ -165,15 +180,62 @@ in {
window.titlebar = false;
#assigns = {
# "9" = [
# {class = "^steam_app_";}
# {app_id = "^Steam$";}
# {class = "^steam$";}
# ];
#};
floating.criteria = [
{class = "Pavucontrol";}
];
assigns = {
"1" = [
{class = "^firefox$";}
];
"5" = [
{class = "^bottles$";}
{class = "^Steam$";}
{class = "^prismlauncher$";}
];
"7" = [
{class = "^obsidian$";}
{class = "^Discord$";}
{class = "^Signal$";}
{class = "^TelegramDesktop$";}
];
"8" = [
{class = "^Spotify$";}
];
};
# TODO eww -> bars = [ ];
workspaceOutputAssign =
{
kroma = let
monitorMain = "DP-2";
monitorLeft = "DP-4";
in
map (x: {
workspace = x;
output = monitorMain;
}) ["1" "2" "3" "4" "5" "6"]
++ map (x: {
workspace = x;
output = monitorLeft;
}) ["7" "8" "9"];
}
.${nixosConfig.node.name}
or {};
};
extraConfig = let
configLayouts = (pkgs.formats.toml {}).generate "per-workspace-layouts.toml" {
layouts = {
"1" = "stacking";
"7" = "stacking";
"8" = "stacking";
"9" = "stacking";
};
};
in ''
exec_always --no-startup-id ${i3-per-workspace-layout}/bin/i3-per-workspace-layout --config ${configLayouts}
'';
};
programs.autorandr.enable = true;