Coder Social home page Coder Social logo

Comments (7)

andresgongora avatar andresgongora commented on June 16, 2024

I'm working on an edited version of status.sh - It does not solve this issue, but it will make it MUCH easier to implement any option we might choose to; be it a matrix implementation or a smart multirow with overlapping text.

from synth-shell.

andresgongora avatar andresgongora commented on June 16, 2024

I've taken a look at your exit code suggestion, and its perfect!! Great idea!! :D

from synth-shell.

andresgongora avatar andresgongora commented on June 16, 2024

This might be an interesting reference http://bruxy.regnet.cz/web/linux/EN/matrix-sh/

from synth-shell.

andresgongora avatar andresgongora commented on June 16, 2024

http://www.termsys.demon.co.uk/vtansi.htm

from synth-shell.

andresgongora avatar andresgongora commented on June 16, 2024

So, I'm back from another journey; but I had time to think about the problem and put together all the pieces from our past discussion. The idea would be as follows:

  1. Get terminal info: such as size, to compute where we want the logo and the info elements. On a wide terminal, they might be plotted further apart, on a narrow terminal (e.g. 80 chars broad), they should be packed tightly together. On a super narrow terminal, the logo should be omitted altogether.

  2. Draw the logo

    1. Load the logo as a single string, where the end of the logo would obviously be delimited by a \n.
    2. Move the cursor to the position where we want the logo to start (upper left corner).
    3. Reformat the logo (sed, tr, awk...) by replacing the new line characters \n with an escape character that tells the cursor to go to position [i+1,c]; where i+1 is such that sequential lines are drawn, and c is the first column where we want to draw the logo.
    4. Print the reformatted logo. Each new line will start at the correct position.
  3. Draw info

    1. Read a configuration line that contains the info elements that the user wants to plot, and their order. For example stats="os, cpu, gpu, user" means that the first info line should be OS related info, next line should be CPU info, next line should be GPU info (not implemented yet), and the last should be the USER/HOST info. This way, the user may omit or reorder the lines as wished.
    2. For each word in the above configuration line, call a function that is basically a big switch-case that then calls the appropriate printing helper. But before printing, the cursor is relocated to the current position.

from synth-shell.

andresgongora avatar andresgongora commented on June 16, 2024

First working draft in 472d98d

from synth-shell.

andresgongora avatar andresgongora commented on June 16, 2024

Solved in #105.
Realized there is a bug (maybe always there?), described in #106.

from synth-shell.

Related Issues (20)

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.