From f48fa5a9cb2746723e3a1d873d4258b1c998cfc5 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 22 Jan 2023 19:32:46 -0800 Subject: [PATCH] Set up autostart layout for i3 --- hosts/desktop/home.nix | 2 +- hosts/desktop/i3.nix | 14 -------------- hosts/desktop/i3/default.nix | 23 +++++++++++++++++++++++ hosts/desktop/i3/tree.json | 16 ++++++++++++++++ 4 files changed, 40 insertions(+), 15 deletions(-) delete mode 100644 hosts/desktop/i3.nix create mode 100644 hosts/desktop/i3/default.nix create mode 100644 hosts/desktop/i3/tree.json diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index c844f5c..b46d0b9 100644 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -1,5 +1,5 @@ { ... }: { - imports = [ (import ./i3.nix) ]; + imports = [ (import ./i3) ]; } diff --git a/hosts/desktop/i3.nix b/hosts/desktop/i3.nix deleted file mode 100644 index 066d034..0000000 --- a/hosts/desktop/i3.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: - -{ - xsession.windowManager.i3.config.workspaceOutputAssign = [ - { - output = "HDMI-0"; - workspace = "1"; - } - { - output = "DVI-D-0"; - workspace = "2"; - } - ]; -} diff --git a/hosts/desktop/i3/default.nix b/hosts/desktop/i3/default.nix new file mode 100644 index 0000000..feea8f7 --- /dev/null +++ b/hosts/desktop/i3/default.nix @@ -0,0 +1,23 @@ +{ ... }: + +{ + xsession.windowManager.i3.config = { + startup = [ + { + command = ''i3-msg workspace 1 && (firefox &) && i3-msg "workspace 2; append_layout ${./tree.json}; open" && (for i in {1..4}; do i3-msg move left; done) && (discord &) && firefox --new-window https://youtube.com && i3-msg workspace 1''; + always = true; + notification = false; + } + ]; + workspaceOutputAssign = [ + { + output = "HDMI-0"; + workspace = "1"; + } + { + output = "DVI-D-0"; + workspace = "2"; + } + ]; + }; +} diff --git a/hosts/desktop/i3/tree.json b/hosts/desktop/i3/tree.json new file mode 100644 index 0000000..c88ea20 --- /dev/null +++ b/hosts/desktop/i3/tree.json @@ -0,0 +1,16 @@ +// vim:ts=4:sw=4:et +{ + "layout": "splitv", + "type": "con", + "nodes": [ + { + "swallows": [{ "class": "^firefox$" }], + "type": "con" + }, + { + "swallows": [{ "class": "^discord$" }], + "type": "con" + } + ] +} +