diff options
-rw-r--r-- | flake.lock | 11 | ||||
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | home/wayland/home.nix | 2 | ||||
-rw-r--r-- | home/wayland/modules/sway/home.nix | 144 | ||||
-rw-r--r-- | home/wayland/modules/sway/i3status.nix | 35 | ||||
-rw-r--r-- | home/wayland/modules/sway/mako.nix (renamed from home/wayland/modules/mako.nix) | 0 | ||||
-rw-r--r-- | home/wayland/modules/sway/swaylock.nix | 14 |
7 files changed, 201 insertions, 7 deletions
@@ -7,15 +7,16 @@ ] }, "locked": { - "lastModified": 1717316182, - "narHash": "sha256-Xi0EpZcu39N0eW7apLjFfUOR9y80toyjYizez7J1wMI=", - "owner": "nix-community", + "lastModified": 1717392041, + "narHash": "sha256-GAVPZEa13tEX5b0wBCpOZU3jUF2yZb4vi4WeN/Gc2V0=", + "owner": "sinanmohd", "repo": "home-manager", - "rev": "9b53a10f4c91892f5af87cf55d08fba59ca086af", + "rev": "fd6c12bfd7f9dd0987d5ce5cd749b34bd9f817ad", "type": "github" }, "original": { - "owner": "nix-community", + "owner": "sinanmohd", + "ref": "sway-generators", "repo": "home-manager", "type": "github" } @@ -10,7 +10,7 @@ }; home-manager = { - url = "github:nix-community/home-manager"; + url = "github:sinanmohd/home-manager/sway-generators"; inputs.nixpkgs.follows = "nixpkgs"; }; }; diff --git a/home/wayland/home.nix b/home/wayland/home.nix index 56d74fc..98053c7 100644 --- a/home/wayland/home.nix +++ b/home/wayland/home.nix @@ -3,8 +3,8 @@ ../common/home.nix ./modules/foot.nix ./modules/zathura.nix - ./modules/mako.nix ./modules/firefox.nix ./modules/mimeapps.nix + ./modules/sway/home.nix ]; } diff --git a/home/wayland/modules/sway/home.nix b/home/wayland/modules/sway/home.nix new file mode 100644 index 0000000..eb2bf41 --- /dev/null +++ b/home/wayland/modules/sway/home.nix @@ -0,0 +1,144 @@ +{ config, pkgs, lib, ... }: let + mod = "mod4"; + left = "h"; + right = "l"; + down = "j"; + up = "k"; + + menu = "${pkgs.bemenu}/bin/bemenu-run --prompt ' '"; + term = lib.getExe config.programs.foot.package; + status = lib.getExe config.programs.i3status.package; + lock = lib.getExe config.programs.swaylock.package; + + nnn = lib.getExe pkgs.nnn; + wpctl = "${pkgs.wireplumber}/bin/wpctl"; + brightnessctl = lib.getExe pkgs.brightnessctl; + notification = lib.getExe config.services.mako.package; + firefox = lib.getExe config.programs.firefox.finalPackage; +in { + imports = [ + ./mako.nix + ./swaylock.nix + ./i3status.nix + ]; + + home.packages = [ + pkgs.nnn + pkgs.bemenu + pkgs.brightnessctl + ]; + + wayland.windowManager.sway = { + enable = true; + config = null; + + settings = { + bar = { + position = "top"; + font = "sans"; + status_command = status; + colors = { + background = "#000000"; + focused_workspace = "#000000 #000000 #ffba08"; + inactive_workspace = "#000000 #000000 #cde4e6"; + }; + }; + + bindgesture = { + "swipe:left" = "workspace next"; + "swipe:right" = "workspace prev"; + "swipe:down" = "exec ${lock}"; + }; + input = { + "type:touchpad" = { + dwt = "enabled"; + tap = "enabled"; + }; + "type:keyboard" = { + repeat_rate = 100; + repeat_delay = 250; + }; + }; + + bindsym = { + # sway + "${mod}+q" = "kill"; + "${mod}+shift+c" = "reload"; + "${mod}+tab" = "workspace back_and_forth"; + "${mod}+shift+e" = '' + exec swaynag -t warning -m 'Do you really want to exit sway?' \ + -B 'Yes, exit sway' 'swaymsg exit' + ''; + + # workspaces + "${mod}+1" = "workspace number 1"; + "${mod}+2" = "workspace number 2"; + "${mod}+3" = "workspace number 3"; + "${mod}+4" = "workspace number 4"; + "${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" = "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}+c" = "splitv"; + "${mod}+v" = "splith"; + + # layout + "${mod}+${left}" = "focus left"; + "${mod}+${down}" = "focus down"; + "${mod}+${up}" = "focus up"; + "${mod}+${right}" = "focus right"; + "${mod}+shift+${left}" = "move left"; + "${mod}+shift+${right}" = "move right"; + "${mod}+shift+${down}" = "move down"; + "${mod}+shift+${up}" = "move up"; + "${mod}+f" = "fullscreen"; + "${mod}+s" = "layout stacking"; + "${mod}+t" = "layout tabbed"; + "${mod}+e" = "layout toggle split"; + "${mod}+shift+space" = "floating toggle"; + "${mod}+r" = "mode resize"; + + # scratchpad + "${mod}+shift+minus" = "move scratchpad"; + "${mod}+minus" = "scratchpad show"; + + # exec + "${mod}+return" = "exec ${term}"; + "${mod}+p" = "exec ${menu}"; + "${mod}+w" = "exec ${firefox}"; + "${mod}+n" = "exec ${term} -- ${nnn} -decC"; + + XF86MonBrightnessDown = "exec ${brightnessctl} set 1%-"; + XF86MonBrightnessUp = "exec ${brightnessctl} set 1%+"; + XF86AudioLowerVolume = "exec ${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%-"; + XF86AudioRaiseVolume = "exec ${wpctl} set-volume --limit 1.5 @DEFAULT_AUDIO_SINK@ 5%+"; + XF86AudioMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle"; + XF86AudioMicMute = "exec ${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + }; + + mode.resize.bindsym = { + ${left} = "resize shrink width 10px"; + ${right} = "resize grow width 10px"; + ${down} = "resize grow height 10px"; + ${up} = "resize shrink height 10px"; + return = "mode default"; + }; + + gaps.inner = 10; + exec = notification; + default_border.pixel = 2; + floating_modifier = "${mod} normal"; + "client.focused" = "#4c7899 #285577 #ffffff #285577"; + }; + }; +} diff --git a/home/wayland/modules/sway/i3status.nix b/home/wayland/modules/sway/i3status.nix new file mode 100644 index 0000000..57b62a4 --- /dev/null +++ b/home/wayland/modules/sway/i3status.nix @@ -0,0 +1,35 @@ +{ ... }: { + programs.i3status = { + enable = true; + enableDefault = false; + + general = { + output_format = "i3bar"; + separator = ""; + interval = 5; + colors = false; + }; + + modules = { + "tztime local" = { + position = 30; + settings.format = " %a,%e %b %H:%M"; + }; + "volume master" = { + position = 20; + settings = { + format = " %volume"; + format_muted = " %volume"; + }; + }; + "memory" = { + position = 10; + settings.format = " %available"; + }; + "disk /" = { + position = 00; + settings.format = " %avail"; + }; + }; + }; +} diff --git a/home/wayland/modules/mako.nix b/home/wayland/modules/sway/mako.nix index 4280fdf..4280fdf 100644 --- a/home/wayland/modules/mako.nix +++ b/home/wayland/modules/sway/mako.nix diff --git a/home/wayland/modules/sway/swaylock.nix b/home/wayland/modules/sway/swaylock.nix new file mode 100644 index 0000000..dcbe165 --- /dev/null +++ b/home/wayland/modules/sway/swaylock.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: { + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + + settings = { + clock = true; + timestr = "%H:%M"; + datestr = "%a,%e %b"; + indicator-idle-visible = true; + color = "404040"; + }; + }; +} |