0

I would like to launch this simple oneliner in terminal, but from app launcher.

curl wttr.in/bydgoszcz

It just shows nice weather report, like this: enter image description here

I found out that it is possible to launch a terminal from the script and make it launch a command, with:

#!/bin/sh
exec io.elementary.terminal -e "curl wttr.in/bydgoszcz"

But this way the output gest strangely corrupted (notice where the user@machine line lands): enter image description here

Its just like if the weather report command gets executed too fast. Is there a way to maybe delay it somehow, so the user@machine line goes first, and then goes the report, just like in the #1 image

1

I've tried writing a script, changing the output, etc but the problem is (I believe) on elementary's terminal not waiting the command to end

Because I've changed the command using cat instead of curl (to test that thought), having curl output the website to a temp text, and got the same result with the command prompt

Also haven't tried another terminal to compare results


The solution I see could fit as a probable solution, is to write code in C, Python or w/e language you want...compile it and run it.


UPDATE

I've made my first Vala app just for this :P , I modified an example code with my knowledge of other languages and worked

https://github.com/rscm/wttr/blob/master/wttr

Just download the file and it will load the default url wttr.in in a webview. If you call the file with and argument like bydgoszcz will load that location. I didn't validate any input so don't send weird stuff

Summary:

  • ./wttr is the same as curl wttr.in

  • ./wttr bydgoszcz is the same as curl wttr.in/bydgoszcz

Tomorrow I'll upload the code in the repo if you want to modify it

  • Thanks for it. It's definately a nicer workaround than Maccer's. Pls upload the code for modification. – DanyGee Nov 22 '18 at 10:51
  • Uploaded, have fun with it :P – Sebastian Nov 23 '18 at 6:35
0

This is not the answer you were looking for but... Why do all of this when you can install a web app and click a icon on the Applications launcher?

Just open Epiphany and go to wttr.in/bydgoszcz. Then press the gear button and select "Install Site as Web Application". Image

Now the app is available with just a click from the launcher!

  • Thats a nice trick, but the goal is to launch it in terminal, it looks way nicer this way, slicker. – DanyGee Oct 19 '18 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.