WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: jwm bug and change plan report  (Read 2154 times)

Offline attiny

  • Newbie
  • *
  • Posts: 2
jwm bug and change plan report
« on: November 23, 2009, 12:53:13 AM »
How do you do! I am not good at the English, but report it.

<jwm.tcz bug and change plan report>
TinyCore V2.4.1 and 2.5 and 2.6rc4
Boot option normal and backup/restore
file:/usr/bin/jwm_makemenu

before-----bug
ctrl+alt+bs key in to text mode. After "startx" and the enter.
Mouse click's Main menu => Apps menu double.

After------before 7,8lines change
[ -z "$1" ] && exit 1 --- line first done
cp "$TCEMENU" "$OUTFILE" --- line was added to "|| exit 1"
Check to use "grep" command.
if "menu" entry and "$1" are the same, program to exit.

before----------------------------------------------------------------
Code: [Select]
#!/bin/sh
# (c) Robert Shingledecker 2009
# Typically called from /usr/bin/desktop.sh
# makemenu APPNAME
TCEMENU=/usr/local/tce.menu/menu
OUTFILE=/tmp/menu.tmp
cp "$TCEMENU" "$OUTFILE"
[ -z "$1" ] && exit 1
busybox awk -v appname="$1" -v outfile="$OUTFILE" '
{
  if ( $2 == "TCE_Placeholder" )
  {
     holder = $0
     while (( getline < "/usr/local/tce.menu/"appname ) > 0 )
     {
        if ( index($0,"Program label=") > 0 )
        {
           sub(">",">exec ")
           print $0 > outfile
        } else {
           if ( index($0,"JWM") == 0 )
           {
              print $0 > outfile
           }
        }
     }
     close("/usr/local/tce.menu/"appname)
     print holder > outfile
  } else {
     print $0 > outfile
  }
} ' "$TCEMENU"
[ "$?" == 0 ] && sudo mv "$OUTFILE" "$TCEMENU"
--------------------------------------------------------------------------------
   |
   |
   |/
after-----------------------------------------------------------------
Code: [Select]
#!/bin/sh
# (c) Robert Shingledecker 2009
# Typically called from /usr/bin/desktop.sh
# makemenu APPNAME
TCEMENU=/usr/local/tce.menu/menu
OUTFILE=/tmp/menu.tmp
[ -z "$1" ] && exit 1
cp "$TCEMENU" "$OUTFILE" || exit 1
grep -q "$1" "$TCEMENU" > NULL
[ "$?" == 0 ] && exit 1
busybox awk -v appname="$1" -v outfile="$OUTFILE" '
{
  if ( $2 == "TCE_Placeholder" )
  {
     holder = $0
     while (( getline < "/usr/local/tce.menu/"appname ) > 0 )
     {
        if ( index($0,"Program label=") > 0 )
        {
           sub(">",">exec ")
           print $0 > outfile
        } else {
           if ( index($0,"JWM") == 0 )
           {
              print $0 > outfile
           }
        }
     }
     close("/usr/local/tce.menu/"appname)
     print holder > outfile
  } else {
     print $0 > outfile
  }
} ' "$TCEMENU"
[ "$?" == 0 ] && sudo mv "$OUTFILE" "$TCEMENU"
--------------------------------------------------------------------------------

Please check it.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: jwm bug and change plan report
« Reply #1 on: November 23, 2009, 02:56:50 AM »
I fixed the menu double issue, but not by using a call to grep, instead to make jwm menu support consistent with the other wm menu support scripts. Thanks for the bug report.
10+ Years Contributing to Linux Open Source Projects.

Offline attiny

  • Newbie
  • *
  • Posts: 2
Re: jwm bug and change plan report
« Reply #2 on: November 23, 2009, 04:14:12 AM »
Thank you for an answer.
Because grep was used in "/usr/bin/jwm_initmenu", I thought that I was good.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: jwm bug and change plan report
« Reply #3 on: November 23, 2009, 10:34:10 AM »
Your solution is good! Many ways to solve a problem.
10+ Years Contributing to Linux Open Source Projects.