right click on desktop; how to modify?

Ralf Mardorf ralf.mardorf at alice-dsl.net
Tue Aug 22 13:06:05 CEST 2017


On Tue, 22 Aug 2017 10:38:24 +0200, Ralf Mardorf wrote:
>On Tue, 22 Aug 2017 09:09:58 +1000, Jim Dean wrote:
>>This and associated questions have been asked a number of times on the
>>forum and the answer is always the same. It requires a code change as
>>that menu is hardcoded  
>
>Actually a workaround would be to write a very simple xfce4-terminal
>wrapper script. If it gets launched with the Desktop path, launch it
>with the desired options instead, else don't change the options.
>
>On Debian based distros, such as Ubuntu it's possible to use the
>"divert" command. IIRC the line would look like this (if not, Google
>is your temporarily friend):
>
>sudo dpkg-divert --add --rename
>--divert /usr/bin/xfce4-terminal.real /usr/bin/xfce4-terminal
>
>/usr/bin/xfce4-terminal would be renamed
>to /usr/bin/xfce4-terminal.real , even if it should be upgraded, it
>automatically would be renamed.
>
>Now it's possible to store a wrapper script /usr/bin/xfce4-terminal .

Hi,

I had a break and some time to provide a simple script.

[rocketmouse at archlinux tmp]$ cat xfce4-terminal.wrapper 
#!/bin/dash
echo $@ | grep Desktop >/dev/null 2>&1
case $? in
  0) /usr/bin/xfce4-terminal --geometry 50x5+100+100 --working-directory=/usr/local/bin >/dev/null 2>&1 &;;
  *) /usr/bin/xfce4-terminal $@ >/dev/null 2>&1 &;;
esac
exit
[rocketmouse at archlinux tmp]$ ./xfce4-terminal.wrapper --geometry 50x10+200+200 --working-directory=/etc
[rocketmouse at archlinux tmp]$ ./xfce4-terminal.wrapper --geometry 50x10+200+200 --working-directory=/home/rocketmouse/Desktop

The second command including "Desktop" opens with the geometry of the
wrapper script and in /usr/local/bin. The first command opens with
geometry 50x10+200+200 in /etc .

Just save it in /usr/bin instead of /tmp and name it
xfce4-terminal instead of xfce4-terminal.wrapper, then make it
executable

  sudo chmod a+x /usr/bin/xfce4-terminal

In the script change the two lines /usr/bin/xfce4-terminal to
/usr/bin/xfce4-terminal.real .

Pitfalls of this simple script are " resp. paths with spaces and this
simple grep isn't much advanced, you could check all options
individually, e.g. using a "shift" loop. Simple example:

#!/bin/dash

while [ "$1" ]; do
  echo $1
  shift
done
exit

Hth,
Ralf


More information about the Xfce mailing list