#!/bin/bash # Simple dmenu-based snippet tool that copies selected snippet to clipboard SNIPPETS_DIR="$HOME/.local/share/dmenu/snippet" [ ! -d "$SNIPPETS_DIR" ] && mkdir -p "$SNIPPETS_DIR" # Select snippet file using dmenu SNIPPET=$(ls "$SNIPPETS_DIR" | dmenu -i -l 10 -p "Select snippet:") # Exit if no snippet selected [ -z "$SNIPPET" ] && exit 1 # Copy snippet content to clipboard cat "$SNIPPETS_DIR/$SNIPPET" | xclip -selection clipboard # Notify user notify-send "Snippet copied" "$SNIPPET copied to clipboard"