add sway and kanshi config

This commit is contained in:
Leonardo Eugênio 2022-06-13 09:45:20 -03:00
parent ffead99722
commit 1f1d7f0878
2 changed files with 161 additions and 77 deletions

View file

@ -54,7 +54,7 @@ in
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi"; boot.loader.efi.efiSysMountPoint = "/boot/efi";
networking.hostName = "nixos"; # Define your hostname. networking.hostName = "i15"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
@ -75,7 +75,7 @@ in
# Enable the GNOME Desktop Environment. # Enable the GNOME Desktop Environment.
# services.xserver.displayManager.gdm.enable = true; # services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true; # services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11 # Configure keymap in X11
services.xserver = { services.xserver = {
@ -85,7 +85,14 @@ in
# Enable CUPS to print documents. # Enable CUPS to print documents.
# services.printing.enable = true; # services.printing.enable = true;
services.dbus.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
gtkUsePortal = true;
};
services.flatpak.enable = true; services.flatpak.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
@ -131,6 +138,8 @@ in
kakoune kakoune
kak-lsp kak-lsp
pavucontrol
# recomended by nixwiki # recomended by nixwiki
alacritty # gpu accelerated terminal alacritty # gpu accelerated terminal
sway sway
@ -149,6 +158,12 @@ in
mako # notification system developed by swaywm maintainer mako # notification system developed by swaywm maintainer
]; ];
# enable sway window manager
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
# programs.mtr.enable = true; # programs.mtr.enable = true;

View file

@ -28,6 +28,7 @@ in {
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.packages = with pkgs; [ home.packages = with pkgs; [
kanshi
alacritty alacritty
exa exa
fd fd
@ -68,17 +69,19 @@ in {
# ".config/sway/config".source = ./sway; # ".config/sway/config".source = ./sway;
# }; # };
programs.waybar = { programs.waybar = {
enable = true; enable = true;
settings = [{ settings = [{
layer = "top"; layer = "top";
modules-left = [ "sway/workspaces" ]; modules-left = [
modules-center = [ "sway/workspaces"
"clock" ];
]; modules-center = [
modules-right = []; "clock"
}]; ];
}; modules-right = [];
}];
};
wayland.windowManager.sway = { wayland.windowManager.sway = {
@ -101,30 +104,43 @@ programs.waybar = {
keybindings = keybindings =
let let
mod = "Mod4"; mod = "Mod4";
floating.modifier = "Mod4";
menu = "bemenu-run"; menu = "bemenu-run";
terminal = "alacritty"; terminal = "alacritty";
in workspace_binds = {
{ "${mod}+1" = "workspace number 1";
"${mod}+Prior" = "workspace prev_on_output"; "${mod}+2" = "workspace number 2";
"${mod}+Next" = "workspace next_on_output"; "${mod}+3" = "workspace number 3";
"${mod}+${key.tabL}" = "workspace prev_on_output"; "${mod}+4" = "workspace number 4";
"${mod}+${key.tabR}" = "workspace next_on_output"; "${mod}+5" = "workspace number 5";
"${mod}+6" = "workspace number 6";
XF86AudioRaiseVolume = "exec pactl set-sink-volume @DEFAULT_SINK@ +10%"; "${mod}+7" = "workspace number 7";
XF86AudioLowerVolume = "exec pactl set-sink-volume @DEFAULT_SINK@ -10%"; "${mod}+8" = "workspace number 8";
XF86AudioMute = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; "${mod}+9" = "workspace number 9";
XF86AudioMicMute = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle"; "${mod}+0" = "workspace number 10";
# Control media
XF86AudioPlay = "exec playerctl play-pause";
XF86AudioPause = "exec playerctl play-pause";
XF86AudioNext = "exec playerctl next";
XF86AudioPrev = "exec playerctl previous";
"${mod}+Return" = "exec ${terminal}";
"${mod}+Shift+q" = "kill";
"${mod}+s" = "exec ${menu}";
"${mod}+Shift+1" =
"move container to workspace number 1";
"${mod}+Shift+2" =
"move container to workspace number 2";
"${mod}+Shift+3" =
"move container to workspace number 3";
"${mod}+Shift+4" =
"move container to workspace number 4";
"${mod}+Shift+5" =
"move container to workspace number 5";
"${mod}+Shift+6" =
"move container to workspace number 6";
"${mod}+Shift+7" =
"move container to workspace number 7";
"${mod}+Shift+8" =
"move container to workspace number 8";
"${mod}+Shift+9" =
"move container to workspace number 9";
"${mod}+Shift+0" =
"move container to workspace number 10";
};
movement_binds = {
"${mod}+${key.left}" = "focus left"; "${mod}+${key.left}" = "focus left";
"${mod}+${key.down}" = "focus down"; "${mod}+${key.down}" = "focus down";
"${mod}+${key.up}" = "focus up"; "${mod}+${key.up}" = "focus up";
@ -145,61 +161,114 @@ programs.waybar = {
"${mod}+Shift+Up" = "move up"; "${mod}+Shift+Up" = "move up";
"${mod}+Shift+Right" = "move right"; "${mod}+Shift+Right" = "move right";
"${mod}+b" = "splith"; "${mod}+Control+${key.left}" = "resize shrink width";
"${mod}+v" = "splitv"; "${mod}+Control+${key.down}" = "resize grow height";
"${mod}+f" = "fullscreen toggle"; "${mod}+Control+${key.up}" = "resize shrink height";
"${mod}+a" = "focus parent"; "${mod}+Control+${key.right}" = "resize grow width";
# "${mod}+s" = "layout stacking"; "${mod}+Control+Left" = "resize shrink width";
"${mod}+w" = "layout tabbed"; "${mod}+Control+Down" = "resize grow height";
# "${mod}+e" = "layout toggle split"; "${mod}+Control+Up" = "resize shrink height";
"${mod}+Control+Right" = "resize grow width";
"${mod}+Shift+space" = "floating toggle"; "${mod}+mod1+${key.left}" = "focus output left";
"${mod}+space" = "focus mode_toggle"; "${mod}+mod1+${key.down}" = "focus output down";
"${mod}+mod1+${key.up}" = "focus output up";
"${mod}+mod1+${key.right}" = "focus output right";
"${mod}+1" = "workspace number 1"; "${mod}+mod1+Left" = "focus output left";
"${mod}+2" = "workspace number 2"; "${mod}+mod1+Down" = "focus output down";
"${mod}+3" = "workspace number 3"; "${mod}+mod1+Up" = "focus output up";
"${mod}+4" = "workspace number 4"; "${mod}+mod1+Right" = "focus output right";
"${mod}+5" = "workspace number 5";
"${mod}+6" = "workspace number 6";
"${mod}+7" = "workspace number 7";
"${mod}+8" = "workspace number 8";
"${mod}+9" = "workspace number 9";
"${mod}+Shift+1" = "${mod}+mod1+Shift+${key.left}" = "move workspace output left";
"move container to workspace number 1"; "${mod}+mod1+Shift+${key.down}" = "move workspace output down";
"${mod}+Shift+2" = "${mod}+mod1+Shift+${key.up}" = "move workspace output up";
"move container to workspace number 2"; "${mod}+mod1+Shift+${key.right}" = "move workspace output right";
"${mod}+Shift+3" =
"move container to workspace number 3";
"${mod}+Shift+4" =
"move container to workspace number 4";
"${mod}+Shift+5" =
"move container to workspace number 5";
"${mod}+Shift+6" =
"move container to workspace number 6";
"${mod}+Shift+7" =
"move container to workspace number 7";
"${mod}+Shift+8" =
"move container to workspace number 8";
"${mod}+Shift+9" =
"move container to workspace number 9";
"${mod}+Shift+minus" = "move scratchpad"; "${mod}+mod1+Shift+Left" = "move workspace output left";
"${mod}+minus" = "scratchpad show"; "${mod}+mod1+Shift+Down" = "move workspace output down";
"${mod}+mod1+Shift+Up" = "move workspace output up";
"${mod}+mod1+Shift+Right" = "move workspace output right";
};
audio_binds = {
XF86AudioRaiseVolume = "exec pactl set-sink-volume @DEFAULT_SINK@ +10%";
XF86AudioLowerVolume = "exec pactl set-sink-volume @DEFAULT_SINK@ -10%";
XF86AudioMute = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
XF86AudioMicMute = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle";
# Control media
XF86AudioPlay = "exec playerctl play-pause";
XF86AudioPause = "exec playerctl play-pause";
XF86AudioNext = "exec playerctl next";
XF86AudioPrev = "exec playerctl previous";
};
in {
"${mod}+Prior" = "workspace prev_on_output";
"${mod}+Next" = "workspace next_on_output";
"${mod}+${key.tabL}" = "workspace prev_on_output";
"${mod}+${key.tabR}" = "workspace next_on_output";
"${mod}+Shift+c" = "reload"; "${mod}+Return" = "exec ${terminal}";
# "${mod}+Shift+e" = "${mod}+x" = "kill";
# "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'"; "${mod}+s" = "exec ${menu}";
"${mod}+r" = "mode resize";
"${mod}+b" = "splith";
"${mod}+v" = "splitv";
"${mod}+f" = "fullscreen toggle";
"${mod}+a" = "focus parent";
# "${mod}+s" = "layout stacking";
"${mod}+w" = "layout tabbed";
# "${mod}+e" = "layout toggle split";
"${mod}+Shift+space" = "floating toggle";
"${mod}+space" = "focus mode_toggle";
"${mod}+Shift+minus" = "move scratchpad";
"${mod}+minus" = "scratchpad show";
"${mod}+Shift+c" = "reload";
# "${mod}+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'";
"${mod}+r" = "mode resize";
} }
// workspace_binds
// movement_binds
# // map (key: "$mod+${key} workspace prev_on_output") [ key.tabL "bracketleft" "Prior" "button9" "button4" ] # // map (key: "$mod+${key} workspace prev_on_output") [ key.tabL "bracketleft" "Prior" "button9" "button4" ]
# // map (key: "$mod+${key} workspace next_on_output") [ key.tabL "bracketleft" "Prior" "button9" "button4" ] # // map (key: "$mod+${key} workspace next_on_output") [ key.tabL "bracketleft" "Prior" "button9" "button4" ]
; ;
terminal = pkgs.alacritty.executable; terminal = pkgs.alacritty.executable;
};
};
services.kanshi = {
enable = true;
profiles = {
sedetary = {
outputs = [{
criteria = "eDP-1";
status = "disable";
position = "1920,312";
} {
criteria = "HDMI-A-1";
position = "0,0";
}];
exec = [
"xrdb .Xresources"
];
};
nomad = {
outputs = [{
criteria = "eDP-1";
status = "enable";
position = "1920,312";
}];
exec = [
"xrdb .Xresources"
];
};
}; };
}; };
} }