As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label dzen. Show all posts

I just finish this bzen2.sh script, it is used to replace twmn. Its a good program but I recently found out it has strange memory usage issue and I cant quite find out whats the cause. If I leave it runs for hours and have music plays, so the notifications would pop up every a few minutes. After hours, it could uses several hundred MB of memory.

I dont want to report since I dont think I can commit to help find out the bug and the author committed the feature and then removed it. I asked about it, didnt get a response yet. Anyway, I would just drop it since I feel my Bash script does a little better, though its not a daemon. Well, I dont really need a notification daemon actually.

Back to bzen2, the name is very clear, b stands for bouncing and zen2 for dzen2. So, it bounces and thats basically all it does. No options. All arguments after the command will be treated as a string and been fed to dzen2.

There is only one bouncing mode, which is below the cursor. Check out this clip:

https://i.ytimg.com/vi/awOk_YoQOb4/maxresdefault.jpg

(A/V is out of sync, an issue of x11grabr, havent started to fix it. All music in the video can be found on Jamendo)

This script uses a simple C code to get cursor information, so it can keep dzen2 below the cursor. It also depends on xwininfo, xprop, and wmctrl for necessary controlling.

Sexy bouncing!

I have an old script to generate current clouds map using Xplanet. Thats two and a half years ago and I recently revamped it, so I could use dzen to show the clouds map.

https://farm6.staticflickr.com/5060/5448106668_1f4411dae8_o.png

The first one, xplanet.sh, which downloads clouds image and monthly Blue Marble 2004 as background1. Xplanet combines clouds map and monthly Blue Marble image into one image, so you can display the merged image. The script wont download clouds image often, it only downloads new clouds three hours after previous download.

I dont recall I need to use configuration file, but this time I have to give configuration. There is a sample default configuration. I also add some commandline options for customization, such as changing font (-pango is required) and color, the position of label, the time. man Xplanet, its very useful.

The generated image shows the time since the clouds map is downloaded using -label_string "blah" with another script td.sh. I think this information is useful, because clouds map could be as old as up to three hours, or even older.

The second one, status-clouds.sh, I use it to convert JPEG image, which Xplanet generates, to XPM, the only color image format dzen accepts. This script also check time, it only runs Xplanet.sh after ten minutes from previous run for new image. Earth doesnt spin that fast and that only updates the line between day and night, and some numbers.

The files will be stored at ~/.xplanet and /tmp/clouds.xpm. You also need mogrify and convert programs for image manipulation and conversion.

The clouds is smiling at you! :-)

[1]This script will only download 12 times for the months of a year.

Just finished some changes for showing song title and artist of music which played by (S)MPlayer in my dzen.

The modified lf-submit.sh (lf-mplayer-wrapper.sh) doesnt extract time information because it will have to parse MPlayers output, though its not hard, but I just didnt want to do it. Beside, the script couldnt decide the song length, because I might set A-B playing mode. Basically, only song title and artist are available to display and thats what my dzen used to show me the songs played by MPD.

Except the time and players status, my dzen shows me same information as if showing MPD status, including Last.fm playcount and loved status. lf-submit.sh helps save the current song information to /tmp/lf-submit.sh.currentsong and my status.c pick up and show them, then lf-playcount-image.sh helps retrieve data from Last.fm.

I dont feel I really need song to be shown in dzen when I play a music video, you can just watch pictures, why do you want to read text? Anyway, it just got me something to do.

If you have watched the screencast above, you may notice that there are some glitches when rolling the text after 050. I knew someday I would have to fix that, problems with characters other than ASCII. Now, I really have to, but later.

Last few days, I have been watching German music video. I found there are some awesome videos and some funny ones. I will post later hopefully.

Oh, sorry for the last 1 minute and 30 second, seeing me fixing that exclamation mark thing!

I just discovered this much more powerful GNU gcal program. It has a lot of features that cal doesnt have. My base command to list calendar is:

