spectre_nixcfg/sway/sway.nix
2025-11-21 03:25:16 -05:00

119 lines
2.7 KiB
Nix

{ lib, pkgs, config, ... }:
let
mod = "Mod4";
chvol = pkgs.writeShellScript "chvol"
(builtins.readFile ./chvol.sh);
chbright = pkgs.writeShellScript "chbrights"
(builtins.readFile ./chbright.sh);
multiTouchGesturesConfig = ''
bindgesture swipe:4:up focus parent
bindgesture swipe:4:left workspace prev
bindgesture swipe:4:right workspace next
bindgesture swipe:3:up focus up
bindgesture swipe:3:down focus down
bindgesture swipe:3:left focus left
bindgesture swipe:3:right focus right
'';
in {
home.packages = with pkgs;
[ grim slurp wl-clipboard brightnessctl ];
home.sessionVariables = {
NIXOS_OZONE_WL = "1";
};
wayland.windowManager.sway = {
enable = true;
config = {
modifier = mod;
terminal = "alacritty";
# Waybar
bars = [{
command = "${pkgs.lib.getExe config.programs.waybar.package}";
position = "top";
fonts = config.wayland.windowManager.sway.config.fonts;
}];
menu = "${pkgs.lib.getExe config.programs.rofi.package} -modes \"drun,run\" -show-icons -show drun";
keybindings = let
screenshotPath ="pictures/Screenshots/screenshot`date +%Y%m%d%H%M%S`.png";
in lib.mkOptionDefault ({
# volume
XF86AudioRaiseVolume = "exec bash ${chvol} sink 5";
XF86AudioLowerVolume = "exec bash ${chvol} sink -5";
XF86AudioMute = "exec bash ${chvol} sink mute";
XF86AudioMicMute = "exec bash ${chvol} source mute";
# brightness
XF86MonBrightnessUp = "exec bash ${chbright} 1";
XF86MonBrightnessDown = "exec bash ${chbright} -1";
# media
XF86AudioPlay = "exec playerctl play-pause";
XF86AudioPrev = "exec playerctl previous";
XF86AudioNext = "exec playerctl next";
# Lock
"${mod}+Shift+l" = "exec swaylock -f";
# Screenshots
"${mod}+Shift+s" = "exec grim -g \"`slurp`\" - | wl-copy && wl-paste > ${screenshotPath}";
});
};
# GODOT IS A PAIN
extraConfig = "
for_window [class=\"^.*Godot.*$\"] floating enable
for_window [class=\"^.*Unity.*$\"] floating enable
" +
multiTouchGesturesConfig
+
''output 'eDP-1' scale 1''
;
};
# Waybar
programs.waybar = {
enable = true;
};
# App menu
programs.rofi = {
enable = true;
};
# Lock screen
programs.swaylock = {
enable = true;
settings = {
font-size = 14;
};
};
# Autolock
services.swayidle = {
enable = true;
events = [{
event = "before-sleep";
command = "${pkgs.lib.getExe pkgs.swaylock} -f";
}];
};
qt = {
enable = true;
# style = {};
};
gtk = {
enable = true;
# theme = {};
};
}