nixfiles/home/gui/environments/sway/sway.nix

164 lines
4.4 KiB
Nix

{
config,
pkgs,
lib,
tree,
...
}: let
inherit (lib.modules) mkMerge;
inherit (lib.strings) escapeShellArgs;
in {
# import default terminal
imports = with tree; [home.apps.kitty home.apps.rofi];
home.sessionVariables = {
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland";
#WLR_DRM_DEVICES = "/dev/dri/card0";
SDL_VIDEODRIVER = "wayland";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = 1;
# For Ghidra to make windows work properly
_JAVA_AWT_WM_NONREPARENTING = 1;
XCURSOR_SIZE = 64;
QT_AUTO_SCREEN_SCALE_FACTOR = 1;
SAL_USE_VCLPLUGIN = "gtk3"; # GTK3 on LibreOffice
};
home.pointerCursor = {
package = pkgs.gnome.adwaita-icon-theme;
name = "Adwaita";
size = 24;
gtk.enable = true;
x11 = {
enable = true;
defaultCursor = "Adwaita";
};
};
home.packages = with pkgs; [
grim
slurp
wl-clipboard
jq
wofi
wmctrl
libnotify
light
gobar
libdbusmenu-gtk3
];
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.base = true;
wrapperFeatures.gtk = true;
config = let
modifier = "Mod1";
terminal = "${pkgs.kitty}/bin/kitty";
menu = "${pkgs.rofi}/bin/rofi -show run";
pactl = "${pkgs.pulseaudio}/bin/pactsl";
in {
bars = [
{
position = "top";
fonts = {
names = ["Comic Code"];
size = 14.0;
};
statusCommand = escapeShellArgs [
#"/home/chaos/Projects/rustbar/target/debug/rustbar"
"${pkgs.gobar}/bin/gobar"
"-config"
"cpu\\|mem\\|weather\\(Leighton\\ Buzzard\\)\\|bat\\(BAT0\\)\\|time"
];
}
{command = "${pkgs.waybar}/bin/waybar";}
];
output = {"*" = {bg = "${pkgs.nixos-artwork.wallpapers.simple-dark-gray.gnomeFilePath} fill";};};
input = {"*" = {xkb_layout = "gb";};};
fonts = {
names = ["Comic Code"];
size = 18.0;
};
inherit modifier;
inherit terminal;
startup = [
# gets blueman applet working for some reason
{
command = "dbus-update-activation-environment DISPLAY";
always = true;
}
{
command = "nm-applet";
always = true;
}
];
seat = {"*" = {"xcursor_theme" = "Adwaita 24";};};
gaps = {
top = 10;
bottom = 10;
left = 10;
right = 10;
inner = 20;
outer = 20;
smartGaps = true;
};
window = {
border = 0;
titlebar = false;
};
keybindings = mkMerge [
{
"${modifier}+Return" = "exec ${terminal}";
"${modifier}+Left" = "focus left";
"${modifier}+Down" = "focus down";
"${modifier}+Up" = "focus up";
"${modifier}+Right" = "focus right";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+space" = "floating toggle";
"${modifier}+space" = "focus mode_toggle";
"XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec sudo xbacklight -time 1 -dec +5";
"XF86MonBrightnessUp" = "exec sudo xbacklight -time 1 -inc +5";
"Print" = ''
exec ${pkgs.grim}/bin/grim -t png -g "$(${pkgs.slurp}/bin/slurp -d)" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png'';
"Shift+Print" = "exec ${pkgs.grim}/bin/grim -t png - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png";
"${modifier}+d" = "exec ${menu}";
"${modifier}+f" = "fullscreen";
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
"${modifier}+r" = "mode resize";
}
(mkMerge (map (workspace: {
"${modifier}+${workspace}" = "workspace ${workspace}";
"${modifier}+Shift+${workspace}" = "move container to workspace ${workspace}";
}) ["1" "2" "3" "4" "5" "6" "7" "8" "9"]))
];
};
};
}