Giter VIP home page Giter VIP logo

synth-shell's People

Contributors

andresgongora avatar emberavenge avatar isanych avatar mcgillij avatar olmari avatar peterjriches avatar sambwest avatar sandropernerstorfer avatar valeriomagnago 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

synth-shell's Issues

Show sys load avg value with 2 decimal points

Now the new sys load average that shows "current load" / "available processing units" rounds the "load" number to nearest integer. This isn't too helpful in load context (like it was as percentage figure). Let's change the value from X / Z to X.YY / Z to reflect how "load" value works .

Ways to get current public IP-numbers

After #24 gets done, we need ways to check what programs are there, and then properly use them. I will gather code snippets to here in later comments.

  • Method to determine what programs are available on system.
  • Figure out proper usage of each program.
  • Method to use first found program and ignore rest...
  • ...but try next program if earlier one fails to work

Add photo to README to show what the script do at a glance

  • Main photo showing the coolest functionalities
  • Optional extra photos showing other stuff

Right now, when looking at the repo, it's impossible to tell what it does... I probably wouldn't pay much attention to this repo if I stumbled upon it by chance. This must be fixed :P

Move all configuration files to common location

Right now it's a mess to change the configuration files. The user must really know what she is doing. I think that the configuration files should be in a more logical location.

  • Put configuration files in a better location
  • Explain how to change the configuration in the README. As of now, it does not even say that the scripts can be modified

Make date format configurable

Currently getSysDate() has hardcoded value of "%Y.%m.%d - %T". This should be also user configurable at config-file.

Script to read configuration files

Most scripts have some sort of internal configuration section, mostly for color schemes and such. It should be possible to optionally allow the user to extract said configuration to an external file (i.e. inside ~/.config) such that the script remains the same for all deployments, but may be configured as needed between different machines (i.e. different color schemes depending on the host).

Thus, I need a config reading script that, when invoked from an external scipt can either:

  1. Read some configuration from an external config file and return the value of specific KEYWORDS
  2. Read the configuration within the very same external script (i.e. if no config file is specified, use the external script as such)

Thus, sse a mechanism like $var = config_get KEYWORD OPTIONAL_CONFIG_FILE; where it searches in the optional file (if non specified, use current file) and returns the value of said keyword.

status.sh - Repack everything into functions

All variables that are displayed should be "provided" by a function with the appropriate name, instead of being stored in variables.

That way, we can easily add extra functionality in a modular and salable fashion. For example, a function called getExternalIP might do several checks to find the best tool to get the IP instead of resorting only to dig or wget (as suggested by @olmari ).

This also helps with #20

Coding style guide

Create a small text file with basic coding style guides for this project - mostly a reference for myself to be more constant and uniform between scripts, but also as a guide for new developers who might want to join this project.

The goal is not to come up with a complete guide, but to start small and gradually add more content as we see fit.

  • Variable names
  • Function names

Get external IP in parallel

This is just an idea, but how about this:

  1. Check what tools the user has to get her external IP
  2. (somehow) call them all in parallel
  3. Use the first one to finish

Color script

Most of my scripts rely on colors for aesthetically purposes. Instead of replicating the code in each file, create a single script that takes care of either creating returning color command tags (to be added to a string) or to return "colorized" strings (to be then printed or concatenated).

  • Recognize terminal color compatibility, and adjust properly. If terminal is B&W, then it should apply no colors.

  • Intuitive, verbose and explicit

status.sh hangs the terminal, gives message "cat: /etc/upstream-release: Is a directory."

The script status.sh doesn't work properly for me. It hangs at the very part of the script, where it is looking for OS information. The command "cat /etc/*-release" works fine by itself though, so I guess something is wrong with how my system is interpreting the bash script. Any advice?
I know I can just ctrl-c and stop it, but I'd like to actually see the script run the way it is supposed to.

Apply modular scripts to currently existing scripts

  • Apply config to status.sh
  • Apply config to color.sh
  • Apply config to alias.sh
  • Apply color.sh to status.sh
  • Apply color.sh and config.sh to fancy-bash-prompt.sh
  • Update main README file with a brief description of the new modular scripts
  • Update README with instructions regarding how to change the configuration to the user's liking
  • Put all config files in a better location - dedidated folder maybe??

Now load avg is % again?

Where did the actual load-figure went? :P At least develop branch is now not curent vompared to master :)

Consider making this into two separate repos

  1. Repo with all other scripts (which noone uses but me xD) and the common scripts.
  2. Repo with status, fancy-bash-prompt installer, config examples. Include first repo as submodule.

@olmari you have more experience. Would it be a good idea? I mean, this way our work could become a "bunch of script" solely aimed at improving the terminal experience; instead of a collection of loose scripts. Also, the installer only installs status and fancy anyway...

Problem is. Can I rename this repo?

Limit CPU % to 100 and make it a bit faster

Currently, the CPU percentage is shown as the average of the last minute. This is meant to avoid showing the spike of loading up a terminal and such. I suggest the following changes:

  • Get CPU usage % as the average of the last 10 or so seconds. Ideally, make this user configurable.
  • Compute CPU % in the range [0-100]. Right now, if you have 8 cores, the range would be 0-800.

