What I am trying to do is, I have a few texts in a file & when I tap a key combination like ctrl+Q, the text should appear as a notification on my Ubuntu Desktop. What is the command to assign this keyboard shortcut?
Asked
Active
Viewed 774 times
2
-
O_O wat? I think you will need to develop a software to accomplish something like that. – Lucio Sep 18 '14 at 05:41
-
How big would the text be? only a few lines or a text block? – Jacob Vlijm Sep 18 '14 at 06:05
-
Only a very few lines. – Anandu M Das Sep 18 '14 at 07:20
-
would you use sections (lines) or the whole file at once? – Jacob Vlijm Sep 18 '14 at 07:22
-
Just that line. I know how to write the script for that. But i want to execute that script using the keyboard shortcut. – Anandu M Das Sep 18 '14 at 07:27
1 Answers
3
You can use the notify-send tool:
cd $HOME
touch foo
echo "foo\nbar\nbaz" > foo
notify-send "TEST" $(cat ~/foo)
it will create a notification like the one below:
Finally read How to add keyboard shortcuts? to enable Ctrl+Q for this notification (or better choose another combination as this one is already occupied - Thanks Jacob Vlijm).
Update:
All you have to do now is to create a small launcher (foo.sh
):
#!/bin/bash
notify-send "TEST" $(cat ~/foo)
Change its permissions:
chmod 777 foo.sh
And assign to your new shortcut the full path of your launcher:

Sylvain Pineau
- 62,169
-
-
I have a script to show the notification. But the script is in some other directory. So how can I set that to open with my assigned keyboard shortcut? – Anandu M Das Sep 18 '14 at 07:35
-
@AnanduMDas I've updated my answer to detail how to create the shortcut – Sylvain Pineau Sep 18 '14 at 07:48
-