Comments (65)
I really don't want to split fetch into any more files unless we have to. Even though the script
has multiple files it still works on its own. If we move the functions away from the script then
nobody will be able to just drop it into their path, they'll have to install it entirely.
The script uses fold comments so it's super easy to navigate inside of an editor that supports
them. You can also just ctrl+f for getfuncname
to find the function. For example getbattery
.
I've come up with an alternate solution, it's done and it's in a branch called stdout
but I want
your opinion before I do anything with it.
I've created a new helper function called stdout
which prints the function output to stdout without
any escape codes, newlines etc. This is what the printinfo function will look like:
printinfo () {
# Print the info in the "Title: output" format.
stdout "OS: distro"
stdout "Kernel: kernel"
# Print the memory without a title.
stdout "memory"
#...
}
You then launch the script like this:
fetch --image off
Here's a screenshot of what it looks like when used in a lemonbar script:
NOTE: Click the image for a larger version
NOTE: I've added the ' | ' myself with a few printfs
You can then create a seperate config file and launch fetch with --config barconfig
.
I've pushed this to a new branch called stdout
so that you can test it out. If you need a simple
lemonbar script to test this out, this will work:
#!/bin/bash
while :; do
echo "$(fetch --image off)"
sleep 1s
done |
lemonbar
I know this probably isn't ideal but it's the best workaround I could come up with
without splitting fetch into more files.
What do you think?
from neofetch.
It looks nice. I will test it this afternoon (5 hours since now).
from neofetch.
Awesome!
from neofetch.
I've pushed a better (imo) solution to a new branch called stdout2
. This version adds a new flag called --stdout
which prints the existing printinfo function in a lemonbar compatible format. This new version is much smaller (excluding flags and comments) and allows you to use the same config without any modification.
This version also adds 3 new launch flags and config options:
stdout_title
: Toggle the display oftitle@hostname
in the output.stdout_seperator
: Takes a string which it adds to the end of each bit of info as a seperator.- eg.
--stdout_seperator " | "
- eg.
stdout_subtitles
: Toggle the display of each info's subtitle in the output.
You can then launch fetch like this to also remove unwanted info from printing in the bar:
fetch --stdout --disable gpu gtktheme windowmanager shell kernel
Please test it out!
from neofetch.
Let's say I have a bar script and I want to display the CPU in the left and the GPU in the right. I need two different config files to do that. Correct me if I'm wrong.
from neofetch.
I think the stdout
functions should be there.
from neofetch.
The problem with the stdout
function is that it requires users to have two configs if they want to use fetch and stdout.
from neofetch.
I have an idea though.
from neofetch.
Why not an enable
flag?
from neofetch.
A new flag which only runs the functions that the flag is given, so:
fetch --stdout --function cpu gpu etc
from neofetch.
That's what I was typing :)
from neofetch.
Why not simplify?
fetch --stdout cpu gpu etc
from neofetch.
Having a general flag allows it to work with fetch as well.
from neofetch.
I don't understand.
from neofetch.
fetch --enable cpu gpu memory
This will only display cpu, gpu and memory in the regular fetch output.
from neofetch.
Ah ok.
from neofetch.
The only issue with --enable
is setting the subtitle, in the info
functions the user has to specify a title but with this flag it'll complicate things.
I think I'll just add --stdout cpu gpu memory etc
and make it print the info without a subtitle.
What do you think?
from neofetch.
Leave it as --stdout etc
for now.
from neofetch.
I can add --stdout etc
but you won't be able to have subtitles infront of the info.
from neofetch.
That was the whole purpose... just the info.
from neofetch.
Alright, I've pushed an update to the stdout2
and --stdout cpu etc
now work.
from neofetch.
It works beautifully, can you put it in master?
from neofetch.
I just need to write some docs about it and update the readme.
from neofetch.
BTW showing battery info doesn't work.
from neofetch.
Also setting --stdout_seperator
doesn't work when --stdout
has args, so I'm going to fix this too before I push to master.
from neofetch.
Battery is the only function that makes use of prin
, I'll have a look.
from neofetch.
It's because prin
prints a newline, I'll fix this.
from neofetch.
I just pushed a fix for the battery info, try it out!
from neofetch.
It prints all the other info and then the battery. Not good.
from neofetch.
Oh, what do you mean?
from neofetch.
I've figured it out.
from neofetch.
I just pushed another fix, try it out.
from neofetch.
Running fetch --stdout battery
yields
off60\033[0m8: 799% OS: Arch Linux x86_64 Kernel: 4.3.5-1-ck Uptime: up 1 hour, 53 minutes Packages: 839 Shell: /bin/mksh Window Manager: Bspwm GTK Theme: Arc-Darker [GTK2/3] Icons: UltraFlatIcons [GTK2/3] CPU: Intel Core i5-3210M @ 3.1GHz GPU: Nvidia NVS 5400M Memory: 726MB / 7737MB Birthday: Fri 27 Nov 2015 12:39 AM Battery*: 99%
from neofetch.
What's the first battery in your system called?
from neofetch.
0
from neofetch.
How many batteries do you have in your system?
from neofetch.
1
from neofetch.
I just pushed another fix, try it out.
from neofetch.
off6�[0m8: 799%
799?
from neofetch.
Btw don't forget to test in normal mode, there are bugs in here.
from neofetch.
Progress!
There are some escape codes which need to be removed.
from neofetch.
What does normal mode look like?
from neofetch.
I can't test the battery stuff myself.
from neofetch.
from neofetch.
Pic is not found.
Also I just pushed another commit to stdout2
, try it out.
from neofetch.
Not found? Refresh.
from neofetch.
Image is still not found for me
from neofetch.
Now it works perfectly, but in normal it no longer shows Battery0: 99%
. It shows Battery: 99%
, without the 0.
from neofetch.
The reason the battery output wasn't working properly in stdout mode is because $battery
wasn't being set and we were directly printing the info instead. The fix is to use the subtitle from printinfo
if there's only a single battery detected.
So in short, the battery info will now print the subtitle without a number if there's only a single battery detected.
from neofetch.
Ah ok. We should keep the issue open until you replace --stdout
with --enable
.
from neofetch.
Thanks!
from neofetch.
I want to add --enable
but the user won't be able to set the subtitle unless the flags look like this:
fetch --enable "CPU: cpu" "Memory: memory"
How does that look?
from neofetch.
As a temp fix, it looks good.
from neofetch.
I don't think we can get any cleaner than that tbh,
from neofetch.
Then push it.
from neofetch.
I don't think I can add --enable
without some work, I'm going to just leave it at --stdout cpu etc
for now. I'll push to master once I've done some cleanup and written some docs about it.
It's 2 am here so I'm going to bed and I'll finish this up tomorrow.
Thanks for the help!
from neofetch.
Thank you too and good night!
from neofetch.
Merged, thanks again!
Note: --stdout_seperator
now works with --stdout cpu gpu etc
from neofetch.
See #50
from neofetch.
Thanks
from neofetch.
You're lucky because in my native language the word for "separator" is
exactly "separator" and I thought something was not right. You're welcome!
On Feb 7, 2016 1:07 AM, "Dylan Araps" [email protected] wrote:
Thanks
—
Reply to this email directly or view it on GitHub
#48 (comment).
from neofetch.
What's your native language?
from neofetch.
Romanian. A very hard language.
On Feb 7, 2016 1:15 AM, "Dylan Araps" [email protected] wrote:
What's your native language?
—
Reply to this email directly or view it on GitHub
#48 (comment).
from neofetch.
Mine's English but I also speak Greek. :)
from neofetch.
That was.... unexpected. Let's end this discussion because it floods the
watchers' mailboxes.
On Feb 7, 2016 1:18 AM, "Dylan Araps" [email protected] wrote:
Mine's English but I also speak Greek. :)
—
Reply to this email directly or view it on GitHub
#48 (comment).
from neofetch.
Related Issues (20)
- kubuntu is recongized as ubuntu.
- --disk_show don't work
- Kitty image backend not working on startup HOT 5
- Infobar preceded by unwanted characters
- Add support for Peropesis Linux HOT 4
- Format error in help message due to misaligned letter in `--col_offset` option
- Memory reporting is inconsistent with "free" HOT 4
- Print the Display Manager HOT 2
- Issues using custom ASCII HOT 2
- No ascii for Windows 11
- Neofetch doesn't fulfil it's purpose HOT 2
- No output when using Image Backend on Debian 12 - WSL2 - Windows Terminal
- Terminal font is not detected on alacritty HOT 1
- Move code to GitLab or Codeberg HOT 1
- [Feature Suggestion] Support for codenames. From Debian and other common distros. HOT 2
- how install neofetch win 11 HOT 6
- `gen-man` Fails
- Random Characters during auto-startup
- doesn't respect config: info "host" model HOT 3
- windows 11 in ascii HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neofetch.