GithubHelp home page GithubHelp logo

screenfetch-c's Introduction

screenfetch-c

Build Status

Current Version: 1.6 (release)

screenfetch-c is an attempt to rewrite screenFetch, a popular shell script that displays system information and an ASCII logo, in the C language. Like the original screenFetch, screenfetch-c is meant to be compatible with a number of systems, including the BSDs, Solaris, GNU/Linux, OS X, and Windows.

Installing screenfetch-c

Dependencies:

screenfetch-c only relies on libraries that come on virtually every system.

  • On Linux, OpenGL is used to detect the GPU. In most package managers, this is listed as libgl-dev.

  • On Linux and Solaris, libX11 is required. In most package managers, this is listed as libX11-dev.

Installing screenfetch-c is very simple:

$ git clone https://www.github.com/woodruffw/screenfetch-c.git
$ cd screenfetch-c
$ make

If you want to disable colors you can run make COLORS=0 instead.

Note: For Solaris, make must be GNU make. If it isn't, use gmake. Using regular (Sun) make will cause strange errors.

Arch Linux

screenfetch-c is availible on the AUR

OS X

screenfetch-c is also available via Homebrew!

To install it, just run the following:

$ brew install woodruffw/screenfetch-c/screenfetch-c

Removal:

Removing screenfetch-c is just as easy as installing it:

$ sudo make uninstall

If you installed it via Homebrew:

$ brew rm screenfetch-c
$ brew untap woodruffw/screenfetch-c # optional

Contributing

There are a number of things that still need to be tested or completed in screenfetch-c.

If you think that you can test/fix/improve one or more of them, feel free to fork and issue requests back to me.

In particular, the following things still need to be done:

  • Improve error checking and handling.
  • Matching screencapture capabilities on Windows with OS X/Linux/BSD/Solaris
  • Improve RAM/HDD detection on BSD
  • Fix manual mode on Windows
  • Improve features on Android
  • Improve/replace configuration format and parser

Notes on MinGW

Shell detection on the MinGW build is limited. You must set the SHELL environment variable manually if you're running screenfetch-c from command prompt or PowerShell. For command prompt that's set SHELL=cmd.exe and for PowerShell it's $env:SHELL = "PowerShell".

You can also run screenfetch-c from a batch script

@echo off
set SHELL=cmd.exe
echo.
cmd /C screenfetch-c.exe
echo.
pause

or a PowerShell script

$env:SHELL = "PowerShell"
Write-Host ""
Invoke-Expression -Command:"cmd /C screenfetch-c.exe"
Write-Host "
Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

if you prefer to start it with a double click.

Unlike PowerShell the Windows command prompt doesn't support ANSI colors by default. You can deactivate colors if you build with make COLORS=0. However there's a neat project called ANSICON which allows you to enable colors in command prompt by running screenfetch-c with cmd /C ansicon.exe screenfetch-c.exe.

Current Known Compatibility:

Note: These are only the ones that have actually been tested (so far). screenfetch-c may very well work on many of the untested distros, so feel free to try it.

  • OS X
  • Windows (Cygwin, MSYS2, MinGW)
  • Arch Linux
  • Fedora
  • Linux Mint
  • LMDE
  • Ubuntu (including derivatives)
  • Fedora
  • Debian
  • CrunchBang
  • Gentoo
  • Funtoo
  • FreeBSD
  • OpenBSD
  • NetBSD
  • DragonFlyBSD
  • OpenSUSE
  • Mandriva/Mandrake
  • Slackware
  • Red Hat (RHEL)
  • Frugalware
  • Peppermint
  • SolusOS
  • Mageia
  • ParabolaGNU/Linux-libre
  • Viperr
  • LinuxDeepin
  • Chakra
  • Fuduntu
  • Trisquel
  • Manjaro
  • ElementaryOS (styled as 'elementary OS')
  • Scientific Linux
  • Backtrack Linux
  • Kali Linux
  • Sabayon
  • Android (requires -D "Android" flag)
  • Linux (upon failure to detect a specific distro)
  • Solaris (including SunOS, OpenSolaris, and OpenIndiana)
  • Angstrom

License

screenfetch-c is licensed under the MIT license.

For the exact terms, see the license.

screenfetch-c's People

Contributors

danyisill avatar darealshinji avatar kittykatt avatar m-wells avatar nachosimo avatar woodruffw avatar zerweck avatar zzxyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

screenfetch-c's Issues

overflow in memory detection

image

