From 105d7278ddf44f32728b90e6aabfc6d283e23b03 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 23 Apr 2024 11:51:15 +0300 Subject: [PATCH] modules: add easymotion for hyprland --- hosts/asus-gl553vd/users/jan.nix | 2 - .../configs/window-manager/default.nix | 4 +- .../{hyprland.nix => hyprland/default.nix} | 67 +++++++++++++++---- .../hyprland/easyfocus-hyprland.nix | 19 ++++++ .../{xmonad.nix => xmonad/default.nix} | 0 .../{ => xmonad}/xmonad_config.hs | 2 +- modules/home-manager/programs/aerc.nix | 2 +- .../programs/terminals/wezterm.nix | 2 + 8 files changed, 78 insertions(+), 20 deletions(-) rename modules/home-manager/configs/window-manager/{hyprland.nix => hyprland/default.nix} (60%) create mode 100644 modules/home-manager/configs/window-manager/hyprland/easyfocus-hyprland.nix rename modules/home-manager/configs/window-manager/{xmonad.nix => xmonad/default.nix} (100%) rename modules/home-manager/configs/window-manager/{ => xmonad}/xmonad_config.hs (99%) diff --git a/hosts/asus-gl553vd/users/jan.nix b/hosts/asus-gl553vd/users/jan.nix index a65313b..9829279 100644 --- a/hosts/asus-gl553vd/users/jan.nix +++ b/hosts/asus-gl553vd/users/jan.nix @@ -16,8 +16,6 @@ in xmonad.projects = import ./xmonad-projects.secret.nix; }; - local.programs.terminals.wezterm.enable = false; - # local.programs.dev-tools.k8s.enable = true; local.programs.libreoffice.enable = false; diff --git a/modules/home-manager/configs/window-manager/default.nix b/modules/home-manager/configs/window-manager/default.nix index e784004..20e5290 100644 --- a/modules/home-manager/configs/window-manager/default.nix +++ b/modules/home-manager/configs/window-manager/default.nix @@ -2,8 +2,8 @@ { imports = [ - ./xmonad.nix - ./hyprland.nix ./polybar.nix + ./xmonad + ./hyprland ]; } diff --git a/modules/home-manager/configs/window-manager/hyprland.nix b/modules/home-manager/configs/window-manager/hyprland/default.nix similarity index 60% rename from modules/home-manager/configs/window-manager/hyprland.nix rename to modules/home-manager/configs/window-manager/hyprland/default.nix index 2551548..7b707e0 100644 --- a/modules/home-manager/configs/window-manager/hyprland.nix +++ b/modules/home-manager/configs/window-manager/hyprland/default.nix @@ -2,6 +2,8 @@ let cfg = config.local.window-manager.hyprland; + + easyfocus = pkgs.callPackage ./easyfocus-hyprland.nix { }; in { options.local.window-manager.hyprland = with lib; { @@ -10,13 +12,36 @@ in config = lib.mkIf cfg.enable { home.packages = with pkgs.unstable; [ - foot wl-clipboard wlsunset - swaybg dmenu-wayland ]; + xdg.configFile."easyfocus-hyprland/config.yaml".text = '' + chars: 'aoeuhtns' + + window_background_color: '1d1f21' + window_background_opacity: 0.2 + + label_background_color: '1d1f21' + label_background_opacity: 1.0 + label_text_color: 'c5c8c6' + + focused_background_color: '285577' + focused_background_opacity: 1.0 + focused_text_color: 'ffffff' + + font_family: monospace + font_weight: bold + font_size: 60px + + label_padding_x: 16 + label_padding_y: 16 + label_border_radius: 4 + label_margin_x: 4 + label_margin_y: 16 + ''; + wayland.windowManager.hyprland = { enable = true; package = pkgs.unstable.hyprland; @@ -26,7 +51,7 @@ in settings = { # monitors - monitor = ",preferred,auto,auto"; + monitor = ",preferred,auto,1"; # env @@ -41,7 +66,7 @@ in gaps_in = 5; gaps_out = 20; - border_size = 2; + border_size = 1; "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; "col.inactive_border" = "rgba(595959aa)"; @@ -80,8 +105,11 @@ in workspace_swipe = false; }; + xwayland = { + force_zero_scaling = true; + }; - "$terminal" = "foot"; + "$terminal" = "wezterm start"; "$browser" = "librewolf"; "$fileManager" = "vifm"; "$menu" = "dmenu-wl_run"; @@ -90,32 +118,44 @@ in bind = lib.flatten [ # programs - "$mod SHIFT, Return, exec, $terminal" - "$mod SHIFT, S, exec, flameshot gui" "$mod SHIFT, B, exec, $browser" "$mod, p, exec, $menu" - # Move focus - (lib.flip lib.mapAttrsToList { L = "r"; H = "l"; J = "d"; K = "u"; } (k: d: - "$mod, ${k}, movefocus, ${d}" - )) + # focus + (lib.flip lib.mapAttrsToList { k = "prev"; j = "next"; } (k: d: [ + "$mod, ${k}, layoutmsg, cycle${d}" + "$mod SHIFT, ${k}, layoutmsg, swap${d}" + ])) + "$mod, Return, layoutmsg, swapwithmaster, master" + "$mod, s, exec, ${easyfocus}/bin/easyfocus-hyprland" + # comma (,) + "$mod, code:44, layoutmsg, addmaster" + # period (.) + "$mod, code:46, layoutmsg, removemaster" + # windows + "MOD4 SHIFT, C, killactive" + "$mod, Space, fullscreen, 0" + + # workspaces (lib.flip map [ 1 2 3 4 5 6 7 8 9 0 ] (i: let wid = if i == 0 then 10 else i; in [ # switch warkspaces with mod + [0-9] "$mod, ${toString i}, workspace, ${toString wid}" # move active window to a workspace with mod + shift + [0-9] - "$mod SHIFT, ${toString i}, movetoworkspace, ${toString wid}" + "$mod SHIFT, ${toString i}, movetoworkspacesilent, ${toString wid}" ] )) + + # syste + "MOD4 SHIFT, Q, exit" ]; bindm = [ "$mod, mouse:272, movewindow" "$mod, mouse:273, resizewindow" - ]; input = let kb = config.home.keyboard; in { @@ -124,7 +164,6 @@ in kb_variant = kb.variant; kb_options = lib.head kb.options; }; - }; }; }; diff --git a/modules/home-manager/configs/window-manager/hyprland/easyfocus-hyprland.nix b/modules/home-manager/configs/window-manager/hyprland/easyfocus-hyprland.nix new file mode 100644 index 0000000..23d5676 --- /dev/null +++ b/modules/home-manager/configs/window-manager/hyprland/easyfocus-hyprland.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: + + +pkgs.rustPlatform.buildRustPackage { + pname = "easyfocus-hyprland"; + version = "2024-03-14"; + + src = pkgs.fetchFromGitHub { + owner = "PostCyberPunk"; + repo = "easyfocus-hyprland"; + rev = "382efb8bcdbb5e35a417d4ef415f92f5fca0d41e"; + hash = "sha256-BLX3ASmTq+xkUOQQ0yBCn/mhsnz6JU2u+lor1YYHkdI="; + }; + cargoHash = "sha256-M72KO6Z/ZCsns1yZd5eqz94CSIZ/dI4SpGjnqJ9LYko="; + + nativeBuildInputs = with pkgs; + [ pkg-config glib ]; + buildInputs = with pkgs; [ glib gtk3 gtk-layer-shell ]; +} diff --git a/modules/home-manager/configs/window-manager/xmonad.nix b/modules/home-manager/configs/window-manager/xmonad/default.nix similarity index 100% rename from modules/home-manager/configs/window-manager/xmonad.nix rename to modules/home-manager/configs/window-manager/xmonad/default.nix diff --git a/modules/home-manager/configs/window-manager/xmonad_config.hs b/modules/home-manager/configs/window-manager/xmonad/xmonad_config.hs similarity index 99% rename from modules/home-manager/configs/window-manager/xmonad_config.hs rename to modules/home-manager/configs/window-manager/xmonad/xmonad_config.hs index e5d4207..7ec4383 100644 --- a/modules/home-manager/configs/window-manager/xmonad_config.hs +++ b/modules/home-manager/configs/window-manager/xmonad/xmonad_config.hs @@ -1,4 +1,4 @@ --- +- -- xmonad example config file. -- -- A template showing all available configuration hooks, diff --git a/modules/home-manager/programs/aerc.nix b/modules/home-manager/programs/aerc.nix index 21718eb..895f7c3 100644 --- a/modules/home-manager/programs/aerc.nix +++ b/modules/home-manager/programs/aerc.nix @@ -11,7 +11,7 @@ let rev = version; hash = "sha256-IyAcTCDSjOmZ6KPr9nYKdxWA0qryeU4jTwxRWzt2NOY="; }; - vendorHash = "sha256-pir78zXidz7N9Z6uw9YqkkjVRUho0PuKgDTQFli/4fs="; + vendorHash = "sha256-s7lt5amq6Zsn+1AM2SlNeXSZIRbJ+vYKZmdWEDC4Sp4="; }); }; diff --git a/modules/home-manager/programs/terminals/wezterm.nix b/modules/home-manager/programs/terminals/wezterm.nix index 46b0149..c39ad99 100644 --- a/modules/home-manager/programs/terminals/wezterm.nix +++ b/modules/home-manager/programs/terminals/wezterm.nix @@ -60,6 +60,8 @@ in font_size = ${toString cfg.fontSize}, color_scheme = "myCoolTheme", hide_tab_bar_if_only_one_tab = true, + -- https://github.com/wez/wezterm/issues/4483 + enable_wayland = false, } ''; };