home/sway: brought to parity with hyprland

This commit is contained in:
Aly Raffauf 2024-04-19 22:00:41 -04:00
parent 1019dd7ed7
commit 89a177caa1
5 changed files with 137 additions and 42 deletions

View file

@ -53,6 +53,15 @@
}; };
"sway/workspaces" = { "sway/workspaces" = {
"all-outputs" = true; "all-outputs" = true;
"format" = "{icon} {name}";
"format-icons" = {
"default" = "󰝥";
"focused" = "󰪥";
};
"sort-by" = "id";
};
"sway/mode" = {
"on-click" = "${pkgs.sway}/bin/swaymsg mode default";
}; };
"sway/window" = { "sway/window" = {
"max-length" = 100; "max-length" = 100;

View file

@ -17,7 +17,7 @@ window#waybar {
color: #FAFAFA; color: #FAFAFA;
} }
#workspaces button.active { #workspaces button.active, #workspaces button.focused {
color: #ca9ee6; color: #ca9ee6;
} }

View file

@ -112,7 +112,7 @@
media = "${pkgs.playerctl}/bin/playerctl"; media = "${pkgs.playerctl}/bin/playerctl";
media_play = "${media} play-pause"; media_play = "${media} play-pause";
media_next = "${media} next"; media_next = "${media} next";
media_previous = "${media} previous"; media_prev = "${media} previous";
screenshot = "${pkgs.hyprshot}/bin/hyprshot"; screenshot = "${pkgs.hyprshot}/bin/hyprshot";
screenshot_folder = "~/pics/screenshots"; screenshot_folder = "~/pics/screenshots";
@ -274,16 +274,16 @@
windowrulev2 = suppressevent maximize, class:.* windowrulev2 = suppressevent maximize, class:.*
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = ${modifier}, T, exec, ${terminal}
bind = ${modifier}, F, exec, ${fileManager}
bind = ${modifier}, B, exec, ${browser} bind = ${modifier}, B, exec, ${browser}
bind = ${modifier}, E, exec, ${editor} bind = ${modifier}, E, exec, ${editor}
bind = ${modifier}, F, exec, ${fileManager}
bind = ${modifier}, R, exec, ${launcher} bind = ${modifier}, R, exec, ${launcher}
bind = ${modifier}, T, exec, ${terminal}
# Manage session. # Manage session.
bind = ${modifier}, C, killactive, bind = ${modifier}, C, killactive,
bind = ${modifier}, M, exec, ${logout}
bind = ${modifier}, L, exec, ${lock} bind = ${modifier}, L, exec, ${lock}
bind = ${modifier}, M, exec, ${logout}
# Basic window management. # Basic window management.
bind = ${modifier} SHIFT, W, fullscreen bind = ${modifier} SHIFT, W, fullscreen
@ -333,7 +333,7 @@
bind = ${modifier} SHIFT, 9, movetoworkspace, 9 bind = ${modifier} SHIFT, 9, movetoworkspace, 9
bind = ${modifier} SHIFT, 0, movetoworkspace, 10 bind = ${modifier} SHIFT, 0, movetoworkspace, 10
# Example special workspace (scratchpad) # Scratchpad show and move
bind = ${modifier}, S, togglespecialworkspace, magic bind = ${modifier}, S, togglespecialworkspace, magic
bind = ${modifier} SHIFT, S, movetoworkspace, special:magic bind = ${modifier} SHIFT, S, movetoworkspace, special:magic
@ -353,7 +353,7 @@
bindl = , xf86audiomute, exec, ${volume_mute} bindl = , xf86audiomute, exec, ${volume_mute}
bindl = , xf86audiomicmute, exec, ${mic_mute} bindl = , xf86audiomicmute, exec, ${mic_mute}
bindl = , xf86audioplay, exec, ${media_play} bindl = , xf86audioplay, exec, ${media_play}
bindl = , xf86audioprev, exec, ${media_previous} bindl = , xf86audioprev, exec, ${media_prev}
bindl = , xf86audionext, exec, ${media_next} bindl = , xf86audionext, exec, ${media_next}
# Extra bindings for petalburg. # Extra bindings for petalburg.

View file

