factor out fuzzel

This commit is contained in:
Nathan McCarty 2023-06-20 02:17:47 -04:00
parent 2dc5e60d16
commit 00c2ca236a
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
2 changed files with 43 additions and 29 deletions

View File

@ -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
'';
};
})
]

View File

@ -1,21 +1,16 @@
{ config, lib, pkgs, inputs, ... }@args: { config, lib, pkgs, inputs, ... }@args:
let nathan = config.nathan; let nathan = config.nathan;
in with lib; { 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 config = mkIf nathan.programs.hyprland.enable (let
fuzzel-command = config.nathan.config.desktop.fuzzel-command;
notif-package = notif-package =
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter; inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter;
shortcuts = inputs.self.packages.${pkgs.system}.shortcuts;
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
# General # General
killall killall
# Display management # Display management
wdisplays wdisplays
# Clipboard
wl-clipboard
cliphist
# Notifications # Notifications
notif-package notif-package
# glib for sound stuff # glib for sound stuff
@ -24,8 +19,6 @@ in with lib; {
(inputs.hyprland-contrib.packages.${pkgs.system}.grimblast.override { (inputs.hyprland-contrib.packages.${pkgs.system}.grimblast.override {
hyprland = config.wayland.windowManager.hyprland.package; hyprland = config.wayland.windowManager.hyprland.package;
}) })
# fuzzel for launcher
fuzzel
# for image viewing # for image viewing
inputs.self.packages.${pkgs.system}.swayimg inputs.self.packages.${pkgs.system}.swayimg
# For private browsing # For private browsing
@ -121,7 +114,6 @@ in with lib; {
# bind = $mainMod, M, exit, # bind = $mainMod, M, exit,
bind = $mainMod, E, exec, dolphin bind = $mainMod, E, exec, dolphin
bind = $mainMod, V, togglefloating, bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, ${fuzzel-command} --prompt=' '
bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, B, togglesplit, # dwindle bind = $mainMod, B, togglesplit, # dwindle
@ -185,12 +177,8 @@ in with lib; {
# Notif bind # Notif bind
bind = $mainMod, T, exec, swaync-client -t -sw bind = $mainMod, T, exec, swaync-client -t -sw
# Shortcut dispatcher
bind = $mainMod, W, exec, ${shortcuts}/bin/shortcuts ~/.config/shortcuts/shortcuts.toml
## Window rules ## Window rules
# Gamescope - vmware # Gamescope - vmware
windowrulev2 = float,class:^(.gamescope-wrapped)$,title:VMware Workstation windowrulev2 = float,class:^(.gamescope-wrapped)$,title:VMware Workstation
windowrulev2 = noborder,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 = workspace special silent,$dropspotify
windowrulev2 = center,$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" ]; }; 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 # Setup pyprland
systemd.user.services.pypr = { systemd.user.services.pypr = {
Unit = { Unit = {