nix-dotfiles/wayland/sway.nix
vorboyvo 770b7d23e9 Changed a bunch of packages installed through home manager
Added brightness and volume scripts to bind to media keys. Still imperfect
Refactored to put neovim in its own file, will do the same for others
2024-01-15 14:11:14 -05:00

54 lines
2.4 KiB
Nix

{ config, lib, pkgs, ... }:
let
dynscreenshot = pkgs.writeShellScript "dynscreenshot" (builtins.readFile ./dynscreenshot.sh);
changebrightness = pkgs.writeShellScript "changebrightness" (builtins.readFile ./changebrightness.sh);
mod = config.wayland.windowManager.sway.config.modifier;
in {
enable = true;
config = rec {
terminal = "kitty";
modifier = "Mod4";
fonts = {
names = [ "Red Hat Display" ];
style = "Regular";
size = 12.0;
};
input = { "type:touchpad" = { natural_scroll = "disabled"; }; };
bars = let config = config; in [{
position = "top";
inherit fonts;
statusCommand = "${pkgs.i3status}/bin/i3status";
}];
window = {
border = 2;
titlebar = true;
};
keybindings = let screenshotPath = "Pictures/Screenshots/screenshot`date +%Y%m%d%H%M%S`.png"; in lib.mkOptionDefault ({ # Screenshot keybinds
"Print" = "exec grim ${screenshotPath} && wl-copy < ${screenshotPath}"; # Take screenshot of whole screen, save it, and copy it to clipboard
"Shift+Print" = "exec swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | \"\\(.x),\\(.y) \\(.width)x\\(.height)\"' | grim -g - ${screenshotPath} && wl-copy < ${screenshotPath}"; # Take screenshot of current window, save it, and copy it to clipboard
"Ctrl+Print" = "exec bash ${dynscreenshot}"; # Take screenshot of selection, save it, and copy it to clipboard
} // { # Function Media Keys
XF86MonBrightnessUp = "exec bash ${changebrightness} 1";
XF86MonBrightnessDown = "exec bash ${changebrightness} -1";
XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+";
XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-";
"${mod}+XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05+";
"${mod}+XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05-";
});
menu = "j4-dmenu-desktop --no-generic --term=kitty --dmenu='bemenu -i --fn Red Hat Display 12 -H 24 -p \"\" -B 2 --hp 5'"; # I don't like hardcoding kitty here, TODO think of better way to do it
focus.followMouse = false;
};
extraConfig =
''
output 'eDP-1' scale 1.50
'' + # Fractional scaling to 1.50
''
input type:touchpad {
dwt disabled
click_method clickfinger
}
''; # Disable fake scroll direction and disabling touchpad while typing, enable multi finger clicking
}