Xfce: could not use $( <command> ) in a launcher command
Hello :-)
I would like some programs, started from Xfce launchers, to open full screen. X has a "geometry" option but this allows only X and Y sizes to be specified, not full screen. I wrote a script that outputs the current screen's X x Y with the intention of using it in launcher commands. Testing at the command line this worked: Code:
/usr/bin/mrxvt -name c -geometry $(/home/c/d/bin/try/get_current_screen_size.sh) -ic /usr/share/pixmaps/mrxvt.xpm I tried editing the /home/c/.config/xfce4/panel/launcher-<unique number>.rc file directly and it still did not work. Perhaps these files are loaded at session initialisation. Will try again after re-initialising the session and update this post. EDIT: that didn't work. After re-initialising the session (actually a reboot for another reason), Xfce had re-written the /home/c/.config/xfce4/panel/launcher-<unique number>.rc file with the contents of the launcher (as viewed in the launcher's properties). EDIT 2: logging out of Xfce and using a virtual terminal to edit the /home/c/.config/xfce4/panel/launcher-<unique number>.rc file did result in the $ appearing in the launcher command but it still didn't work -- presumably for the reason identified below by maybeway36 and David the H, that Xfce is not using a shell to process the command. Best Charles |
$(command) is normally processed by the shell (e.g. bash or dash), so you can't use it in a launcher command. But you can do this:
1. make a shell script with the contents: Code:
#!/bin/sh Code:
chmod +x {file} |
$() is a shell pattern for embedding commands. Chances are that xfce isn't using a full shell for launching commands, so the embedding syntax is unrecognized.
Wrap your command up inside a shell script and launch that instead. Edit: beaten to the punch (and made a typing mistake anyway). |
Thanks maybeway36 and David the H :)
That worked. To save having an idle bash process around, I prefaced the command in the script with exec. I guess Xfce's designers chose to pass the command directly to one of the exec family of syscalls for performance rather than incur the overhead of starting a process running bash on the way. EDIT: One gotcha was that a PWD was picked up from somewhere (haven't worked out where) so I added a cd before calling the command. In case anyone wants to see the script that gets the current geometry, here it is: Code:
#!/bin/bash |
All times are GMT -5. The time now is 10:40 AM. |