NixOS-Config/home-manager/sway/rules.nix

113 lines
3.5 KiB
Nix
Raw Normal View History

2024-08-24 22:16:51 -04:00
{config, pkgs, ...}: {
# Enable Sway and write some scripts
wayland.windowManager.sway = {
config = let
border = import ../common/border.nix;
displays = import ../common/displays.nix;
ws = import ./workspaces.nix;
in {
# Assign workspaces to outputs
workspaceOutputAssign = let
workspaces1 = ["${ws.w0}" "${ws.w1}" "${ws.w2}" "${ws.w3}" "${ws.w1a}" "${ws.w2a}" "${ws.w3a}"];
workspaces2 = ["${ws.w4}" "${ws.w5}" "${ws.w6}" "${ws.w4a}" "${ws.w5a}" "${ws.w6a}"];
workspaces3 = ["${ws.w7}" "${ws.w8}" "${ws.w9}" "${ws.w7a}" "${ws.w8a}" "${ws.w9a}"];
assign = output: workspaces:
map (workspace: {
inherit workspace;
inherit output;
})
workspaces;
in
(assign "${displays.d1}" workspaces1) ++ (assign "${displays.d2}" workspaces2) ++ (assign "${displays.d3}" workspaces3);
# Rules
window = {
border = border.weightInt;
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 ${border.weight}'';
}
{
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 = {
# Browsers
"${ws.w1}" = [{app_id = "JimBrowser";}];
"${ws.w1a}" = [{app_id = "AltBrowser";}];
# Communication
"${ws.w3a}" = [{class = "zoom";}];
"${ws.w7}" = [{app_id = "MiscBrowser";} {app_id = "vesktop";}];
"${ws.w8}" = [{app_id = "Element";}];
2024-08-24 22:16:51 -04:00
"${ws.w9}" = [{app_id = "thunderbird";}];
# Else
"${ws.w2}" = [{class = "SDL Application";} {class = "heroic";}];
"${ws.w2a}" = [{app_id = "looking-glass-client";}];
"${ws.w4a}" = [{app_id = "com.obsproject.Studio";}];
};
focus.newWindow = "focus";
};
};
}