Add support for a portable monitor.

This commit is contained in:
Tom Alexander
2026-03-07 12:58:20 -05:00
parent ea133ded21
commit 7f9f010217
3 changed files with 238 additions and 20 deletions

View File

@@ -6,6 +6,25 @@
}:
let
patchScriptBin =
{
filename,
contents,
path ? [ ],
}:
((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
postBuild = ''
wrapProgram $out/bin/${filename} --prefix PATH : ${lib.makeBinPath path}
'';
}));
workspace_helper = (
patchScriptBin {
filename = "workspace_helper";
contents = (builtins.readFile ./files/workspace_helper.bash);
path = with pkgs; [ jq ];
}
);
sway-config = pkgs.writeTextFile {
name = "config";
text = ''
@@ -174,29 +193,34 @@ let
# Workspaces:
#
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
bindsym $mod+1 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 1
bindsym $mod+2 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 2
bindsym $mod+3 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 3
bindsym $mod+4 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 4
bindsym $mod+5 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 5
bindsym $mod+6 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 6
bindsym $mod+7 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 7
bindsym $mod+8 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 8
bindsym $mod+9 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 9
bindsym $mod+0 exec ${workspace_helper}/bin/workspace_helper go_to_workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+Shift+1 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 1
bindsym $mod+Shift+2 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 2
bindsym $mod+Shift+3 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 3
bindsym $mod+Shift+4 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 4
bindsym $mod+Shift+5 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 5
bindsym $mod+Shift+6 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 6
bindsym $mod+Shift+7 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 7
bindsym $mod+Shift+8 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 8
bindsym $mod+Shift+9 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 9
bindsym $mod+Shift+0 exec ${workspace_helper}/bin/workspace_helper send_to_workspace 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
bindsym $mod+Ctrl+Left exec ${workspace_helper}/bin/workspace_helper go_to_previous_monitor
bindsym $mod+Ctrl+Shift+Left exec ${workspace_helper}/bin/workspace_helper send_to_previous_monitor
bindsym $mod+Ctrl+Right exec ${workspace_helper}/bin/workspace_helper go_to_next_monitor
bindsym $mod+Ctrl+Shift+Right exec ${workspace_helper}/bin/workspace_helper send_to_next_monitor
'';
};
disable-focus-follows-mouse = pkgs.writeTextFile {