Git Product home page Git Product logo

sysfex's Introduction

Sysfex

Sysfex is just another system information fetching tool for Linux-based systems, written in C++

Key Features

  • Print ASCII and information side by side, or one after another
  • Render image in place of ASCII using viu
  • Customize output without recompiling through dedicated configuration files
  • Output supports customized colors and text decorations (bold, italic or underline)
  • Easily extensible

Install

Required for Sysfex to work properly:

  • libx11 (or libx11-dev) : for getting screen resolution on Xorg (TODO: add workaround for Wayland)
  • viu (optional) : backend for rendering image

Cloning and compiling

Clone Sysfex using git:

git clone https://github.com/mehedirm6244/sysfex && cd sysfex

Compile Sysfex using cmake:

mkdir build && cd build
cmake ..
cmake --build . -j 4

Now you can try Sysfex without installing it to the system

./sysfex

Installing Sysfex to system

Make sure that your present working directory is sysfex

cd ..

Copy files to proper directories:

sudo cp build/sysfex /usr/bin
sudo chown ${USER} /usr/bin/sysfex

Uninstall

Remove Sysfex from system:

sudo rm /usr/bin/sysfex

Configuration

Sysfex automatically generates configuration files in ~/.config/sysfex/ on the first run. Some sample set of configurations can also be found in the /examples folder of this project.

The configuration for Sysfex is split into two files

File name Description
config Stores instructions on how to print information.
info Stores instructions on what to be printed.

Usage

Use sysfex --help for listing all valid flags

To Do

  • Add support for Wayland
  • Rewrite configuration file handling method
  • Write detailed documentation

Special thanks to

  • Some cool fetch tools spread all over GitHub for inspiration and ideas.
  • nothings/stb for a nice image processing library
  • The contributors, testers and those who gave me ideas as well as helped this project spread
  • You, for being interested in this project

sysfex's People

Contributors

mdgaziur avatar mehedirm6244 avatar mirk0dex avatar tyroruyk 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  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

sysfex's Issues

"std::filesystem has not been declared" installation error

I tried to install it on Ubuntu but it failed. Here's what was printed:

#Compiling sysfex...
In file included from src/sysfex.cpp:25:
src/functions.h:14:37: warning: use of ‘auto’ in parameter declaration only available with ‘-fconcepts-ts’
14 | void print(string icon, string key, auto value)
| ^~~~
src/functions.h: In function ‘void init_config()’:
src/functions.h:46:13: error: ‘std::filesystem’ has not been declared
46 | if(std::filesystem::exists("/opt/sysfex/config"))
| ^~~~~~~~~~
src/functions.h: In function ‘std::string exec(const char*)’:
src/functions.h:89:10: error: ‘unique_ptr’ is not a member of ‘std’
89 | std::unique_ptr<FILE, decltype(&pclose)> stream{popen(input, "r"), &pclose};
| ^~~~~~~~~~
src/functions.h:1:1: note: ‘std::unique_ptr’ is defined in header ‘’; did you forget to ‘#include ’?
+++ |+#include
1 | #define BOLD "\033[1m"
src/functions.h:89:25: error: expected primary-expression before ‘,’ token
89 | std::unique_ptr<FILE, decltype(&pclose)> stream{popen(input, "r"), &pclose};
| ^
src/functions.h:89:27: error: expected primary-expression before ‘decltype’
89 | std::unique_ptr<FILE, decltype(&pclose)> stream{popen(input, "r"), &pclose};
| ^~~~~~~~~~~~~~~~~
src/functions.h:91:8: error: ‘stream’ was not declared in this scope; did you mean ‘std::io_errc::stream’?
91 | if(stream)
| ^~~~~~
| std::io_errc::stream
In file included from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/ostream:38,
from /usr/include/c++/10/iostream:39,
from src/sysfex.cpp:2:
/usr/include/c++/10/bits/ios_base.h:203:24: note: ‘std::io_errc::stream’ declared here
203 | enum class io_errc { stream = 1 };
| ^~~~~~
In file included from src/sysfex.cpp:26:
src/fetch_functions.h: In function ‘int Pacman(std::string)’:
src/fetch_functions.h:174:10: error: ‘std::filesystem’ has not been declared
174 | std::filesystem::path pkgfolder = path;
| ^~~~~~~~~~
src/fetch_functions.h:175:16: error: ‘std::filesystem’ has not been declared
175 | using std::filesystem::directory_iterator;
| ^~~~~~~~~~
src/fetch_functions.h:176:45: error: ‘pkgfolder’ was not declared in this scope
176 | return std::distance(directory_iterator(pkgfolder), directory_iterator{});
| ^~~~~~~~~
src/fetch_functions.h:176:26: error: ‘directory_iterator’ was not declared in this scope
176 | return std::distance(directory_iterator(pkgfolder), directory_iterator{});
| ^~~~~~~~~~~~~~~~~~
src/fetch_functions.h:176:75: error: expected ‘)’ before ‘{’ token
176 | return std::distance(directory_iterator(pkgfolder), directory_iterator{});
| ~ ^
| )
src/fetch_functions.h: In function ‘int Portage(std::string)’:
src/fetch_functions.h:181:10: error: ‘std::filesystem’ has not been declared
181 | std::filesystem::path pkgfolder = path;
| ^~~~~~~~~~
src/fetch_functions.h:183:16: error: ‘std::filesystem’ has not been declared
183 | using std::filesystem::recursive_directory_iterator;
| ^~~~~~~~~~
src/fetch_functions.h:184:16: error: ‘recursive_directory_iterator’ was not declared in this scope
184 | for(auto i=recursive_directory_iterator(path); i!=recursive_directory_iterator(); ++i)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/fetch_functions.h: In function ‘void pkgs()’:
src/fetch_functions.h:201:13: error: ‘std::filesystem’ has not been declared
201 | if(std::filesystem::exists("/etc/portage"))
| ^~~~~~~~~~
src/fetch_functions.h:205:13: error: ‘std::filesystem’ has not been declared
205 | if(std::filesystem::exists("/etc/pacman.d"))
| ^~~~~~~~~~
src/fetch_functions.h:209:13: error: ‘std::filesystem’ has not been declared
209 | if(std::filesystem::exists("/etc/apt"))
| ^~~~~~~~~~
src/fetch_functions.h:213:13: error: ‘std::filesystem’ has not been declared
213 | if(std::filesystem::exists("/nix"))
| ^~~~~~~~~~
src/fetch_functions.h:215:17: error: ‘std::filesystem’ has not been declared
215 | if(std::filesystem::exists("/etc/nix"))
| ^~~~~~~~~~
An error occured. Failed to install sysfex

