From c0f9f545defdcfd322fce53317448a40dd1e8de5 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 6 Feb 2024 16:13:56 +0100 Subject: [PATCH 1/6] home: i3: setup default workspace outputs --- home/x/i3.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/home/x/i3.nix b/home/x/i3.nix index 4c583df..e1a10e2 100644 --- a/home/x/i3.nix +++ b/home/x/i3.nix @@ -143,6 +143,22 @@ in { ]; }; + # TODO: make it configurable per machine + workspaceOutputAssign = [ + { workspace = "1"; output = ["DP-3" "eDP-1"]; } + { workspace = "2"; output = ["DP-3" "eDP-1"]; } + { workspace = "3"; output = ["DP-3" "eDP-1"]; } + { workspace = "4"; output = ["DP-3" "eDP-1"]; } + { workspace = "5"; output = ["DP-3" "eDP-1"]; } + + { workspace = "6"; output = ["eDP-1"]; } + { workspace = "7"; output = ["eDP-1"]; } + + { workspace = "8"; output = ["DP-4" "eDP-1"]; } + { workspace = "9"; output = ["DP-4" "eDP-1"]; } + { workspace = "10"; output = ["DP-4" "eDP-1"]; } + ]; + window.commands = [ { command = "border pixel 2"; From ee9131b743c8c86ab5ae0882749dd0d68f47fce3 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 6 Feb 2024 17:07:24 +0100 Subject: [PATCH 2/6] hephaestus: add closed lid dock config --- hosts/hephaestus/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hosts/hephaestus/default.nix b/hosts/hephaestus/default.nix index a315717..0a0f3bc 100644 --- a/hosts/hephaestus/default.nix +++ b/hosts/hephaestus/default.nix @@ -190,6 +190,26 @@ }; }; }; + dock-lid-closed = { + fingerprint = { + "DP-3" = "00ffffffffffff0026cd0f610101010101190103813420782a4ca5a7554da226105054adcf0031468180818c9500950fb300a940d1c0283c80a070b023403020360006442100001a000000ff0031313230303530313030333630000000fd00324b1e4b11000a202020202020000000fc0058323438350a20202020202020008a"; + "DP-4" = "00ffffffffffff0026cd0f610101010108180103813420782a4ca5a7554da226105054adcf0031468180818c9500950fb300a940d1c0283c80a070b023403020360006442100001a000000ff0031313230303430383030333330000000fd00324b1e4b11000a202020202020000000fc0058323438350a202020202020200081"; + }; + config = { + "DP-3" = { + enable = true; + primary = true; + position = "1920x0"; + mode = "1920x1200"; + }; + "DP-4" = { + enable = true; + primary = false; + position = "3840x0"; + mode = "1920x1200"; + }; + }; + }; }; }; From 662cf77b2194e9c2afbd0d978b770394f257a0b4 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 6 Feb 2024 17:07:41 +0100 Subject: [PATCH 3/6] hephaestus: add lid-listener service for autorandr --- hosts/hephaestus/default.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hosts/hephaestus/default.nix b/hosts/hephaestus/default.nix index 0a0f3bc..deb7cde 100644 --- a/hosts/hephaestus/default.nix +++ b/hosts/hephaestus/default.nix @@ -213,6 +213,29 @@ }; }; + systemd.services.autorandr-lid-listener = { + wantedBy = ["multi-user.target"]; + description = "Listening for lid events to invoke autorandr"; + + serviceConfig = { + Type = "simple"; + ExecStart = let + stdbufExe = lib.getExe' pkgs.coreutils "stdbuf"; + libinputExe = lib.getExe' pkgs.libinput "libinput"; + grepExe = lib.getExe pkgs.gnugrep; + autorandrExe = lib.getExe pkgs.autorandr; + in pkgs.writeShellScript "lid-listener.sh" '' + ${stdbufExe} -oL ${libinputExe} debug-events | + ${grepExe} -E --line-buffered '^[[:space:]-]+event[0-9]+[[:space:]]+SWITCH_TOGGLE[[:space:]]' | + while read line; do + ${pkgs.systemd}/bin/systemctl start --no-block autorandr.service + done + ''; + Restart = "always"; + RestartSec = "30"; + }; + }; + # Configure console keymap console.keyMap = "us"; From 789392155ce2b3f9b61dadfa73fce5530af24d53 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 6 Feb 2024 16:13:56 +0100 Subject: [PATCH 4/6] home: i3: setup default workspace outputs --- home/x/i3.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/home/x/i3.nix b/home/x/i3.nix index 4c583df..b41d0c3 100644 --- a/home/x/i3.nix +++ b/home/x/i3.nix @@ -143,6 +143,52 @@ in { ]; }; + # TODO: make it configurable per machine + workspaceOutputAssign = [ + { + workspace = "1"; + output = ["DP-3" "eDP-1"]; + } + { + workspace = "2"; + output = ["DP-3" "eDP-1"]; + } + { + workspace = "3"; + output = ["DP-3" "eDP-1"]; + } + { + workspace = "4"; + output = ["DP-3" "eDP-1"]; + } + { + workspace = "5"; + output = ["DP-3" "eDP-1"]; + } + + { + workspace = "6"; + output = ["eDP-1"]; + } + { + workspace = "7"; + output = ["eDP-1"]; + } + + { + workspace = "8"; + output = ["DP-4" "eDP-1"]; + } + { + workspace = "9"; + output = ["DP-4" "eDP-1"]; + } + { + workspace = "10"; + output = ["DP-4" "eDP-1"]; + } + ]; + window.commands = [ { command = "border pixel 2"; From a3687b008e0f602d60341dbc3b4aa54afb729c17 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 6 Feb 2024 17:07:24 +0100 Subject: [PATCH 5/6] hephaestus: add closed lid dock config --- hosts/hephaestus/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hosts/hephaestus/default.nix b/hosts/hephaestus/default.nix index a315717..0a0f3bc 100644 --- a/hosts/hephaestus/default.nix +++ b/hosts/hephaestus/default.nix @@ -190,6 +190,26 @@ }; }; }; + dock-lid-closed = { + fingerprint = { + "DP-3" = "00ffffffffffff0026cd0f610101010101190103813420782a4ca5a7554da226105054adcf0031468180818c9500950fb300a940d1c0283c80a070b023403020360006442100001a000000ff0031313230303530313030333630000000fd00324b1e4b11000a202020202020000000fc0058323438350a20202020202020008a"; + "DP-4" = "00ffffffffffff0026cd0f610101010108180103813420782a4ca5a7554da226105054adcf0031468180818c9500950fb300a940d1c0283c80a070b023403020360006442100001a000000ff0031313230303430383030333330000000fd00324b1e4b11000a202020202020000000fc0058323438350a202020202020200081"; + }; + config = { + "DP-3" = { + enable = true; + primary = true; + position = "1920x0"; + mode = "1920x1200"; + }; + "DP-4" = { + enable = true; + primary = false; + position = "3840x0"; + mode = "1920x1200"; + }; + }; + }; }; }; From ece9f283c31fa6cb7d36a2b35f32097eb8487836 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 6 Feb 2024 17:07:41 +0100 Subject: [PATCH 6/6] hephaestus: add lid-listener service for autorandr --- hosts/hephaestus/default.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hosts/hephaestus/default.nix b/hosts/hephaestus/default.nix index 0a0f3bc..deb7cde 100644 --- a/hosts/hephaestus/default.nix +++ b/hosts/hephaestus/default.nix @@ -213,6 +213,29 @@ }; }; + systemd.services.autorandr-lid-listener = { + wantedBy = ["multi-user.target"]; + description = "Listening for lid events to invoke autorandr"; + + serviceConfig = { + Type = "simple"; + ExecStart = let + stdbufExe = lib.getExe' pkgs.coreutils "stdbuf"; + libinputExe = lib.getExe' pkgs.libinput "libinput"; + grepExe = lib.getExe pkgs.gnugrep; + autorandrExe = lib.getExe pkgs.autorandr; + in pkgs.writeShellScript "lid-listener.sh" '' + ${stdbufExe} -oL ${libinputExe} debug-events | + ${grepExe} -E --line-buffered '^[[:space:]-]+event[0-9]+[[:space:]]+SWITCH_TOGGLE[[:space:]]' | + while read line; do + ${pkgs.systemd}/bin/systemctl start --no-block autorandr.service + done + ''; + Restart = "always"; + RestartSec = "30"; + }; + }; + # Configure console keymap console.keyMap = "us";