nixos/alex/sway.nix

423 lines
10 KiB
Nix

{ pkgs, lib, ... }:
let
# Catppuccin Mocha Palette
base = "#1e1e2e";
mantle = "#181825";
surface0 = "#313244";
surface1 = "#45475a";
text = "#cdd6f4";
lavender = "#b4befe";
blue = "#89b4fa";
sapphire = "#74c7ec";
red = "#f38ba8";
peach = "#fab387";
yellow = "#f9e2af";
green = "#a6e3a1";
mauve = "#cba6f7";
overlay0 = "#6c7086";
in
{
home.packages = with pkgs; [
swaybg
swayidle
swaylock-effects
grim
slurp
wl-clipboard
mako
libnotify
nerd-fonts.jetbrains-mono
];
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
settings = {
clock = true;
color = base;
effect-pixelate = 50;
effect-greyscale = true;
screenshots = true;
font = "JetBrainsMono Nerd Font";
font-size = 24;
indicator-idle-visible = true;
indicator-radius = 200;
indicator-thickness = 17;
line-color = base;
ring-color = overlay0;
inside-color = base;
key-hl-color = lavender;
separator-color = base;
text-color = text;
text-caps-lock-color = text;
line-ver-color = base;
ring-ver-color = lavender;
inside-ver-color = base;
text-ver-color = text;
ring-wrong-color = red;
text-wrong-color = red;
inside-wrong-color = base;
inside-clear-color = base;
text-clear-color = text;
ring-clear-color = yellow;
line-clear-color = base;
line-wrong-color = base;
bs-hl-color = red;
grace = 2;
grace-no-mouse = true;
grace-no-touch = true;
datestr = "%a, %B %e";
timestr = "%H:%M";
fade-in = 0.3;
ignore-empty-password = true;
};
};
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
checkConfig = false;
config = {
modifier = "Mod4";
terminal = "wezterm";
menu = "rofi -show drun";
fonts = {
names = [ "JetBrainsMono Nerd Font" ];
style = "Regular";
size = 11.0;
};
input = {
"*" = {
xkb_layout = "us";
xkb_variant = "dvorak";
};
"type:touchpad" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
};
};
gaps = {
inner = 10;
outer = 5;
};
colors = {
focused = {
border = lavender;
background = base;
text = text;
indicator = lavender;
childBorder = lavender;
};
focusedInactive = {
border = overlay0;
background = base;
text = text;
indicator = overlay0;
childBorder = overlay0;
};
unfocused = {
border = overlay0;
background = base;
text = overlay0;
indicator = overlay0;
childBorder = overlay0;
};
urgent = {
border = red;
background = base;
text = red;
indicator = red;
childBorder = red;
};
};
output = {
"*" = {
bg = "/home/alex/Pictures/wallpaper.jpg fill";
};
};
bars = [];
startup = [
{ command = "waybar"; }
{ command = "mako"; }
{ command = "swayidle -w timeout 300 'swaylock -f' timeout 600 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"' timeout 900 'systemctl suspend' before-sleep 'swaylock -f'"; }
];
keybindings = let
modifier = "Mod4";
in lib.mkOptionDefault {
"${modifier}+Return" = "exec wezterm";
"${modifier}+d" = "exec rofi -show drun";
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+Shift+l" = "exec swaylock -f";
"${modifier}+Shift+s" = "exec grim -g \"$(slurp)\" - | wl-copy";
# Workspaces
"--whole-window ${modifier}+button4" = "workspace prev";
"--whole-window ${modifier}+button5" = "workspace next";
"XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86MonBrightnessUp" = "exec light -A 5";
"XF86MonBrightnessDown" = "exec light -U 5";
};
};
extraConfig = ''
default_border pixel 2
default_floating_border pixel 2
corner_radius 10
shadows enable
shadow_blur_radius 20
shadow_color #00000077
blur enable
blur_passes 3
blur_radius 5
layer_effects "waybar" blur enable; shadows enable; corner_radius 10;
'';
};
services.mako = {
enable = true;
settings = {
font = "JetBrainsMono Nerd Font 11";
background-color = "${base}dd";
border-color = lavender;
border-radius = 10;
border-size = 2;
text-color = text;
default-timeout = 5000;
};
};
programs.rofi = {
enable = true;
font = "JetBrainsMono Nerd Font 12";
theme = lib.mkForce "default"; # Use default for now, can be themed later
};
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
margin-top = 5;
margin-left = 10;
margin-right = 10;
spacing = 4;
modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = [ "clock" ];
modules-right = [ "pulseaudio" "network" "cpu" "memory" "battery" "tray" ];
"sway/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"clock" = {
format = "{:%a %d %b %H:%M:%S}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt>{calendar}</tt>";
interval = 1;
};
"cpu" = {
format = "{usage}% ";
tooltip = false;
};
"memory" = {
format = "{}% ";
};
"battery" = {
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
format-icons = ["" "" "" "" ""];
};
"network" = {
format-wifi = "{essid} ({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} ";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "{ifname} (No IP) ";
format-disconnected = "Disconnected ";
format-alt = "{ifname}: {ipaddr}/{cidr}";
};
"pulseaudio" = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = "pavucontrol";
};
};
};
style = ''
* {
font-family: "JetBrainsMono Nerd Font";
font-size: 13px;
}
window#waybar {
background-color: transparent;
color: ${text};
transition-property: background-color;
transition-duration: .5s;
}
window#waybar > box {
background-color: ${base};
border-radius: 10px;
opacity: 1.0;
}
button {
box-shadow: inset 0 -3px transparent;
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
box-shadow: inset 0 -3px ${text};
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: ${text};
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: ${surface1};
box-shadow: inset 0 -3px ${lavender};
}
#workspaces button.urgent {
background-color: ${red};
}
#mode {
background-color: ${surface0};
border-bottom: 3px solid ${text};
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 10px;
color: ${text};
background-color: ${surface0};
border-radius: 10px;
margin: 5px 2px;
}
#clock {
background-color: ${mauve};
color: ${base};
}
#battery {
background-color: ${green};
color: ${base};
}
#battery.charging, #battery.plugged {
color: ${base};
background-color: ${green};
}
#battery.critical:not(.charging) {
background-color: ${red};
color: ${text};
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#cpu {
background-color: ${peach};
color: ${base};
}
#memory {
background-color: ${yellow};
color: ${base};
}
#network {
background-color: ${sapphire};
color: ${base};
}
#pulseaudio {
background-color: ${blue};
color: ${base};
}
#pulseaudio.muted {
background-color: ${overlay0};
color: ${text};
}
#tray {
background-color: ${surface0};
}
'';
};
}