diff options
| author | Mitsuo Tokumori <[email protected]> | 2025-06-25 03:21:50 +0900 |
|---|---|---|
| committer | Mitsuo Tokumori <[email protected]> | 2025-06-25 03:21:50 +0900 |
| commit | a2f2b28f086c455f85e3ec31c1fdde54b363744c (patch) | |
| tree | b227975dc57d7ec44d4e58337a833641a73e83a3 /public/.local | |
| parent | 0ef90b80e441afdc8dada2b7c2f28fef415bf37e (diff) | |
| download | dotfiles-a2f2b28f086c455f85e3ec31c1fdde54b363744c.tar.gz dotfiles-a2f2b28f086c455f85e3ec31c1fdde54b363744c.tar.bz2 dotfiles-a2f2b28f086c455f85e3ec31c1fdde54b363744c.zip | |
Add dmenu-snippet.sh
Diffstat (limited to 'public/.local')
| -rwxr-xr-x | public/.local/bin/dmenu-snippet.sh | 17 | ||||
| -rw-r--r-- | public/.local/share/dmenu/snippet/references.wiki | 3 | ||||
| -rw-r--r-- | public/.local/share/dmenu/snippet/syntaxhighlight.wiki | 7 |
3 files changed, 27 insertions, 0 deletions
diff --git a/public/.local/bin/dmenu-snippet.sh b/public/.local/bin/dmenu-snippet.sh new file mode 100755 index 0000000..46f21de --- /dev/null +++ b/public/.local/bin/dmenu-snippet.sh @@ -0,0 +1,17 @@ +#!/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" diff --git a/public/.local/share/dmenu/snippet/references.wiki b/public/.local/share/dmenu/snippet/references.wiki new file mode 100644 index 0000000..518f731 --- /dev/null +++ b/public/.local/share/dmenu/snippet/references.wiki @@ -0,0 +1,3 @@ +== References == + +<references /> diff --git a/public/.local/share/dmenu/snippet/syntaxhighlight.wiki b/public/.local/share/dmenu/snippet/syntaxhighlight.wiki new file mode 100644 index 0000000..eef2530 --- /dev/null +++ b/public/.local/share/dmenu/snippet/syntaxhighlight.wiki @@ -0,0 +1,7 @@ +<syntaxhighlight lang="c"> +#include <stdio.h> +int main(int argc, char *argv[]) { + printf("Hello world!\n"); + return 0; +} +</syntaxhighlight> |