igc@thor:screenfetch-c$ prtdiag | grep -i 'memory'
Memory size: 130848 Megabytes
======================= Physical Memory Configuration ========================
igc@thor:screenfetch-c$ screenfetch-c
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM igc@thor
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM██MMMM$MMMMMMMMMMMM OS: SunOS
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM█MMMM██MMMM█MMMMMMMMMMMM Kernel: 5.11
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM████████████MMMMMMMMMMMM CPU: UltraSPARC-T2+ (chipid 65552, clock 1415 MHz)
MMMMMMMMMMMMMMMMMMMMMMMMMM██M██████████████MM█MMMMMMMMM GPU: Unknown
MMMMMMMMMMMMMMMMMMMMMMMMMMM████████████████████MMMMMMMM Shell: bash version 4.3.33(1)
MMMMMMMMMMMMMMMMMMMMMMMMMMM███████████████████MMMMMNMMM Packages: 942
MMMMMMMMMMMMMMMMMMMMM██████████████████████████████MMMM Disk: 2G / 3G (66%)
MMMMMMMMMMMMMMMMMMMMMMMM█████████████████████████MMMMMM Memory: -224MB
======================================================= Uptime: 69d 22h 17m 27s
MMM###NMMMMM####MMMM##MMMMMM####MMMMM#####MM##MMMM###MM Resolution: 1600x1200
MM##MMMMMM###MM###MM##MMMM##MMM##MMMM###MMMM##MM###MMMM DE: Gnome
M##MMMMMMM##MMMM##MM##MMMMMMMMMM##MMM##MMMMM##MM##MMMMM WM: Metacity
MM####MMM###MMMM##MM##MMMMM#######MMM##MMMMM##MMM####MM WM Theme: Unknown
MMMMM###MM##MMMM##MM##MMMM##MMMM##MMM##MMMMM##MMMMMN##M GTK: Not implemented
MMMMMM##MM###MM###MM##MMMM##MMM###MMM##MMMMM##MMMMMM##M Icon Theme: Unknown
M######MMMMM####MMMM=####MM#######MMM##MMMMM##MM#####MM Font: Unknown
igc@thor:screenfetch-c$

igc@thor:screenfetch-c$

MinGW compatibility

It would be nice if screenfetch-c was full functional as a standalone program in cmd.exe when built with the MinGW compilers.
It can already be build with MinGW if you add -lws2_32 to the LDFLAGS but the output in cmd.exe is obviously a mess since the Unix specific features are missing and the bash color flags are ignored.

manjaro & integrated gpu

Doesn't work:

  • OS is ManjaroLinux but should be Manjaro 0.8.10 Ascella
  • GPU not detected (Intel HD 4400)
  • DE & WM not detected (gnome shell)
  • Packages is 0 (can get from pacman -Q | wc -l)
  • GTK themes not found (is adwaita), regular screenfetch doesn't find them either

Development on OS X and Windows

I'm just leaving this issue open as a notice to potential OS X and Windows users:

I have very limited computing resources at the moment, and they're pretty much limited to various flavors of Linux and BSD. My last build server running OS X died this past week, making it difficult for me to test OS X specific screenfetch-c enhancements.
As a result, you OS X and Windows users may not see many enhancements or improvements for a while. screenfetch-c should still work just fine, however.

Rasbpian issues.

Howdy? I am the /g/uy who had issues with high CPU usage on the raspberry pi.

