5

Sometimes, I want to create s̶t̶r̶i̶k̶e̶o̶u̶t̶ strikethrough text quickly and easily. What's a quick way to do this that is usable in any program?

P.S. Someone should add 'strikethrough' as a tag for this -- I'm just not reputable enough to create a new tag.

Mr. B
  • 521

1 Answers1

5

This is what I did to make this globally available:

I have a folder for stuff I install locally in my user account called ~/.local/bin, but you don't have to put this there, you can put it wherever is most convenient. This only affects my login.

  1. Install xsel to enable manipulation of clipboard contents:

    sudo apt install xsel
    
  2. Create a bash script to add strikethrough to copied text. I call mine strikethrough.sh. You can comment out one of the two lines by putting a # character in front of the line starting with xsel:

    #!/bin/sh
    # affects only highight/middle click
    xsel --primary | sed $"s/./&\xCC\xB6/g" | xsel --primary
    

    affects only clipboard text (ctrl-c/ctrl-x and ctrl-v)

    xsel --clipboard | sed $"s/./&\xCC\xB6/g" | xsel --clipboard

  3. Create a keyboard shortcut that executes the script. I use Ctrl+Shift+X. If you're unfamiliar with how to do this, check out How to add keyboard shortcuts?

  4. Use it whenever you need strikethrough text! Cut/Copy your text as normal, press your keyboard shortcut, then paste as normal -- V̶i̶o̶l̶a̶ Voilà!

Credits:

Mr. B
  • 521