use sway for now since hyprland crashes with kvm switch

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-08-31 21:25:28 -05:00
parent 00a045d0c1
commit 566d709ca8
15 changed files with 739 additions and 3 deletions

View file

@ -0,0 +1,12 @@
{ ... }:
{
imports = [
./theme.nix
./sway.nix
./waybar.nix
./wofi.nix
./swaync.nix
./swaylock.nix
./polkit.nix
];
}

View file

@ -0,0 +1,4 @@
{ ... }:
{
services.polkit-gnome.enable = true;
}

View file

@ -0,0 +1,140 @@
{
config,
osConfig,
lib,
...
}:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
wayland.windowManager.sway = {
enable = true;
xwayland = true;
config = lib.mkMerge [
rec {
modifier = "Mod4"; # SUPER
terminal = cfg.terminalCommand;
menu = "wofi --show drun";
# Per-output workspace mapping (user can extend via extraOptions)
# Example (left as defaults): users can add `output HDMI-A-1 workspace 1,3,5` in extraOptions
input = {
"type:keyboard" = {
xkb_layout = "us";
xkb_options = "caps:escape";
};
"type:touchpad" = {
natural_scroll = "enabled";
tap = "enabled";
dwt = "enabled";
};
# Disable focus follows mouse to avoid accidental focus changes
# In Sway this behavior is controlled by focus_follows_mouse
};
focus = {
followMouse = "no";
# onWindowActivation = "urgent"; # don't steal focus; mark urgent instead
};
gaps = {
inner = 2;
outer = 4;
smartGaps = false;
smartBorders = "on";
};
window = {
border = 1;
titlebar = false;
commands = [
# Bitwarden chrome popup as floating example from Hyprland rules
{
criteria = {
class = "chrome-nngceckbapebfimnlniiiahkandclblb-Default";
title = "_crx_nngceckbapebfimnlniiiahkandclblb";
instance = ".*";
};
command = "floating enable, move position center, resize set 720 600";
}
];
};
# Keybindings mirroring Hyprland
keybindings = {
# Apps
"${modifier}+return" = "exec ${cfg.terminalCommand}";
"${modifier}+space" = "exec pkill wofi || wofi --show drun";
"${modifier}+q" = "kill";
"${modifier}+shift+Escape" = "exit";
"${modifier}+shift+q" = "exec swaylock";
"${modifier}+f" = "floating toggle";
# Focus
"${modifier}+h" = "focus left";
"${modifier}+l" = "focus right";
"${modifier}+k" = "focus up";
"${modifier}+j" = "focus down";
# Workspaces (numbers and vim-like mirror)
"${modifier}+1" = "workspace number 1";
"${modifier}+n" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+m" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+comma" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+period" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+slash" = "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";
# Move windows
"${modifier}+shift+h" = "move left";
"${modifier}+shift+l" = "move right";
"${modifier}+shift+k" = "move up";
"${modifier}+shift+j" = "move down";
"${modifier}+shift+1" = "move container to workspace number 1";
"${modifier}+shift+n" = "move container to workspace number 1";
"${modifier}+shift+2" = "move container to workspace number 2";
"${modifier}+shift+m" = "move container to workspace number 2";
"${modifier}+shift+3" = "move container to workspace number 3";
"${modifier}+shift+comma" = "move container to workspace number 3";
"${modifier}+shift+4" = "move container to workspace number 4";
"${modifier}+shift+period" = "move container to workspace number 4";
"${modifier}+shift+5" = "move container to workspace number 5";
"${modifier}+shift+slash" = "move container to workspace number 5";
"${modifier}+shift+6" = "move container to workspace number 6";
"${modifier}+shift+7" = "move container to workspace number 7";
"${modifier}+shift+8" = "move container to workspace number 8";
"${modifier}+shift+9" = "move container to workspace number 9";
"${modifier}+shift+0" = "move container to workspace number 10";
# Mouse bindings (Mod + drag)
"${modifier}+button1" = "move";
"${modifier}+button3" = "resize";
# Screenshot
"Print" = "exec grim -g \"$(slurp)\" - | wl-copy";
};
bars = [ ]; # Use Waybar via Home Manager
startup = [ { command = "pgrep waybar >/dev/null || waybar"; } ];
}
cfg.extraOptions
];
};
}

View file

@ -0,0 +1,15 @@
{ ... }:
{
programs.swaylock = {
enable = true;
settings = {
color = "#000000";
indicator-caps-lock = true;
indicator-idle-visible = true;
indicator-radius = 100;
indicator-thickness = 10;
font = "JetBrainsMono Nerd Font Regular";
font-size = 20;
};
};
}

View file

@ -0,0 +1,112 @@
{ lib, osConfig, ... }:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
"swaync"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = lib.mkIf cfg.enable {
services.swaync = {
enable = true;
settings = {
ignore = [ "com.spotify.Client" ];
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;
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;
widgets = [
"inhibitors"
"title"
"dnd"
"volume"
"backlight"
"mpris"
"buttons-grid#quick"
"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";
mpris = {
image-size = 96;
image-radius = 12;
};
volume = {
label = "󰕾";
show-per-app = true;
};
backlight = {
label = "󰃟";
device = "intel_backlight";
};
# "buttons-grid#quick" = {
# columns = 4;
# icon-size = 20;
# actions = [
# { label = "󰐥"; tooltip = "Shutdown"; command = "confirm-action 'systemctl poweroff' 'Shutdown?'"; }
# { label = "󰜉"; tooltip = "Reboot"; command = "confirm-action 'systemctl reboot' 'Reboot?'"; }
# { label = "󰍃"; tooltip = "Logout"; command = "confirm-action 'swaymsg exit' 'Logout?'"; }
# ];
# };
};
};
style = ''
.control-center { background: #1a1b26; border: 2px solid #7dcae4; border-radius: 12px; }
.control-center-list { background: transparent; }
.control-center .notification-row:focus, .control-center .notification-row:hover { opacity: 1; background: #24283b; }
.notification { border-radius: 8px; margin: 6px 12px; box-shadow: 0 0 0 1px rgba(125,196,228,.3), 0 1px 3px 1px rgba(0,0,0,.7), 0 2px 6px 2px rgba(0,0,0,.3); padding: 0; }
.widget-title { margin: 8px; font-size: 1.5rem; color: #c0caf5; }
.widget-dnd { margin: 8px; font-size: 1.1rem; color: #c0caf5; }
.widget-dnd > switch { font-size: initial; border-radius: 8px; background: #414868; border: 1px solid #7dcae4; }
.widget-dnd > switch:checked { background: #7dcae4; }
.widget-mpris { color: #c0caf5; background: #24283b; padding: 8px; margin: 8px; border-radius: 8px; }
.widget-mpris-player { padding: 8px; margin: 8px; }
.widget-mpris-title { font-weight: bold; font-size: 1.25rem; }
.widget-mpris-subtitle { font-size: 1.1rem; color: #9ece6a; }
.widget-volume, .widget-backlight, .widget-menubar { background: #24283b; padding: 8px; margin: 8px; border-radius: 8px; color: #c0caf5; }
.widget-menubar .menu-item button { background: #1f2335; color: #c0caf5; border-radius: 8px; padding: 6px 10px; margin: 4px; border: 1px solid #2e3440; font-family: "JetBrainsMonoNL Nerd Font"; }
.widget-menubar .menu-item button:hover { background: #414868; border-color: #7dcae4; }
.topbar-buttons button { border: none; background: transparent; color: #c0caf5; font-size: 1.1rem; border-radius: 8px; margin: 0 4px; padding: 8px; }
.topbar-buttons button:hover { background: #414868; }
.topbar-buttons button:active { background: #7dcae4; color: #1a1b26; }
'';
};
};
}

View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
home.pointerCursor = {
gtk.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 16;
};
gtk = {
enable = true;
theme = { package = pkgs.flat-remix-gtk; name = "Flat-Remix-GTK-Grey-Darkest"; };
iconTheme = { package = pkgs.adwaita-icon-theme; name = "Adwaita"; };
font = { name = "Sans"; size = 11; };
};
}

View file

@ -0,0 +1,132 @@
{ lib, osConfig, ... }:
let
ccfg = import ../../../config.nix;
cfg_path = [ ccfg.custom_config_key "desktopEnvironment" "sway" "waybar" ];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = lib.mkIf cfg.enable {
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
spacing = 6;
margin-top = 0;
margin-bottom = 0;
margin-left = 10;
margin-right = 10;
modules-left = [ "sway/workspaces" ];
modules-center = [ "clock" "temperature" "cpu" "memory" "disk" ];
modules-right = [ "pulseaudio" "network" "bluetooth" "custom/notifications" "sway/language" ];
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = ""; "2" = ""; "3" = ""; "4" = ""; "5" = "";
"6" = ""; "7" = ""; "8" = ""; "9" = ""; "10" = "";
"11" = ""; "12" = ""; "13" = ""; "14" = ""; "15" = "";
"16" = ""; "17" = ""; "18" = ""; "19" = ""; "20" = "";
};
disable-scroll = false;
};
pulseaudio = {
format = "{icon} {volume}%";
format-bluetooth = "󰂰 {volume}%";
format-bluetooth-muted = "󰂲 ";
format-muted = "󰖁 ";
format-source = "󰍬 {volume}%";
format-source-muted = "󰍭 ";
format-icons = {
headphone = "󰋋";
hands-free = "󰂑";
headset = "󰂑";
phone = "󰏲";
portable = "󰦧";
car = "󰄋";
default = [ "󰕿" "󰖀" "󰕾" ];
};
scroll-step = 5;
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
on-click-right = "swaync-client -t -sw";
};
"custom/notifications" = {
format = "{icon} {}";
format-icons = {
notification = ""; none = "";
dnd-notification = "󰂛"; dnd-none = "󰂛";
inhibited-notification = ""; inhibited-none = "";
dnd-inhibited-notification = "󰂛"; dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
tooltip = false;
};
clock = { format = "{:%b %d, %H:%M}"; };
temperature = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "󰔏 {temperatureC}°C";
format = "󰔏 {temperatureC}°C";
};
cpu = { format = "󰻠 {usage}%"; tooltip = false; on-click = "btop"; };
memory = { format = "󰍛 {}%"; on-click = "btop"; };
disk = { interval = 30; format = "󰋊 {percentage_used}%"; path = "/"; on-click = "btop"; };
network = {
format-wifi = "󰤨 {essid} ({signalStrength}%)";
format-ethernet = "󰈀 {ipaddr}/{cidr}";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "󰈀 {ifname} (No IP)";
format-disconnected = "󰖪 Disconnected";
# on-click = "wofi-wifi-menu";
# on-click-right = "nmcli radio wifi toggle";
};
bluetooth = {
format = "󰂯 {status}";
format-connected = "󰂱 {device_alias}";
format-connected-battery = "󰂱 {device_alias} {device_battery_percentage}%";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
# on-click = "wofi-bluetooth-menu";
# on-click-right = "bluetoothctl power toggle";
};
"sway/language" = { format = "{}"; }; # simplified
};
};
style = ''
* { font-family: "JetBrainsMonoNL Nerd Font"; font-size: 12px; border: none; border-radius: 0; min-height: 0; }
window#waybar { background: transparent; border-radius: 10px; margin: 0px; }
.modules-left,.modules-center,.modules-right { background: rgba(26,27,38,.8); border-radius: 10px; margin: 4px; padding: 0 10px; }
#workspaces { padding: 0 5px; }
#workspaces button { padding: 0 8px; background: transparent; color: #c0caf5; border-radius: 5px; margin: 2px; }
#workspaces button:hover { background: rgba(125,196,228,.2); color: #7dcae4; }
#workspaces button.active { background: #7dcae4; color: #1a1b26; }
#pulseaudio,#custom-notifications,#clock,#temperature,#cpu,#memory,#disk,#network,#bluetooth,#language { padding: 0 8px; color: #c0caf5; margin: 2px; }
#temperature.critical { color: #f7768e; }
#network.disconnected { color: #f7768e; }
#bluetooth.disabled { color: #565f89; }
#pulseaudio.muted { color: #565f89; }
'';
};
};
}

View file

@ -0,0 +1,23 @@
{ ... }:
{
programs.wofi = {
enable = true;
settings = {
width = 500;
height = 600;
location = "bottom";
show = "drun";
prompt = "...";
filter_rate = 100;
allow_markup = true;
no_actions = true;
halign = "fill";
orientation = "vertical";
content_halign = "fill";
insensitive = true;
allow_images = true;
image_size = 40;
gtk_dark = true;
};
};
}