The git repo behind my blog.

index.html 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html lang="fr">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Phyks' blog - 2014/02</title>
  6. <link rel="stylesheet" href="//phyks.me/design.css"/>
  7. <link type="text/plain" rel="author" href="//phyks.me/humans.txt"/>
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <link rel="alternate" type="application/rss+xml" title="RSS" href="//phyks.me/rss.xml" />
  10. </head>
  11. <body>
  12. <div id="wrapper">
  13. <!-- Sidebar -->
  14. <aside id="sidebar-wrapper">
  15. <header><h1><a href="//phyks.me">~Phyks</a></h1></header>
  16. <h2>Catégories</h2>
  17. <nav id="sidebar-tags">
  18. <div class="tag"><a href="//phyks.me/tags/Arch.html">/Arch (2)</a> </div><div class="tag"><a href="//phyks.me/tags/Autohébergement.html">/Autohébergement (3)</a> </div><div class="tag"><a href="//phyks.me/tags/Dev.html">/Dev (7)</a> </div><div class="tag"><a href="//phyks.me/tags/DIY.html">/DIY (2)</a> </div><div class="tag"><a href="//phyks.me/tags/Électronique.html">/Électronique (2)</a> </div><div class="tag"><a href="//phyks.me/tags/Libre.html">/Libre (7)</a> </div><div class="tag"><a href="//phyks.me/tags/Linux.html">/Linux (5)</a> </div><div class="tag"><a href="//phyks.me/tags/Phyks.html">/Phyks (7)</a> </div><div class="tag"><a href="//phyks.me/tags/Smartphone.html">/Smartphone (2)</a> </div><div class="tag"><a href="//phyks.me/tags/Vim.html">/Vim (1)</a> </div><div class="tag"><a href="//phyks.me/tags/Web.html">/Web (6)</a> </div><div class="tag"><a href="//phyks.me/tags/Weechat.html">/Weechat (2)</a> </div>
  19. </nav>
  20. <h2>Derniers articles</h2>
  21. <ul id="sidebar-articles">
  22. <li><a href="//phyks.me/2014/10/dhcp_server.html">Utiliser son PC sous Arch pour connecter un Raspberry Pi à Internet</a></li><li><a href="//phyks.me/2014/08/sortez_vos_emails.html">Sortez vos emails, c'est pas sale&nbsp;!</a></li><li><a href="//phyks.me/2014/08/synchronisation_backups_1.html">Synchroniser ses ordinateurs 1/2</a></li><li><a href="//phyks.me/2014/08/free_mobile_fluctuant.html">Les énigmes du réseau Free Mobile</a></li><li><a href="//phyks.me/2014/07/notification_sms_free.html">Recevoir ses emails par SMS avec Free Mobile</a></li><li><a href="//phyks.me/archives.html">Archives</a></li>
  23. </ul>
  24. <h2>Liens</h2>
  25. <ul id="sidebar-links">
  26. <li><a href="//phyks.me/contact.html" title="Contact">Me contacter</a></li>
  27. <li class="monospace"><a href="//links.phyks.me" title="Mon Shaarli">find ~phyks -type l</a></li>
  28. <li><a href="https://github.com/phyks/" title="Github">Mon Github</a></li>
  29. <li><a href="//phyks.me/divers.html" title="Divers">Divers</a></li>
  30. </ul>
  31. </aside>
  32. <!-- Page content -->
  33. <header id="header">
  34. <h1><a href="//phyks.me">~Phyks</a></h1>
  35. </header>
  36. <div id="note_responsive">
  37. <p><em>Note</em> : Cliquez sur la bande bleue à gauche pour faire apparaître le menu.</p>
  38. </div>
  39. <div id="articles">
  40. <article>
  41. <aside>
  42. <p class="day">20</p>
  43. <p class="month">Février</p>
  44. </aside>
  45. <div class="article">
  46. <header><h1 class="article_title"><a href="//phyks.me/2014/02/notif_weechat_urxvt.html">Local notifications for Weechat and UrXVT</a></h1></header>
  47. <!--
  48. @author=Phyks
  49. @date=20022014-2057
  50. @title=Local notifications for Weechat and UrXVT
  51. @tags=Weechat, Linux
  52. -->
  53. <p>After moving from irssi to weechat, I decided to look for a way to have local notifications for IRC messages. The problem is that I run weechat through a screen on my server, which I access thanks to SSH. Thus, I need to find a way to allow weechat to communicate to my local terminal and send notifications.</p>
  54. <p>I found many solutions on the web which were using a local server or a pipe file. But these aren't fitted to my needs, as they need an external program running on my machine, which I don't want. I was quite sure there could be a way to do it, with nothing more than my terminal emulator and weechat plugins, and I finally found it. My solution is based on <a href="http://artisan.karma-lab.net/ajouter-notification-a-urxvt" lang="fr">karma-lab</a>'s one [French].</p>
  55. <p>The idea is to use the Bell signal which corresponds to the ASCII escape sequence 7 to raise attention (beep signal). The following steps work fine with UrXVT and weechat in a screen session. It may be possible to adapt this to other terminal emulators or terminal multiplexers (such as tmux) but I don't use them and can't help you much with it. We will define our own escape sequence, that will be interpreted by an UrXVT plugin and will spawn a notification with the IRC message.</p>
  56. <p>First of all, you will have to modify your <span class="monospace">~/.Xdefaults</span> or your <span class="monospace">~/.Xresources</span> to tell UrXVT to listen for bell signals. In order to do so, just add the following line:</p>
  57. <pre>URxvt*urgentOnBell: true</pre>
  58. <p>Then, reload it:</p>
  59. <pre>$ xrdb -load ~/.Xdefaults</pre>
  60. <p>Your UrXVT terminal now listens to bell signals. But we'd like them to spawn real local notifications. For this, I used libnotify, which is built-in in gnome. The main idea is to enhance our bell signal with a more complete escape sequence to include a message to display (using the so-called osc sequences). Thus, the sequence sent to UrXVT will look like <span class="monospace">[ESC]777;notify;TITRE;MESSAGEBELL]</span>. Just add the following plugin (written by <a href="http://artisan.karma-lab.net/ajouter-notification-a-urxvt">Karma-lab</a>[French] and slightly modified by me to enhance security) to your UrXVT and you are ready to go. So, you should put <a href="https://snippet.phyks.me/?snippet=52de79d12e4c9">this plugin</a> in <span class="monospace">/usr/lib/urxvt/perl/notify</span>.</p>
  61. <p>To test that everything worked correctly, you can use the following command:</p>
  62. <pre>$ echo -ne "\033]777;notify;Moi;Hello World\007\007"</pre>
  63. <p>which should spawn an "Hello World" notification on your desktop.</p>
  64. <p>Finally, if the previous example is working fine, let's integrate it to Weechat. We'll need another plugin for weechat, to make him write this escape sequence when needed to send notifications. This plugin is also from karma-labs, but as my weechat is running in a <span class="monospace">screen</span> session, I had to tweak it a bit. I improved security of the plugin as well, to prevent any unauthorized code execution. Concerning <span class="monospace">screen</span>, it is “consuming” the escape sequences for itself, and you have to tweak it a bit to make it pass through <span class="monospace">screen</span>. The python script to load in your Weechat can be found <a href="https://snippet.phyks.me/?snippet=52de79829dcbb">here</a>.</p>
  65. <p>Have fun with IRC and your brand new notifications !</p>
  66. <footer><p class="date">Le 20/02/2014 à 20:57</p>
  67. <p class="tags">Tags : <a href="//phyks.me/tags/Weechat.html">Weechat</a>, <a href="//phyks.me/tags/Linux.html">Linux</a></p></footer>
  68. </div>
  69. </article>
  70. <article>
  71. <aside>
  72. <p class="day">19</p>
  73. <p class="month">Février</p>
  74. </aside>
  75. <div class="article">
  76. <header><h1 class="article_title"><a href="//phyks.me/2014/02/news.html">Quelques nouvelles</a></h1></header>
  77. <!--
  78. @author=Phyks
  79. @date=19022014-2100
  80. @title=Quelques nouvelles
  81. @tags=Phyks
  82. -->
  83. <p>Attention, article 3615MaLife. Pfiou, ça fait plus d'un mois que je n'ai rien posté… La faute à un mois de janvier très chargé. J'ai plusieurs articles en attente, mais je n'ai pas réussi à trouver le temps de les terminer…</p>
  84. <p>Dans tout ça, mon serveur vient d'être <em>down</em> pendant environ 24h. C'est aussi ça l'autohébergement, une galère qui vous tombe dessus et vous passez 24h sans votre serveur. En l'occurrence, mes partitions sont du LVM sur du LUKS pour mon serveur. Je dois donc rentrer une phrase de passe en me connectant en SSH au démarrage pour déverrouiller les disques. Ça a toujours bien marché, mais cela refusait de fonctionner depuis la dernière mise à jour que j'ai faite (qui aurait dû être anodine, soit dit en passant).</p>
  85. <p>N'ayant pas redémarré mon serveur depuis 122 jours avant, je ne savais pas exactement à quel moment ça avait pu se casser, et le fait de ne pas avoir d'accès physique au PC n'aide pas à débugger. Enfin, finalement, j'ai réussi à tout redémarrer, par je ne sais trop quel moyen, et je prie pour que ça fonctionne encore la prochaine fois…</p>
  86. <footer><p class="date">Le 19/02/2014 à 21:00</p>
  87. <p class="tags">Tags : <a href="//phyks.me/tags/Phyks.html">Phyks</a></p></footer>
  88. </div>
  89. </article>
  90. </div>
  91. <footer id="rss">
  92. <p><a href="//phyks.me/rss.xml"><img src="//phyks.me/img/rss.png" alt="RSS"/></a></p>
  93. </footer>
  94. </div>
  95. </body>
  96. </html>