From 8935eeac4bd43c57244585feb6212ba5d1894e51 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Tue, 28 Jun 2022 17:05:14 +0200 Subject: [PATCH] feat(i3): load workspace layouts at startup --- home-manager/i3/default.nix | 26 ++++++++++++--- home-manager/i3/workspaces/workspace-1.json | 10 ++++++ home-manager/i3/workspaces/workspace-2.json | 36 +++++++++++++++++++++ home-manager/i3/workspaces/workspace-4.json | 10 ++++++ home-manager/i3/workspaces/workspace-5.json | 10 ++++++ 5 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 home-manager/i3/workspaces/workspace-1.json create mode 100644 home-manager/i3/workspaces/workspace-2.json create mode 100644 home-manager/i3/workspaces/workspace-4.json create mode 100644 home-manager/i3/workspaces/workspace-5.json diff --git a/home-manager/i3/default.nix b/home-manager/i3/default.nix index 6f09068..dede570 100644 --- a/home-manager/i3/default.nix +++ b/home-manager/i3/default.nix @@ -5,8 +5,15 @@ ./i3status-rust.nix ]; + home.file.workspaces = { + source = ./workspaces; + target = ".config/i3/workspaces"; + recursive = true; + }; + xsession.windowManager.i3 = { enable = true; + config = { modifier = "Mod4"; terminal = "${pkgs.kitty}/bin/kitty"; @@ -42,13 +49,24 @@ defaultWorkspace = "workspace number 1"; startup = [ - { command = "${pkgs.kitty}/bin/kitty"; } - { command = "${pkgs.firefox}/bin/firefox"; } + { command = "i3-msg 'workspace 1; append_layout ~/.config/i3/workspaces/workspace-1.json'"; } + { command = "i3-msg 'workspace 2; append_layout ~/.config/i3/workspaces/workspace-2.json'"; } + { command = "i3-msg 'workspace 4; append_layout ~/.config/i3/workspaces/workspace-4.json'"; } + { command = "i3-msg 'workspace 5; append_layout ~/.config/i3/workspaces/workspace-5.json'"; } + { command = "kitty"; notification = false; } + { command = "firefox"; notification = false; } + # { command = "element-desktop"; notification = false; } + { command = "keepassxc"; notification = false; } + { command = "nextcloud"; notification = false; } + { command = "signal-desktop"; notification = false; } + { command = "slack"; notification = false; } + { command = "telegram-desktop"; notification = false; } + { command = "thunderbird"; notification = false; } + # { command = "zoom"; notification = false; } ]; assigns = { - "1" = [{ class = "^kitty$"; }]; - "5" = [{ class = "^firefox$"; }]; + "6" = [{ class = "^zoom$"; }]; }; }; }; diff --git a/home-manager/i3/workspaces/workspace-1.json b/home-manager/i3/workspaces/workspace-1.json new file mode 100644 index 0000000..d6ce6b0 --- /dev/null +++ b/home-manager/i3/workspaces/workspace-1.json @@ -0,0 +1,10 @@ +// vim:ts=4:sw=4:et +{ + "name": "Terminal", + "swallows": [ + { + "class": "^kitty$" + } + ], + "type": "con" +} diff --git a/home-manager/i3/workspaces/workspace-2.json b/home-manager/i3/workspaces/workspace-2.json new file mode 100644 index 0000000..76f5f14 --- /dev/null +++ b/home-manager/i3/workspaces/workspace-2.json @@ -0,0 +1,36 @@ +// vim:ts=4:sw=4:et +{ + "layout": "tabbed", + "type": "con", + "nodes": [ + { + "name": "Telegram", + "swallows": [ + { + "class": "^TelegramDesktop$" + } + ], + "type": "con" + }, + { + "name": "Signal", + "swallows": [ + { + "class": "^Signal$" + } + ], + "type": "con" + } + ] +} + +{ + "name": "Slack", + "swallows": [ + { + "class": "^Slack$" + } + ], + "type": "con" +} + diff --git a/home-manager/i3/workspaces/workspace-4.json b/home-manager/i3/workspaces/workspace-4.json new file mode 100644 index 0000000..b41470b --- /dev/null +++ b/home-manager/i3/workspaces/workspace-4.json @@ -0,0 +1,10 @@ +// vim:ts=4:sw=4:et +{ + "name": "Email", + "swallows": [ + { + "class": "^Thunderbird$" + } + ], + "type": "con" +} diff --git a/home-manager/i3/workspaces/workspace-5.json b/home-manager/i3/workspaces/workspace-5.json new file mode 100644 index 0000000..7c74fa7 --- /dev/null +++ b/home-manager/i3/workspaces/workspace-5.json @@ -0,0 +1,10 @@ +// vim:ts=4:sw=4:et +{ + "name": "Browser", + "swallows": [ + { + "class": "^firefox$" + } + ], + "type": "con" +}