I had the same issues as yesterday, (high CPU usage, no output), I have tried both manual compilation and using the install.sh script, with no results (I even tried to compile with -mfloat-abi=soft, but that won't work since hard and soft ABI are not compatible for linking).

So I decided to tinker with the code, first I modified the while ((c = getopt(argc, argv, "mdvnsD:EVh")) != -1) section by adding a default case to print ebin.

192 168 0 109 - putty_2013-10-16_05-11-10

and ran the program, and started to spam ebin on the output.

192 168 0 109 - putty_2013-10-16_05-11-36

So I commented out the while ... section, and compiled the program again, and it worked!

192 168 0 109 - putty_2013-10-16_05-18-15

And a few notes aside:

When I run screenfetch -V, the terminal font color is not restored to grey.

192 168 0 109 - putty_2013-10-16_05-12-51

segmentation fault

I'm using Arch Linux (3.18.5-1 kernel). With a fresh clone I get the following issue.

:> make
Testing for X11...
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result ./tests/x11test.c -o ./x11test -lX11
Looks good.
Testing for OpenGL...
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result ./tests/gltest.c -o ./gltest -lGL
Looks good.
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/logos.c -o src/logos.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/util.c -o src/util.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/main.c -o src/main.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/arrays.c -o src/arrays.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/disp.c -o src/disp.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/error_flag.c -o src/error_flag.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L -c src/plat/linux/detect.c -o src/plat/linux/detect.o
gcc -O3 -std=c99 -Wall -Wformat -Wunused-variable -pedantic -Wno-unused-result -D_POSIX_C_SOURCE=200112L ./src/logos.o ./src/util.o ./src/main.o ./src/arrays.o ./src/disp.o ./src/error_flag.o ./src/plat/linux/detect.o -o ./screenfetch-c  -lX11 -lGL

:> ./screenfetch-c 
[[ ! ]] Error: No desktop environment found.
Segmentation fault (core dumped)

Any idea what is going on here?

I have libgl and libX11 installed.

Manpage issue

I believe that the
man/screenfetch-c.1
should be
man/man1/screenfetch-c.1

then in my .bashrc I can properly setup
MANPATH=:~/builds/screenfetch-c/man
and have man screenfetch-c work correctly

detect_distro problems (and a bunch of Arch Linux problems)

First of all, I'd like to say I REALLY like what you're doing with my project. I've actually been attempting to learn C to do something like this myself, but will instead just contribute to yours where you will allow me to. :)

2013-10-20-010724_484x279_scrot

So, detect_distro. Relying on the top line of /etc/lsb-release to be DISTRO_ID is a little unreliable (example: on Arch Linux, the top line is LSB_VERSION=1.4 so the distro detected is "=1.4"). Another issue is the way you're reading that line. I assume that the "=" is not supposed to be there.

If I remove the line, I've also added a detection in my local version for the file /etc/arch-release which will detect Arch Linux if nothing is still found. Please note that I had to comment out an "else {" and "}" to make the following appear.

2013-10-20-010832_484x279_scrot

Note that there are some spacing issues to be dealt with here. I'll try to fix them myself and make a pull request with all of this after cleaning up my edits.

Don't throw errors

[[ ! ]] Error: No desktop environment found. (src/plat/linux/detect.c:662)
[[ ! ]] Error: No _NET_WM_NAME property found. (src/plat/linux/detect.c:699)

Failed to detect the Distro, WM.

2015-10-27-174640_784x87_scrot

The particular problem is faced in Slackware, herbstluftwm was the WM used here. It would be nice if the software recognizes the WM and ignores the DE if only WM is installed. The slackware Ascii art is found in the original screenfetch.
Thank you. 😄

Issue Installing on Debian

When installing

gcc -O3 -std=c99 ./src/screenfetch-c.c ./src/thread.c -o ./screenfetch -lpthread │················
make: gcc: Command not found │················
make: *** [all] Error 127

Desktop environment on Windows

The Windows version detection in detect_de() from src/plat/win32/detect.c is a bit wrong.
The version numbers don't equal exactly the release numbers: https://msdn.microsoft.com/en-us/library/ms724832%28VS.85%29.aspx

The detection should probably be more like this:

    if ((major == 6 && minor <= 1) || major == 10)
        safe_strncpy(de_str, "Aero", MAX_STRLEN);
    else if (major == 6 && minor >= 2)
        safe_strncpy(de_str, "Metro", MAX_STRLEN);
    else
        safe_strncpy(de_str, "Luna", MAX_STRLEN);

Identify the package manager

It would be useful to have the package manager identified. Many users take pride in their choice for pkg mgmt :)

Some changes 3

Hello William,

I have added internationalization.

Wrote argument parsing module based on argp.h

Wrote m4 (macro processor) files that will
be used to test for the presence of X11 and OpenGL
headers, they won't produce any errors if the current
operating system lacks these headers, instead no
-lX11 -lGL linker flags will be substituted. It took
me half day to find the needed information in `info m4'
but it is neat feature as it enables you to add support
for NVIDIA and INTEL gpu's, perharps you should add support
for those manufactors as well and substitute some macros,
pass them to AM_CPPFLAGS, and in detect.c module
you may use:

if (AMD_RADEON) | amd macro
...
else if (NVIDIA) | nvidia macro
...
else if (INTEL) | intel macro
...
else
fallback to the bash scripts

Your old makefile and the test files in test
folder was removed.

Copied bootstrap' script (from my pdf2img-c) that will produce the needed configuration files, but it needs further polishing. Whenever you want to add platform specific linker flags or macros you may prefer to put them with bash variable, seebootstrap' -
'${prog_name}'_LDADD and AM_CPPFLAGS

po/en_GB.po contains only testing strings,
so I could verify that the internationalization
is working flawlessly.

What is missing: uname' (linux/mac) tests, machine' (*bsd) tests, the detect scripts
should be moved by Makefile.am (find out how),
po/en_GB.po should contain all strings that will be
translated, so everyone will be able to copy it,
rename it and translate all 'msgstr'. Open up
`bootstrap' and do the described tasks in the comments.

Drop the windows support, and create other screenfetch
written in C sharp as the language provideds hardware
support out of the box and it will be relatively easy
to implement all current features within 300 lines
or less.

The performance was also improved.

GitHub doesn't lets me to propose a new pull request as my
screenfetch-c fork is several commits behind the master
branch and the git client on my tablet isn't helping me
either, so my hands are tied.
Can you copy all files from my screenfetch-c fork and
push them to the master branch ?

I have tried to keep this comment as shorter as possible
without describing what else was edited.

Best regards,
Aaron Caffrey

user@host is misaligned

Hello,

I have managed to modify the source code so that way the colours are the ones I would like, but I haven't seen where in the code I can fix the alignment issue with the user@host part of the displayed output. Attached is an image of what I mean.

Can someone be of help in letting me know how I can fix this?

http://imgur.com/qPFFVuC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.