davatorium / rofi-blezz

MIT License
30 stars 2 forks source link

Tilde (~) not interpreted when given as an argument to command #6

Open roomcays opened 4 months ago

roomcays commented 4 months ago

Consider following blezz content action:

act(t,The test,zenity --text-info --filename=~/foobar.txt)

Executing this action with rofi-blezz gives an error of... Zenity:

(zenity:1860728): Zenity-WARNING **: 19:07:09.220: Cannot open file '~/foobar.txt': No such file or directory

However, running the same command (zenity --text-info --filename=~/foobar.txt) on terminal works well.

Zenity is just an example, tried also with Geany and then realized that this is rather connected with rofi-blezz.

Note: original blezz behaves the same.

roomcays commented 4 months ago

Oh, maybe it is worth mentioning: action for Geany....

act(t,The test,geany ~/test.txt)

...opens empty file at current/working directory with the ~/test.txt appended, for example: /home/user/Downloads/~/test.txt (I was debugging by running rofi from CLI, and not by keybinding).

roomcays commented 4 months ago

And... running rofi-blezz via keybinding (by sxhkd) opens file at location: /home/user/~/test.txt, which is not the same as ~/test.txt or, equivalently, /home/user/test.txt.

So, no work-around by cd ~ && rofi -show blezz -modi blezz -auto-select -matching normal is possible here.

DaveDavenport commented 4 months ago

try

bash -c 'zenity --text-info --filename=~/foobar.txt'

as command?

roomcays commented 4 months ago

Things get complicated.

The command you have suggested does not work with Zenity:

(zenity:1931820): Zenity-WARNING **: 11:45:23.152: Cannot open file '~/foobar.txt': No such file or directory

but opening Geany this way surprisingly works:

bash -c 'geany ~/foobar.txt'
roomcays commented 4 months ago

Some workaround is to use $HOME instead of ~:

bash -c 'zenity --text-info --filename="$HOME/foobar.txt"'