Variant on the define_word script #3
Replies: 2 comments
-
|
I have 1 more variant, this time to ask the user to input the word instead of giving it as an input argument. Why do that? It saves the user from having to type the directory every time, he can simply make a global hotkey and use the -e option to open up the terminal and run that script. This is the change. If you use the Alacritty terminal and the script is in ~/scripts and named word3 then simply set the global hotkey to this: alacritty -e ~/scripts/word3 Finally to prevent the terminal from closing down immediately after showing the output you have to add these lines on the bottom: This keeps the terminal in a loop until the enter-key is hit so that the terminal only closes after that and not directly before the user can read the output.. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks so much for the suggestions and ideas! Just added the ability for it to work from terminal, and commented out the option for echo in case it is wanted. Last idea is a great modification but since it would alter the functionality significantly I'll leave the script as is, but feel free to fork and add :-) Thanks again! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Not always it is possible to select a word by blocking it with the mouse, for example if a person is gaming or hears or sees (subtitles) a word in a movie/TV-show or song. So I changed the define_word script so that it also works from the terminal. The changes are quite trivial, I will paste the changed lines here and show both the script and how to use it in a screenshot. Feel free to add it to your repository and name it however you want.
Changed lines:
word=$1 #$1 refers to the first argument given when you start the script
bold=$(tput bold) #This makes it possible to print text bold with echo, required for visual clarity
normal=$(tput sgr0) #This makes it possible to reset the text to normal again with echo
echo "${bold}Definition of $word"
echo "${normal}$def"
Beta Was this translation helpful? Give feedback.
All reactions