Outils pour utilisateurs

Outils du site


issue98:tutoriel_conky

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
issue98:tutoriel_conky [2015/06/30 11:00] – créée auntieeissue98:tutoriel_conky [2015/07/06 07:45] (Version actuelle) d52fr
Ligne 1: Ligne 1:
-If you are like me, you have a lot to do and sometimes forget when something needs to be done.+**If you are like me, you have a lot to do and sometimes forget when something needs to be done.
  
 A couple of years ago, I wrote an article about using remind, but I have changed my setup enough that I thought a follow-up article might be worthwhile. There are many ways to keep track of tasks, this is how I am keeping organized – at the moment. A couple of years ago, I wrote an article about using remind, but I have changed my setup enough that I thought a follow-up article might be worthwhile. There are many ways to keep track of tasks, this is how I am keeping organized – at the moment.
Ligne 9: Ligne 9:
 The required programs are: The required programs are:
 • remind • remind
-• conky+• conky**
  
-Remind is an ultra geeky calendar program that was written by David Skoll. Remind can do almost anything related to dates. It reads the information stored in a reminders' file which is just a text file with reminders written in a format that remind can understand.+Si vous êtes comme moi, vous avez plein de choses à faire et, parfois, vous oubliez la date à laquelle il faut faire un truc précis. 
 + 
 +Il y a environ deux ans, j'ai écrit un article au sujet de l'utilisation de remind, mais, depuis, j'ai modifié ma configuration au point où je pensais qu'un deuxième article pourrait valoir le coup. Il y a beaucoup de moyens pour suivre vos tâches et voici comment je reste organisé, pour le moment. 
 + 
 +Cette solution vous affichera une liste chronologique de choses dont vous voulez vous souvenir, triées par échéance. La liste vous dira aussi combien de temps il reste jusqu'à la date butoir. Le temps est mis à jour automatiquement et la liste s'affiche sur votre bureau. Si cela semble intéressant, continuez votre lecture. 
 + 
 +En bas à gauche, vous voyez une capture d'écran de ma liste, qui se trouve dans le coin de mon bureau. [Ndt : « Countdown » = compte à rebours.] 
 + 
 +**Remind is an ultra geeky calendar program that was written by David Skoll. Remind can do almost anything related to dates. It reads the information stored in a reminders' file which is just a text file with reminders written in a format that remind can understand.
  
 The first part of the reminders' file is critical. The file I use has the text shown above at the top. The first part of the reminders' file is critical. The file I use has the text shown above at the top.
Ligne 18: Ligne 26:
  
  
 +REM 2015-04-11 +30 AT 13:00 MSG Minecraft Party %b (in [_countdown(trigdatetime()-current())])**
  
 +Écrit par David Skoll, remind est un programme ultra-geeky de calendrier. Remind sait faire tout et n'importe quoi, ou presque, qui a un rapport avec des dates. Il lit les informations stockées dans un fichier de rappel qui n'est qu'un fichier texte contenant des rappels dans un format compréhensible par remind.
 +
 +La première partie du fichier des rappels est capitale. Le fichier que j'utilise comporte le texte montré ci-dessus.
 +
 +En l'examinant,  vous pouvez voir que la première ligne est un « include », qui dit à remind d'inclure une liste de jours fériés (holidays) que j'ai dans un autre fichier. Ceci permet à remind d'inclure cet autre fichier dans la liste des événements/dates qu'il suivra à votre place. Les fonctions « helper » (assistant) disent à remind comment compter les minutes, les heures et les jours. La « main function » (fonction principale) est le code qui permet à remind d'afficher le nombre exact de jours, heures et minutes restants avant un événement. C'est tout ce qu'il y a à l'intérieur des parenthèses dans le scrot (SCReen-shOT ou capture d'écran).
  
 REM 2015-04-11 +30 AT 13:00 MSG Minecraft Party %b (in [_countdown(trigdatetime()-current())]) REM 2015-04-11 +30 AT 13:00 MSG Minecraft Party %b (in [_countdown(trigdatetime()-current())])
  
-This is an example of a reminder in the format that is required for remind to be able to understand an event.+**This is an example of a reminder in the format that is required for remind to be able to understand an event.
  
 The format begins with REM followed by the date and then how many days in advance you want this reminder to be displayed. In this case, I want to start being reminded 30 days in advance. The AT tells remind what time the event will begin. This is followed by MSG and the actual message you want to see. The ending %b tells remind to end with "in x days' time" and the code in the parentheses gives the exact breakdown of how much time is left. In the scrot above, you can see that there was two days' time until my kids' Minecraft party, specifically the party was in 1 day 22 hours and 53 minutes. The format begins with REM followed by the date and then how many days in advance you want this reminder to be displayed. In this case, I want to start being reminded 30 days in advance. The AT tells remind what time the event will begin. This is followed by MSG and the actual message you want to see. The ending %b tells remind to end with "in x days' time" and the code in the parentheses gives the exact breakdown of how much time is left. In the scrot above, you can see that there was two days' time until my kids' Minecraft party, specifically the party was in 1 day 22 hours and 53 minutes.
Ligne 28: Ligne 42:
 You could type out each new reminder or use snippets to speed up the process, but I found that to be too much work. So I wrote a very simple script (shown below) to make it easier. You could type out each new reminder or use snippets to speed up the process, but I found that to be too much work. So I wrote a very simple script (shown below) to make it easier.
  
-Basically, this script asks the user a few questions and then formats the answers into the remind format and adds the new reminder to the reminders' file.+Basically, this script asks the user a few questions and then formats the answers into the remind format and adds the new reminder to the reminders' file.**
  
