NixOS-Config/home-manager/sway/rules.nix
2024-09-23 16:22:01 -04:00

133 lines
3.8 KiB
Nix

{config, pkgs, outputs, ...}: {
# Enable Sway and write some scripts
wayland.windowManager.sway = {
config = {
# Assign workspaces to outputs
workspaceOutputAssign = let
workspaces1 = [
"${outputs.ws.w0}"
"${outputs.ws.w1}"
"${outputs.ws.w2}"
"${outputs.ws.w3}"
"${outputs.ws.w1a}"
"${outputs.ws.w2a}"
"${outputs.ws.w3a}"
];
workspaces2 = [
"${outputs.ws.w4}"
"${outputs.ws.w5}"
"${outputs.ws.w6}"
"${outputs.ws.w4a}"
"${outputs.ws.w5a}"
"${outputs.ws.w6a}"
];
workspaces3 = [
"${outputs.ws.w7}"
"${outputs.ws.w8}"
"${outputs.ws.w9}"
"${outputs.ws.w7a}"
"${outputs.ws.w8a}"
"${outputs.ws.w9a}"
];
assign = output: workspaces:
map (workspace: {
inherit workspace;
inherit output;
})
workspaces;
in
(assign "${outputs.displays.d1}" workspaces1) ++
(assign "${outputs.displays.d2}" workspaces2) ++
(assign "${outputs.displays.d3}" workspaces3);
# Rules
window = {
border = outputs.look.border.int;
titlebar = false;
commands = [
# Scratchpads
{
criteria = {con_mark = "scratchpad";};
command = ''floating enable, sticky enable, move scratchpad, mark borderless'';
}
{
criteria = {app_id = "gotop";};
command = ''mark scratchpad'';
}
{
criteria = {app_id = "music";};
command = ''mark scratchpad'';
}
{
criteria = {app_id = "sound";};
command = ''mark scratchpad'';
}
{
criteria = {app_id = "com.github.wwmm.easyeffects";};
command = ''mark scratchpad, opacity 0.9'';
}
# Create a "Scratchpad" for apps I don't want to be seen when launched
{
criteria = {con_mark = "hiddenaway";};
command = ''move scratchpad'';
}
# Give apps that don't have them borders
{
criteria = {con_mark = "borderless";};
command = ''border pixel ${outputs.look.border.string}'';
}
{
criteria = {app_id = "com.github.wwmm.easyeffects";};
command = ''mark borderless'';
}
{
criteria = {class = "steam";};
command = ''mark borderless'';
}
{
criteria = {app_id = "swappy";};
command = ''mark borderless'';
}
{
criteria = {app_id = "virt-manager";};
command = ''mark borderless'';
}
{
criteria = {window_role = "pop-up";};
command = ''mark borderless'';
}
# Floating or fullscreen rules
{
criteria = {app_id = "float";};
command = ''floating enable'';
}
{
criteria = {title = "^GlobalShot";};
command = ''floating enable, fullscreen enable global'';
}
];
};
assigns = {
# Brooutputs.wsers
"${outputs.ws.w1}" = [{app_id = "JimBrooutputs.wser";}];
"${outputs.ws.w1a}" = [{app_id = "AltBrooutputs.wser";}];
# Communication
"${outputs.ws.w3a}" = [{class = "zoom";}];
"${outputs.ws.w7}" = [{app_id = "MiscBrooutputs.wser";} {app_id = "vesktop";} {class = "vesktop";}];
"${outputs.ws.w8}" = [{app_id = "Element";} {class = "Element";}];
"${outputs.ws.w9}" = [{app_id = "thunderbird";}];
# Else
"${outputs.ws.w2}" = [{class = "steam";} {app_id = "heroic";}];
"${outputs.ws.w2a}" = [{app_id = "looking-glass-client";}];
"${outputs.ws.w4a}" = [{app_id = "com.obsproject.Studio";}];
};
focus.newWindow = "focus";
};
};
}