nix-config/home/desktop-sway/sway.nix

147 lines
5.3 KiB
Nix
Raw Normal View History

2022-01-18 09:32:55 +01:00
{ config, pkgs, ... }:
let
cfg = config.wayland.windowManager.sway.config;
wofi_pass = pkgs.callPackage ./wofi-pass.nix { inherit config pkgs; };
pactl = "${pkgs.pulseaudio}/bin/pactl";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
in
{
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true;
config = {
modifier = "Mod4";
terminal = "alacritty";
menu = "${pkgs.wofi}/bin/wofi --show run";
left = "h";
down = "j";
up = "k";
right = "l";
output = {
"LVDS-1" = {
resolution = "1366x768";
bg = "~/Images/wallpapers/times_of_grace.jpg fill";
};
};
input = {
"type:keyboard" = {
xkb_layout = "us";
xkb_variant = "altgr-intl";
xkb_options = "caps:escape";
};
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+Shift+c" = "kill";
"${cfg.modifier}+r" = "exec ${cfg.menu}";
"${cfg.modifier}+Shift+r" = "reload";
"${cfg.modifier}+Shift+Escape" = "exec ${pkgs.sway}/bin/swaymsg exit";
"${cfg.modifier}+Escape" = "exec ${pkgs.swaylock}/bin/swaylock";
"${cfg.modifier}+${cfg.left}" = "focus left";
"${cfg.modifier}+${cfg.down}" = "focus down";
"${cfg.modifier}+${cfg.up}" = "focus up";
"${cfg.modifier}+${cfg.right}" = "focus right";
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
"${cfg.modifier}+Control+${cfg.left}" = "move workspace to output left";
"${cfg.modifier}+Control+${cfg.down}" = "move workspace to output down";
"${cfg.modifier}+Control+${cfg.up}" = "move workspace to output up";
"${cfg.modifier}+Control+${cfg.right}" = "move workspace to output right";
"${cfg.modifier}+Shift+w" = "move window to output left";
"${cfg.modifier}+Shift+e" = "move window to output right";
"${cfg.modifier}+w" = "focus output left";
"${cfg.modifier}+e" = "focus output right";
"${cfg.modifier}+1" = "workspace number 1";
"${cfg.modifier}+2" = "workspace number 2";
"${cfg.modifier}+3" = "workspace number 3";
"${cfg.modifier}+4" = "workspace number 4";
"${cfg.modifier}+5" = "workspace number 5";
"${cfg.modifier}+6" = "workspace number 6";
"${cfg.modifier}+7" = "workspace number 7";
"${cfg.modifier}+8" = "workspace number 8";
"${cfg.modifier}+9" = "workspace number 9";
"${cfg.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
"${cfg.modifier}+s" = "layout stacking";
"${cfg.modifier}+t" = "layout tabbed";
# "${cfg.modifier}+e" = "layout toggle split";
"${cfg.modifier}+m" = "fullscreen toggle";
"${cfg.modifier}+a" = "focus parent";
"${cfg.modifier}+f" = "floating toggle";
# "${cfg.modifier}+space" = "focus mode_toggle";
"${cfg.modifier}+d" = "mode resize";
"${cfg.modifier}+space" = "layout toggle all";
"${cfg.modifier}+Shift+space" = "layout default";
"${cfg.modifier}+p" = "exec ${wofi_pass}/bin/wofi-pass";
"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 ${brightnessctl} set 5%-";
"XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%";
"XF86AudioPlay" = "exec ${playerctl} play-pause";
"XF86AudioNext" = "exec ${playerctl} next";
"XF86AudioPrev" = "exec ${playerctl} previous";
"XF86Search" = "exec ${cfg.menu}";
};
colors = {
focused = rec {
childBorder = "#458588";
background = "#282828";
text = "#fbf1c7";
indicator = "#3c3836";
border = "#83a598";
};
unfocused = rec {
childBorder = "#504945";
background = "#282828";
text = "#ebdbb2";
indicator = "#3c3836";
border = "#bdae93";
};
};
focus.followMouse = true;
window.border = 3;
workspaceAutoBackAndForth = true;
bars = [];
};
};
}