From 38945825aa85eb888cc5331ec97f6b20a041d843 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 7 Jul 2024 19:26:27 +0200 Subject: [PATCH] walker: Rewrite config in nix --- .../graphical/launchers/walker/config.json | 100 ------------- .../graphical/launchers/walker/default.nix | 137 +++++++++++++++++- 2 files changed, 135 insertions(+), 102 deletions(-) delete mode 100644 home/programs/graphical/launchers/walker/config.json diff --git a/home/programs/graphical/launchers/walker/config.json b/home/programs/graphical/launchers/walker/config.json deleted file mode 100644 index 6871011..0000000 --- a/home/programs/graphical/launchers/walker/config.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "placeholder": "Search...", - "keep_open": false, - "ignore_mouse": false, - "ssh_host_file": "", - "enable_typeahead": false, - "show_initial_entries": true, - "fullscreen": false, - "scrollbar_policy": "automatic", - "hyprland": { - "context_aware_history": false - }, - "applications": { - "disable_cache": true - }, - "activation_mode": { - "disabled": false, - "use_f_keys": false, - "use_alt": false - }, - "search": { - "delay": 0, - "hide_icons": false, - "margin_spinner": 10, - "hide_spinner": false - }, - "runner": { - "excludes": [ - "rm" - ] - }, - "clipboard": { - "max_entries": 10, - "image_height": 300 - }, - "align": { - "ignore_exlusive": true, - "width": 400, - "horizontal": "center", - "vertical": "start", - "anchors": { - "top": false, - "left": false, - "bottom": false, - "right": false - }, - "margins": { - "top": 20, - "bottom": 0, - "end": 0, - "start": 0 - } - }, - "list": { - "height": 300, - "margin_top": 10, - "always_show": true, - "hide_sub": false - }, - "orientation": "vertical", - "icons": { - "theme": "", - "hide": false, - "size": 28, - "image_height": 200 - }, - "modules": [ - { - "name": "runner", - "prefix": "" - }, - { - "name": "applications", - "prefix": "" - }, - { - "name": "ssh", - "prefix": "", - "switcher_exclusive": true - }, - { - "name": "finder", - "prefix": "", - "switcher_exclusive": true - }, - { - "name": "commands", - "prefix": "", - "switcher_exclusive": true - }, - { - "name": "websearch", - "prefix": "?" - }, - { - "name": "switcher", - "prefix": "/" - } - ] -} diff --git a/home/programs/graphical/launchers/walker/default.nix b/home/programs/graphical/launchers/walker/default.nix index fa10293..091daad 100644 --- a/home/programs/graphical/launchers/walker/default.nix +++ b/home/programs/graphical/launchers/walker/default.nix @@ -1,7 +1,7 @@ { inputs, + config, osConfig, - pkgs, lib, ... }: let @@ -14,7 +14,140 @@ in { enable = true; runAsService = true; # makes walker a lot faster when starting - config = builtins.fromJSON (builtins.readFile ./config.json); + config = { + placeholder = "Search..."; + ignore_mouse = false; + terminal = "kitty"; + shell_config = "${config.xdg.configHome}/zsh/.zshrc"; + ssh_host_file = "${config.home.homeDirectory}/.ssh/known_hosts"; + enable_typeahead = false; + show_initial_entries = true; + fullscreen = false; + scrollbar_policy = "automatic"; + websearch = { + engines = ["google" "duckduckgo"]; + }; + hyprland = { + context_aware_history = false; + }; + applications = { + enable_cache = false; # disabling doesn't cause slowdowns, and allows picking up new apps automatically + }; + + # Mode for picking the entry with keyboard using labels + # defaults to ctrl+ + activation_mode = { + disabled = false; + use_f_keys = false; # F-keys instead of letters for labels + use_alt = false; # use alt instead of ctrl to enter activation mode + }; + search = { + delay = 0; # debounce delay (until src/cmd is ran) in ms + hide_icons = false; + margin_spinner = 10; # margin of the spinner in px + hide_spinner = false; + }; + runner = { + excludes = ["rm"]; # commands to be excluded from the runner + }; + clipboard = { + max_entries = 10; + image_height = 300; + }; + align = { + ignore_exclusive = true; + width = 400; + horizontal = "center"; + vertical = "start"; + anchors = { + top = false; + left = false; + bottom = false; + right = false; + }; + margins = { + top = 20; + bottom = 0; + end = 0; + start = 0; + }; + }; + list = { + height = 300; + width = 100; + margin_top = 10; + always_show = true; + hide_sub = false; + fixed_height = false; + }; + orientation = "vertical"; + icons = { + theme = ""; # GTK Icon theme (default) + hide = false; + size = 28; + image_height = 200; + }; + # Built-in modules + modules = [ + # Module switcher + { + name = "switcher"; + prefix = "/"; + } + + # Default modules (always listed) + { + name = "runner"; + prefix = ""; + } + { + name = "applications"; + prefix = ""; + } + + # Prefix modules + { + name = "hyprland"; + prefix = "#"; + } + { + name = "clipboard"; + prefix = ">"; + } + + # Switcher exclusive modules (must be chosen) + { + name = "commands"; # walker commands + prefix = ""; + switcher_exclusive = true; + } + { + name = "ssh"; + prefix = ""; + switcher_exclusive = true; + } + { + name = "websearch"; # uses google + prefix = ""; + switcher_exclusive = true; + } + ]; + # Custom modules + external = [ + { + name = "Home directory explorer"; + prefix = "~"; + src = "fd --base-directory ~ %TERM%"; + cmd = "xdg-open file://%RESULT%"; + } + { + name = "DDG search"; + prefix = "?"; + src = "jq -sRr '@uri'"; + cmd = "xdg-open https://duckduckgo.com/?t=h_&q=%RESULT%&ia=web"; + } + ]; + }; style = builtins.readFile ./style.css; }; };