foreshadow / atom-python-run

A simple atom package. Press one key to run your python code in atom.
https://atom.io/packages/atom-python-run
MIT License
44 stars 32 forks source link

settings patch - fixed and added config settings #54

Closed ghost closed 7 years ago

ghost commented 7 years ago

this is a patch for issue #32 and a comment on issue #46 by @Megamiun

patch allows for user defined shell and shell option.

friendly reminder: don't forget to apm publish patch to push the update through.

foreshadow commented 7 years ago

Published.

ghost commented 7 years ago

so what do you think? have you had a chance to take a look?

Megamiun commented 7 years ago

Thank you very much, @xovertheyearsx, it has been working correctly. A little sad that there seems to be no way to know the default terminal of the user automatically, but this change already is a great update :D

Oh, and sorry if I disapeared, this week was a little busy. On the end I just was searching for a way to know automatically the user's default terminal, without success hahahhahah

ghost commented 6 years ago

@Megamiun That's what the terminal.js module does. I had to write it up after googling for a bit. Maybe you can figure out which environment variables, terminal, and it's execution option that mate uses. it's mainly a gnome-terminal port, so I wouldn't be surprised if you could figure out like this in the shell.

echo $GDMSESSION

or

echo $XDG_CURRENT_DESKTOP

You can find more details on how it works here in the wiki. You might want to go through the Overview and Getting Started sections first and then you can just skip to What is terminal?

The LinuxSessionWrapper class is what handles it in the background for you.

You can always add it to the switch statement as a patch and make a pull request (on a separate branch of course) or post your code as an enhancement issue. This article taught me how to do a pull request.

Megamiun commented 6 years ago

@xovertheyearsx I meant a way yo really know this automatically, like an environment variable that says the current default for the terminal or some way to ask the system for that, but it seems there isn't a default on all Linux distros for that D:

About the PR, I was thinking of doing one to warn the user when the module tries to open an terminal but it doesn't exists, warning about that the user can select a different terminal. Probably will create an issue later, just needs to know if js has exception handling to do that in case of an error opening the terminal.

And about the wiki, I read it and I should say I feel happy to see such attention to a project. Thank you for the support to those interested in helping.

PS: Sorry if sometimes I use unusual terms or phrases, english isn't my native language.