tag_preview 605 B

123456789101112131415
  1. #!/bin/bash
  2. screenshot_dir="$HOME/.dwm/tag_previews/"
  3. if [ "$1" == "--hide" ]; then # If first argument is --hide execute
  4. killall rofi 2>/dev/null
  5. shift # shift the first argument
  6. fi
  7. if [ "$1" == "--show" ]; then # If first argument is --show execute
  8. file="${screenshot_dir}${2}.png" # $2 is the tag which will be previewed
  9. [ -f $file ] || exit 1 # Exit when file does not exist
  10. sed -i "s:${HOME}/.*\.png:$file:" $HOME/.config/rofi/tag.rasi #overwrites the tagname in rofi config
  11. rofi -show drun -theme tag 2>/dev/null
  12. fi