p-e-w / shin

A shell in every text input on your system
GNU General Public License v3.0
278 stars 12 forks source link

Change to zsh possible? #7

Open Hedronmx opened 2 years ago

Hedronmx commented 2 years ago

Hello! instead of using bash would it be possible to use ZSH?

0unknwn commented 2 years ago

I think you could just change this line in the main.go file:

command := exec.Command("bash", "-c", commandText) https://github.com/p-e-w/shin/blob/9c67a6d28b77a8d3eae9518f82e928bfe01d30d0/main.go#L173

p-e-w commented 2 years ago

Making the command interpreter configurable is something I'm considering.

Could you describe your use case? This would help me decide whether adding this feature makes sense. Zsh and Bash differ mostly in the interactive shell, which is irrelevant for Shin. What would you be able to do differently if Shin ran Zsh instead of Bash?

apockill commented 1 year ago

One use case I have would be to have a hotkey that opens shin but as a python command.

That way, I could activate shin and do simple multiplication or quick string manipulation.

Ideally it would be configurable as an argument (not sure if this is possible?) so I could bind separate hotkeys with ibus engine shin --shell 'bash -c' or ibus engine shin --shell 'python -c'

p-e-w commented 1 year ago

Ideally it would be configurable as an argument (not sure if this is possible?) so I could bind separate hotkeys with ibus engine shin --shell 'bash -c' or ibus engine shin --shell 'python -c'

That is unfortunately not possible. ibus engine takes an engine name, which is cross-referenced with the engine definition from the component XML. It doesn't accept arbitrary commands. Switching between interpreters would need to be handled within Shin itself.

0unknwn commented 1 year ago

Maybe there could be some standard shell scripts in shin's bin folder to easily use Python etc.

@apockill, you can have Python with:

#!/bin/bash

python3 -c "print($*)"
Hedronmx commented 1 year ago

One use case I have would be to have a hotkey that opens shin but as a python command.

That way, I could activate shin and do simple multiplication or quick string manipulation.

Ideally it would be configurable as an argument (not sure if this is possible?) so I could bind separate hotkeys with ibus engine shin --shell 'bash -c' or ibus engine shin --shell 'python -c'

This is exactly my use case! To change depending on the commands i want to run.