i3,sway: workspace output assignment (#2003)

(cherry picked from commit ea3ff797c87313e71f2ed2fd2b932a18a4b4400b)
This commit is contained in:
Basti 2021-06-03 02:03:20 +02:00 committed by GitHub
parent 30102ea9e5
commit 95da56b783
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 369 additions and 4 deletions

View file

@ -17,7 +17,7 @@ let
inherit (commonOptions)
fonts window floating focus assigns modifier workspaceLayout
workspaceAutoBackAndForth keycodebindings colors bars startup gaps menu
terminal defaultWorkspace;
terminal defaultWorkspace workspaceOutputAssign;
keybindings = mkOption {
type = types.attrsOf (types.nullOr types.str);
@ -141,7 +141,7 @@ let
inherit (commonFunctions)
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString
fontConfigStr keybindingDefaultWorkspace keybindingsRest;
fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr;
startupEntryStr = { command, always, notification, workspace, ... }: ''
${if always then "exec_always" else "exec"} ${
@ -186,6 +186,7 @@ let
${concatStringsSep "\n" (map floatingCriteriaStr floating.criteria)}
${concatStringsSep "\n" (map windowCommandsStr window.commands)}
${concatStringsSep "\n" (map startupEntryStr startup)}
${concatStringsSep "\n" (map workspaceOutputStr workspaceOutputAssign)}
''
else
"") + "\n" + cfg.extraConfig);

View file

@ -155,4 +155,6 @@ rec {
"for_window ${criteriaStr criteria} floating enable";
windowCommandsStr = { command, criteria, ... }:
"for_window ${criteriaStr criteria} ${command}";
workspaceOutputStr = item:
''workspace "${item.workspace}" output ${item.output}'';
}

View file

@ -831,4 +831,35 @@ in {
'';
example = "workspace number 9";
};
workspaceOutputAssign = mkOption {
type = with types;
let
workspaceOutputOpts = submodule {
options = {
workspace = mkOption {
type = str;
default = "";
example = "Web";
description = ''
Name of the workspace to assign.
'';
};
output = mkOption {
type = str;
default = "";
example = "eDP";
description = ''
Name of the output from <command>
${if isSway then "swaymsg" else "i3-msg"} -t get_outputs
</command>.
'';
};
};
};
in listOf workspaceOutputOpts;
default = [ ];
description = "Assign workspaces to outputs.";
};
}

View file

@ -17,7 +17,7 @@ let
inherit (commonOptions)
fonts window floating focus assigns workspaceLayout
workspaceAutoBackAndForth modifier keycodebindings colors bars startup
gaps menu terminal defaultWorkspace;
gaps menu terminal defaultWorkspace workspaceOutputAssign;
left = mkOption {
type = types.str;
@ -246,7 +246,7 @@ let
inherit (commonFunctions)
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString
fontConfigStr keybindingDefaultWorkspace keybindingsRest;
fontConfigStr keybindingDefaultWorkspace keybindingsRest workspaceOutputStr;
startupEntryStr = { command, always, ... }: ''
${if always then "exec_always" else "exec"} ${command}
@ -307,6 +307,7 @@ let
++ map floatingCriteriaStr floating.criteria # floating
++ map windowCommandsStr window.commands # window commands
++ map startupEntryStr startup # startup
++ map workspaceOutputStr workspaceOutputAssign # custom mapping
)}
''
else