scripts/tofi/tofi-snippets.sh

10 lines
542 B
Bash
Executable File

#!/usr/bin/env bash
# Copy snippet to primary clipboard for middle-click pasting
# Maintain list of snippets in private repository
cd ${HOME}/.private-scripts/snippets
HEIGHT=$(swaymsg -t get_outputs | tr '\n' ' ' | sed -e 's/ */ /g' | sed -e 's/\(.*"focused": [a-z]*\),/\1\n/' | less | grep '"focused": true' | sed -e 's/.*"rect": {[^}]*"height": \([0-9]*\).*/\1/')
cat $(find ./ -type f | sed -E 's/\.\///' | ${HOME}/.local/bin/tofi --prompt-text 'Snippets: ' --height $HEIGHT --config ${HOME}/.dotfiles/tofi/sidebar.toml) | wl-copy -p