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

173 lines
6.0 KiB
Nix
Raw Normal View History

2022-01-18 09:32:55 +01:00
{ config, pkgs, ... }:
let
cfg = config.wayland.windowManager.sway.config;
pactl = "${pkgs.pulseaudio}/bin/pactl";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
2022-01-21 16:18:38 +01:00
wallpapers = "${config.home.homeDirectory}/Images/wallpapers/enabled";
2022-05-07 15:45:08 +02:00
# # todo: do it properly like in https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/security/pass/rofi-pass.nix
# tessenSrc = builtins.fetchTarball {
# url =
# "https://github.com/ayushnix/tessen/releases/download/v1.3.1/tessen-1.3.1.tar.gz";
# };
# tessen = pkgs.runCommandLocal "tessen" {
# nativeBuildInputs = [ pkgs.makeWrapper ];
# } ''
# install -m755 ${tessenSrc}/tessen -D $out/bin/tessen
# patchShebangs $out/bin/tessen
# wrapProgram $out/bin/tessen \
# --prefix PATH: ${pkgs.lib.makeBinPath [ pkgs.bash ]}
# '';
2022-01-21 16:18:38 +01:00
in {
2022-05-07 15:45:08 +02:00
# home.packages = [ tessen ];
2022-01-18 09:32:55 +01:00
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true;
config = {
modifier = "Mod4";
terminal = "alacritty";
2022-01-21 16:18:38 +01:00
menu = "${pkgs.bemenu}/bin/bemenu-run";
2022-01-18 09:32:55 +01:00
left = "h";
down = "j";
up = "k";
right = "l";
output = {
"LVDS-1" = {
resolution = "1366x768";
2022-01-21 16:18:38 +01:00
bg =
"`${pkgs.findutils}/bin/find ${wallpapers} -type f | ${pkgs.coreutils}/bin/shuf -n 1` fill";
2022-01-18 09:32:55 +01:00
};
};
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";
2022-01-21 16:18:38 +01:00
"${cfg.modifier}+${cfg.left}" = "focus left";
"${cfg.modifier}+${cfg.down}" = "focus down";
"${cfg.modifier}+${cfg.up}" = "focus up";
2022-01-18 09:32:55 +01:00
"${cfg.modifier}+${cfg.right}" = "focus right";
2022-01-21 16:18:38 +01:00
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
2022-01-18 09:32:55 +01:00
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
2022-01-21 16:18:38 +01:00
"${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";
2022-01-18 09:32:55 +01:00
"${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";
2022-05-07 15:45:08 +02:00
# "${cfg.modifier}+p" = "exec ${tessen}/bin/tessen";
2022-01-18 09:32:55 +01:00
2022-01-21 16:18:38 +01:00
"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";
2022-01-18 09:32:55 +01:00
"XF86MonBrightnessDown" = "exec ${brightnessctl} set 5%-";
2022-01-21 16:18:38 +01:00
"XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%";
2022-01-18 09:32:55 +01:00
"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;
2022-01-21 16:18:38 +01:00
bars = [ ];
2022-01-18 09:32:55 +01:00
2022-05-07 15:45:08 +02:00
startup = [{
command = "${pkgs.autotiling}/bin/autotiling";
always = true;
}];
2022-01-18 09:32:55 +01:00
};
};
}