flake/home/applications/sway/default.nix

119 lines
4.2 KiB
Nix
Raw Normal View History

2023-10-10 07:25:31 +00:00
{
2024-07-21 06:49:16 +00:00
lib,
config,
2024-07-21 06:49:16 +00:00
inputs,
pkgs,
...
}:
{
2024-06-14 23:25:48 +00:00
# remove csd window buttons
# https://github.com/localsend/localsend/blob/2457acd8a7412723b174672d174e4853dccd7d99/app/linux/my_application.cc#L45
home.sessionVariables.GTK_CSD = 0;
dconf.settings."org/gnome/desktop/wm/preferences"."button-layout" = "appmenu:";
2024-06-14 23:25:48 +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?
2023-10-10 07:25:31 +00:00
wrapperFeatures.gtk = true;
2023-12-08 15:44:35 +00:00
systemd.xdgAutostart = true;
2024-08-15 15:33:15 +00:00
xwayland = false;
2023-10-10 07:25:31 +00:00
config = {
### Visuals
2024-07-21 06:49:16 +00:00
output."*".bg = "${inputs.self.legacyPackages.${pkgs.stdenv.hostPlatform.system}.background} fill";
2024-08-29 18:17:30 +00:00
bars = lib.singleton {
statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml";
position = "top";
extraConfig = ''
icon_theme ${config.gtk.iconTheme.name}
'';
};
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
inherit (config.wayland.windowManager.sway.config) modifier;
in
2023-12-30 15:42:09 +00:00
{
### 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-06-23 07:31:24 +00:00
"${modifier}+Return" = "exec ${lib.getExe pkgs.foot}";
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
2024-07-07 17:06:26 +00:00
# Launcher
"${modifier}+d" = "exec ${lib.getExe' pkgs.wmenu "wmenu-run"}";
"${modifier}+Shift+d" = "exec ${lib.getExe pkgs.cliphist} list | ${lib.getExe pkgs.wmenu} -l 10 | ${lib.getExe pkgs.cliphist} decode | ${lib.getExe' pkgs.wl-clipboard "wl-copy"}";
"${modifier}+Shift+Semicolon" = "exec loginctl lock-session";
2023-10-10 07:25:31 +00:00
2023-12-30 15:42:09 +00:00
# Screenshot
2024-07-08 09:50:26 +00:00
"Print" = "exec env XDG_SCREENSHOTS_DIR=$HOME/Pictures/Screenshots ${lib.getExe pkgs.sway-contrib.grimshot} --notify savecopy anything";
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";
2024-05-30 18:13:15 +00:00
"XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play-pause";
2023-12-30 15:42:09 +00:00
"XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
"XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
"XF86AudioStop" = "exec ${lib.getExe pkgs.playerctl} stop";
}
//
# workspace binds
lib.listToAttrs (
lib.concatMap (x: [
{
name = "${modifier}+${x}";
value = "workspace ${x}";
}
{
name = "${modifier}+Shift+${x}";
value = "move container to workspace ${x}";
}
]) (lib.genList (x: toString (x + 1)) 9)
);
2023-10-10 07:25:31 +00:00
};
};
}