From 00c2ca236ac54967d094d3aaf0afed4ad4b6f5bf Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Tue, 20 Jun 2023 02:17:47 -0400 Subject: [PATCH] factor out fuzzel --- .../linux/programs/desktop/fuzzel.nix | 42 +++++++++++++++++++ home-manager/linux/programs/hyprland.nix | 30 +------------ 2 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 home-manager/linux/programs/desktop/fuzzel.nix diff --git a/home-manager/linux/programs/desktop/fuzzel.nix b/home-manager/linux/programs/desktop/fuzzel.nix new file mode 100644 index 0000000..47c22f8 --- /dev/null +++ b/home-manager/linux/programs/desktop/fuzzel.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, inputs, ... }: +let + fuzzel-command = config.nathan.config.desktop.fuzzel-command; + hyprland = config.nathan.programs.hyprland.enable; + targets = config.nathan.config.desktop.targets; + shortcuts = inputs.self.packages.${pkgs.system}.shortcuts; +in lib.mkMerge [ + (lib.mkIf hyprland { + wayland.windowManager.hyprland.extraConfig = '' + bind = $mainMod, R, exec, ${fuzzel-command} --prompt='❯ ' + # Clipboard history management + exec-once=wl-paste --watch cliphist store + bind = $mainMod, X, exec, cliphist list | ${fuzzel-command} --prompt=' ❯ ' --dmenu | cliphist decode | wl-copy + # Shortcut dispatcher + bind = $mainMod, W, exec, ${shortcuts}/bin/shortcuts ~/.config/shortcuts/shortcuts.toml + ''; + }) + # General configuration + (lib.mkIf hyprland { + home.packages = with pkgs; [ + fuzzel + # Clipboard + wl-clipboard + cliphist + ]; + + # Shortcut dispatcher + xdg.configFile."shortcuts/shortcuts.toml" = { + text = '' + directories = ["~/.config/shortcuts/shortcuts", "${shortcuts}/shortcuts"] + picker_command = "${ + builtins.replaceStrings [ ''"'' ] [ ''\"'' ] + (fuzzel-command + " --prompt=' ❯ ' ") + } --dmenu" + ''; + onChange = '' + mkdir -p ~/.config/shortcuts/shortcuts + ''; + }; + + }) +] diff --git a/home-manager/linux/programs/hyprland.nix b/home-manager/linux/programs/hyprland.nix index 46ff916..3c03ac7 100644 --- a/home-manager/linux/programs/hyprland.nix +++ b/home-manager/linux/programs/hyprland.nix @@ -1,21 +1,16 @@ { config, lib, pkgs, inputs, ... }@args: let nathan = config.nathan; in with lib; { - imports = [ ./desktop/waybar.nix ./desktop/locking.nix ]; + imports = [ ./desktop/waybar.nix ./desktop/locking.nix ./desktop/fuzzel.nix ]; config = mkIf nathan.programs.hyprland.enable (let - fuzzel-command = config.nathan.config.desktop.fuzzel-command; notif-package = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter; - shortcuts = inputs.self.packages.${pkgs.system}.shortcuts; in { home.packages = with pkgs; [ # General killall # Display management wdisplays - # Clipboard - wl-clipboard - cliphist # Notifications notif-package # glib for sound stuff @@ -24,8 +19,6 @@ in with lib; { (inputs.hyprland-contrib.packages.${pkgs.system}.grimblast.override { hyprland = config.wayland.windowManager.hyprland.package; }) - # fuzzel for launcher - fuzzel # for image viewing inputs.self.packages.${pkgs.system}.swayimg # For private browsing @@ -121,7 +114,6 @@ in with lib; { # bind = $mainMod, M, exit, bind = $mainMod, E, exec, dolphin bind = $mainMod, V, togglefloating, - bind = $mainMod, R, exec, ${fuzzel-command} --prompt='❯ ' bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, B, togglesplit, # dwindle @@ -185,12 +177,8 @@ in with lib; { # Notif bind bind = $mainMod, T, exec, swaync-client -t -sw - # Shortcut dispatcher - bind = $mainMod, W, exec, ${shortcuts}/bin/shortcuts ~/.config/shortcuts/shortcuts.toml - ## Window rules - # Gamescope - vmware windowrulev2 = float,class:^(.gamescope-wrapped)$,title:VMware Workstation windowrulev2 = noborder,class:^(.gamescope-wrapped)$,title:VMware Workstation @@ -234,9 +222,6 @@ in with lib; { windowrulev2 = workspace special silent,$dropspotify windowrulev2 = center,$dropspotify - # Clipboard history management - exec-once=wl-paste --watch cliphist store - bind = $mainMod, X, exec, cliphist list | ${fuzzel-command} --prompt=' ❯ ' --dmenu | cliphist decode | wl-copy ''; }; @@ -267,19 +252,6 @@ in with lib; { }; Install = { WantedBy = [ "hyprland-session.target" ]; }; }; - # Shortcut dispatcher - xdg.configFile."shortcuts/shortcuts.toml" = { - text = '' - directories = ["~/.config/shortcuts/shortcuts", "${shortcuts}/shortcuts"] - picker_command = "${ - builtins.replaceStrings [ ''"'' ] [ ''\"'' ] - (fuzzel-command + " --prompt=' ❯ ' ") - } --dmenu" - ''; - onChange = '' - mkdir -p ~/.config/shortcuts/shortcuts - ''; - }; # Setup pyprland systemd.user.services.pypr = { Unit = {