% cal -3s
    December 2010         January 2011          February 2011
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
          1  2  3  4                     1         1  2  3  4  5
 5  6  7  8  9 10 11   2  3  4  5  6  7  8   6  7  8  9 10 11 12
12 13 14 15 16 17 18   9 10 11 12 13 14 15  13 14 15 16 17 18 19
19 20 21 22 23 24 25  16 17 18 19 20 21 22  20 21 22 23 24 25 26
26 27 28 29 30 31     23 24 25 26 27 28 29  27 28
                      30 31

The command for the similar result using gcal is:

% gcal .


                                2010/2011


      December                  January                   February
 Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa      Su Mo Tu We Th Fr Sa
           1  2  3  4                         1             1  2  3  4  5
  5  6  7  8  9 10 11       2  3  4  5  6  7  8       6  7  8  9 10 11 12
 12 13 14 15 16 17 18       9 10 11 12 13 14 15      13 14 15 16 17 18 19
 19 20 21 22 23 24 25      16 17 18 19 20 21 22      20 21 22 23 24 25 26
 26 27 28 29 30 31         23 24 25 26 27 28 29      27 28
                           30 31

My old dzen script showed 3-month calendar in this way:

http://farm6.static.flickr.com/5206/5238087713_a0d00fc585_z.jpg

Now its much better:

http://farm6.static.flickr.com/5241/5337378959_490043b340_z.jpg

And the code is sort of simpler, you can see the diff. The basic command is

gcal --cc-holiday=TW+US_NY --holiday-list=short --highlighting=\<:\>:[:] .

First arguments lists what country holidays I need, I use two, Taiwan and New York State of US, you can use plus sign + to list more than one. I also change the highlighting characters, so I can do some dzen syntax later. I tried to give it a string instead of single character, but gcal doesnt accept that. So I used <>[] which dont seem to be used by gcal itself, then used sed to replace with the strings I really need. You can use same method for ANSI color escape code if you want. Note that the last period . is for 3-month format. There are more information in its info page, info gcal, or you can run gcal -hh -p.

I think the most amazing part of gcal is you can have a holiday list. I think you can also import your schedule from some source with a bit of coding help. But I dont have such need, therefore I didnt dig in.

Few days ago, I posted about using dzen for system status. Within these days, I made more changes. Now it looks like

http://farm6.static.flickr.com/5204/5243206767_2706e0ea6c_b.jpg

It updates the content 5 times/s, so the volume changes when you adjust. In my old Conky, I set it to update every 6 seconds, its kind of weird after you press volume up button. Even before, 1 time/second, its still too long. When battery runs too low, the icon will blink. What can I say, I love my scripts.

Let me tell you whats in it, from left to right:

  • The first two parts are CPU utilization and Memory usage. If you click on icon, you will get a popup window like in this screenshot. It lists processes use most resource first. I was wanting to add kill button with -9 and -15 options, but ^ca() only supported in title area. I didnt want to adjust positions, that would require too much work and no scrolling in title area. Those red or pink color are reflecting the resource usage, if it consumed more, it gets redder.
  • Next one is root filesystem / usage. Nothing special this one, clicking on the icon brings up output of df.
  • Then the network transfer rate, fixed with interface ppp0.
  • The temperature.
  • Battery remaining capacity. This one has more colors than others. Icon color indicates different states. Green is the battery is charged, using AC source. Yellow is for discharging, if capacity goes too low, it will blink with red color. Blue means the battery is charging.
  • The music note is for MPD. It shows artist name and track name. If the text is too long, it scrolls for you to read all text! If you click on icon, it brings up a window like this.
  • Sound volume.
  • Date and time. Clicking on the clock brings up a 3-month calendar.
  • The last information box. I stuff update, load average, processes count, and weather in a window, you will see after you click on that icon.

You can get my configurations.

I think I have everything I need, but I wont stop tweaking it.