flake/users/guanranwang/home-manager/applications/sway/default.nix

170 lines
5.4 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,
...
}: {
imports = [
2023-12-08 15:44:35 +00:00
../cliphist
2023-11-28 05:40:22 +00:00
../dunst
../rofi
../swayidle
../swaylock
../udiskie
../waybar
];
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-12-03 12:01:38 +00:00
dconf.settings = {
"org/gnome/desktop/wm/preferences" = {
"button-layout" = "icon,appmenu:"; # remove csd window buttons
};
};
2023-11-05 12:50:08 +00:00
home.packages = with pkgs; [
pamixer
brightnessctl
playerctl
pavucontrol
wl-clipboard
cliphist
grim
slurp
swappy
#mpvpaper
libnotify
jq
];
2023-10-10 07:25:31 +00:00
wayland.windowManager.sway = {
enable = true;
2023-12-08 15:44:35 +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.enable = true;
systemd.xdgAutostart = true;
2023-10-10 07:25:31 +00:00
config = {
### Default Applications
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${pkgs.rofi}/bin/rofi";
### Visuals
2023-12-08 15:44:35 +00:00
#window.titlebar = false;
bars = [
{
command = "${pkgs.waybar}/bin/waybar";
}
#{
# statusCommand = "${lib.getExe pkgs.i3status-rust} $HOME/.config/i3status-rust/config-default.toml";
# position = "top";
#}
];
2023-10-10 07:25:31 +00:00
gaps = {
inner = 4;
outer = 4;
#smartGaps = true;
};
output = {
eDP-1 = {
2023-12-11 09:12:35 +00:00
bg = "~/.local/share/backgrounds/aqua.png fill";
};
};
2023-10-10 07:25:31 +00:00
### Inputs
input = {
"*" = {
accel_profile = "flat";
natural_scroll = "enabled";
# touchpad
tap = "enabled";
drag = "enabled";
dwt = "disabled";
};
};
### Autostarts
2023-12-08 15:44:35 +00:00
startup = [];
2023-10-10 07:25:31 +00:00
### Keybinds
modifier = "Mod4";
modes = {};
keybindings = let
2023-12-02 10:42:59 +00:00
inherit (config.wayland.windowManager.sway.config) modifier;
2023-12-08 15:44:35 +00:00
inherit (config.wayland.windowManager.sway.config) terminal;
inherit (config.wayland.windowManager.sway.config) menu;
setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl";
setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer";
2023-12-05 07:48:54 +00:00
screenshot = "/home/guanranwang/.local/bin/screenshot";
in {
2023-10-10 07:25:31 +00:00
### Sway itself
# Window
"${modifier}+s" = "split toggle";
"${modifier}+v" = "floating toggle";
"${modifier}+f" = "fullscreen";
"${modifier}+q" = "kill";
"${modifier}+Shift+e" = "exec ${pkgs.sway}/bin/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' '${pkgs.sway}/bin/swaymsg exit'";
2023-10-10 07:25:31 +00:00
# Move around
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
# Workspaces
# Switch to workspace
"${modifier}+1" = "workspace 1";
"${modifier}+2" = "workspace 2";
"${modifier}+3" = "workspace 3";
"${modifier}+4" = "workspace 4";
"${modifier}+5" = "workspace 5";
"${modifier}+6" = "workspace 6";
"${modifier}+7" = "workspace 7";
"${modifier}+8" = "workspace 8";
"${modifier}+9" = "workspace 9";
# Move focused Window to workspace
"${modifier}+Shift+1" = "move container to workspace 1";
"${modifier}+Shift+2" = "move container to workspace 2";
"${modifier}+Shift+3" = "move container to workspace 3";
"${modifier}+Shift+4" = "move container to workspace 4";
"${modifier}+Shift+5" = "move container to workspace 5";
"${modifier}+Shift+6" = "move container to workspace 6";
"${modifier}+Shift+7" = "move container to workspace 7";
"${modifier}+Shift+8" = "move container to workspace 8";
"${modifier}+Shift+9" = "move container to workspace 9";
### Execute other stuff
# Launch applications
2023-12-08 15:44:35 +00:00
"${modifier}+Return" = "exec ${terminal}";
"${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
# Rofi
2023-12-08 15:44:35 +00:00
"${modifier}+d" = "exec ${menu} -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}";
"${modifier}+Shift+d" = "exec ${pkgs.cliphist}/bin/cliphist list | ${menu} -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy";
"${modifier}+Shift+l" = ''exec ${menu} -modi "power-menu:rofi-power-menu --confirm=reboot/shutdown" -show power-menu'';
2023-10-10 07:25:31 +00:00
# Screenshot
"${modifier}+Shift+s" = "exec ${screenshot} region";
"Print" = "exec ${screenshot} fullscreen";
2023-12-05 07:48:54 +00:00
"Print+Control" = "exec ${screenshot} swappy";
2023-10-10 07:25:31 +00:00
# Fn keys
"XF86MonBrightnessUp" = "exec ${setBrightness} up";
2023-10-10 07:25:31 +00:00
"XF86MonBrightnessDown" = "exec ${setBrightness} down";
"XF86AudioRaiseVolume" = "exec ${setVolume} up";
"XF86AudioLowerVolume" = "exec ${setVolume} down";
"XF86AudioMute" = "exec ${setVolume} mute";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
"XF86AudioMedia" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
2023-10-10 07:25:31 +00:00
};
};
};
}