In some cases you may experience that the script seems to silently fail or that it fails after a certain amount of time. The process will not end until the script either fails, you close the Terminal-window or you send a sigkill-signal. When typing irssi_notifier in Terminal you should now be able to manully run the process. Fix the ssh-details in the script and save.Copy and paste the code above into ~/.bash_profile.Open or create the file ~/.bash_profile.Please note that you will need to change ssh in the code above to your correct information. Terminal-notifier -title " \" $heading \" " -message " \" $message \" " -open " \" $url \" " fi done Terminal-notifier -title " \" $heading \" " -message " \" $message \" " -activate else Url= `echo \" $message \" | grep -Eo 'https?:// ' | head -1 ` if then Ssh 'echo -n "" > ~/.irssi/fnotify tail -f ~/.irssi/fnotify ' | \ When there is no link it will activate the Terminal-window instead. If it finds a link it uses the -open flag in terminal-notifier to make it so the url opens in your browser if you click on the notification message. This script displays the messages but will also look for links. Now you need to create a script on your Mac that will read from the file on the server in "real time" and then send the messages to the Mac OS X Notification Center with terminal-notifier.īelow we have provided you with a basic function you can use and experiment with. Part 3: Read messages from server and send notifications If you click on the notification box you will activate Terminal. This should cause a notification message to appear on your screen and you will see the confirmation message * Notification delivered. terminal-notifier -title 'Title' -message 'This is a simple test message.' -activate Once the ruby-version is installed you can test it by typing the following in Terminal. Type gem install terminal-notifier in Terminal.The next parts assume however that you have installed the ruby-version as detailed below. The official readme from the developer should be good enough to show you how to install and use it. Terminal-notifier is a very useful tool that makes it easy to trigger OS X Notifications from Terminal and scripts. Part 2: Installing terminal-notifier on your Mac You can do this simply by repeating the command /script load. If you ever create your own script remember that you'll have to reload the script in irssi each time you have saved changes before irssi will execute the updates. Please type /help hilight in irssi for more details. If you didn't change the code this should be saved to the file ~/.irssi/fnotifyĮnsure this is working by having another irc user hilight you or send you a private message and then open /.irssi/fnotify to see if the message was written to it.īy default it's likely that your IRC username trigger hilights, but you can also add other terms it should match. Irssi should now begin to write private messages and hilights you receive to the log file. In irssi, load your script by typing /script load.Continue irssi from an already existing screen session or start irssi.Copy and paste the code from into the file.Go to ~/.irssi/scripts (Create any missing folders).We'll use fnotify in this walktrough, but feel free to create your own script that will retrive what you want it to retrieve.įnotify was authored by Thorsten Leemhuis and released under the GNU General Public License. The first thing we need is a script for irssi that will write what we want to display in the notification center to a file on the remote server. Part 1: Writing messages to file on a remote server Basic knowledge on the above terms and programs including Terminal.You use an ssh key to connect to the remote server (For Part 4 atleast).Remote server running a screen session with irssi. We assume that you have the following knowledge and tools:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |