Daily Journal With Panel Launcher

Want to support HowtoForge? Become a subscriber!
 
Submitted by ardchoille42 (Contact Author) (Forums) on Thu, 2009-09-17 13:04. :: Ubuntu

Daily Journal With Panel Launcher

I keep a daily journal because my memory is not what it used to be. I have friends who keep daily journals just because they like to write.

I use gedit for most text-related work and recently learned how to make a special panel launcher for my journal. I keep my daily journal in a folder called "office" but the month and year change, so my journal for this month is named 200908.journal or "yyyymm.journal". Now, making a panel launcher to open a file with gedit is no big deal but I found that using "gedit /home/user/office/*.journal" in the Command portion of the launcher doesn't work. I think this is due to the wildcard, "*", and I will show you how to overcome this problem. Using the month and year in the panel launcher requires that you edit the launcher every month and I didn't want to have to do that so I came up with a way to open a file from a panel launcher regardless of the file name.

 

Creating The Journal

Create a new text file in your desired location. I use the command line for many things so creating the journal file in a terminal is as easy as:

touch /path/$(date +%Y%m).journal

This creates a new empty file with 200908.journal as the file name - I like to keep journal entries separated by month.

 

Creating The Launcher

I use gnome as my desktop environment so creating a panel launcher is as follows:

  • Right click on an empty place on the panel
  • Choose "Add to Panel"
  • In the Add to Panel dialog, choose Custom Application Launcher
  • Click the Add button
  • Assign the launcher an icon with the icon button (top left)
  • Assign a Name for the launcher
  • Enter sh -c "gedit /path/*.journal" for the Command substituting your desired path for /path. This is required or the launcher will not work.
  • Add a Comment for the launcher (optional)
  • Click the OK button

You should now have a new launcher in your panel that will open any file in your desired path that has the .journal file extension. Using this method I can simply move the old journal file to my archives and make a new journal file as the months change without having to edit the panel launcher every month.

 

Timestamps In Journals

One of the things I like about gedit is that it allows you to customize the time stamp. This aids in locating journal entries when I have forgotten the date of a particular entry. Gedit can highlight every instance of a word in a file so it's easy to see where one entry ends and the next one begins.

Open gedit and click Edit > Insert Date and Time. The Date and Time dialog allows you to insert from a list of pre-configured dates and times. I wanted to customize this so I ticked the radio button next to Use custom format and entered my own format. I used

TIMESTAMP %a %d %b %Y %I:%M:%S %p %Z

but you can create your own format using the information found in man date.

 

Automation

The above method requires that the journal file be moved and a new journal file be created as the months change, otherwise you'd be working on the same file with an old month number next month. You can automate this process with a cronjob. Please see my Crontab Tutorial for more information about how to set up a cronjob.

Once all of this is set up - less than four minutes - the user needs only click the panel launcher to edit the journal and the system maintains the journal files over time.

Happy writing :)


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Kelly Fulks (not registered) on Thu, 2009-09-17 13:35.

Create a shell script in your $HOME/bin directory as follows

#/bin/sh
/usr/bin/gedit $HOME/.journal/`date +%Y%m`.journal

Don't forget to make your shell script executable using chmod.

Then you can link this to the launcher button and it will always open the file for the current month and year.  When you browse to the .journal folder, you will see all the journals sorted properly by month and year if you need to reference an older one.

 No cron job, no editing the launcher, not looking in separate places.  This could be further enhanced by placing the files into yearly directories if desired, or maybe you want a daily journal instead of a monthly journal.  The possibilities become nearly endless by using a panel launcher with a shell script for something like this.