Basic sway setup

This commit is contained in:
Nathan McCarty 2025-07-15 01:33:34 -04:00
parent d752880bad
commit bd16449cc8
3 changed files with 156 additions and 14 deletions

View file

@ -36,6 +36,7 @@
(import ../../modules/programs/emacs.nix {})
../../modules/programs/fonts.nix
../../modules/programs/desktop.nix
../../modules/programs/sway.nix
../../modules/programs/media.nix
../../modules/programs/games.nix
];

View file

@ -4,21 +4,162 @@
pkgs,
inputs',
...
}: {
}: let
fuzzel-command = ''fuzzel -f "Iosevka Sans Quasi:size=16" -b "181818cc" -S "b9b9b9ff" -s "252525cc" -t "777777ff" -B 5 -r 5 -C "70b433cc" --width=80 --lines=25'';
in {
home.packages = with pkgs; [
inputs'.nixpkgs-unstable.legacyPackages.xwayland-satellite
# Clipboard
wl-clipboard
cliphist
# Launcher
fuzzel
# Polkit
kdePackages.polkit-kde-agent-1
# Locking
swaylock-effects
swayidle
];
wayland.windowManger.sway = {
wayland.windowManager.sway = {
enable = true;
package = null;
sway = {
xwayland = false;
config = {
modifer = "Mod4";
startup = [
{command = "env DISPLAY=:0 xwayland-satellite";}
];
swaynag.enable = true;
xwayland = false;
config = let
modifier = "Mod4";
in {
inherit modifier;
# Disable bars in the sway config, we'll launch ours through systemd
bars = [];
# Cosmetic settings
gaps = let
big = 5;
small = 3;
in {
inner = big;
outer = small;
smartBorders = "on";
smartGaps = true;
};
# Making trying to go to the current workspace send you back to your previous one
workspaceAutoBackAndForth = true;
# Use foot client as the default terminal
terminal = "footclient";
# Keybinding configuration
keybindings = {
"${modifier}+d" = "exec ${fuzzel-command} --prompt=' '";
"${modifier}+x" = "exec cliphist list | ${fuzzel-command} --prompt=' ' --dmenu | cliphist decode | wl-copy";
};
# Start programs when sway starts
startup = [
# Use xwayland-satellite as our xwayland server to disable scaling for x11 apps
{command = "env DISPLAY=:0 xwayland-satellite";}
# Setup wl-paste for clipboard memory
{command = "wl-paste --watch cliphist store --250";}
];
# Floating window rules
floating.criteria = [
# Basic window role/type detection
#{ window_role = "pop-up"; }
#{ window_role = "bubble"; }
#{ window_role = "dialog"; }
#{ window_type = "dialog"; }
#{ window_role = "task_dialog"; }
#{ window_type = "menu"; }
#{ window_role = "About"; }
#{ window_role = "Preferences"; }
# "Common" app id detection
#{ app_id = "floating"; }
#{ app_id = "floating_update"; }
#{ class = "(?i)pinentry"; }
#{ app_id = "Yad"; }
#{ app_id = "yad"; }
{app_id = ".*polkit.*";}
{title = "^Open File$";}
{title = "^Open Files$";}
# { title = "^Open$"; }
{title = "^Choose Files$";}
{title = "^Save As$";}
# { title = "^$"; }
{title = "Save File";}
{title = "File Operation Progress";}
{title = "(?i)(?:copying|deleting|moving)";}
# Firefox stuff
{title = "About Mozilla Firefox";}
{title = "Firefox - Sharing Indicator";}
{title = "Firefox Sharing Indicator";}
# Specific applications
{app_id = "pavucontrol";}
{app_id = ".*blueman-manager.*";}
];
window.commands = [
{
command = "floating enable, sticky enable";
criteria = {
app_id = "firefox(-\w*)?";
title = "Library";
};
}
{
command = "floating enable, sticky enable";
criteria = {
title = "[Pp]icture-in-[Pp]icture";
};
}
];
};
systemd = {
enable = true;
variables = ["--all"];
};
wrapperFeatures = {
gtk = true;
};
};
# Services to have sway act like a desktop environment
services.blueman-applet.enable = true;
systemd.user.services.polkit-kde = {
Unit = {
Description = "Polkit kde authentication agent";
After = ["graphical-session.target"];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
Restart = "on-failure";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
services.swayidle = let
swaylock-package = pkgs.swaylock-effects;
swaylock-command = ''--screenshots --grace 30 --indicator --clock --timestr "%-I:%M:%S %p" --datestr "%A %Y-%M-%d" --effect-blur 20x3'';
in {
enable = true;
timeouts = [
# Lock the screen after 5 minutes of inactivity
{
timeout = 300;
command = "${swaylock-package}/bin/swaylock ${
builtins.replaceStrings ["%"] ["%%"] swaylock-command
}";
}
# Turn off the displays after 10 minutes of inactivity
{
timeout = 600;
command = ''swaymsg "output * dpms off"'';
resumeCommand = ''swaymsg "output * dpms on"'';
}
];
};
}
# TODOs:
# - [ ] Dropdown terminal
# - [ ] SwayFX and eyecandy configuration
# - [ ] Brightness control
# - [ ] Volume control
# - [ ] Floating, centered, and specific portion of screen for all configuration apps
# - [ ] Bar
# - [ ] Notifications
# - [x] Port over default floating rules

View file

@ -102,11 +102,11 @@
services.desktopManager.plasma6.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Enable swaywm
# programs.sway = {
# enable = true;
# package = inputs'.swayfx.packages.default;
# wrapperFeatures.gtk = true;
# };
programs.sway = {
enable = true;
# package = inputs'.swayfx.packages.default;
wrapperFeatures.gtk = true;
};
# Setup bluetooth
hardware.bluetooth.enable = true;