Simplify the Sway config files

This commit is contained in:
Jimbo 2024-11-07 18:17:51 -05:00
parent 9299782075
commit bbd3d080b5
10 changed files with 436 additions and 443 deletions

View file

@ -24,5 +24,5 @@
]; ];
networking.hostName = "bomberman"; networking.hostName = "bomberman";
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.19/24" ]; networking.wireguard.interfaces.wgc.ips = [ "10.100.0.19/24" ];
} }

View file

@ -1,31 +1,29 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
wayland.windowManager.sway = { wayland.windowManager.sway.config = {
config = { bars = [ {command = "waybar";} ];
bars = [ {command = "waybar";} ];
startup = [ startup = [
# Scratchpads # Scratchpads
{command = "foot -a gotop -T Gotop gotop";} {command = "foot -a gotop -T Gotop gotop";}
{command = "foot -a music -T Music ncmpcpp";} {command = "foot -a music -T Music ncmpcpp";}
{command = "foot -a sound -T Sound pulsemixer";} {command = "foot -a sound -T Sound pulsemixer";}
{command = "easyeffects";} {command = "easyeffects";}
# Daemons and tray apps # Daemons and tray apps
{command = "wl-paste -t text --watch clipman store -P";} {command = "wl-paste -t text --watch clipman store -P";}
{command = "wl-copy";} {command = "wl-copy";}
{command = "mako";} {command = "mako";}
{command = "sunshine";} {command = "sunshine";}
# Polkit agent # Polkit agent
{command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";} {command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";}
# Foreground apps # Foreground apps
{command = "librewolf -P Misc --name=MiscBrowser";} {command = "librewolf -P Misc --name=MiscBrowser";}
{command = "vesktop";} {command = "vesktop";}
{command = "fractal";} {command = "fractal";}
{command = "thunderbird";} {command = "thunderbird";}
]; ];
};
}; };
} }

View file

@ -1,50 +1,53 @@
{ config, ... }: { config, ... }:
{ {
wayland.windowManager.sway = { wayland.windowManager.sway.config = {
config = { # Define monitors
# Define monitors output = {
output = { ${config.displays.d1} = {
${config.displays.d1} = { pos = "3840 405";
pos = "1920 405"; mode = "1920x1080@143.980Hz";
mode = "1920x1080@143.980Hz"; max_render_time = "3";
max_render_time = "3"; bg = "~/.assets/wallpapers/1.png fill";
bg = "~/.assets/wallpapers/1.png fill"; adaptive_sync = "on";
adaptive_sync = "on";
};
${config.displays.d2} = {
pos = "0 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
bg = "~/.assets/wallpapers/2.png fill";
};
${config.displays.d3} = {
pos = "3840 0";
mode = "1680x1050@59.883Hz";
transform = "270";
max_render_time = "3";
bg = "~/.assets/wallpapers/3.png fill";
};
"*" = {
bg = "~/.assets/wallpapers/1.png fill";
};
}; };
${config.displays.d2} = {
pos = "1920 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
bg = "~/.assets/wallpapers/2.png fill";
};
${config.displays.d3} = {
pos = "5760 0";
mode = "1680x1050@59.883Hz";
transform = "270";
max_render_time = "3";
bg = "~/.assets/wallpapers/3.png fill";
};
${config.displays.d4} = {
pos = "0 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
};
"*" = {
bg = "~/.assets/wallpapers/1.png fill";
};
};
# HID device config # HID device config
input = { input = {
"9610:4103:SINOWEALTH_Game_Mouse" = { "9610:4103:SINOWEALTH_Game_Mouse" = {
pointer_accel = "-0.9"; pointer_accel = "-0.9";
}; };
"9639:64097:Compx_2.4G_Receiver_Mouse" = { "9639:64097:Compx_2.4G_Receiver_Mouse" = {
pointer_accel = "-0.82"; pointer_accel = "-0.82";
}; };
"1452:627:bcm5974" = { "1452:627:bcm5974" = {
scroll_factor = "0.3"; scroll_factor = "0.3";
}; };
"*" = { "*" = {
accel_profile = "flat"; accel_profile = "flat";
dwt = "disabled"; dwt = "disabled";
natural_scroll = "disabled"; natural_scroll = "disabled";
};
}; };
}; };
}; };

View file

@ -1,228 +1,226 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
wayland.windowManager.sway = { wayland.windowManager.sway.config = let
config = let # Set default modifier and variables
# Set default modifier and variables primeMod = "Mod4";
primeMod = "Mod4"; secMod = "Mod1";
secMod = "Mod1"; resizeAmount = "55";
resizeAmount = "55"; sendNotif = "notify-send --expire-time=1500";
sendNotif = "notify-send --expire-time=1500"; in {
# Hotkeys
modifier = "${primeMod}";
keybindings = let
# Define scripts specific to Sway
pinWindow = pkgs.writeScript "pin-window" ''
# Get the current border style of the focused window
current_style=$(swaymsg -t get_tree | jq -r '.. | select(.focused?).border')
# Toggle between "normal" (default) and "pixel ${config.look.border.string}" border styles
if [ "$current_style" == "none" ]; then
swaymsg "sticky disable, border pixel ${config.look.border.string}"
else
swaymsg "sticky enable, border none"
fi
'';
# Kill a window or probe it for info
swayTools = pkgs.writeScript "swaytools" ''
# List the app name and whether or not it uses wayland
swayprop() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
}
# Kill a selected window
swaykill() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid')
kill -9 "$pid"
fi
}
# Handle which tool we use
if [ "$1" == "--prop" ]; then
swayprop
elif [ "$1" == "--kill" ]; then
swaykill
fi
'';
in { in {
# Hotkeys ## Launcher keys
modifier = "${primeMod}";
keybindings = let
# Define scripts specific to Sway
pinWindow = pkgs.writeScript "pin-window" ''
# Get the current border style of the focused window
current_style=$(swaymsg -t get_tree | jq -r '.. | select(.focused?).border')
# Toggle between "normal" (default) and "pixel ${config.look.border.string}" border styles # LibreWolf profiles
if [ "$current_style" == "none" ]; then "${primeMod}+F1" = ''exec librewolf -P Main --name=MainBrowser | ${sendNotif} "Main Browser"'';
swaymsg "sticky disable, border pixel ${config.look.border.string}" "${primeMod}+F2" = ''exec librewolf -P Alt --name=AltBrowser | ${sendNotif} "Alternate Browser"'';
else "${primeMod}+F3" = ''exec librewolf -P Misc --name=MiscBrowser | ${sendNotif} "Miscellaneous Browser"'';
swaymsg "sticky enable, border none"
fi
'';
# Kill a window or probe it for info # Virtual Machines
swayTools = pkgs.writeScript "swaytools" '' "${primeMod}+F4" = ''exec virt-manager | ${sendNotif} "Virtual Machines"'';
# List the app name and whether or not it uses wayland "${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | ${sendNotif} "Looking Glass"'';
swayprop() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
}
# Kill a selected window # BeMenu scripts
swaykill() { "${primeMod}+${secMod}+s" = ''exec rofiscripts --scratchpads'';
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000) "${primeMod}+${secMod}+r" = ''exec rofiscripts --resolutions'';
if [ -n "$selected_window" ]; then
pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid')
kill -9 "$pid"
fi
}
# Handle which tool we use # Mod + Key
if [ "$1" == "--prop" ]; then "${primeMod}+s" = ''exec rofi -show run -p Command'';
swayprop "${primeMod}+c" = ''exec clipman pick -t rofi'';
elif [ "$1" == "--kill" ]; then "${primeMod}+x" = ''exec rofiscripts --power'';
swaykill "${primeMod}+b" = ''exec pkill -USR1 waybar'';
fi "${primeMod}+Return" = ''exec foot'';
''; "${primeMod}+Escape" = ''exec ${swayTools} --kill'';
in { "${primeMod}+Delete" = ''exec foot ranger /etc/nixos | ${sendNotif} "Nix Config"'';
## Launcher keys
# LibreWolf profiles # Mod + shift + key
"${primeMod}+F1" = ''exec librewolf -P Main --name=MainBrowser | ${sendNotif} "Main Browser"''; "${primeMod}+Shift+t" = ''exec pcmanfm-qt'';
"${primeMod}+F2" = ''exec librewolf -P Alt --name=AltBrowser | ${sendNotif} "Alternate Browser"''; "${primeMod}+Shift+e" = ''exec BEMOJI_PICKER_CMD="rofi -dmenu -i -p Emoji" bemoji -n -P 0'';
"${primeMod}+F3" = ''exec librewolf -P Misc --name=MiscBrowser | ${sendNotif} "Miscellaneous Browser"''; "${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history'';
"${primeMod}+Shift+b" = ''exec rofi-bluetooth'';
"${primeMod}+Shift+Return" = ''exec foot ranger'';
# Virtual Machines # Mod + ctrl + key
"${primeMod}+F4" = ''exec virt-manager | ${sendNotif} "Virtual Machines"''; "${primeMod}+Ctrl+x" = ''exec ${swayTools} --prop'';
"${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | ${sendNotif} "Looking Glass"''; "${primeMod}+Ctrl+c" = ''exec ${pkgs.hyprpicker}/bin/hyprpicker -an && ${sendNotif} "Color copied to clipboard"'';
"${primeMod}+Ctrl+Prior" = ''exec ${pkgs.obs-cmd}/bin/obs-cmd scene switch "Main"'';
"${primeMod}+Ctrl+Next" = ''exec ${pkgs.obs-cmd}/bin/obs-cmd scene switch "Guest"'';
# BeMenu scripts ## Media keys
"${primeMod}+${secMod}+s" = ''exec rofiscripts --scratchpads'';
"${primeMod}+${secMod}+r" = ''exec rofiscripts --resolutions'';
# Mod + Key # Volume control
"${primeMod}+s" = ''exec rofi -show run -p Command''; "${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'';
"${primeMod}+c" = ''exec clipman pick -t rofi''; "${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+'';
"${primeMod}+x" = ''exec rofiscripts --power'';
"${primeMod}+b" = ''exec pkill -USR1 waybar'';
"${primeMod}+Return" = ''exec foot'';
"${primeMod}+Escape" = ''exec ${swayTools} --kill'';
"${primeMod}+Delete" = ''exec foot ranger /etc/nixos | ${sendNotif} "Nix Config"'';
# Mod + shift + key # MPD Controls
"${primeMod}+Shift+t" = ''exec pcmanfm-qt''; "${primeMod}+Backslash" = ''exec mpc toggle'';
"${primeMod}+Shift+e" = ''exec BEMOJI_PICKER_CMD="rofi -dmenu -i -p Emoji" bemoji -n -P 0''; "${secMod}+Shift+h" = ''exec mpc prev'';
"${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history''; "${secMod}+Shift+j" = ''exec mpc volume -3'';
"${primeMod}+Shift+b" = ''exec rofi-bluetooth''; "${secMod}+Shift+k" = ''exec mpc volume +3'';
"${primeMod}+Shift+Return" = ''exec foot ranger''; "${secMod}+Shift+l" = ''exec mpc next'';
# Mod + ctrl + key ## Notification keys
"${primeMod}+Ctrl+x" = ''exec ${swayTools} --prop'';
"${primeMod}+Ctrl+c" = ''exec ${pkgs.hyprpicker}/bin/hyprpicker -an && ${sendNotif} "Color copied to clipboard"'';
"${primeMod}+Ctrl+Prior" = ''exec ${pkgs.obs-cmd}/bin/obs-cmd scene switch "Main"'';
"${primeMod}+Ctrl+Next" = ''exec ${pkgs.obs-cmd}/bin/obs-cmd scene switch "Guest"'';
## Media keys # Toggle mako
"${primeMod}+n" = ''exec makotoggle'';
"${primeMod}+Shift+n" = ''exec makoctl restore'';
"${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a'';
# Volume control ## Miscellaneous keys
"${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'';
"${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+'';
# MPD Controls # Screenshots
"${primeMod}+Backslash" = ''exec mpc toggle''; "${secMod}+f" = ''exec swayshot --swappy'';
"${secMod}+Shift+h" = ''exec mpc prev''; "${secMod}+Shift+f" = ''exec swayshot --screen'';
"${secMod}+Shift+j" = ''exec mpc volume -3'';
"${secMod}+Shift+k" = ''exec mpc volume +3'';
"${secMod}+Shift+l" = ''exec mpc next'';
## Notification keys # SSH
"${primeMod}+${secMod}+Return" = ''exec foot ssh ${config.ips.server}'';
# Toggle mako # Display Brightness and Keyboard Brightness
"${primeMod}+n" = ''exec makotoggle''; "${primeMod}+equal" = ''exec light -A 5'';
"${primeMod}+Shift+n" = ''exec makoctl restore''; "${primeMod}+minus" = ''exec light -U 5'';
"${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a''; "${primeMod}+Shift+equal" = ''exec light -A 1'';
"${primeMod}+Shift+minus" = ''exec light -U 1'';
"XF86KbdBrightnessUp" = ''exec light -s sysfs/leds/smc::kbd_backlight -A 5'';
"XF86KbdBrightnessDown" = ''exec light -s sysfs/leds/smc::kbd_backlight -U 5'';
## Miscellaneous keys ## Window manager keys
"${primeMod}+q" = ''kill'';
"${primeMod}+Shift+r" = ''reload'';
# Screenshots # Switch to workspaces
"${secMod}+f" = ''exec swayshot --swappy''; "${primeMod}+grave" = ''workspace ${config.ws.w0}'';
"${secMod}+Shift+f" = ''exec swayshot --screen''; "${primeMod}+1" = ''workspace ${config.ws.w1}'';
"${primeMod}+2" = ''workspace ${config.ws.w2}'';
"${primeMod}+3" = ''workspace ${config.ws.w3}'';
"${primeMod}+4" = ''workspace ${config.ws.w4}'';
"${primeMod}+5" = ''workspace ${config.ws.w5}'';
"${primeMod}+6" = ''workspace ${config.ws.w6}'';
"${primeMod}+7" = ''workspace ${config.ws.w7}'';
"${primeMod}+8" = ''workspace ${config.ws.w8}'';
"${primeMod}+9" = ''workspace ${config.ws.w9}'';
# SSH # Switch to alternate workspaces
"${primeMod}+${secMod}+Return" = ''exec foot ssh ${config.ips.server}''; "${secMod}+F1" = ''workspace ${config.ws.w1a}'';
"${secMod}+F2" = ''workspace ${config.ws.w2a}'';
"${secMod}+F3" = ''workspace ${config.ws.w3a}'';
"${secMod}+F4" = ''workspace ${config.ws.w4a}'';
"${secMod}+F5" = ''workspace ${config.ws.w5a}'';
"${secMod}+F6" = ''workspace ${config.ws.w6a}'';
"${secMod}+F7" = ''workspace ${config.ws.w7a}'';
"${secMod}+F8" = ''workspace ${config.ws.w8a}'';
"${secMod}+F9" = ''workspace ${config.ws.w9a}'';
# Display Brightness and Keyboard Brightness # Move window to and focus new workspace
"${primeMod}+equal" = ''exec light -A 5''; "${primeMod}+Shift+grave" = ''move container to workspace ${config.ws.w0}; workspace ${config.ws.w0}'';
"${primeMod}+minus" = ''exec light -U 5''; "${primeMod}+Shift+1" = ''move container to workspace ${config.ws.w1}; workspace ${config.ws.w1}'';
"${primeMod}+Shift+equal" = ''exec light -A 1''; "${primeMod}+Shift+2" = ''move container to workspace ${config.ws.w2}; workspace ${config.ws.w2}'';
"${primeMod}+Shift+minus" = ''exec light -U 1''; "${primeMod}+Shift+3" = ''move container to workspace ${config.ws.w3}; workspace ${config.ws.w3}'';
"XF86KbdBrightnessUp" = ''exec light -s sysfs/leds/smc::kbd_backlight -A 5''; "${primeMod}+Shift+4" = ''move container to workspace ${config.ws.w4}; workspace ${config.ws.w4}'';
"XF86KbdBrightnessDown" = ''exec light -s sysfs/leds/smc::kbd_backlight -U 5''; "${primeMod}+Shift+5" = ''move container to workspace ${config.ws.w5}; workspace ${config.ws.w5}'';
"${primeMod}+Shift+6" = ''move container to workspace ${config.ws.w6}; workspace ${config.ws.w6}'';
"${primeMod}+Shift+7" = ''move container to workspace ${config.ws.w7}; workspace ${config.ws.w7}'';
"${primeMod}+Shift+8" = ''move container to workspace ${config.ws.w8}; workspace ${config.ws.w8}'';
"${primeMod}+Shift+9" = ''move container to workspace ${config.ws.w9}; workspace ${config.ws.w9}'';
## Window manager keys # Move window to and focus new alternate workspace
"${primeMod}+q" = ''kill''; "${secMod}+Shift+F1" = ''move container to workspace ${config.ws.w1a}; workspace ${config.ws.w1a}'';
"${primeMod}+Shift+r" = ''reload''; "${secMod}+Shift+F2" = ''move container to workspace ${config.ws.w2a}; workspace ${config.ws.w2a}'';
"${secMod}+Shift+F3" = ''move container to workspace ${config.ws.w3a}; workspace ${config.ws.w3a}'';
"${secMod}+Shift+F4" = ''move container to workspace ${config.ws.w4a}; workspace ${config.ws.w4a}'';
"${secMod}+Shift+F5" = ''move container to workspace ${config.ws.w5a}; workspace ${config.ws.w5a}'';
"${secMod}+Shift+F6" = ''move container to workspace ${config.ws.w6a}; workspace ${config.ws.w6a}'';
"${secMod}+Shift+F7" = ''move container to workspace ${config.ws.w7a}; workspace ${config.ws.w7a}'';
"${secMod}+Shift+F8" = ''move container to workspace ${config.ws.w8a}; workspace ${config.ws.w8a}'';
"${secMod}+Shift+F9" = ''move container to workspace ${config.ws.w9a}; workspace ${config.ws.w9a}'';
# Switch to workspaces # Change focus across windows
"${primeMod}+grave" = ''workspace ${config.ws.w0}''; "${primeMod}+h" = ''focus left'';
"${primeMod}+1" = ''workspace ${config.ws.w1}''; "${primeMod}+j" = ''focus down'';
"${primeMod}+2" = ''workspace ${config.ws.w2}''; "${primeMod}+k" = ''focus up'';
"${primeMod}+3" = ''workspace ${config.ws.w3}''; "${primeMod}+l" = ''focus right'';
"${primeMod}+4" = ''workspace ${config.ws.w4}'';
"${primeMod}+5" = ''workspace ${config.ws.w5}'';
"${primeMod}+6" = ''workspace ${config.ws.w6}'';
"${primeMod}+7" = ''workspace ${config.ws.w7}'';
"${primeMod}+8" = ''workspace ${config.ws.w8}'';
"${primeMod}+9" = ''workspace ${config.ws.w9}'';
# Switch to alternate workspaces # Resize windows
"${secMod}+F1" = ''workspace ${config.ws.w1a}''; "${primeMod}+${secMod}+h" = ''resize shrink width ${resizeAmount} px or 5 ppt'';
"${secMod}+F2" = ''workspace ${config.ws.w2a}''; "${primeMod}+${secMod}+j" = ''resize shrink height ${resizeAmount} px or 5 ppt'';
"${secMod}+F3" = ''workspace ${config.ws.w3a}''; "${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${secMod}+F4" = ''workspace ${config.ws.w4a}''; "${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt'';
"${secMod}+F5" = ''workspace ${config.ws.w5a}'';
"${secMod}+F6" = ''workspace ${config.ws.w6a}'';
"${secMod}+F7" = ''workspace ${config.ws.w7a}'';
"${secMod}+F8" = ''workspace ${config.ws.w8a}'';
"${secMod}+F9" = ''workspace ${config.ws.w9a}'';
# Move window to and focus new workspace # Move focused window
"${primeMod}+Shift+grave" = ''move container to workspace ${config.ws.w0}; workspace ${config.ws.w0}''; "${primeMod}+Shift+h" = ''move left ${resizeAmount} px'';
"${primeMod}+Shift+1" = ''move container to workspace ${config.ws.w1}; workspace ${config.ws.w1}''; "${primeMod}+Shift+j" = ''move down ${resizeAmount} px'';
"${primeMod}+Shift+2" = ''move container to workspace ${config.ws.w2}; workspace ${config.ws.w2}''; "${primeMod}+Shift+k" = ''move up ${resizeAmount} px'';
"${primeMod}+Shift+3" = ''move container to workspace ${config.ws.w3}; workspace ${config.ws.w3}''; "${primeMod}+Shift+l" = ''move right ${resizeAmount} px'';
"${primeMod}+Shift+4" = ''move container to workspace ${config.ws.w4}; workspace ${config.ws.w4}'';
"${primeMod}+Shift+5" = ''move container to workspace ${config.ws.w5}; workspace ${config.ws.w5}'';
"${primeMod}+Shift+6" = ''move container to workspace ${config.ws.w6}; workspace ${config.ws.w6}'';
"${primeMod}+Shift+7" = ''move container to workspace ${config.ws.w7}; workspace ${config.ws.w7}'';
"${primeMod}+Shift+8" = ''move container to workspace ${config.ws.w8}; workspace ${config.ws.w8}'';
"${primeMod}+Shift+9" = ''move container to workspace ${config.ws.w9}; workspace ${config.ws.w9}'';
# Move window to and focus new alternate workspace # Change focus between floating/tiled, toggle floating
"${secMod}+Shift+F1" = ''move container to workspace ${config.ws.w1a}; workspace ${config.ws.w1a}''; "${primeMod}+space" = ''focus mode_toggle'';
"${secMod}+Shift+F2" = ''move container to workspace ${config.ws.w2a}; workspace ${config.ws.w2a}''; "${primeMod}+Shift+space" = ''floating toggle'';
"${secMod}+Shift+F3" = ''move container to workspace ${config.ws.w3a}; workspace ${config.ws.w3a}'';
"${secMod}+Shift+F4" = ''move container to workspace ${config.ws.w4a}; workspace ${config.ws.w4a}'';
"${secMod}+Shift+F5" = ''move container to workspace ${config.ws.w5a}; workspace ${config.ws.w5a}'';
"${secMod}+Shift+F6" = ''move container to workspace ${config.ws.w6a}; workspace ${config.ws.w6a}'';
"${secMod}+Shift+F7" = ''move container to workspace ${config.ws.w7a}; workspace ${config.ws.w7a}'';
"${secMod}+Shift+F8" = ''move container to workspace ${config.ws.w8a}; workspace ${config.ws.w8a}'';
"${secMod}+Shift+F9" = ''move container to workspace ${config.ws.w9a}; workspace ${config.ws.w9a}'';
# Change focus across windows # Allow a window to be visible on all workspaces, toggle border
"${primeMod}+h" = ''focus left''; "${primeMod}+0" = ''exec ${pinWindow}'';
"${primeMod}+j" = ''focus down'';
"${primeMod}+k" = ''focus up'';
"${primeMod}+l" = ''focus right'';
# Resize windows # Toggle fullscreen
"${primeMod}+${secMod}+h" = ''resize shrink width ${resizeAmount} px or 5 ppt''; "${primeMod}+f" = ''fullscreen toggle'';
"${primeMod}+${secMod}+j" = ''resize shrink height ${resizeAmount} px or 5 ppt''; "${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global'';
"${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt'';
# Move focused window # Change container layout
"${primeMod}+Shift+h" = ''move left ${resizeAmount} px''; "${primeMod}+w" = ''layout toggle split'';
"${primeMod}+Shift+j" = ''move down ${resizeAmount} px''; "${primeMod}+e" = ''layout toggle tabbed stacking'';
"${primeMod}+Shift+k" = ''move up ${resizeAmount} px'';
"${primeMod}+Shift+l" = ''move right ${resizeAmount} px'';
# Change focus between floating/tiled, toggle floating # Change split direction
"${primeMod}+space" = ''focus mode_toggle''; "${primeMod}+v" = ''split v'';
"${primeMod}+Shift+space" = ''floating toggle'';
# Allow a window to be visible on all workspaces, toggle border # Focus parent / child
"${primeMod}+0" = ''exec ${pinWindow}''; "${primeMod}+a" = ''focus parent'';
"${primeMod}+shift+a" = ''focus child'';
# Toggle fullscreen # Scratchpads
"${primeMod}+f" = ''fullscreen toggle''; "Shift+Ctrl+Backslash" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888'';
"${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global''; "${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657'';
"${primeMod}+Shift+v" = ''[app_id="sound"] scratchpad show, move position center, resize set 1000 800'';
# Change container layout "${primeMod}+Shift+Backslash" = ''[app_id="com.github.wwmm.easyeffects"] scratchpad show, move position center, resize set 1000 800'';
"${primeMod}+w" = ''layout toggle split'';
"${primeMod}+e" = ''layout toggle tabbed stacking'';
# Change split direction
"${primeMod}+v" = ''split v'';
# Focus parent / child
"${primeMod}+a" = ''focus parent'';
"${primeMod}+shift+a" = ''focus child'';
# Scratchpads
"Shift+Ctrl+Backslash" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888'';
"${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657'';
"${primeMod}+Shift+v" = ''[app_id="sound"] scratchpad show, move position center, resize set 1000 800'';
"${primeMod}+Shift+Backslash" = ''[app_id="com.github.wwmm.easyeffects"] scratchpad show, move position center, resize set 1000 800'';
};
}; };
}; };
} }

View file

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

View file

@ -1,45 +1,43 @@
{ config, ... }: { config, ... }:
{ {
wayland.windowManager.sway = { wayland.windowManager.sway.config = {
config = { colors = {
colors = { focused = {
focused = { border = "#${config.look.colors.prime}";
border = "#${config.look.colors.prime}"; background = "#${config.look.colors.prime}";
background = "#${config.look.colors.prime}"; text = "#FFFFFF";
text = "#FFFFFF"; indicator = "#${config.look.colors.actSplit}";
indicator = "#${config.look.colors.actSplit}"; childBorder = "#${config.look.colors.prime}";
childBorder = "#${config.look.colors.prime}";
};
focusedInactive = {
border = "#${config.look.colors.accent}";
background = "#${config.look.colors.accent}";
text = "#${config.look.colors.text}";
indicator = "#${config.look.colors.split}";
childBorder = "#${config.look.colors.accent}";
};
unfocused = {
border = "#${config.look.colors.dark}";
background = "#${config.look.colors.dark}";
text = "#${config.look.colors.text}";
indicator = "#${config.look.colors.split}";
childBorder = "#${config.look.colors.split}";
};
urgent = {
border = "#${config.look.colors.urgent}";
background = "#${config.look.colors.urgent}";
text = "#${config.look.colors.text}";
indicator = "#${config.look.colors.urgent}";
childBorder = "#${config.look.colors.urgent}";
};
}; };
fonts = { focusedInactive = {
names = ["${config.look.fonts.main}"]; border = "#${config.look.colors.accent}";
size = 10.5; background = "#${config.look.colors.accent}";
text = "#${config.look.colors.text}";
indicator = "#${config.look.colors.split}";
childBorder = "#${config.look.colors.accent}";
}; };
gaps = { unfocused = {
inner = 5; border = "#${config.look.colors.dark}";
smartGaps = true; background = "#${config.look.colors.dark}";
text = "#${config.look.colors.text}";
indicator = "#${config.look.colors.split}";
childBorder = "#${config.look.colors.split}";
}; };
urgent = {
border = "#${config.look.colors.urgent}";
background = "#${config.look.colors.urgent}";
text = "#${config.look.colors.text}";
indicator = "#${config.look.colors.urgent}";
childBorder = "#${config.look.colors.urgent}";
};
};
fonts = {
names = ["${config.look.fonts.main}"];
size = 10.5;
};
gaps = {
inner = 5;
smartGaps = true;
}; };
}; };
} }

View file

@ -16,10 +16,10 @@
allowPing = false; allowPing = false;
extraInputRules = '' extraInputRules = ''
${lib.optionalString (!config.system.firewall.server.enable) '' ${lib.optionalString (!config.system.firewall.server.enable) ''
ip saddr { ${config.ips.server}, ${config.ips.wgSpan}.1 } accept comment "Accept Server" ip saddr { ${config.ips.server}, 10.100.0.1 } accept comment "Accept Server"
''} ''}
${lib.optionalString config.system.firewall.server.enable '' ${lib.optionalString config.system.firewall.server.enable ''
ip saddr { ${config.ips.localSpan}.0/24, ${config.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS" ip saddr { ${config.ips.localSpan}.0/24, 10.100.0.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP" ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
''} ''}
''; '';
@ -34,7 +34,7 @@
chain PREROUTING { chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept; type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC" tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC"
tcp dport 2222 dnat to ${config.ips.wgSpan}.19:22 comment "SSH to Oracle VM" tcp dport 2222 dnat to 10.100.0.19:22 comment "SSH to Oracle VM"
udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games" udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games"

View file

@ -24,36 +24,36 @@
nat = { nat = {
enable = config.system.wireguard.server.enable; enable = config.system.wireguard.server.enable;
externalInterface = "${config.ips.netInt}"; externalInterface = "${config.ips.netInt}";
internalInterfaces = [ "${config.ips.wgInt}" ]; internalInterfaces = [ "wgs" ];
}; };
wireguard.interfaces = { wireguard.interfaces = {
"wgc" = lib.mkIf config.system.wireguard.client.enable { wgc = lib.mkIf config.system.wireguard.client.enable {
# Define IP of client in per device config # Define IP of client in per device config
listenPort = 51820; listenPort = 51820;
privateKey = config.secrets.wgClientPriv; privateKey = config.secrets.wgClientPriv;
peers = [ peers = [
{ # NixOS Server { # NixOS Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8="; publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "${config.ips.wgSpan}.0/24" ]; allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820"; endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
]; ];
}; };
"wgs" = lib.mkIf config.system.wireguard.server.enable { wgs = lib.mkIf config.system.wireguard.server.enable {
ips = [ "${config.ips.wgSpan}.1/24" ]; ips = [ "10.100.0.1/24" ];
listenPort = 51820; listenPort = 51820;
privateKey = config.secrets.wgServerPriv; privateKey = config.secrets.wgServerPriv;
peers = [ peers = [
{ # NixOS { # NixOS
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0="; publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "${config.ips.wgSpan}.16/28" ]; allowedIPs = [ "10.100.0.16/28" ];
} }
{ # Pixel 9 { # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4="; publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "${config.ips.wgSpan}.2/32" ]; allowedIPs = [ "10.100.0.2/32" ];
} }
]; ];
}; };

View file

@ -6,9 +6,10 @@
}; };
config.displays = { config.displays = {
d1 = "DP-3"; d1 = "DP-2";
d2 = "DP-1"; d2 = "DP-3";
d3 = "DP-2"; d3 = "DP-1";
d4 = "HDMI-A-1";
dI = "eDP-1"; dI = "eDP-1";
}; };
} }

View file

@ -12,8 +12,5 @@
pc = "${localSpan}.3"; pc = "${localSpan}.3";
vm = "${localSpan}.4"; vm = "${localSpan}.4";
hx = "${localSpan}.70"; hx = "${localSpan}.70";
wgInt = "wg0";
wgSpan = "10.100.0";
}; };
} }