woodruffw / screenfetch-c

A rewrite of screenFetch in C.
MIT License
73 stars 17 forks source link

some changes #11

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hello William,

Decided to help you out with screenfetch-c, will list the changes here because I was working on 3 weeks old copy of your program.

Two pictures will be attached by the time you read this, so you can preview what I've done without reading the described changes below the pics:

to_send

to_send to_send2

colors.h - the non-bold colours was fixed by adding 0; , that is why the archlogo wasn't able to show darker colour where the manifest constants was substitued.

detect.h - comment in detect_arch function prototype, because it will be moved to the "Kernel", detect_distro function prototype now takes two formal parameters, the second parameter/argument will be used so we can print the "user@hostname" with the same colour as the detected distro one. detect_host takes two formal parameters/arguments (explained earlier what it will do with "user@hostname"). detect_gtk function prototype now takes 3 formal parameters/arguments, so we can print "Icon Theme" and "Font" which are detected by the detectgtk bash script.

Fixed the detectgtk script, because it was overriding the detected gtk themes and icon theme, added proper testing and new location to look for gtkrc, few variables was declared so we can make our life easier instead typing same strings over and over again.

Fixed detectgpu script, wrote proper gpu detection with g/awk and deprecated the sed one.

disp.h - Added two function prototypes so we can eliminate some of the repeating code in disp.c

disp.c - In main_ascii_output function changed the for loop condition values regarding "Arch Linux", so the loop can iterate one more time and show the whole logo instead truncating the last part of it (the very bottom). Removed all 'for' loops in output_logo_only and main_ascii_output functions body, so now they do function calls to process_data and process_logo_only, thus following the "Don't Repeat Yourself" principle.

main.c - comment in the 'arch_str' chararacter array, added icon_str and font_str char arrays, later one host_colour char array was added so it will hold the printable "user@hostname" colour. Removed arch_str and added icon_str and font_str in detected_arr. Removed "Arch: " and added "Icon theme: ", "Font: " in detected_arr_name. The functions that takes more arguments was edited (see the changes in detect.h)

detect.c - same description as detect.h but instead function prototypes the function headers was edited and their body to match the actions described in detect.h

There is a lot work to be done, as I edited only the plat/linux/detect.c module.

It would be great if you could replace getopt.h with argp.h, also if you could add internationalization support with gettext and *.po files it will be neat feature because everything will be shown in native system language instead English, there is no way to predict what the "detected" text will be as user hardware varies, so it shouldn't be translated.

Could you switch to cmake or autoconf/autotools (gnu build system) instead standalone and predefined Makefile ?

Any changes that are not described here are probably overwritten by my old screenfetch-c copy.

Best regards, Aaron Caffrey

woodruffw commented 9 years ago

These changes look great! Thank you for introducing them. I'll merge them in and do some testing tonight.

Edit: On the argp.h note: I'm refraining from using argp.h for the moment, until I can guarantee that it doesn't complicate the build process on some of the less reasonable *nixes out there. It'll probably get added eventually. On internationalization: That's something that I've been meaning to add for a while now. Expect to see that in a few weeks. On a different build system: That's also something I've considered. I don't have a lot of experience with autotools or cmake, though. If you could contribute something like that (or point me to a good resource), I would be very grateful.

Thanks again, William

ghost commented 9 years ago

With autotools I don't know how to detect the current operating system, otherwise it is no brainer to me to write the rest of it, same goes for the internatilization, once autotools or cmake is created the gettext library will be incorporated easily as I already used it in my first C gui program (pdf2img-c) Here is my program, feel free to examine and copy the needed code https://github.com/wifiextender/pdf2img-c