Hacker News new | past | comments | ask | show | jobs | submit login

If only there's a $PS1 version



It might just be me, but I never saw the usefulness in widgets that shows the current weather, at your current location. I mean can’t you just look out the window?

Stuffing a three days weather report into $PS1 might be to much information for a prompt.


I have to get up and walk to the window, so looking it up in the terminal is much faster. But I agree that it feels somewhat detached from nature. Also the thermometer at the window varies a lot with direct sunlight or wind, so i find these weather services give a better estimate to what i should be wearing when i go outside.


I’m reminded of the old discussion of which clock program for X11 consumed the least resources and screen size. It concluded with something like: “Of course, the clock which consumes no resources, and does not take any screen space, is the clock which hangs on your wall.”.


That would be cool, but how would you condense the information enough that it's both useful and doesn't take up 2/3 of a line?


I might be a heathen, but my PS1 is as long as it wants to be, and ends with \n$


I feel like I should hate this...

But I don't. I may steal this idea later, than there would be a whole 2 of us!


That's a great old-school idea. I used to run it that way but forgot.

I have also started adding a time stamp to the second, so that when I run long commands and come back later in a tmux session I can see when it finished.


> how would you condense the information enough that it's both useful and doesn't take up 2/3 of a line?

There's a method that takes 0 space: just change the color of the prompt symbol depending on the weather status (sunny, cloudy, raining, snowing).


It’s provides different formats, I was using this one in the past from Powershell

invoke-restmethod wttr.in/?format=4

…and I think it was quite compact


Emojis? For the current weather, a single emoji could convey quite a lot; e.g. a snowflake for sub-60 weather (I have a low tolerance for cold), a sun for 60-80, fire emoji for 80+...

Now, I don't know if anyone truly needs the weather in their terminal prompt, but it is doable.


Microcharts or sparklines are another option. I've seen a few implementations along these lines for shell prompts / shell use.

This might be useful for temperature, humidity, wind, preciptitation, and similar measures, either as quantities or timelines.

https://en.wikipedia.org/wiki/Sparkline

https://github.com/deeplook/sparklines

Similar:

https://www.linux-magazine.com/Issues/2016/183/Calc-Conditio...


perhaps the RPROMPT would be better. i usually use it to show time %T.


curl 'wttr.in/?format=%c'

see the readme here for all options:

https://github.com/chubin/wttr.in


i know you’re referring to the shell prompt, but it reminded me that PowerShell file extension is also *.ps1 (which I find strange as I’m not used to seeing numbers in file extensions).

didn’t this really come up when MS was designing PowerShell?


i think they count the namespace pollution as free advertising




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: