[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Extending fluxbox menu with a script.



On 23/11/13 01:13, Sharon Kimble wrote:
> On Fri, 22 Nov 2013 12:15:21 +0000
> Sharon Kimble <boudiccas@talktalk.net> wrote:
> 
>> On Fri, 22 Nov 2013 09:09:23 +1100
>> Scott Ferguson <scott.ferguson.debian.user@gmail.com> wrote:
>>
>>> On 22/11/13 08:50, Scott Ferguson wrote:
>>>> On 22/11/13 06:39, Scott Ferguson wrote:
>>> <snipped>
>>>>
>>>> Try #2 :/
>>>
>>> Try #3 (no sleep last night - trees and power lines down across the
<snipped>

>>>
>> Morning Scott.
>> Thanks for this, I hope you slept better? This is what I currently
>> have -
>>
>> #!/bin/bash
>> # .fmenu
>> mv ~/.fluxbox/menu{,-$(date +%Y%m%d-%R)}
>>
>> mmaker fluxbox -f
>>
>> sed -i 's/\[end]//g' ~/.fluxbox/menu;sed -i '/^\s*$/d' ~/.fluxbox/menu
>>
>> printf '\t[submenu] \(My
>> Menu\)\n\t[include]\(~/.fluxbox/usermenu\)\n\t[end]\n\t[separator]'
>>>> ~/.fluxbox/menu" >~/.fmenu
>>
>> and the double sed line works okay, but its failing at the 'printf'
>> line saying -
>> 'tryitout
>> /home/boudiccas/bin/tryitout: line 21: /home/boudiccas/.fluxbox/menu 
>>
>>> ~/.fmenu'
>>
>> NB - my working script is always called 'tryitout', just whilst I'm
>> developing something. 
>>
>> The new menu is created without the two [end] at its end, but there is
>> nothing from 'printf' at all.
>>
>> Sorry
>> Sharon.
>>
> I've been doing some more testing and now got the 'submenu' being
> generated at the end, which is good. But, the sed lines are also
> stripping out *all* of the [end] lines which separate the sections of
> the menu, which are needed for it to function properly. So how can we
> get it to just strip out the two [end] at the end of the main menu, and
> leave all of the other [end] in the script intact please?

Here's what *should* happen when the created script ~/.fmenu is run:-

1. archive the existing menu
$ mv ~/.fluxbox/menu{,-$(date +%Y%m%d-%R)}

2. Create new menu
$ mmaker fluxbox -f

3. Strip the first, and at this stage *only*, [end] tag from the new menu
$ sed -i 's/\[end]//g' ~/.fluxbox/menu

4. Remove the empty line (and tab) from the new menu (left from where
the end tag was stripped out)

$ sed -i '/^\s*$/d' ~/.fluxbox/menu

5. Create the submenu (this step creates the '2nd' end tag)
$ printf '\t[submenu] \(My
Menu\)\n\t[include]\(~/.fluxbox/usermenu\)\n\t[end]\n\t[separator]'
~/.fluxbox/menu" >~/.fmenu


If the script strips out both [end] tags it's because steps 3 and 4 are
being run after step 5 (or their wouldn't be two [end] tags to strip out.


> 
> Thanks
> Sharon.
> 

Kind regards


Reply to: