flake/home/applications/sway/default.nix

148 lines
4.7 KiB
Nix
Raw Normal View History

2023-10-10 07:25:31 +00:00
{
config,
pkgs,
2023-11-04 12:52:55 +00:00
lib,
2024-03-02 12:50:51 +00:00
inputs,
...
}: {
imports = [
2023-12-18 19:06:50 +00:00
../common/wayland.nix
../common/wm.nix
2024-01-16 05:32:25 +00:00
../i3status-rust
2024-02-02 12:24:55 +00:00
../mako
2023-11-28 05:40:22 +00:00
../rofi
../swayidle
../swaylock
];
2024-03-26 08:49:35 +00:00
services.cliphist.enable = true;
services.udiskie.enable = true;
2023-11-04 12:52:55 +00:00
home.sessionVariables = {
2023-11-14 03:22:17 +00:00
GTK_IM_MODULE = lib.mkForce "wayland"; # use text-input-v3
2023-11-04 12:52:55 +00:00
};
2023-10-10 07:25:31 +00:00
wayland.windowManager.sway = {
enable = true;
2024-04-23 08:08:11 +00:00
checkConfig = false; # wtf?
2024-01-26 23:40:39 +00:00
extraOptions = [
"--unsupported-gpu"
#"-Dnoscanout"
];
2023-10-10 07:25:31 +00:00
wrapperFeatures.gtk = true;
2023-12-08 15:44:35 +00:00
systemd.xdgAutostart = true;
2023-10-10 07:25:31 +00:00
config = {
2024-01-16 08:56:10 +00:00
### Startup
startup = [
{command = "systemctl --user import-environment PATH";}
];
2023-10-10 07:25:31 +00:00
### Visuals
output."*".bg = "${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.src} fill";
2024-02-02 01:20:51 +00:00
#window.titlebar = false;
2024-02-02 11:35:59 +00:00
#gaps.inner = 4;
#gaps.outer = 4;
2023-12-08 15:44:35 +00:00
bars = [
#{
2024-01-16 05:32:25 +00:00
# command = lib.getExe pkgs.waybar;
2023-12-08 15:44:35 +00:00
#}
2024-01-16 05:32:25 +00:00
{
statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml";
position = "top";
extraConfig = ''
icon_theme ${config.gtk.iconTheme.name}
'';
}
2023-12-08 15:44:35 +00:00
];
2023-10-10 07:25:31 +00:00
### Inputs
2024-03-06 08:48:01 +00:00
input = {
"*" = {
accel_profile = "flat";
natural_scroll = "enabled";
};
2023-10-10 07:25:31 +00:00
2024-03-06 08:48:01 +00:00
"type:touchpad" = {
tap = "enabled";
drag = "enabled";
dwt = "disabled";
};
"type:keyboard" = {
2024-04-01 20:09:59 +00:00
xkb_layout = "us";
2024-03-06 08:48:01 +00:00
xkb_options = "caps:escape";
2024-04-01 20:09:59 +00:00
xkb_variant = "dvorak";
2024-03-06 08:48:01 +00:00
};
2023-10-10 07:25:31 +00:00
};
### Keybinds
modifier = "Mod4";
keybindings = let
2023-12-02 10:42:59 +00:00
inherit (config.wayland.windowManager.sway.config) modifier;
2024-03-06 08:46:24 +00:00
screenshot = lib.getExe inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.scripts.screenshot;
2023-12-30 15:42:09 +00:00
in
{
### Sway itself
# Window
"${modifier}+s" = "split toggle";
"${modifier}+v" = "floating toggle";
2023-12-30 16:18:02 +00:00
"${modifier}+f" = "fullscreen toggle";
2024-01-27 22:31:43 +00:00
"${modifier}+r" = "mode resize";
2023-12-30 15:42:09 +00:00
"${modifier}+q" = "kill";
2023-12-30 16:18:02 +00:00
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
2023-10-10 07:25:31 +00:00
2023-12-30 15:42:09 +00:00
# Move around
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
2024-01-27 22:31:43 +00:00
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
2023-10-10 07:25:31 +00:00
2023-12-30 15:42:09 +00:00
### Execute other stuff
# Launch applications
2024-01-02 22:22:55 +00:00
"${modifier}+Return" = "exec alacritty";
2023-12-30 15:42:09 +00:00
"${modifier}+w" = "exec ${pkgs.xdg-utils}/bin/xdg-open http:";
"${modifier}+e" = "exec ${pkgs.xdg-utils}/bin/xdg-open ~";
2023-10-10 07:25:31 +00:00
2023-12-30 15:42:09 +00:00
# Rofi
2024-01-02 22:22:55 +00:00
"${modifier}+d" = "exec rofi -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}";
"${modifier}+Shift+d" = "exec ${lib.getExe pkgs.cliphist} list | rofi -dmenu | ${lib.getExe pkgs.cliphist} decode | ${pkgs.wl-clipboard}/bin/wl-copy";
2024-01-27 22:31:43 +00:00
"${modifier}+Shift+Semicolon" = ''exec rofi -modi "power-menu:rofi-power-menu --confirm=reboot/shutdown" -show power-menu'';
2023-10-10 07:25:31 +00:00
2023-12-30 15:42:09 +00:00
# Screenshot
2024-03-02 12:50:51 +00:00
"${modifier}+Shift+s" = "exec ${screenshot} region";
"Print" = "exec ${screenshot} fullscreen";
"Print+Control" = "exec ${screenshot} swappy";
2023-10-10 07:25:31 +00:00
2023-12-30 15:42:09 +00:00
# Fn keys
2024-02-02 12:49:19 +00:00
"XF86MonBrightnessUp" = "exec ${lib.getExe pkgs.brightnessctl} set 5%+";
"XF86MonBrightnessDown" = "exec ${lib.getExe pkgs.brightnessctl} set 5%-";
"XF86AudioRaiseVolume" = "exec ${lib.getExe pkgs.pamixer} -i5";
"XF86AudioLowerVolume" = "exec ${lib.getExe pkgs.pamixer} -d5";
"XF86AudioMute" = "exec ${lib.getExe pkgs.pamixer} -t";
2023-12-30 15:42:09 +00:00
"XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play";
"XF86AudioPause" = "exec ${lib.getExe pkgs.playerctl} pause";
"XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
"XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
"XF86AudioStop" = "exec ${lib.getExe pkgs.playerctl} stop";
"XF86AudioMedia" = "exec ${lib.getExe pkgs.playerctl} play-pause";
}
//
# workspace binds
builtins.listToAttrs (builtins.concatMap (x: [
{
name = "${modifier}+${x}";
value = "workspace ${x}";
}
{
name = "${modifier}+Shift+${x}";
value = "move container to workspace ${x}";
}
]) (builtins.genList (x: toString (x + 1)) 9));
2023-10-10 07:25:31 +00:00
};
};
}