From 79552ed846ec3ffe0a8a5763f229b0d73829fc43 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 31 Mar 2024 08:09:03 -0400 Subject: [PATCH] added sway configs --- homeManagerModules/desktopEnv/default.nix | 2 +- .../desktopEnv/hypr/hyprland.conf | 14 ++- homeManagerModules/desktopEnv/sway/config | 108 ++++++++++++++++++ .../desktopEnv/sway/default.nix | 105 +++++++++++++++++ .../windowManagers/sway/default.nix | 18 +++ 5 files changed, 240 insertions(+), 7 deletions(-) create mode 100644 homeManagerModules/desktopEnv/sway/config create mode 100644 homeManagerModules/desktopEnv/sway/default.nix create mode 100644 nixosModules/desktopConfig/windowManagers/sway/default.nix diff --git a/homeManagerModules/desktopEnv/default.nix b/homeManagerModules/desktopEnv/default.nix index 37580f72..528e5361 100644 --- a/homeManagerModules/desktopEnv/default.nix +++ b/homeManagerModules/desktopEnv/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - imports = [ ./gnome ./hypr ]; + imports = [ ./gnome ./hypr ./sway ]; desktopEnv.hyprland.enable = lib.mkDefault true; } diff --git a/homeManagerModules/desktopEnv/hypr/hyprland.conf b/homeManagerModules/desktopEnv/hypr/hyprland.conf index 29424712..42e0e255 100644 --- a/homeManagerModules/desktopEnv/hypr/hyprland.conf +++ b/homeManagerModules/desktopEnv/hypr/hyprland.conf @@ -139,7 +139,9 @@ dwindle { master { # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - new_is_master = true + new_is_master = false + always_center_master = true + } gestures { @@ -175,7 +177,7 @@ $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, T, exec, $terminal -bind = $mainMod, $mainMod_L, exec, $menu +# bind = $mainMod, $mainMod_L, exec, $menu bind = $mainMod, R, exec, $menu bind = $mainMod, F, exec, $fileManager bind = $mainMod, B, exec, $browser @@ -186,10 +188,10 @@ bind = $mainMod, M, exec, wlogout bind = $mainMod, L, exec, hyprlock --immediate # Basic window management. -bind = $mainMod, W, fullscreen -bind = $mainMod, V, togglefloating, -bind = $mainMod, P, pseudo, # dwindle -bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod SHIFT, W, fullscreen +bind = $mainMod SHIFT, V, togglefloating, +bind = $mainMod SHIFT, P, pseudo, # dwindle +bind = $mainMod SHIFT, J, togglesplit, # dwindle # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l diff --git a/homeManagerModules/desktopEnv/sway/config b/homeManagerModules/desktopEnv/sway/config new file mode 100644 index 00000000..beb471f1 --- /dev/null +++ b/homeManagerModules/desktopEnv/sway/config @@ -0,0 +1,108 @@ +font pango:monospace 8.000000 +floating_modifier Mod1 +default_border normal 2 +default_floating_border normal 2 +hide_edge_borders none +focus_wrapping no +focus_follows_mouse yes +focus_on_window_activation smart +mouse_warping output +workspace_layout default +workspace_auto_back_and_forth no +client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 +client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +client.unfocused #333333 #222222 #888888 #292d2e #222222 +client.urgent #2f343a #900000 #ffffff #900000 #900000 +client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c +client.background #ffffff + +bindsym Mod1+0 workspace number 10 +bindsym Mod1+1 workspace number 1 +bindsym Mod1+2 workspace number 2 +bindsym Mod1+3 workspace number 3 +bindsym Mod1+4 workspace number 4 +bindsym Mod1+5 workspace number 5 +bindsym Mod1+6 workspace number 6 +bindsym Mod1+7 workspace number 7 +bindsym Mod1+8 workspace number 8 +bindsym Mod1+9 workspace number 9 +bindsym Mod1+Down focus down +bindsym Mod1+Left focus left +bindsym Mod1+Return exec alacritty +bindsym Mod1+Right focus right +bindsym Mod1+Shift+0 move container to workspace number 10 +bindsym Mod1+Shift+1 move container to workspace number 1 +bindsym Mod1+Shift+2 move container to workspace number 2 +bindsym Mod1+Shift+3 move container to workspace number 3 +bindsym Mod1+Shift+4 move container to workspace number 4 +bindsym Mod1+Shift+5 move container to workspace number 5 +bindsym Mod1+Shift+6 move container to workspace number 6 +bindsym Mod1+Shift+7 move container to workspace number 7 +bindsym Mod1+Shift+8 move container to workspace number 8 +bindsym Mod1+Shift+9 move container to workspace number 9 +bindsym Mod1+Shift+Down move down +bindsym Mod1+Shift+Left move left +bindsym Mod1+Shift+Right move right +bindsym Mod1+Shift+Up move up +bindsym Mod1+Shift+c reload +bindsym Mod1+Shift+e exec wlogout +bindsym Mod1+Shift+h move left +bindsym Mod1+Shift+j move down +bindsym Mod1+Shift+k move up +bindsym Mod1+Shift+l move right +bindsym Mod1+Shift+minus move scratchpad +bindsym Mod1+Shift+q kill +bindsym Mod1+Shift+space floating toggle +bindsym Mod1+Up focus up +bindsym Mod1+a focus parent +bindsym Mod1+b splith +bindsym Mod1+d exec fuzzel +bindsym Mod1+e layout toggle split +bindsym Mod1+f fullscreen toggle +bindsym Mod1+h focus left +bindsym Mod1+j focus down +bindsym Mod1+k focus up +bindsym Mod1+l focus right +bindsym Mod1+minus scratchpad show +bindsym Mod1+r mode resize +bindsym Mod1+s layout stacking +bindsym Mod1+space focus mode_toggle +bindsym Mod1+v splitv +bindsym Mod1+w layout tabbed + +mode "resize" { + bindsym Down resize grow height 10 px + bindsym Escape mode default + bindsym Left resize shrink width 10 px + bindsym Return mode default + bindsym Right resize grow width 10 px + bindsym Up resize shrink height 10 px + bindsym h resize shrink width 10 px + bindsym j resize grow height 10 px + bindsym k resize shrink height 10 px + bindsym l resize grow width 10 px +} + +bar { + font pango:monospace 8.000000 + mode dock + hidden_state hide + position bottom + status_command /nix/store/dg4f4b9zcl0cn0993qaw5dd4nny6zm8j-i3status-2.14/bin/i3status + swaybar_command /nix/store/4qg7qmx19n0c1z26fjbxfndr6v7vbaxy-sway-1.9/bin/swaybar + workspace_buttons yes + strip_workspace_numbers no + tray_output primary + colors { + background #000000 + statusline #ffffff + separator #666666 + focused_workspace #4c7899 #285577 #ffffff + active_workspace #333333 #5f676a #ffffff + inactive_workspace #333333 #222222 #888888 + urgent_workspace #2f343a #900000 #ffffff + binding_mode #2f343a #900000 #ffffff + } +} + +exec "/nix/store/f9w2kp8y55zvcyz33b5lnr7qwhx652y8-dbus-1.14.10/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target" diff --git a/homeManagerModules/desktopEnv/sway/default.nix b/homeManagerModules/desktopEnv/sway/default.nix new file mode 100644 index 00000000..5a0dff41 --- /dev/null +++ b/homeManagerModules/desktopEnv/sway/default.nix @@ -0,0 +1,105 @@ +{ pkgs, lib, config, ... }: { + + options = { + desktopEnv.sway.enable = + lib.mkEnableOption "Sway with extra apps."; + }; + + config = lib.mkIf config.desktopEnv.sway.enable { + + # Basic apps needed to run a hyprland desktop. + guiApps.waybar.enable = lib.mkDefault true; + guiApps.mako.enable = lib.mkDefault true; + guiApps.fuzzel.enable = lib.mkDefault true; + guiApps.wlogout.enable = lib.mkDefault true; + guiApps.alacritty.enable = lib.mkDefault true; + guiApps.firefox.enable = lib.mkDefault true; + + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ + brightnessctl + evince + playerctl + xfce.exo + xfce.ristretto + xfce.thunar + xfce.thunar-archive-plugin + xfce.thunar-media-tags-plugin + xfce.thunar-volman + xfce.tumbler + xfce.xfce4-settings + xfce.xfce4-taskmanager + xfce.xfconf + ]; + + services.cliphist.enable = true; + + wayland.windowManager.sway = { + enable = true; + extraConfig = builtins.readFile ./config.conf; + }; + + xdg.configFile."xfce4/helpers.rc".text = '' + TerminalEmulator=alacritty + FileManager=thunar + WebBrowser=firefox + ''; + + xdg.portal = { + enable = true; + configPackages = [ pkgs.xdg-desktop-portal-wlr]; + extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; + }; + + home.pointerCursor = { + gtk.enable = true; + x11.enable = true; + package = pkgs.catppuccin-cursors.frappeDark; + name = "Catppuccin-Frappe-Dark-Cursors"; + size = 24; + }; + + qt = { + enable = true; + platformTheme = "gtk"; + style.name = "Catppuccin-Frappe-Compact-Mauve-Dark"; + }; + + gtk = { + enable = true; + + theme = { + package = pkgs.catppuccin-gtk.override { + accents = [ "mauve" ]; + size = "compact"; + variant = "frappe"; + tweaks = [ "normal" ]; + }; + name = "Catppuccin-Frappe-Compact-Mauve-Dark"; + }; + + iconTheme = { + package = pkgs.catppuccin-papirus-folders.override { + flavor = "frappe"; + accent = "mauve"; + }; + name = "Papirus-Dark"; + }; + + font = { + name = "NotoSans Nerd Font Regular"; + package = pkgs.nerdfonts.override { fonts = [ "Noto" ]; }; + size = 11; + }; + }; + + dconf.settings = { + "org/gnome/desktop/interface" = { + gtk-theme = "Catppuccin-Frappe-Compact-Mauve-Dark"; + color-scheme = "prefer-dark"; + cursor-theme = "Catppuccin-Frappe-Dark-Cursors"; + cursor-size = 24; + }; + }; + }; +} diff --git a/nixosModules/desktopConfig/windowManagers/sway/default.nix b/nixosModules/desktopConfig/windowManagers/sway/default.nix new file mode 100644 index 00000000..dc342e50 --- /dev/null +++ b/nixosModules/desktopConfig/windowManagers/sway/default.nix @@ -0,0 +1,18 @@ +{ pkgs, lib, config, ... }: { + + options = { + desktopConfig.windowManagers.sway.enable = + lib.mkEnableOption "Sway window manager session."; + }; + + config = lib.mkIf config.desktopConfig.windowManagers.sway.enable { + + desktopConfig.displayManagers.lightdm.enable = lib.mkDefault true; + + programs.sway.enable = true; + + services.dbus.packages = [ pkgs.gcr ]; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + }; +}