Error when run sysfex

I tried run the command as:

sysfex

and

sysfex --ascii 0

But the script no works correctly:
https://i.imgur.com/jRHwju4.png

Binary and Conf directory owned by Root when using `./install.sh`

Hi, just to let you know that I had some installation issues. The sysfex binary and the opt configure directory are both owned by root and therefore could not be run by a standard users. This was resolved with a simple chown $USER /usr/bin/sysfex however it should probably be within the install script.

This was done on Ubuntu 20.0.4 compiled using g++.

[Bug] macOS

./installer.sh compile errors on macOS, is this supported on Mac?

Compiling sysfex...
In file included from src/sysfex.cpp:19:
src/functions.h:9:37: error: 'auto' not allowed in function prototype
void print(string icon, string key, auto value)
                                    ^~~~
src/functions.h:43:5: error: no matching function for call to 'print'
    print("", "--help", "Print this screen");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [18]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:44:5: error: no matching function for call to 'print'
    print("", "--ascii <value>", "If value == 0, don't print the ascii art, else do");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [50]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:45:5: error: no matching function for call to 'print'
    print("", "--ascii-dir <path-to-ascii>", "Specify the file which you want to be shown as ascii-art");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [57]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:46:5: error: no matching function for call to 'print'
    print("", "--ascii-beside-txt <value>", "Choose whether ascii art will be printed beside infos or not");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [61]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:47:5: error: no matching function for call to 'print'
    print("", "--icons <value>", "If value == 0, don't print font-icons beside informations, else do");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [67]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:48:5: error: no matching function for call to 'print'
    print("", "--config <path-to-config>", "Specify the file which you want to be used as the config file");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [62]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:4:
src/modules/cpu.h:30:5: error: no matching function for call to 'print'
    print("", "CPU", cpu);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:5:
src/modules/de.h:12:9: error: no matching function for call to 'print'
        print("", "DE/WM", desktop_session);
        ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char *' to 'int' for 3rd argument; dereference the argument with *
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:6:
src/modules/host.h:18:5: error: no matching function for call to 'print'
    print("", "Host", name+" "+version);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'basic_string<char>' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:7:
src/modules/kernel.h:5:2: error: no matching function for call to 'print'
        print("", "Kernel", uname_info.release);
        ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'char [256]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:8:
src/modules/os.h:24:5: error: no matching function for call to 'print'
    print("", "OS", name+" "+uname_info.machine);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'basic_string<char>' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:9:
src/modules/pkgs.h:48:5: error: no matching function for call to 'print'
    print("", "Pkgs", pkg);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:10:
src/modules/ram.h:27:5: error: no matching function for call to 'print'
    print("", "Mem", ram);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:11:
src/modules/resolution.h:12:5: error: no matching function for call to 'print'
    print("", "Res", res);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:12:
src/modules/shell.h:3:2: error: no matching function for call to 'print'
        print("", "Shell", std::getenv("SHELL"));
        ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'char *' to 'int' for 3rd argument; dereference the argument with *
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:14:
src/modules/uptime.h:49:5: error: no matching function for call to 'print'
    print("", "Uptime", time);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
