Did a lot of Sway stuff, most notably swaysome/multimonitor setup.

This commit is contained in:
vorboyvo 2025-01-31 11:09:26 -05:00
parent dfa137c5d4
commit f6878f9a3b

View file

@ -3,22 +3,29 @@
let let
extra = ../extra; extra = ../extra;
scripts = ../scripts; scripts = ../scripts;
dynscreenshot = pkgs.writeShellScript "dynscreenshot"
(builtins.readFile "${scripts}/dynscreenshot.sh");
changebrightness = pkgs.writeShellScript "changebrightness" changebrightness = pkgs.writeShellScript "changebrightness"
(builtins.readFile "${scripts}/changebrightness.sh"); (builtins.readFile "${scripts}/changebrightness.sh");
mod = "Mod4"; mod = "Mod4";
shutdownMenu = pkgs.writeShellScript "shutdownmenu" shutdownMenu = pkgs.writeShellScript "shutdownmenu"
(builtins.readFile "${scripts}/shutdownmenu.sh"); (builtins.readFile "${scripts}/shutdownmenu.sh");
backgroundImage = "${extra}/kuwaitboat.jpg"; backgroundImage = "${extra}/kuwaitboat.jpg";
in rec { multiTouchGesturesConfig = ''
bindgesture swipe:4:up focus parent
bindgesture swipe:4:left workspace prev
bindgesture swipe:4:right workspace next
bindgesture swipe:3:up focus up
bindgesture swipe:3:down focus down
bindgesture swipe:3:left focus left
bindgesture swipe:3:right focus right
'';
in {
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
config = rec { config = {
terminal = "${pkgs.lib.getExe inputs.config.defaultPrograms.terminal}"; terminal = "${pkgs.lib.getExe inputs.config.defaultPrograms.terminal}";
modifier = mod; modifier = mod;
fonts = { fonts = {
names = [ "Inter" ]; names = [ "Rubik" ];
style = "Regular"; style = "Regular";
size = 12.0; size = 12.0;
}; };
@ -45,7 +52,7 @@ in rec {
"Print" = "Print" =
"exec grim - | wl-copy && wl-paste > ${screenshotPath}"; # Take screenshot of whole screen, save it, and copy it to clipboard "exec grim - | wl-copy && wl-paste > ${screenshotPath}"; # Take screenshot of whole screen, save it, and copy it to clipboard
"Shift+Print" = '' "Shift+Print" = ''
exec swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | grim -g - | wl-copy && wl-paste > ${screenshotPath}''; # Take screenshot of current window, save it, and copy it to clipboard exec swaymsg -t get_tree | ${pkgs.lib.getExe pkgs.jq} -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | grim -g - | wl-copy && wl-paste > ${screenshotPath}''; # Take screenshot of current window, save it, and copy it to clipboard
"Ctrl+Print" = "Ctrl+Print" =
"exec grim -g \"`slurp`\" - | wl-copy && wl-paste > ${screenshotPath}"; "exec grim -g \"`slurp`\" - | wl-copy && wl-paste > ${screenshotPath}";
} // rec { # Function Media Keys } // rec { # Function Media Keys
@ -71,6 +78,20 @@ in rec {
"${mod}+Shift+l" = "exec swaylock -f"; "${mod}+Shift+l" = "exec swaylock -f";
"${mod}+Home" = "move workspace to output left"; "${mod}+Home" = "move workspace to output left";
"${mod}+End" = "move workspace to output right"; "${mod}+End" = "move workspace to output right";
} // lib.attrsets.mergeAttrsList (map (n: {
# Change focus between workspaces
"${mod}+${n}" = "exec swaysome focus ${n}";
# Move containers between workspaces
"${mod}+Shift+${n}" = "exec swaysome move ${n}";
# Focus workspace groups
"${mod}+Alt+${n}" = "exec swaysome focus-group ${n}";
# Move containers to other workspace groups
"${mod}+Alt+Shift+${n}" = "exec swaysome move-to-group ${n}";
}) (map toString (lib.lists.range 0 9)) ) // {
"${mod}+o" = "exec swaysome next-output";
"${mod}+Shift+o" = "exec swaysome prev-output";
"${mod}+Alt+o" = "exec swaysome workspace-group-next-output";
"${mod}+Alt+Shift+o" = "exec swaysome workspace-group-prev-output";
} // { }); } // { });
# menu = "j4-dmenu-desktop --no-generic --term=${ # menu = "j4-dmenu-desktop --no-generic --term=${
# terminal # terminal
@ -78,9 +99,14 @@ in rec {
menu = "${pkgs.lib.getExe config.programs.rofi.package} -modes \"drun,run\" -show-icons -show drun"; menu = "${pkgs.lib.getExe config.programs.rofi.package} -modes \"drun,run\" -show-icons -show drun";
focus.followMouse = false; focus.followMouse = false;
}; };
extraConfig = '' extraConfig =
output 'eDP-1' scale 1.50 ''
'' + # Fractional scaling to 1.50 output 'eDP-1' scale 1.50
'' + # Fractional scaling to 1.50
''
output 'DP-10' pos 0,0
output 'DP-9' pos 1920,0 transform 270
'' + # CTF Docking Station Monitors
'' ''
exec gammastep-indicator exec gammastep-indicator
'' + # gammastep-indicator enables red shift '' + # gammastep-indicator enables red shift
@ -90,15 +116,7 @@ in rec {
'' ''
exec "activate-linux -c 0.5-0.5-0.5-0.5" exec "activate-linux -c 0.5-0.5-0.5-0.5"
'' + # Enable Activate Linux '' + # Enable Activate Linux
'' multiTouchGesturesConfig + # Multi-touch touchpad gestures
bindgesture swipe:4:up focus parent
bindgesture swipe:4:left workspace prev
bindgesture swipe:4:right workspace next
bindgesture swipe:3:up focus up
bindgesture swipe:3:down focus down
bindgesture swipe:3:left focus left
bindgesture swipe:3:right focus right
'' + # Multi-touch touchpad gestures
'' ''
exec swaybg -i ${backgroundImage} exec swaybg -i ${backgroundImage}
'' + # Background image '' + # Background image
@ -110,15 +128,18 @@ in rec {
bindswitch --reload --locked lid:on output $laptop disable bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable bindswitch --reload --locked lid:off output $laptop enable
'' + # Clamshell mode '' + # Clamshell mode
''
exec swaysome init 1
'' +
""; "";
}; };
programs.rofi = { programs.rofi = {
enable = true; enable = true;
font = "Inter 12"; font = "Rubik 12";
package = pkgs.rofi-wayland; package = pkgs.rofi-wayland;
theme = "android_notification"; theme = "android_notification";
}; };
home.packages = with pkgs; [ swaybg bemenu j4-dmenu-desktop ]; home.packages = with pkgs; [ swaybg bemenu j4-dmenu-desktop swaysome ];
} }