zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #03342
Re: xterm fails (How to start a terminal as zim custom command)
Hi Jaap.
My workmate insists on using xterm.
# zim custom command:
# ok (needs flag: command does not modify data)
/bin/bash -c "cd /tmp ; xterm &"
# FAIL (%d is ignored, not expanded)
/bin/bash -c "cd %d ; xterm &"
The problem with the 2nd case is that "%d" is not expanded within quotes.
No way.
Just for info.
Best regards,
Andreas
On 24.03.2015 11:43, WEHLER Andreas wrote:
> Hi Jaap.
>
> You are right, thanks.
> Both variants work from command line as should be expected.
> Variant b) works from zim, variant a) does not.
>
> a) gnome-terminal --working-directory=%d
> b) gnome-terminal --working-directory %d
>
>
> One little thing is left:
> If you start a terminal from a leaf page then there is no attachment
> directory and therefore "%d" does not exist. Then you wind up in your
> home directory. But that's another problem and is probably ok so.
>
> Also:
> You have to keep in mind that the command is started without the help
> of a shell when launched with XFCE launcher (e.g. Applications menu).
> Command then has to be found in minimum $PATH, inherited from xinitrc.
> Say, $HOME/bin/command.sh will not work due to unknown $HOME,
> and neither will "~/bin/command.sh".
>
> This again is not a problem of zim, but an issue with the XFCE launcher.
> So don't bother with that in zim context.
>
>
> Thanks a lot!
>
> Andreas
>
>
>
> On 24.03.2015 10:43, Jaap Karssenberg wrote:
>> .. that should be "gnome-terminal --working-directory %d" ... so same command minus the "="
>>
>> On Tue, Mar 24, 2015 at 10:43 AM, Jaap Karssenberg <jaap.karssenberg@xxxxxxxxx <mailto:jaap.karssenberg@xxxxxxxxx>> wrote:
>>
>> Hi Andreas,
>>
>> Ah yes, I see. The current limitation is that the "%d" needs to be an argument of it's own. Arguably you could consider that a bug or at least unexpected behavior.
>>
>> Does gnome-terminal allow you to do "gnome-terminal --working-dir %s" instead ?
>>
>> Regards,
>>
>> Jaap
>>
>>
>> On Tue, Mar 24, 2015 at 10:38 AM, WEHLER Andreas <andreas.wehler@xxxxxxxxxxxxxxx <mailto:andreas.wehler@xxxxxxxxxxxxxxx>> wrote:
>>
>> Hi Jaap.
>>
>> # this works:
>> # zim custom command
>> gnome-terminal --working-directory=/tmp
>>
>> # this does not work (%d is ignored? empty? not expanded?)
>> # zim custom command
>> gnome-terminal --working-directory=%d
>>
>>
>> Best regards,
>>
>> Andreas
>>
>>
>>
>>
>>
>> On 24.03.2015 09 <tel:24.03.2015%2009>:28, Jaap Karssenberg wrote:
>> > Hi Andreas,
>> >
>> > What prevents you from define e.g. "xterm %d" as a custom command (replace "xterm" with your console of choice) ? Also when you need the script, you should be able to put the full path to the script in the custom command dialog, e.g "~/bin/StartTerminal.sh" should work just fine.
>> >
>> > But maybe I so not understand the problem statement fully?
>> >
>> > Jaap
>> >
>> >
>> > On Tue, Mar 24, 2015 at 8:31 AM, WEHLER Andreas <andreas.wehler@xxxxxxxxxxxxxxx <mailto:andreas.wehler@xxxxxxxxxxxxxxx> <mailto:andreas.wehler@xxxxxxxxxxxxxxx <mailto:andreas.wehler@xxxxxxxxxxxxxxx>>> wrote:
>> >
>> > Hi.
>> >
>> > I'm still looking for a good way to start a terminal as a custom command
>> > from within zim.
>> >
>> > Until now I have defined a wrapper which must be found within $PATH:
>> > StartTerminal.sh # see attachment
>> >
>> > The setup of the custom command is shown here:
>> > Snap_01.png # see attachment
>> >
>> > This works if zim is started from a shell with PATH being set up
>> > e.g. in .bashrc and the wrapper is saved as "~/bin/StartTerminal.sh".
>> > Assume you have no write permission for /usr/local/bin.
>> >
>> > So I've created also another launcher just to start zim:
>> > StartZim.sh # see attachment, saved to ~/bin
>> >
>> > And my launcher looks like:
>> > Snap_02.png # see attachment, this works
>> >
>> >
>> > Now, the wrappers do a proof of concept, but it is a hassle.
>> > It's nothing you ever want to show a workmate.
>> >
>> > Apparently I miss something with parameter substitution in zim
>> > custom commands or with quoting?
>> >
>> > Thanks,
>> >
>> > Andreas
>> >
>> >
>> > zim 0.60; Ubuntu 14.04
>> >
>>
>>
Follow ups
References