But beware of breaking CPU_CRIT alarm. With 8 cores, if one of them is at 100% because some program is doing nasty stuff, but the rest is idle, the average load would still seem to be below 13%. This requires to think everything through.

Maybe replace the bar all together with something different?? (it must still fit in a single line)

Sort scripts and add a summary table to README with info

  1. Sort scripts into sub-folders depending on functionality. For example, separate scripts meant to "improve" the terminal experience from those meant to aid in system maintenance or simple utility scripts.

  2. Allow everyone looking into this repo to recognize what each script does. Add a table with the scripts name and its main utility in 1-2 sentences

Beautify install script

  • Use common.* script to print and prompt with beautiful texts and colors
  • If no argument provided, run in default mode (for example, if called from an AUR package)
  • Options to choose what to install
  • In manual mode: Print a header with information of what is going to happen. After installing each script, tell the user what files where modified (request by Duarte)

Error in v1.3 after autoinstall

This error was reported by drqxr

bash: printf: `Y': invalid format character

which: no dig in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
which: no nslookup in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
  • Fix printf Y
  • Fix which
  • Add instruction to README for uninstall

Ass soon as all the fixes are implemented on my PC, I will push them to the github repo.

Status fails if no swap is set

There comes error on screen if there is no swap set up and also Swap status line also fails.

We need to add check if there is any swap set up before we try to show it, I'd suggest showing "N/A"

Status.sh with no swap set up at all

Fix automatic padding in status.sh

There is an issue for lower MAX_DIGITS values. For instance, if the HDD has 56GB capacity, and 43GB used, it will show as follows:

  • MAX_DIGITS=5 leads to 43/56 GB
  • MAX_DIGITS=4 leads to 4/56 GB - INCORRECT
  • Fix padding
  • Fix for floats as suggested during merge

Separate logo drawing and status-lines drawing

  • Separate (smart) logo and info printing
  • Update configuration files with new parameters
  • Make all status-info lines optional (allow user to hide or change their order)
  • Multi line info loading (required for logo)
  • Enable multi-colors in logo (written inside config file)
  • Allow to place the logo on the right instead of the left

Make logo drawing separate function and do that first, then at separate function draw statusdata lines. This way logo is easier to manage, especially if smaller than maximum lines, and then if terminal windows is too small to fit all the status data we can more easily to cut our way into the logo area.

We can use ANSI escape characters to actiave that, more info at https://unix.stackexchange.com/questions/210325/posix-command-that-moves-cursor-to-specific-position-in-terminal-window

This would also take care/include #42

Also here is very simple test in terminal, I made few lines of positioned text, and then on next command I used overlapping position:

A long text in terminal

New text that replaces part of old one

Add optional messages to status through a menu

Add a menu script that allows me to run some extra diagnostics, or by default (hitting enter), go into a simple terminal. Said options could include stuff like:

  • journalctl -p 3 -xb
  • netstat -atp #add -n to show IPs instead of host names
  • find -xtype l -print # Find broken symlinks
  • dmesg
  • -TP --level=err,crit,alert,emerg

More ideas:

dig command not found

Some commands, like dig, might not be present on the user's system.
Either make them a dependency, or make it such that the script just skips them without breaking. Alternatively, see what commands DO usually exist and use them instead.

Add installation script

Add installation scripts that take care of copying everything into place, and if possible, an AUR script, for:

  • Better bash promt
  • System-status terminal greeter
  • Prevent multiple additions of the anchor in /etc/bash.bash.rc
  • Automatic installation and manual installation
  • Uninstall
  • Update instructions for installer
  • Update instructions for user-specific config

Create additional, optional, configuration files

To anyone reading this: Feel free to paste here your configuration files. I will add them and cite you as their original author

Planned themes

fancy-bash-prompt.sh

  • red theme
  • green theme
  • orange theme
  • yellow theme
  • gray theme

status.sh

  • MAPIR theme
  • root theme
  • ArchLinux theme
  • Debian theme
  • Ubuntu theme
  • Manjaro theme
  • DISAL

Avoid variable name leakage

Most scripts don't clean up after them self and leave lots of variables inside the user's session. Fix this with local variables or unsetting variables that are no longer used.

printTop() fails if $cpu_is_crit is true

When CPU load average goes above determined critical value, status.sh fails to print proper data and/or prints out also printf error:

Output error on CPU above critical

(Logo being improperly aligned is another on-going thing, no need to point that one out)

Run scripts from within bashrc instead of sourcing them

  • Advantage: no user environment contamination with function names and variables

  • Disadvantages: the script must be ensured to be executables. This was not needed because bashrc is an executable and took care of the "permissions" for us.

Search for binaries in common folders

Create a utility script that can be called from the other scripts such that I can adapt the path of the code depending on the distro. For instance, the following code is very common in my scripts. It could be converted to a simple function.

## GET LOCATION OF TREE COMMAND -> Check for all possible locations
if [ -f "/usr/bin/tree" ]; then
	TREE="/usr/bin/tree"
elif [ -f "/bin/tree" ]; then
	TREE="/bin/tree"
else
	echo "tree command not found"
fi
alias tree="$TREE --dirsfirst -C"

Fix better-ls for all distros

ls is not always under /bin/usr/. The script should search for ls under different folders (maybe iteratively?) until it finds the correct executable; then, it should store the path to said executable in a variable and from there on use that variable for the rest of the script.

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.