@ -54,6 +54,7 @@
}; };
wayland.windowManager.sway.enable = true; wayland.windowManager.sway.enable = true;
wayland.windowManager.sway.package = pkgs.swayfx;
wayland.windowManager.sway.config = let wayland.windowManager.sway.config = let
modifier = "Mod4"; modifier = "Mod4";
@ -63,11 +64,11 @@
editor = pkgs.vscodium + "/bin/codium"; editor = pkgs.vscodium + "/bin/codium";
terminal = pkgs.alacritty + "/bin/alacritty"; terminal = pkgs.alacritty + "/bin/alacritty";
# River desktop utilities # Sway desktop utilities
bar = pkgs.waybar + "/bin/waybar"; bar = pkgs.waybar + "/bin/waybar";
launcher = pkgs.fuzzel + "/bin/fuzzel"; launcher = pkgs.fuzzel + "/bin/fuzzel";
notifyd = pkgs.mako + "/bin/mako"; notifyd = pkgs.mako + "/bin/mako";
wallpaperd = pkgs.swaybg + "/bin/swaybg"; wallpaperd = pkgs.swaybg + "/bin/swaybg -i ~/.local/share/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
idle = pkgs.swayidle + "/bin/swayidle"; idle = pkgs.swayidle + "/bin/swayidle";
logout = pkgs.wlogout + "/bin/wlogout"; logout = pkgs.wlogout + "/bin/wlogout";
lock = pkgs.swaylock + "/bin/swaylock -f -c 000000"; lock = pkgs.swaylock + "/bin/swaylock -f -c 000000";
@ -83,11 +84,11 @@
media = "${pkgs.playerctl}/bin/playerctl"; media = "${pkgs.playerctl}/bin/playerctl";
media_play = "${media} play-pause"; media_play = "${media} play-pause";
media_next = "${media} next"; media_next = "${media} next";
media_previous = "${media} previous"; media_prev = "${media} previous";
# screenshot = "${pkgs.hyprshot}/bin/hyprshot"; screenshot = "${pkgs.grim}/bin/grim";
# screenshot_folder = "~/pics/screenshots"; screenshot_folder = "~/pics/screenshots";
# screenshot_screen = "${screenshot} -m output -o ${screenshot_folder}"; screenshot_screen = "${screenshot} ${screenshot_folder}/$(date +'%s_grim.png')";
# screenshot_region = "${screenshot} -m region -o ${screenshot_folder}"; # screenshot_region = "${screenshot} -m region -o ${screenshot_folder}";
# Color, themes, scaling # Color, themes, scaling
@ -100,7 +101,6 @@
gdk_scale = "1.5"; gdk_scale = "1.5";
in { in {
bars = [{command = "${bar}";}]; bars = [{command = "${bar}";}];
# bars.waybar.command = "${pkgs.waybar}/bin/waybar";
terminal = "${terminal}"; terminal = "${terminal}";
menu = "${launcher}"; menu = "${launcher}";
modifier = "${modifier}"; modifier = "${modifier}";
@ -135,10 +135,16 @@
size = 12.0; size = 12.0;
}; };
startup = [ startup = [
# { command = "${pkgs.kanshi}"; } {command = "${wallpaperd}";}
{command = "nm-applet";} {command = "${pkgs.kanshi}";}
{command = "swayosd-server";} {command = "${notifyd}";}
{command = "thunar --daemon";} {command = "${pkgs.wl-clipboard}/bin/wl-paste --type text --watch cliphist store";}
{command = "${pkgs.wl-clipboard}/bin/wl-paste --type image --watch cliphist store";}
{command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";}
{command = "${fileManager} --daemon";}
{command = "${pkgs.swayosd}/bin/swayosd-server";}
{command = "${pkgs.networkmanagerapplet}/bin/nm-applet";}
{command = "${pkgs.trayscale}/bin/trayscale --hide-window";}
{command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '${pkgs.swaylock}/bin/swaylock' before-sleep '${pkgs.swaylock}/bin/swaylock'";} {command = "${pkgs.swayidle}/bin/swayidle -w timeout 300 '${pkgs.swaylock}/bin/swaylock' before-sleep '${pkgs.swaylock}/bin/swaylock'";}
]; ];
output = { output = {
@ -156,27 +162,42 @@
tap_button_map = "lrm"; tap_button_map = "lrm";
}; };
}; };
keybindings = lib.mkOptionDefault { keybindings = {
"${modifier}+r" = "exec ${launcher}"; # Apps
"${modifier}+t" = "exec ${terminal}"; "${modifier}+B" = "exec ${browser}";
"${modifier}+b" = "exec ${browser}"; "${modifier}+E" = "exec ${editor}";
"${modifier}+e" = "exec ${editor}"; "${modifier}+F" = "exec ${fileManager}";
"${modifier}+f" = "exec ${fileManager}"; "${modifier}+R" = "exec ${launcher}";
"${modifier}+T" = "exec ${terminal}";
"${modifier}+c" = "kill"; # Manage session.
"${modifier}+C" = "kill";
"${modifier}+L" = "exec ${lock}";
"${modifier}+M" = "exec ${logout}";
"${modifier}+l" = "exec ${lock}"; # Basic window management.
"${modifier}+m" = "exec ${logout}"; "${modifier}+Shift+W" = "fullscreen toggle";
"${modifier}+Shift+V" = "floating toggle";
"${modifier}+w" = "fullscreen toggle"; # Move focus with modifier + arrow keys
"${modifier}+v" = "floating toggle"; "${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+s" = "scratchpad show"; # Move window with modifier SHIFT + arrow keys
"${modifier}+Shift+s" = "move scratchpad"; "${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
"${modifier}+period" = "workspace next"; # Gnome-like workspaces.
"${modifier}+comma" = "workspace prev"; "${modifier}+Comma" = "workspace prev";
"${modifier}+Period" = "workspace next";
"${modifier}+Shift+Comma" = "move container to workspace prev; workspace prev";
"${modifier}+Shift+Period" = "move container to workspace next; workspace next";
# Switch workspaces with modifier + [0-9]
"${modifier}+1" = "workspace number 1"; "${modifier}+1" = "workspace number 1";
"${modifier}+2" = "workspace number 2"; "${modifier}+2" = "workspace number 2";
"${modifier}+3" = "workspace number 3"; "${modifier}+3" = "workspace number 3";
@ -186,10 +207,9 @@
"${modifier}+7" = "workspace number 7"; "${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8"; "${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9"; "${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10";
"${modifier}+Shift+period" = "move container to workspace next; workspace next"; # Move active window to a workspace with modifier + SHIFT + [0-9]
"${modifier}+Shift+comma" = "move container to workspace prev; workspace prev";
"${modifier}+Shift+1" = "move container to workspace number 1"; "${modifier}+Shift+1" = "move container to workspace number 1";
"${modifier}+Shift+2" = "move container to workspace number 2"; "${modifier}+Shift+2" = "move container to workspace number 2";
"${modifier}+Shift+3" = "move container to workspace number 3"; "${modifier}+Shift+3" = "move container to workspace number 3";
@ -199,24 +219,84 @@
"${modifier}+Shift+7" = "move container to workspace number 7"; "${modifier}+Shift+7" = "move container to workspace number 7";
"${modifier}+Shift+8" = "move container to workspace number 8"; "${modifier}+Shift+8" = "move container to workspace number 8";
"${modifier}+Shift+9" = "move container to workspace number 9"; "${modifier}+Shift+9" = "move container to workspace number 9";
"${modifier}+Shift+0" = "move container to workspace number 10";
# audio control # Scratchpad show and move
"${modifier}+S" = "scratchpad show";
"${modifier}+Shift+S" = "move scratchpad";
# TODO: scroll with mouse up/down through workspaces
# Display, volume, microphone, and media keys.
"XF86MonBrightnessUp" = "exec ${brightness_up}";
"XF86MonBrightnessDown" = "exec ${brightness_down}";
"XF86AudioRaiseVolume" = "exec ${volume_up}"; "XF86AudioRaiseVolume" = "exec ${volume_up}";
"XF86AudioLowerVolume" = "exec ${volume_down}"; "XF86AudioLowerVolume" = "exec ${volume_down}";
"XF86AudioMute" = "exec ${volume_mute}"; "XF86AudioMute" = "exec ${volume_mute}";
# mic control
"XF86AudioMicMute" = "exec ${mic_mute}"; "XF86AudioMicMute" = "exec ${mic_mute}";
"XF86AudioPlay" = "exec ${media_play}";
"XF86AudioPrev" = "exec ${media_prev}";
"XF86AudioNext" = "exec ${media_next}";
# brightness # For petalburg
"XF86MonBrightnessUp" = "exec ${brightness_up}"; "XF86Launch4" = "exec pp-adjuster";
"XF86MonBrightnessDown" = "exec ${brightness_down}"; # TODO: night color shift
# "XF86Launch1" =
"XF86Launch2" = "exec ${media_play}";
# Screenshots
"PRINT" = "exec ${screenshot_screen}";
# "${modifier}+PRINT" = "${screenshot_region}";
# Show/hide waybar
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar";
"Mod1+R" = "mode resize";
"Mod1+M" = "mode move";
};
modes = {
resize = {
Escape = "mode default";
Left = "resize shrink width 10 px";
Down = "resize grow height 10 px";
Up = "resize shrink height 10 px";
Right = "resize grow width 10 px";
};
move = {
Escape = "mode default";
Left = "move left";
Down = "move down";
Up = "move up";
Right = "move right";
Comma = "move container to workspace prev; workspace prev";
Period = "move container to workspace next; workspace next";
"1" = "move container to workspace number 1";
"2" = "move container to workspace number 2";
"3" = "move container to workspace number 3";
"4" = "move container to workspace number 4";
"5" = "move container to workspace number 5";
"6" = "move container to workspace number 6";
"7" = "move container to workspace number 7";
"8" = "move container to workspace number 8";
"9" = "move container to workspace number 9";
"0" = "move container to workspace number 10";
S = "move scratchpad";
};
}; };
}; };
wayland.windowManager.sway.extraConfig = '' wayland.windowManager.sway.extraConfig = ''
bindgesture swipe:right workspace prev bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next bindgesture swipe:left workspace next
blur enable
blur_passes 1
corner_radius 10
shadows enable
layer_effects waybar blur enable
layer_effects launcher blur enable
layer_effects logout_dialog blur enable
''; '';
xdg.configFile."xfce4/helpers.rc".text = '' xdg.configFile."xfce4/helpers.rc".text = ''

View file

@ -8,5 +8,11 @@
home-manager.users.aly = { home-manager.users.aly = {
imports = [../../homeManagerModules ../../aly.nix]; imports = [../../homeManagerModules ../../aly.nix];
home.stateVersion = "23.11"; home.stateVersion = "23.11";
alyraffauf = {
services.syncthing.enable = true;
desktop.sway = {
enable = true;
};
};
}; };
} }