190 lines
6.8 KiB
Nix
190 lines
6.8 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
# Close the bar if it's already open (wrong screen), then open on the target screen.
|
|
moveOrOpenBar = screen: "${pkgs.writeShellScript "kanshi-eww-bar-${toString screen}" ''
|
|
if ${pkgs.eww}/bin/eww active-windows 2>/dev/null | grep -qx "bar"; then
|
|
${pkgs.eww}/bin/eww close bar
|
|
fi
|
|
${pkgs.eww}/bin/eww open bar --screen ${toString screen}
|
|
''}";
|
|
|
|
baseOutput = {
|
|
position = "0,0";
|
|
scale = 1.0;
|
|
adaptiveSync = true;
|
|
status = "enable";
|
|
transform = "normal";
|
|
};
|
|
aocT = "AOC 24E1W1 GNSKCHA086899";
|
|
aocB = "AOC 24E1W1 GNSKBHA080346";
|
|
lgM = "LG Electronics LG ULTRAGEAR+ 511NTDVGC194";
|
|
|
|
in {
|
|
|
|
config = lib.mkIf (config.usercfg.wm == "Wayland") {
|
|
services.kanshi = {
|
|
enable = true;
|
|
systemdTarget = "graphical-session.target";
|
|
settings = [
|
|
{output = baseOutput//{
|
|
criteria = "LG Electronics LG ULTRAGEAR+ 511NTDVGC194";
|
|
# mode = "2560x1440@480.168";
|
|
mode = "2560x1440@240.083";
|
|
# mode = "1920x1080x240.084";
|
|
};}
|
|
{output = baseOutput//{
|
|
criteria = "AOC 24E1W1 GNSKCHA086899";
|
|
mode = "1920x1080@60.000";
|
|
transform = "180";
|
|
};}
|
|
{output = baseOutput//{
|
|
criteria = "AOC 24E1W1 GNSKBHA080346";
|
|
mode = "1920x1080@60.000";
|
|
};}
|
|
{output = baseOutput//{
|
|
criteria = "LG UNKNOWN_TBD";
|
|
mode = "1920x1080@144.000";
|
|
};}
|
|
{output = baseOutput//{
|
|
criteria = "LG Display 0x060A Unknown";
|
|
mode = "1920x1080@60.020";
|
|
};}
|
|
{output = baseOutput//{
|
|
criteria = "CEX CX133 0x00000001";
|
|
mode = "2560x1600@59.972";
|
|
};}
|
|
{output = baseOutput//{
|
|
criteria = "AOC 16G3 1DDP7HA000348";
|
|
mode = "1920x1080@144.000";
|
|
};}
|
|
{profile = {
|
|
name = "tower_00";
|
|
outputs = [
|
|
{
|
|
criteria = aocT;
|
|
position = "0,0";
|
|
}
|
|
{
|
|
criteria = aocB;
|
|
position = "0,1080";
|
|
}
|
|
{
|
|
criteria = lgM;
|
|
position = "1920,720";
|
|
}
|
|
];
|
|
exec = [
|
|
(moveOrOpenBar 0)
|
|
"${pkgs.writeShellScript "kanshi-hyprland-init" ''
|
|
#!/usr/bin/env bash
|
|
${pkgs.hyprland}/bin/hyprctl eval '
|
|
hl.workspace_rule({ workspace = "1", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "2", monitor = "desc:${aocT}", default = true })
|
|
hl.workspace_rule({ workspace = "3", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "4", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "5", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "6", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "7", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "8", monitor = "desc:${aocT}", default = true })
|
|
hl.workspace_rule({ workspace = "9", monitor = "desc:${aocB}", default = true })
|
|
hl.workspace_rule({ workspace = "name:X", monitor = "desc:${lgM}", default = true })
|
|
'
|
|
${pkgs.hyprland}/bin/hyprctl eval 'hl.dispatch(hl.dsp.focus({ monitor = "desc:${aocT}" })); hl.dispatch(hl.dsp.focus({ workspace = "2" }));'
|
|
${pkgs.hyprland}/bin/hyprctl eval 'hl.dispatch(hl.dsp.focus({ monitor = "desc:${lgM}" })); hl.dispatch(hl.dsp.focus({ workspace = "name:X" }));'
|
|
#${pkgs.hyprland}/bin/hyprctl eval 'hl.monitor({ output = "desc:${lgM}", cm = "hdr" });'
|
|
${pkgs.hyprland}/bin/hyprctl eval 'hl.dispatch(hl.dsp.focus({ monitor = "desc:${aocB}" }));'
|
|
|
|
''}"
|
|
"${pkgs.awww}/bin/awww restore"
|
|
];
|
|
};}
|
|
{profile = {
|
|
name = "tower_0";
|
|
outputs = [
|
|
{
|
|
criteria = "AOC 24E1W1 GNSKCHA086899";
|
|
transform = "180";
|
|
position = "0,0";
|
|
}
|
|
{
|
|
criteria = "AOC 24E1W1 GNSKBHA080346";
|
|
position = "0,1080";
|
|
}
|
|
];
|
|
exec = [
|
|
|
|
"${pkgs.writeShellScript "kanshi-hyprland-init" ''
|
|
#!/usr/bin/env bash
|
|
${pkgs.hyprland}/bin/hyprctl eval '
|
|
hl.workspace_rule({ workspace = "1", monitor = "DP-1", default = true })
|
|
hl.workspace_rule({ workspace = "2", monitor = "DP-2", default = true })
|
|
hl.workspace_rule({ workspace = "3", monitor = "DP-1", default = true })
|
|
hl.workspace_rule({ workspace = "4", monitor = "DP-1", default = true })
|
|
hl.workspace_rule({ workspace = "5", monitor = "DP-1", default = true })
|
|
hl.workspace_rule({ workspace = "6", monitor = "DP-1", default = true })
|
|
hl.workspace_rule({ workspace = "7", monitor = "DP-1", default = true })
|
|
hl.workspace_rule({ workspace = "8", monitor = "DP-2", default = true })
|
|
hl.workspace_rule({ workspace = "9", monitor = "DP-1", default = true })
|
|
'
|
|
${pkgs.hyprland}/bin/hyprctl eval 'hl.dispatch(hl.dsp.focus({ monitor = "DP-2" })); hl.dispatch(hl.dsp.focus({ workspace = "2" }));'
|
|
|
|
''}"
|
|
"${pkgs.awww}/bin/awww restore"
|
|
(moveOrOpenBar 0)
|
|
];
|
|
};}
|
|
{profile = {
|
|
name = "tower_1";
|
|
outputs = [
|
|
{
|
|
criteria = "AOC 24E1W1 GNSKCHA086899";
|
|
position = "0,0";
|
|
}
|
|
{
|
|
criteria = "AOC 24E1W1 GNSKBHA080346";
|
|
position = "0,0";
|
|
}
|
|
{
|
|
criteria = "LG UNKNOWN_TBD";
|
|
position = "0,0";
|
|
}
|
|
];
|
|
};}
|
|
{profile = {
|
|
name = "laptop_0";
|
|
outputs = [{
|
|
criteria = "LG Display 0x060A Unknown";
|
|
position = "0,0";
|
|
}];
|
|
};}
|
|
{profile = {
|
|
name = "laptop_1";
|
|
outputs = [
|
|
{
|
|
criteria = "CEX CX133 0x00000001";
|
|
position = "0,0";
|
|
}
|
|
{
|
|
criteria = "LG Display 0x060A Unknown";
|
|
position = "2560,0";
|
|
}
|
|
];
|
|
};}
|
|
{profile = {
|
|
name = "laptop_2";
|
|
outputs = [
|
|
{
|
|
criteria = "AOC 16G3 1DDP7HA000348";
|
|
position = "0,0";
|
|
}
|
|
{
|
|
criteria = "LG Display 0x060A Unknown";
|
|
position = "1920,0";
|
|
}
|
|
];
|
|
};}
|
|
];
|
|
};
|
|
};
|
|
}
|