17 errors generated.
An error occured. Failed to install sysfex
adviksharma@MacBook-Air ~/sysfex (main) [1]> ./installer.sh
An existing installation of Sysfex is found. Remove or override it? [Y/n] y
Removing old sysfex installation
rm: /usr/bin/sysfex: No such file or directory
Install Sysfex? [Y/n] y
Compiling sysfex...
In file included from src/sysfex.cpp:19:
src/functions.h:9:37: error: 'auto' not allowed in function prototype
void print(string icon, string key, auto value)
                                    ^~~~
src/functions.h:43:5: error: no matching function for call to 'print'
    print("", "--help", "Print this screen");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [18]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:44:5: error: no matching function for call to 'print'
    print("", "--ascii <value>", "If value == 0, don't print the ascii art, else do");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [50]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:45:5: error: no matching function for call to 'print'
    print("", "--ascii-dir <path-to-ascii>", "Specify the file which you want to be shown as ascii-art");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [57]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:46:5: error: no matching function for call to 'print'
    print("", "--ascii-beside-txt <value>", "Choose whether ascii art will be printed beside infos or not");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [61]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:47:5: error: no matching function for call to 'print'
    print("", "--icons <value>", "If value == 0, don't print font-icons beside informations, else do");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [67]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
src/functions.h:48:5: error: no matching function for call to 'print'
    print("", "--config <path-to-config>", "Specify the file which you want to be used as the config file");
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char [62]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:4:
src/modules/cpu.h:30:5: error: no matching function for call to 'print'
    print("", "CPU", cpu);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:5:
src/modules/de.h:12:9: error: no matching function for call to 'print'
        print("", "DE/WM", desktop_session);
        ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'const char *' to 'int' for 3rd argument; dereference the argument with *
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:6:
src/modules/host.h:18:5: error: no matching function for call to 'print'
    print("", "Host", name+" "+version);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'basic_string<char>' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:7:
src/modules/kernel.h:5:2: error: no matching function for call to 'print'
        print("", "Kernel", uname_info.release);
        ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'char [256]' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:8:
src/modules/os.h:24:5: error: no matching function for call to 'print'
    print("", "OS", name+" "+uname_info.machine);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'basic_string<char>' to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:9:
src/modules/pkgs.h:48:5: error: no matching function for call to 'print'
    print("", "Pkgs", pkg);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:10:
src/modules/ram.h:27:5: error: no matching function for call to 'print'
    print("", "Mem", ram);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:11:
src/modules/resolution.h:12:5: error: no matching function for call to 'print'
    print("", "Res", res);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:12:
src/modules/shell.h:3:2: error: no matching function for call to 'print'
        print("", "Shell", std::getenv("SHELL"));
        ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'char *' to 'int' for 3rd argument; dereference the argument with *
void print(string icon, string key, auto value)
     ^
In file included from src/sysfex.cpp:20:
In file included from src/modules.h:14:
src/modules/uptime.h:49:5: error: no matching function for call to 'print'
    print("", "Uptime", time);
    ^~~~~
src/functions.h:9:6: note: candidate function not viable: no known conversion from 'std::string' (aka 'basic_string<char>') to 'int' for 3rd argument
void print(string icon, string key, auto value)
     ^
17 errors generated.
An error occured. Failed to install sysfex

Misalignment of infos when using ASCII art with certain characters

Example:

image

Reason:

image
By current line length, I don't mean character count. I mean the number of blocks the string will occupy.
Though this thing works as it's supposed to be on strings with fontawesome, it doesn't work with strings which have Chinese, Bengali and/or characters of some other languages as well.
I don't know how to actually solve this issue yet. Need a bit help here.

[Bug] [Distro independent] segfault when executing `sysfex --help`

Describe the bug
After the recent PR #14 merge, sysfex --help segfaults when ~/.config/sysfex/config does not exist
At the same time, sysfex crashes as well

To Reproduce

  • Delete or rename ~/.config/sysfex/config
  • Execute sysfex --help

Expected behavior
Sysfex should be using the template config from /opt/sysfex/config but that exact path doesn't even exist! (After the recent PR, the installation script copies the template configs to /opt/sysfex/data/ instead of /opt/sysfex. However, even if the template config is missing, sysfex should be using the hardcoded configuration, instead, it segfaults

Screenshots
image

Desktop (please complete the following information):

  • Linux distro: Arch
  • Desktop environment (if you think that it's related with this bug): Not related

Additional context
Go touch grass

Segmentation fault when no display is available

Sysfex segfaults when a display is not available. For example, on tty there's no display. Try running it in a tty(Ctrl+Alt+F(n)).

What happens probably is that when the display is null, X11Display returns nullptr instead of an actual pointer. And dereferencing that causes segfault. Solution is to check for null pointer and take action accordingly.

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.