refactor sway config

This commit is contained in:
Adithya 2023-04-08 14:57:55 +05:30
parent 4d0b092f9b
commit 76b768777a
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
3 changed files with 221 additions and 210 deletions

View file

@ -33,6 +33,7 @@
pavucontrol
ripgrep
spotify-tui
wl-clipboard
xdg-utils
yubioath-flutter
yubikey-manager

View file

@ -8,7 +8,7 @@ let
rofi = "${config.programs.rofi.package}/bin/rofi";
slurp = "${pkgs.slurp}/bin/slurp";
swaylock = "${pkgs.swaylock}/bin/swaylock";
tmux = "${pkgs.tmux}/bin/tmux";
tmux = "${config.programs.tmux.package}/bin/tmux";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
xdg-user-dir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir";
change-wallpaper = "${pkgs.scripts}/bin/chpaper ${pkgs.catppuccin-wallpapers}/share/wallpapers";

View file

@ -1,19 +1,17 @@
{ config, lib, pkgs, ... }: {
home.packages = with pkgs; [
wl-clipboard
];
wayland.windowManager.sway.enable = true;
wayland.windowManager.sway.package = pkgs.sway;
wayland.windowManager.sway.config.modifier = "Mod4";
wayland.windowManager.sway.config.bars = [ ];
wayland.windowManager.sway.xwayland = true;
wayland.windowManager.sway.config.fonts = {
wayland.windowManager.sway = {
enable = true;
systemdIntegration = true;
wrapperFeatures.gtk = true;
xwayland = true;
config = {
modifier = "Mod4";
fonts = {
names = [ "FiraCode Nerd Font" ];
size = 11.0;
};
wayland.windowManager.sway.config.input = {
input = {
"type:touchpad" = {
dwt = "enabled";
tap = "enabled";
@ -21,11 +19,14 @@
middle_emulation = "enabled";
};
};
wayland.windowManager.sway.systemdIntegration = true;
wayland.windowManager.sway.wrapperFeatures = {
gtk = true;
bars = [ ];
gaps = {
outer = 2;
inner = 2;
};
wayland.windowManager.sway.config.colors = {
window.titlebar = false;
floating.titlebar = false;
colors = {
background = "#F8F8F2";
focused = {
background = "#6272A4";
@ -64,45 +65,57 @@
};
};
wayland.windowManager.sway.config.seat = {
seat = {
"*" = {
xcursor_theme = "Bibata-Modern-Classic 24";
};
};
wayland.windowManager.sway.config.keybindings =
keybindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
grim = "${pkgs.grim}/bin/grim";
kitty = "${config.programs.kitty.package}/bin/kitty";
playerctl = "${pkgs.playerctl}/bin/playerctl";
rofi = "${config.programs.rofi.package}/bin/rofi";
tmux = "${config.programs.tmux.package}/bin/tmux";
slurp = "${pkgs.slurp}/bin/slurp";
swaylock = "${pkgs.swaylock}/bin/swaylock";
wpctl = "${pkgs.wireplumber}/bin/wpctl";
xdg-user-dir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir";
change-wallpaper = "${pkgs.scripts}/bin/chpaper ${pkgs.catppuccin-wallpapers}/share/wallpapers";
in
lib.mkOptionDefault {
"${modifier}+Return" = "exec $config.programs.kitty.package}/bin/kitty ${pkgs.tmux}/bin/tmux new";
"${modifier}+Shift+Return" = "exec ${config.programs.kitty.package}/bin/kitty";
"${modifier}+d" = "exec ${config.programs.rofi.package}/bin/rofi -show drun";
"${modifier}+Return" = "exec ${kitty} ${tmux} new";
"${modifier}+Shift+Return" = "exec ${kitty}";
"${modifier}+d" = "exec ${rofi} -show drun";
"${modifier}+Shift+c" = "reload";
"${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -f -i /tmp/lockpaper.jpg";
"${modifier}+Shift+w" = "exec ~/.config/scripts/chpaper.sh";
"${modifier}+Shift+escape" = "exec ~/.config/scripts/power_menu.sh";
"${modifier}+f11" = "exec ~/.config/scripts/tmux_sessions.sh";
"${modifier}+l" = "exec ${swaylock} -f -i /tmp/lockpaper.jpg";
"${modifier}+Shift+w" = "exec ${change-wallpaper}";
"${modifier}+Shift+escape" = "exec ${pkgs.scripts}/bin/power-menu";
"${modifier}+f11" = "exec ${pkgs.scripts}/bin/tmux-sessions";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
"XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%";
"XF86MonBrightnessDown" = "exec ${brightnessctl} set 5%-";
"XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioRaiseVolume" = "exec ~/.config/scripts/volume_up.sh";
"XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioRaiseVolume" = "exec ${wpctl} set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioLowerVolume" = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioPlay" = "exec ${playerctl} play-pause";
"XF86AudioNext" = "exec ${playerctl} next";
"XF86AudioPrev" = "exec ${playerctl} previous";
"print" = ''exec ${pkgs.grim}/bin/grim "''$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)/Screenshots/screenshot-''$(date +%Y-%m-%d-%H-%M-%S).png"'';
"Shift+print" = ''exec ${pkgs.grim}/bin/grim -g "''$(${pkgs.slurp}/bin/slurp)" "''$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)/Screenshots/screenshot-''$(date +%Y-%m-%d-%H-%M-%S).png"'';
"print" = ''exec ${grim} "''$(${xdg-user-dir} PICTURES)/Screenshots/screenshot-''$(date +%Y-%m-%d-%H-%M-%S).png"'';
"Shift+print" = ''exec ${grim} -g "''$(${slurp})" "''$(${xdg-user-dir} PICTURES)/Screenshots/screenshot-''$(date +%Y-%m-%d-%H-%M-%S).png"'';
};
wayland.windowManager.sway.config.startup = [
startup = [
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; }
{
command = "~/.config/scripts/chpaper.sh";
command = "${pkgs.scripts}/bin/chpaper ${pkgs.catppuccin-wallpapers}/share/wallpapers";
always = true;
}
{
@ -115,7 +128,7 @@
}
];
wayland.windowManager.sway.config.window.commands = [
window.commands = [
{
command = "floating enable, focus";
criteria = {
@ -207,9 +220,6 @@
};
}
];
wayland.windowManager.sway.config.gaps.outer = 2;
wayland.windowManager.sway.config.gaps.inner = 2;
wayland.windowManager.sway.config.window.titlebar = false;
wayland.windowManager.sway.config.floating.titlebar = false;
};
};
}