GeekTool allows you to run shell commands and render the results as widgets that are embedded into your desktop. This means that I never have to look further than my desktop to see what is on my to-do list. I embedded this into my desktop using GeekTool, and it updates automatically as my to-do list changes. basically, it shows you what you completed yesterday (or the last day on which you completed a task) and what is still on your list. I use todo.txt to manage my to-do list, and there is a little add on that takes your to-do list and produces a rundown. You’ll note I’ve made 3 annotations on the image. I found a cool typing paper background and an old typewriter font to give it some flavor. I use multiple “desktops” but all of them have the same basic look as above. I have a 27″ iMac so my screen is pretty big. Click on the image to see a larger version. And thanks to the fact that my to-do list is based on text files, and that I use text files for many other things, it was fairly easy to include some real-time analytics embedded into my desktop via GeekTool. I spent this afternoon giving my desktop a long-overdue makeover. It's basically a full-blown programming language, designed to deal with text files one line at a time, and it's really useful it's also something you can pick up a little bit at a time, if you're so inclined.Every now and then, I need a change of scenery, and that includes what I see on my computer desktop. Type "man awk" in the terminal for a full description of the command. If max is not greater than zero, then something wrong happened (maybe ioreg doesn't have a line which says "MaxCapacity") and so return the character "?". If the variable max is greater than zero, then take the contents of the array labelled "CurrentCapacity", divide it by max, and multiply by 100. Next it prints out the result of the formula max>0?100*c/max:"?"which is an if-then statement (with the form test?true:false awk stole this notation from C). Second, it defines the variable max to be the contents of the array labelled "MaxCapacity" (which was defined in the first part of the process). First it sets OFMT="%.2f%%", which means to change the output format so that it outputs real numbers with two decimal places followed by a percentage sign (as above). The END segment means to run the following command after you're done reading in standard input. (Unlike in some languages, awk's arrays can be labelled with text, not just numbers.) Whenever column 3 ($3) contains the word "Capacity" ($3~/Capacity), it runs the command "c=$5", which stores the fifth column into an array (a box) labelled with the contents of the third column. This awk command starts by reading in each line of ioreg -l, one at a time. The printf command calculates $10/$5*100 (that is, the 10th column divided by the 5th column, times 100) and prints it as a floating-point number with 2 decimal places ("%.2f") followed by a percentage sign ("%%").Īwk '$3~/Capacity/ ' (So $5 is the 5th column's data and $10 is the 10th column's). This first awk command reads the standard input, one line at a time (if necessary I'm guessing only one line is being sent to it here), and splits the line into columns, the data in column c having the name $c.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |