Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-06-13 07:24:35

hrkucuk
Member
Registered: 2019-06-13
Posts: 3

[SOLVED] How to run an alias command in Whisker Menu

So I am trying to run this comman through Whisker Menu, without opening the terminal:

 redshift -P -O 3200 

In the properties of Whisker Menu > Search Actions, I can create an entry with the following 'pattern' and  'command' value:

pattern: !

command:

 exo-open --launch TerminalEmulator %s 

With this configuration, I can run any terminal command I want in the Whisker Menu, simply by preceding the command by an exclamation mark (!).
However, I don't want to write this long 'redshift' command everytime. So I create the following alias and put it in my ~/.bashrc file:


 alias redscreen='redshift -P -O 3200'
 alias bluescreen='redshift -P -O 6500'

Both aliases work in a normal terminal, but when I try to run them Whisker Menu, I get the following error message:

 Failed to execute command "redscreen". Failed to execute child process "redscreen" (no such file or directory) 

I am using XFCE4 on Archlinux.

Has anybody any experience with running aliases in Whisker Menu?

Thanks!

Last edited by hrkucuk (2019-06-13 20:48:15)

Offline

#2 2019-06-13 19:42:51

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,020

Re: [SOLVED] How to run an alias command in Whisker Menu

I don't believe that the whiskermenu (or rather the libxfce4ui function that it uses to spawn a command) supports aliases because it uses a limited shell when executing these commands and does not parse your current environment (or things like aliases). Create a script that contains the full shell environment and call that script instead.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2019-06-13 20:47:58

hrkucuk
Member
Registered: 2019-06-13
Posts: 3

Re: [SOLVED] How to run an alias command in Whisker Menu

Thanks a lot for the help! I did exactly as you said and it is working now.

I created two files with names 'redscreen' and 'bluescreen' and placed them in /usr/local/bin. I gave them +x privilage with chmod. In each of them, I wrote the correspinding one liner as seen in my above post.

Now in my normal terminal, the commands `bluescreen` and `redscreen` function as aliases and in Whisker Menu, both commands are callable with or without the preceding exclamation mark.

Thanks again!

Last edited by hrkucuk (2019-06-13 20:48:35)

Offline

Board footer

Powered by FluxBB