Fuzzy Find Everything - Alec's BlogFuzzy Find Everything<br>I had a subtitle for this but my memory is a little fuzzy<br>August 19, 2026<br>Time and time again I find out I was wrong about something, like the time I thought vim keybinds were stupid or when I thought that trackballs were stupid too.This time is the dmenu function of dmenu, wmenu, rofi and fuzzel. By default dmenu and the option like --dmenu in others menus allows one to build menus with any entries one would like to define, I though this wasn’t too useful simply because I could not come up with a use case. Turns out it is really useful for bookmarks, emojies and really anything that needs to be searched and picked.Today I use --dmenu fuzzy finding for everything, very recently I made use of fuzzel to quicky pick bookmarks I have saved and open them in my browser, www-gem thought I should make I post about it and I thought so too. But first let me tell you what led up to here.Emoji Picker<br>Months ago I found an emoji picker, made with fuzzel that used fuzzel’s --dmenu option and it made very easy to quickly type any emoji inside of any app. Even though I rarely use emojies it was pretty nifty being able to pick an emoji fast regarless of where I needed to insert the emoji.The picker has three modes; copy, type and both, and instead of having a keybind shortcut for each mode I made the picker feed the mode to itself.#!/bin/sh
# Stolen and adapted from https://github.com/end-4/fuzzel-emoji
set -euo pipefail
MODE="${1:-menu}"<br>emoji_data_path="$HOME/.local/share/emojis"<br>menu_data=$(cat END<br>c| Copy|copy<br>t| type|type<br>b| Copy and Type|both<br>END
usage() {<br>echo "Usage: $0 [menu|type|copy|both]"<br>exit 1
get_emoji() {<br>cat "${emoji_data_path}" | \<br>fuzzel --dmenu \<br>--width 120 \<br>--accept-nth 1 \<br>--nth-delimiter " " \<br>--mesg "Select an emoji" \<br>--placeholder "Keyword …"
case "$MODE" in<br>menu)<br>_mode=$(<br>echo "${menu_data}" | \<br>fuzzel \<br>--dmenu \<br>--width 20 \<br>--minimal-lines \<br>--nth-delimiter "|" \<br>--with-nth "{1} {2}" \<br>--accept-nth 3 \<br>--mesg "Emoji picker" \<br>--placeholder "Mode …"<br>[ -n "${_mode}" ] && fuzzel-emoji "${_mode}"<br>;;<br>type)<br>emoji=$(get_emoji)<br>wtype "${emoji}"<br>;;<br>copy)<br>emoji=$(get_emoji)<br>wl-copy "${emoji}"<br>;;<br>both)<br>emoji=$(get_emoji)<br>wl-copy "${emoji}"<br>wtype "${emoji}"<br>;;<br>*) usage ;;<br>esac<br>And in the file with the emoji data:😀 grinning face face smile happy joy :D grin<br>😃 grinning face with big eyes face happy joy haha :D :) smile funny<br>😄 grinning face with smiling eyes face happy joy funny haha laugh like :D :) smile<br>[…]<br>At that moment I thought nothing about it but deep in my subconscious I found the solution of a “problem” I had for a while.Which Key?<br>See, I was using a keyboard shortcut driven menu called wlr-which-key to manage my monitors, clipboard and stuff. It lets the user define menus with entries that are accesible by a single key press, the selected entry then runs an arbitrary command. Most entries I defined spawned a simple one line command, but in some other cases I used it to spawn a fuzzel script to pick an emoji or a clipboard entry.~/.config/wlr-which-key/config.yamlfont: JetBrainsMono Nerd Font 12<br>background: "#1d201d"<br>color: "#cccccc"<br>border: "#a6e06c"<br>separator: ": "<br>border_width: 1<br>corner_r: 0<br>padding: 15<br>anchor: "center"<br>margin_right: 0<br>margin_bottom: 0<br>margin_left: 0<br>margin_top: 0
menu:<br>- key: o<br>desc: Power<br>submenu:<br>- key: p<br>desc: Poweroff<br>cmd: poweroff
- key: s<br>desc: Suspend<br>cmd: systemctl suspend
- key: S<br>desc: Suspend then hibernate<br>cmd: systemctl suspend-then-hibernate
- key: h<br>desc: Hibernate<br>cmd: systemctl hibernate
- key: r<br>desc: Reboot<br>cmd: reboot
- key: l<br>desc: Logout<br>cmd: loginctl terminate-session self
- key: p<br>desc: Power Profiles<br>submenu:<br>- key: p<br>desc: Performance<br>cmd: |<br>powerprofilesctl set performance \<br>&& notify-send "Power Control" "Performance profile set" -u low
- key: b<br>desc: Balanced<br>cmd: |<br>powerprofilesctl set balanced \<br>&& notify-send "Power Control" "Balanced profile set" -u low
- key: s<br>desc: Save<br>cmd: |<br>powerprofilesctl set power-saver \<br>&& notify-send "Power Control" "Power-saver profile set" -u low
- key: m<br>desc: Monitors<br>submenu:<br>- key: r<br>desc: hdmi_right<br>cmd: kanshictl switch 'hdmi_right'<br>- key: l<br>desc: hdmi_left<br>cmd: kanshictl switch 'hdmi_left'<br>- key: t<br>desc: hdmi_top<br>cmd: kanshictl switch 'hdmi_top'<br>- key: b<br>desc: hdmi_bottom<br>cmd: kanshictl switch 'hdmi_bottom'<br>- key: o<br>desc: hdmi_only<br>cmd: kanshictl switch 'hdmi_only'<br>- key: c<br>desc: Clipboard<br>submenu:<br>- key: c<br>desc: Copy<br>cmd: |<br>cliphist list \<br>| fuzzel --dmenu --config ~/.config/fuzzel/clipboard-round.ini \<br>| cliphist decode \<br>| wl-copy
- key: d<br>desc: Delete Item<br>cmd: |<br>cliphist list \<br>| fuzzel --dmenu --config ~/.config/fuzzel/clipboard-round.ini \<br>| cliphist delete
- key: w<br>desc: Wipe<br>cmd: cliphist wipe
- key: r<br>desc: Reset Database<br>cmd: rm $XDG_CACHE_HOME/cliphist/db
- key: d<br>desc: Disks<br>submenu:<br>- key: u<br>desc: Unmount(all)<br>cmd: udiskie-umount -a
- key: e<br>desc: Eject<br>cmd: udiskie-umount -ae
- key: m<br>desc: Mount<br>cmd:...