To my second post.. ..I am going to show you (something that some may find quite useless) as change the color of my favorite screensaver (screensaver, screensaver) about xscreensaver, G.L.Matrix, which if you do not know it is a simulator of the typical symbols falling through the monitor in the Matrix style with beautiful 3D effects. Here is an image:
As I am quite annoying, and my computer is customized with the colors black and the characteristic blue of Arch Linux (which looks great with my blue backlit keyboard xD) .. ..the typical green of Matrix, it does not combine me (or as one would say around here and among children, it does not even hit with mucus).
To achieve this, we will meddle in the source code of the xscreensaver, do not panic the inexperienced, it is simple, and I will guide step by step so that they achieve it; with this I want to tell you, that I am not going to leave things already chewed, but that the idea is that they take a drink and put their hand..without fear.
Let's do it..
1- Download source code of xscreensaver.
We can enter the xscreensaver page, and we download the latest version of source code (source code).
Or we can download directly from the terminal with wget, always knowing the version of itIn this case 5.20:
$ wget http://www.jwz.org/xscreensaver/xscreensaver-5.20.tar.gz
We unzip it:
$ tar -xf xscreensaver-5.20.tar.gz
2- Check your dependencies.
We are going to verify that we have the necessary packages so that the xscreensaver can be used, for this we will use the 'configure'. Must pay attention at the exit (output) that they give us, to know if we some package is missing, or is there some error. If a package is missing, look for it and download it (it can be through synaptics, apt, pacman, etc. - depending on likes and distros).
-We enter the newly unzipped folder:
$ cd xscreensaver-5.20/
We execute the following:
$ ./configure
3- We verify correct operation.
If no package is missing, nor have no mistake; we proceed to to install the xscreensaver, to verify that it works correctly.
We execute:
$ make
If there are no errors in the make, as a user 'root' we install it:
# make install
We test:
$ xscreensaver-demo
4- Modify /hacks/glx/glmatrix.c
They will talk with their text editor favorite (vim, nano, gedit, etc) in my case I saw, the file that we are going to modify in this case:
$ vi ./hacks/glx/glmatrix.c
They have to find a block with the following crafts:
{
unsigned long p = XGetPixel (xi, x, y);
unsigned char r = (p >> rpos) & 0xFF;
unsigned char g = (p >> gpos) & 0xFF;
unsigned char b = (p >> bpos) & 0xFF;
unsigned char a = g;
g = 0xFF;
p = (r << rpos) | (g << gpos) | (b << bpos) | (a << apos);
XPutPixel (xi, x, y, p);
}
Y we add as follows the desired color:
{
unsigned long p = XGetPixel (xi, x, y);
unsigned char r = (p >> rpos) & 0xFF;
unsigned char g = (p >> gpos) & 0xFF;
unsigned char b = (p >> bpos) & 0xFF;
unsigned char a = g;
r = 0x71;
g = 0x93;
b = 0xD1;
p = (r << rpos) | (g << gpos) | (b << bpos) | (a << apos);
XPutPixel (xi, x, y, p);
}
Being in RGB Hexadecimal (red-green-blue)
E.g., the characteristic blue of Arch Linux is he: #1793D1, remaining:
r=0x71;
g=0x93;
b = 0xD1;
We keep the changes.
5- We recompile the new xscreensaver with the modified glmatrix.
At this point we will do practically the same as in the point 2, but this time to capture the changes we made.
We execute:
$ make clean
Then:
$ make
If no kind of error came up in make, as user 'root' we execute:
# make install
6- We execute, verify, configure and enjoy.
We execute:
$ xscreensaver-demo
In the list we choose G.L.Matrix:
And in the presentation it should already be seen in the color they chose.
Configure to taste .. and enjoy 😉
7- Some examples of different colors. (+ TIP)
TIP: to know a color en Hexadecimal i use GIMP, we open the color palette and figure as "HTML notation". We can also press the 'o'and take the color of an image to know what its color is in Hex.
I hope you have enjoyed trying and writing it as much as I did. Do not hesitate to consult with any questions.
Happy hacking ..
Well, if it looks pretty and everything, but there is nothing like the classic green color.
Thanks for your comment .. ..it is clear that classic is classic ..
But the funniest thing about this (at least for me) and what prompted me to do it .. ..is knowing that having the source code in front of us .. is like saying “I have Linux, and how I want to change it. . ..may l!.."..
Thanks for reading .. 😉
Excellent article, who would have imagined that on a subject as elementary or simple as a screensaver, we were going to have a whole class of compilation, modification and installation of it.
Thank you! .. ..I am glad that you are interested ..
For me it was quite a learning odyssey too;) ..
is there any difference with using:
$ sudo pacman -S xscreensaver
For what part? .. ..if you refer to points 2 and 3 to verify if it works .. in your case if you use Arch..yes, it is the same .. since we always have the latest version .. ..but for other distros may not be the same ..
On the other hand..if you don't download the source code .. ..you could not do the color modification .. which is the objective of this post ..
Did I answer your question?
ok thanks for the tip ^ _ ^
Thank you so much!!
The procedure is very interesting.
Regards!
Thanks for the contribution 😀
Is it possible for you to share the modified model with the color red? thank you