Biont / sway-launcher-desktop

TUI Application launcher with Desktop Entry support. Made for SwayWM, but runs anywhere
GNU General Public License v3.0
606 stars 28 forks source link

Aliases doesn't work #47

Open janemba opened 3 years ago

janemba commented 3 years ago

Helllo,

I am using zsh with oh-my-zsh and I'm storing aliases in $HOME/.oh-my-zsh/custom/aliases.zsh. How can I make it work with sway-launcher-desktop ?

janemba commented 3 years ago

Any thoughts on this ?

Biont commented 3 years ago

Sorry, I have zero experience with zsh.

But since the sway-launcher-desktop.sh expects #!/usr/bin/env bash as interpreter, it shouldn make that much of a difference.

What is it that does not work currently?

janemba commented 3 years ago

I just got an idea reading your reply. So I am using zsh and as sway-launcher-desktop.sh is a bash script, my aliases cannot be read.

So I created a .bash_aliases file with all my aliases:

zsh $ alias -L > .bash_aliases

Then I added the following in .bashrc:

zsh $ cat .bashrc
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

So if I switch shell to bash I got all aliases but still sway-launcher-desktop.sh do not contain any aliases. Do I need a specific step to get aliases as a command in sway-launcher-desktop.sh ?

What is it that does not work currently?

I execute the launcher in terminal and aliases are not in list (even with bash).

Biont commented 3 years ago

You can pass a custom TERMINAL_COMMAND to run the resulting command through bash again, which will cause your .bashrc to be read.

For example: TERMINAL_COMMAND="urxvt -e /bin/bash -i -c " sway-launcher-desktop

janemba commented 3 years ago

I tried the following:

TERMINAL_COMMAND="foot /bin/bash -i -c " .local/share/sway-launcher-desktop/sway-launcher-desktop.sh

The issue is the same no aliases are loaded in sway-launcher-desktop. I have no idea if .bashrc is read or not. When I'm trying the following: foot /bin/bash, I can use my aliases.

janemba commented 3 years ago

Any update on this ?

janemba commented 3 years ago

Any update on this ? (x2)

Biont commented 3 years ago

Well I don't know what the launcher script itself could do to aid here since it is not concerned with any specific terminal or shell. Whatever the problem is, I really think it must be possible to solve it with the right TERMINAL_COMMAND

janemba commented 3 years ago

Well ok but how the launcher script read aliases ?