[sway] Switches to sway over hyprland

This commit is contained in:
2025-04-11 14:06:34 -07:00
parent b2b99f12cc
commit 8533f0c9cc
4 changed files with 284 additions and 10 deletions

View File

@@ -1,5 +1,14 @@
{ pkgs, inputs, ... }:
{
home.packages = with pkgs; [
hyprlock # lock screen
swayidle # lock on idle
swayosd # volume pop-up
swaynotificationcenter # notifications
hyprpolkitagent # Privilege managent
hyprshot # Screenshot utility
];
wayland.windowManager.hyprland = {
enable = true;
plugins = [
@@ -17,7 +26,6 @@
];
"$terminal" = "wezterm";
"$fileManager" = "dolphin";
"$menu" = "rofi -show combi -combi-modes drun,ssh,run -theme ~/.config/rofi/launcher/style.rasi";
"$browser" = "firefox";
@@ -286,7 +294,6 @@
"$mainMod, T, exec, $terminal"
"$mainMod, B, exec, $browser"
"$mainMod, D, exec, $menu"
"$mainMod, E, exec, $fileManager"
"$mainMod + SHIFT, S, exec, hyprshot -m region --clipboard-only"
"$mainMod, C, exec, swaync-client -t"

View File

@@ -1,7 +1,7 @@
{ pkgs, ... }:
{
imports = [
./hyprland.nix
./sway.nix
./audio.nix
./nix.nix
./rofi/rofi.nix
@@ -18,25 +18,26 @@
# Common utilities
feh
networkmanagerapplet # network control
hyprlock # lock screen
swayidle # lock on idle
swayosd # volume pop-up
swaynotificationcenter # notifications
hyprpolkitagent # Privilege managent
gnome-keyring # Secret management
glib # for Gnome/GTK settings
gsettings-desktop-schemas # So that we can access gnome settings
xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk # GTK backend for XDG components like pickers
grim # Screenshot provider
hyprshot # Screenshot utility
nwg-look # GTK settings editor
playerctl # for universal play/pause etc
wirelesstools
waypaper # Wallpaper switcher
phinger-cursors # Mouse cursors
];
home.pointerCursor = {
enable = true;
gtk.enable = true;
name = "phinger-cursors";
size = 16;
package = pkgs.phinger-cursors;
};
# Hint for electron apps to use wayland
home.sessionVariables.NIXOS_OZONE_WL = "1";

View File

@@ -0,0 +1,168 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [
./swaync.nix
];
home.packages = with pkgs; [
hyprlock # lock screen
# swayidle # lock on idle
# swayosd # volume pop-up
# swaynotificationcenter # notifications
# hyprpolkitagent # Privilege managent
# hyprshot # Screenshot utility
];
services.swayosd = {
enable = true;
topMargin = 0.7;
};
services.swayidle = {
enable = true;
events = [
{
event = "before-sleep";
command = "hyprlock";
}
];
};
# Enable sway config generation for home.pointerCursor
home.pointerCursor.sway.enable = true;
wayland.windowManager.sway = {
enable = true;
checkConfig = true;
systemd = {
enable = true;
xdgAutostart = true;
};
config = {
# Workspace assignments
# Example:
# {
# "1: web" = [{ class = "^Firefox$"; }];
# "0: extra" = [{ class = "^Firefox$"; window_role = "About"; }];
# }
assigns = { };
colors = {
background = "#333333";
focused = {
background = "#285577";
border = "#4c7899";
childBorder = "#285577";
indicator = "#2e9ef4";
text = "#ffffff";
};
focusedInactive = {
background = "#5f676a";
border = "#333333";
childBorder = "#5f676a";
indicator = "#484e50";
text = "#ffffff";
};
placeholder = {
background = "#0c0c0c";
border = "#000000";
childBorder = "#0c0c0c";
indicator = "#000000";
text = "#ffffff";
};
unfocused = {
background = "#222222";
border = "#333333";
childBorder = "#222222";
indicator = "#292d2e";
text = "#888888";
};
urgent = {
background = "#900000";
border = "#2f343a";
childBorder = "#900000";
indicator = "#900000";
text = "#ffffff";
};
};
modifier = "Mod4"; # Super key
keybindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
terminal = "wezterm";
browser = "firefox";
menu = "rofi -show drun";
in
lib.mkOptionDefault {
"${modifier}+t" = "exec ${terminal}";
"${modifier}+b" = "exec ${browser}";
"${modifier}+d" = "exec ${menu}";
"${modifier}+Shift+s" = "exec hyprshot -m region --clipboard-only";
"${modifier}+c" = "exec swaync-client -t";
"${modifier}+Control+q" = "exec /home/drew/.config/rofi/powermenu/powermenu.sh";
"${modifier}+x" = "exec /home/drew/.config/rofi/powermenu/powermenu.sh";
"${modifier}+f" = "floating toggle";
"${modifier}+Shift+f" = "fullscreen toggle";
"${modifier}+r" = "focus output right"; # sway does not have `focusmonitor next`
"${modifier}+Control+r" = "move workspace to output left";
"${modifier}+Control+s" = "move workspace to output right";
"${modifier}+q" = "kill";
"${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right";
"${modifier}+Up" = "focus up";
"${modifier}+Down" = "focus down";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Down" = "move down";
# Workspace switching
"${modifier}+1" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10";
"${modifier}+Shift+1" = "move container to workspace number 1; workspace number 1";
"${modifier}+Shift+2" = "move container to workspace number 2; workspace number 2";
"${modifier}+Shift+3" = "move container to workspace number 3; workspace number 3";
"${modifier}+Shift+4" = "move container to workspace number 4; workspace number 4";
"${modifier}+Shift+5" = "move container to workspace number 5; workspace number 5";
"${modifier}+Shift+6" = "move container to workspace number 6; workspace number 6";
"${modifier}+Shift+7" = "move container to workspace number 7; workspace number 7";
"${modifier}+Shift+8" = "move container to workspace number 8; workspace number 8";
"${modifier}+Shift+9" = "move container to workspace number 9; workspace number 9";
"${modifier}+Shift+0" = "move container to workspace number 10; workspace number 10";
"${modifier}+Shift+r" = "move container to output left"; # approximating hyprland\u2019s split-changemonitor
"${modifier}+button1" = "move";
"${modifier}+button2" = "resize";
"XF86AudioRaiseVolume" = "exec swayosd-client --output-volume raise";
"XF86AudioLowerVolume" = "exec swayosd-client --output-volume lower";
"XF86AudioMute" = "exec swayosd-client --output-volume mute-toggle";
"XF86AudioMicMute" = "exec swayosd-client --input-volume mute-toggle";
"XF86AudioNext" = "exec playerctl next";
"XF86AudioPause" = "exec playerctl play-pause";
"XF86AudioPlay" = "exec playerctl play-pause";
"XF86AudioPrev" = "exec playerctl previous";
};
};
};
}

View File

@@ -0,0 +1,98 @@
{ ... }:
{
services.swaync = {
enable = true;
settings = {
"positionX" = "right";
"positionY" = "top";
"layer" = "overlay";
"control-center-layer" = "top";
"layer-shell" = true;
"cssPriority" = "application";
"control-center-margin-top" = 0;
"control-center-margin-bottom" = 0;
"control-center-margin-right" = 0;
"control-center-margin-left" = 0;
"notification-2fa-action" = true;
"notification-inline-replies" = false;
"notification-icon-size" = 64;
"notification-body-image-height" = 100;
"notification-body-image-width" = 200;
"timeout" = 10;
"timeout-low" = 5;
"timeout-critical" = 0;
"fit-to-screen" = true;
"relative-timestamps" = true;
"control-center-width" = 500;
"control-center-height" = 600;
"notification-window-width" = 500;
"keyboard-shortcuts" = true;
"image-visibility" = "when-available";
"transition-time" = 200;
"hide-on-clear" = false;
"hide-on-action" = true;
"script-fail-notify" = true;
"scripts" = {
"example-script" = {
"exec" = "echo 'Do something...'";
"urgency" = "Normal";
};
"example-action-script" = {
"exec" = "echo 'Do something actionable!'";
"urgency" = "Normal";
"run-on" = "action";
};
};
"notification-visibility" = {
"example-name" = {
"state" = "muted";
"urgency" = "Low";
"app-name" = "Spotify";
};
};
"widgets" = [
"inhibitors"
"title"
"dnd"
"notifications"
];
"widget-config" = {
"inhibitors" = {
"text" = "Inhibitors";
"button-text" = "Clear All";
"clear-all-button" = true;
};
"title" = {
"text" = "Notifications";
"clear-all-button" = true;
"button-text" = "Clear All";
};
"dnd" = {
"text" = "Do Not Disturb";
};
"label" = {
"max-lines" = 5;
"text" = "Label Text";
};
"mpris" = {
"image-size" = 96;
"image-radius" = 12;
};
"buttons-grid" = {
"actions" = [
{
"label" = "";
"type" = "toggle";
"active" = true;
"command" =
"sh -c '[[ $SWAYNC_TOGGLE_STATE == true ]] && nmcli radio wifi on || nmcli radio wifi off'";
"update_command" = "sh -c '[[ $(nmcli radio wifi) == \"enabled\" ]] && echo true || echo false'";
}
];
};
};
};
};
}