-The only problem is that this results in a list that is not sorted by due date/time, but is just a chronological list of when each reminder was written.+Ceci vous montre un exemple de rappel dans le format nécessaire pour que remind puisse comprendre un événement. 
 + 
 +La ligne commence par REM suivi de la date, puis de combien de jours à l'avance il faut que ce rappel soit affiché. Dans ce cas, je veux que le rappel démarre 30 jours avant l'événement. AT indique à remind l'heure à laquelle l'événement commencera. Ensuite vient MSG et le véritable message que vous voulez voir. La fin %b dit à remind de terminer par « in x days time » (dans x jours) et le code entre parenthèses donne la répartition exacte du temps restant. Dans la capture ci-dessus, vous voyez qu'il restait deux jours avant la fête Minecraft organisée par mes gosses, plus précisément, la fête aurait lieu dans 1 jour 22 heures et 53 minutes. 
 + 
 +Vous pourrez taper chaque nouveau rappel ou utiliser des bribes par-ci par-là pour rendre le processus plus rapide, mais cela faisait trop de travail pour moi. J'ai donc écrit un script très simple (ci-dessous) pour faciliter les choses. 
 + 
 +Essentiellement, ce script pose quelques questions à l'utilisateur, puis formate les réponses dans le format de remind et ajoute le nouveau rappel au fichier des rappels. 
 + 
 +**The only problem is that this results in a list that is not sorted by due date/time, but is just a chronological list of when each reminder was written.
  
 To figure out how to sort the file, I turned to the Ubuntu forums. Advice I received from forum members Lars Noodén and ofnuts got me started and headed in the right direction. A little more time searching the web and I found a page (http://unix.stackexchange.com/questions/75366/sort-part-of-a-file) that explained how to sort part of a file. To figure out how to sort the file, I turned to the Ubuntu forums. Advice I received from forum members Lars Noodén and ofnuts got me started and headed in the right direction. A little more time searching the web and I found a page (http://unix.stackexchange.com/questions/75366/sort-part-of-a-file) that explained how to sort part of a file.
Ligne 40: Ligne 62:
 Note the (head -n 12 part of the code. This is needed because this tells sort to start sorting AFTER line 12. The reason for this is that I did not want any includes or functions to be sorted. In my reminders' file, the actual reminders begin at line 13. So I wanted everything up to and including line 12 left alone. Note the (head -n 12 part of the code. This is needed because this tells sort to start sorting AFTER line 12. The reason for this is that I did not want any includes or functions to be sorted. In my reminders' file, the actual reminders begin at line 13. So I wanted everything up to and including line 12 left alone.
  
-Great, so now we have an easy way to make reminders and a way to have the reminders sorted so that they are listed based on when they are due, with the next reminder at the top of the list and the event furthest from now at the bottom of the list. How do we get it on the desktop?+Great, so now we have an easy way to make reminders and a way to have the reminders sorted so that they are listed based on when they are due, with the next reminder at the top of the list and the event furthest from now at the bottom of the list. How do we get it on the desktop?**
  
-Enter conky. Configuring conky is a topic for another article. Check out the Ubuntu forums conky thread for specifics if you need to, but basically conky will read whatever is written in a conkyrc file and put that information on your desktop. Every conkyrc file has two parts. The top part, above TEXT, contains all of the Configuration Settings and the bottom part, below TEXT, contains all of the Variable Settings that you want displayed on the screen.+Le seul problème est que cela donne une liste qui n'est pas triée par échéance jour/heure, mais n'est qu'une liste chronologique des moments où les rappels ont été écrits. 
 + 
 +Pour essayer de comprendre comment trier le fichier, je me suis tourné vers les forums Ubuntu. Là, les conseils reçus des membres Lars Noodén et ofnuts m'ont permis de démarrer et m'ont mis sur la bonne voie. Après avoir cherché un peu plus sur le Web, j'ai trouvé une page (http://unix.stackexchange.com/questions/75366/sort-part-of-a-file) expliquant comment trier une partie d'un fichier. 
 + 
 +J'ai modifié leur exemple et l'ai rajouté à mon script « Reminder Maker ». 
 + 
 +(head -n 12; sort -k 2,2 -k5,5n) <~/.reminders 1<> ~/.reminders 
 + 
 +Remarquez la partie (head -n 12 du code. Il est nécessaire, car il dit à « sort » de commencer le tri APRÈS la ligne 12, parce que je ne voulais pas que des includes ou des fonctions soit triés. Dans mon fichier des rappels, les rappels eux-mêmes commencent à la ligne 13. C'est pourquoi je voulais que tout jusqu'à, et y compris, la ligne 12, reste dans l'état. 
 + 
 +Excellent, maintenant nous avons une méthode facile pour créer des rappels qui peuvent être triés afin qu'ils soient listés selon leur échéance, avec le prochain rappel au début de la liste et l'événement le plus éloigné à la fin. Comment la mettre sur le bureau ? 
 + 
 +**Enter conky. Configuring conky is a topic for another article. Check out the Ubuntu forums conky thread for specifics if you need to, but basically conky will read whatever is written in a conkyrc file and put that information on your desktop. Every conkyrc file has two parts. The top part, above TEXT, contains all of the Configuration Settings and the bottom part, below TEXT, contains all of the Variable Settings that you want displayed on the screen.
  
 So how do we get remind to output to conky? Below is the text part of my conkyrc file: So how do we get remind to output to conky? Below is the text part of my conkyrc file:
Ligne 53: Ligne 87:
  
 Further reading: Further reading:
 +http://conky.sourceforge.net/config_settings.html
 +http://conky.sourceforge.net/variables.html**
 +
 +C'est là que conky entre en scène. Le paramétrage de conky est un sujet pour un autre article. Jetez un œil au fil conky sur les forums Ubuntu pour des détails si vous en avez besoin, mais, essentiellement, conky lira tout ce qui est écrit dans un fichier conkyrc et mettra ces informations sur le bureau. Chaque fichier conkyrc a deux parties. La partie du haut, au-dessus de TEXT contient tous les Configuration Settings (paramètres de configuration) et la partie du bas, en dessous de TEXT, contient tous les Variable Settings (paramètres des variables) que vous voulez afficher sur l'écran.
 +
 +La question devient : comment faire en sorte que la sortie de remind soit envoyée à conky ? Voici la partie text de mon fichier conkyrc :
 +
 +TEXT
 +
 +${execpi 60 remind -q -r /home/john/~.reminders}
 +
 +Ceci dit à conky d'exécuter remind toutes les 60 secondes et d'afficher la sortie sur mon bureau. Remerciements à mobildiesel pour l'idée de l'ajout des drapeaux -q et -r à la commande remind. L'option -q fait que Remind ne stocke pas les rappels pour une exécution ultérieure. L'option -r désactive les directives RUN et la fonction shell(). Je ne sais pas pourquoi, mais, sans ces drapeaux, le conky se plantait. Leur ajout a corrigé le problème.
 +
 +Pour aller plus loin :
 http://conky.sourceforge.net/config_settings.html http://conky.sourceforge.net/config_settings.html
 http://conky.sourceforge.net/variables.html http://conky.sourceforge.net/variables.html
issue98/tutoriel_conky.1435654824.txt.gz · Dernière modification : 2015/06/30 11:00 de auntiee