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

I was really bored and somehow I decided to make a heatmap out of X cursor position in terminal. The following image shows the result and here is a video:

https://lh6.googleusercontent.com/-Iqlh5J3Relc/UmJgkhY9XQI/AAAAAAAAFQ4/fUdM-1pGQo4/s800/xcinfo-heatmap.png

This is just for fun, nothing really useful. The X cursor position is translated into terminal window space, then heating up and the heat would also cool down as time goes by. The heat scale is the rainbow hues, which I roughly calculated into 256 terminal colors.

If you are interested in xcinfo, it might be useful if you need to script with X cursor infomation. I had not touched the code more than a year ago until now.

Before I moved xcinfo to Bitbucket, I had already written script to plot the trail of my mouse movement. The following image demonstrates the movements of 4 hours:

http://2.bp.blogspot.com/-pIuZmkxPwXU/T5XhWHHA20I/AAAAAAAADQo/_I5twVL5Pvk/s800/test.png

For every position my mouse at on screen, it will be render as a circle (radius = 10 pixels) with radical gradient, the position is polled every 0.1 seconds. For consecutively same position is only rendered once.

From what I see, the high density are seem to be around little to the right and bottom of center pointer. This area probably is where I usually have the focus of web page placed and click up on if I do.

Also a horizontal line near on the top edge, and you can also see there is actually a space in the line, thats because I use dwm and usually I have two windows vertically split. That line should indicate my movement over Firefoxs tab handlers.

4 hours would have 4 * 3600 * 10 = 144,000 points at most. If we roughly count the redundant rate is 90%, then its about 14,400 point rendered. But I dont think mine is lower then that. And clearly, there are a vast region which my mouse has never visited because there is no need to when you use tiling window manager and mainly use mouse to control windows.

You can get the code and make one of your own, please head over to project repository and read mouse trail subsection in Examples section.

xcinfo is a utilization I use for bzen2, it was hosted on GitHub alongside my dotfiles. Because of this one-liner, I decided to move it to its own repository and expand it with a few examples.

That one-liner snaps a screenshot after detecting mouse movements. I like this idea, though it has no use for me. I think its more or less for security measure. The method it uses is to read the device file of X pointer, it has pros but also the cons. I decided to write an alternative using xcinfo, which becomes an example of xcinfo.

I am sure some of you who write shell scripts has hard time to get X cursor information, mainly the X and Y position. I was not aware of any handy program for getting those two numbers. Thats why I wrote that little C code in the first place last year.

The information which xcinfo provides should cover most of your usage, the cursor position and screen size. If you need more, open a feature request issue, I will see what I can do about. A pull request, that would be even better.

By the way, I have also worked on a fun example, you can also read the examples section on project website.

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!