Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Dec 2014, 16:28
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
ROX desktop utility to add & remove icons.### Beta 4
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [36 Posts]   Goto page: 1, 2, 3 Next
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Tue 22 Sep 2009, 18:42    Post subject:  ROX desktop utility to add & remove icons.### Beta 4  

This was an old utility app. I rewrote to make it easy to add and remove desktop icons.
It has Help, in rxvt or Xtem just type: roxDTicon -h

I may write a GUI for it: DtIcon-Manager.

### Beta 2: Added a command MU gave me to refresh the desktop.
........... Unfortunately it makes the desktop blink, I`ll look for a better way.

### Beta 3: Changed the apps. name to: roxDTicon. (makes more sense...)
Using MU`s new command to refresh the desktop. Now it works GREAT !!!.
Now it: Adds an icon, Removes an icon, and Sets (changes) an icon pix.
For help with command usage type: roxDTicon -h

### Beta 4: Rewrote the help section as ecomoney asked.
Be sure to look at the Help, as the command line has changed.
Change is due to the fact it will now auto. place the icons.
Best to get any changes done before apps. are written that use it.

It starts at the bottom of the right column of icons on the left half of the screen.
If that position is filled then it starts a new column at the top of the screen.

>>> Post any Qs or comments...
roxDTicon_b4.gz
Description  Gunzip the file and put it into: /usr/bin
gz

 Download 
Filename  roxDTicon_b4.gz 
Filesize  1.64 KB 
Downloaded  510 Time(s) 

Last edited by sunburnt on Fri 02 Oct 2009, 14:23; edited 6 times in total
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Thu 24 Sep 2009, 22:24    Post subject:  

I got a command from MU to refresh the desktop but it makes it blink.
So I haven`t included it in the app. as it`s an unacceptable effect.
I don`t know if I`ll be able to find another way to do it that`s acceptable.
Back to top
View user's profile Send private message 
sidders

Joined: 23 Jul 2008
Posts: 470
Location: Bolton, uk

PostPosted: Fri 25 Sep 2009, 06:44    Post subject:  

I havnt found a way apart from restartwm

I have just experimented with inserting the icon code in RC.local. The wm runs after so no need to restart the wm. Thats after the conventional way of loading and SFS.
Back to top
View user's profile Send private message 
ecomoney


Joined: 25 Nov 2005
Posts: 2183
Location: Lincolnshire, England

PostPosted: Fri 25 Sep 2009, 08:17    Post subject:  

The desktop "Blinking" would be fine if it meant no further manual intervention was necessary if thats what it takes. Perhaps putting up an "xmessage" for a second befroe the blink saying "Refreshing desktop..." would be enough to alleviate any user anxiety.
_________________
Puppy Linux's Mission

Sorry, my server is down atm!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Fri 25 Sep 2009, 14:23    Post subject:  

I`ve seen other apps. put icons on the desktop without the blink.
And when you drag a folder or file to the desktop it just appears also...
A popup message... Hummmm Maybe...

I made a desktop USB flash drive icon for usb-auto to turn it on and off.
The icon`s red, click & it turns green & runs usb-auto, click again & off.
Sometimes it works great, and other times it doesn`t change the icon.

sidders; Here`s the command to refresh the desktop ( ROX`s pinboard ):
Code:
rox -p /root/Choices/ROX-Filer/PuppyPin
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: Fri 25 Sep 2009, 20:17    Post subject:  

look at /sbin/pup_event_frontend_d
It adds the hotplug drive-icons using SOAP.

SOAP is a XML string that you can send to rox.

Code:
 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <PinboardAdd>
   <Path>/root/.pup_event/drive_${ONEDRVNAME}</Path>
   <X>${COORD_X}</X>
   <Y>${COORD_Y}</Y>
   <Label>${ONEDRVNAME}</Label>
   <Args>${DRV_CATEGORY} ${FSTYPE}</Args>
  </PinboardAdd>
 </env:Body>
</env:Envelope>"  | rox -R


So the whole XML code is sent via "echo" using a pipe "|" to rox.

It seems that the Path is including files like:
/root/.pup_event/drive_sda1/AppInfo.xml
This file then has informations to create a rightclick menu.

It also should be able, to define the icon directly in the XML-Code.

Maybe so (untested):

Via google I find:
http://209.85.135.132/search?q=cache:ek5esBbRh3YJ:www.puppylinux.ca/tpp/tronkel/hotpup-1.00/etc/HotPup/add_icons_for_device5+rox+envelope+icon&cd=10&hl=de&ct=clnk&client=opera

This is one of the older hotplug scripts.
Maybe this works after looking at it:

Add "rxvt" to the desktop:

Code:
 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <PinboardAdd>
   <Path>/usr/bin/rxvt</Path>
   <X>500</X>
   <Y>500</Y>
   <Label>Consolewindow</Label>
   <Args></Args>
  </PinboardAdd>
 </env:Body>
</env:Envelope>"  | rox -R


To assign an icon:
Code:
 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <SetIcon>
    <Path>rxvt</Path>
    <Icon>/usr/local/lib/X11/pixmaps/console48.png</Icon>
  </SetIcon>
 </env:Body>
</env:Envelope>"  | rox -R


Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Sat 26 Sep 2009, 00:55    Post subject:  

Mark finds it again! He never fails to impress....
# First, I don`t see how the XML code changes the globicons file.
......... I can only guess that ROX is using the info. to change the file.
# Second, what the 2 web addresses are in it for is confusing too.
......... The SetIcon section looks the same as gtkDialog.

The code below is to change an existing icon red/green/red/green etc.
It changes the file: globicons, but the desktop isn`t refreshed with it.
The apps. icon changed to the standard script icon and stays that way.
To see if I could fix it, I tried: rox -p /root/Choices/ROX-Filer/PuppyPin
It stays the script icon even though the globicons file tells it otherwise.
I really thought running the ROX command would at least bring it back.
I run SeaMonkey400, it doesn`t have hotplug in it, is this the problem?
Code:
echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <SetIcon>
    <Path>/mnt/home/apps/bin/auto-mnt</Path>
    <Icon>`cat /tmp/auto-mnt_icon`</Icon>
  </SetIcon>
 </env:Body></env:Envelope>" | rox -R
My code had also changed the globicons file, still the refresh problem.
Code:
sed -i "s#$iconOFF#$iconON#" $orgGI

It seems that a command to refresh the desktop icons is still needed...
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2293

PostPosted: Sat 26 Sep 2009, 03:13    Post subject:  

'rox -x APP_DIR' will refresh the icon, where APP_DIR is the path to the appdir.

I wrote a Trash appdir which changes it's icon depending on how full the trash is. I'll post the code for the AppRun here:
Code:
#!/bin/sh
# RecycleBin-0.4
# copyright 2006 Gilbert Ashley <amigo@ibiblio.org>
# See the documentation
EXEC_NAME=`basename "$0"`
# Set the name of the main executable here.
PROG=Trash
# This is needed for CHOICES_DIR -set to EXEC_NAME for version specific
APP_NAME=RecycleBin
#
DEFAULT_OPTIONS="
TRASH_DIR=${HOME}/Desktop/Trash
TRASH_WARN=20
TRASH_FULL=50
"

COUNT=0
for OPTION in $DEFAULT_OPTIONS ; do
(( COUNT++ ))
declare DEFAULT_OPTION_TAG[$COUNT]="$(echo $OPTION |cut -f1 -d=)"
declare DEFAULT_OPTION_VALUE[$COUNT]="$(echo $OPTION |cut -f2- -d=)"
done

# Check for links and get APP_DIR
if [ ! -L "$0" ] ; then
   APP_DIR=`dirname "$0"`
   APP_DIR=`cd "$APP_DIR";pwd`
elif [ ! -z `which readlink 2> /dev/null` ] ; then
   APP_DIR=`readlink -f "$0"`
   APP_DIR=`dirname "$APP_DIR"`
else
   echo "$PROG: Can't get real path to AppRun!" 1>&2
fi
export APP_DIR
# EXEC_NAME=`basename "$0"`
# Add APP_DIR/Resources to the path and read in FUNCTIONS
PATH="$APP_DIR":"$APP_DIR/Resources":$PATH
source "$APP_DIR/Resources/AppFunctions"

# Option: Detect the PLATFORM
PLATFORM=`get_platform`
# Or specify a simple local binary path(wrapped binary or shell):
PLATFORM=bin

# Add the BIN_DIR to the path
BIN_DIR="$APP_DIR/$PLATFORM"
PATH="$APP_DIR/$PLATFORM":$PATH
export PATH

# Use CHOICES dir if needed -be sure you have set APP_NAME above
get_choices_dir ;

# Here is where we put the default choices. $HOME/Choices/$APP_DIR
# Uncomment this if we need to set or retrieve any options.
if [[ $CHOICES_DIR != '' ]] && [[ ! -e $CHOICES_DIR/Settings ]] ; then
   mkdir -p $CHOICES_DIR
   cat /dev/null > $CHOICES_DIR/Settings
   COUNT=0
   IFS=$'\n'
   for OPTION in $DEFAULT_OPTIONS ; do
      (( COUNT++ ))
      echo ${DEFAULT_OPTION_TAG[$COUNT]}=${DEFAULT_OPTION_VALUE[$COUNT]} >> $CHOICES_DIR/Settings
   done
fi
#
if [[ -e $CHOICES_DIR ]] ; then
   if [[ -e $CHOICES_DIR/Settings ]] ; then
      source $CHOICES_DIR/Settings
   else
      COUNT=0
      IFS=$'\n'
      for OPTION in $DEFAULT_OPTIONS ; do
         (( COUNT++ ))
         declare ${DEFAULT_OPTION_TAG[$COUNT]}=${DEFAULT_OPTION_VALUE[$COUNT]}
      done
   fi
fi
#cd $APP_DIR ;

# Simply changing the icon image doesn't cause the display to update
# This is a nice trick to update the display without waiting for a mouse-over
function update_icon() {
# update the display
( UPDATE_ICON=1 ; rox -x ${APP_DIR} )
}

function calculate_usage() {
cd $TRASH_DIR ;

SIZE=$(expr $(du -s --exclude=.Trash.data |cut -f1) / 1024)
#xterm -hold -e echo "$SIZE $TRASH_FULL"

   if [[ $SIZE -gt $TRASH_FULL ]] ; then
    cp -f "$APP_DIR/Full.png" "$APP_DIR/.DirIcon"
   #elif [[ $(eval du -s --exclude=.Trash.data |cut -f1) -gt $TRASH_WARN ]] ; then
   elif [[ $SIZE -gt $TRASH_WARN ]] ; then
    #xterm -hold -e echo "$SIZE $TRASH_WARN"
    cp -f "$APP_DIR/Warn.png" "$APP_DIR/.DirIcon"
   else
    cp -f "$APP_DIR/Empty.png" "$APP_DIR/.DirIcon"
   fi

   ignore() {
   if [[ $(eval du -s --exclude=.Trash.data |cut -f1) -gt $TRASH_FULL ]] ; then
    cp -f "$APP_DIR/Full.png" "$APP_DIR/.DirIcon"
   elif [[ $(eval du -s --exclude=.Trash.data |cut -f1) -gt $TRASH_WARN ]] ; then
    cp -f "$APP_DIR/Warn.png" "$APP_DIR/.DirIcon"
   else
    cp -f "$APP_DIR/Empty.png" "$APP_DIR/.DirIcon"
   fi
   }
}

#
if [[ $# = 0 ]] ; then
   # What to do if icon is simply clicked.
   # don't do anything if we are just updating the icon
   if [[ $UPDATE_ICON ]] ; then
   exit 0
   # or insert a routine here to select a PROG
   # xterm -hold -e echo "What to do if the icon is simply clicked. See line 55"
   # Then exit if needed
   # exit 0
   else
      # If the TRASH_DIR doesn't exist we need to setup
      if [[ -d $TRASH_DIR ]] ; then
         # open the Trash
         rox $TRASH_DIR ; exit 0
      else
       xterm -hold -geometry 40x5 -e echo "No TRASH_DIR found. Configure Me!"
      fi
   fi
elif [[ $1 == '--help' ]] ; then
   # Put menu options here that you have added to AppInfo.xml
   xterm -hold -e cat $APP_DIR/Help/README
   exit 0
elif [[ $1 == '--showvolume' ]] ; then
   # Put menu options here that you have added to AppInfo.xml
   if [[ -d $TRASH_DIR ]] ; then
      if [[ $TRASH_FULL ]] ; then
      #calculate_usage
      cd $TRASH_DIR ;
      SIZE=$(expr $(du -s --exclude=.Trash.data |cut -f1) / 1024)
      #xterm -hold -e echo "Trash is $( expr $SIZE/$TRASH_FULL) full"
      xterm -hold -geometry 60x5 -e echo "$SIZE MB of $TRASH_FULL MB used for $TRASH_DIR"
      fi
   exit 0
   
   fi
elif [[ $1 == '--showdata' ]] ; then
   if [[ -e $TRASH_DIR/.Trash.data ]] ; then
     xterm -hold -geometry 110x10 -e cat $TRASH_DIR/.Trash.data
   fi
elif [[ $1 == '--restoreitems' ]] ; then
 cd $TRASH_DIR ;
 cat > /tmp/FILELIST <<EOF
Xdialog --title "Restore Items" --backtitle "Select items to restore" \\
      --stdout --separator "\n" \\
      --checklist "hello, this is a --checklist..." 0 0 0 \\
EOF

IFS='
'
   for item in $(cat /root/Trash/.Trash.data) ; do
   name=$(echo $item |cut -f1 -d ' ')
   loc=$(echo $item |cut -f2 -d ' ')
   echo -n $(basename $name)" " >> /tmp/FILELIST
   echo -n $(dirname $loc)" " >> /tmp/FILELIST
   echo "no \\" >> /tmp/FILELIST
   done
   echo "1> /tmp/builtlist" >> /tmp/FILELIST
   
   . /tmp/FILELIST
   
   cd $TRASH_DIR ;
   
   for file in $(cat /tmp/builtlist) ; do
      /usr/apps/RecycleBin/AppRun $TRASH_DIR/$file
   done
elif [[ $1 == '--configure' ]] ; then
   # Put configure options interface here if needed
   if [[ -d  $CHOICES_DIR ]] ; then
      
      if [[ -e $CHOICES_DIR/Settings ]] ; then
        MYOPTIONS=$(Xdialog --stdout --title "Hello" --inputbox "Set Trash Directory" 0 0 ${TRASH_DIR} \
        --title TrashMan --spinbox "Set Trash Warn Size" 0 0 1 1000 "${TRASH_WARN}" "Show yellow when ${TRASH_WARN}MB full" \
        --title TrashMan --spinbox "Set Trash Full Size" 0 0 1 1000 "${TRASH_FULL}" "Show red when ${TRASH_FULL}MB full")
      else
        MYOPTIONS=$(Xdialog --stdout --title "Hello" --inputbox "Set Trash Directory" 0 0 ${DEFAULT_OPTION_VALUE[1]} \
        --title TrashMan --spinbox "Set Trash Warn Size" 0 0 1 1000 ${DEFAULT_OPTION_VALUE[2]} warn \
        --title TrashMan --spinbox "Set Trash Full Size" 0 0 1 1000 ${DEFAULT_OPTION_VALUE[3]} full)
      fi
      
      case $? in
      0)
         cat /dev/null > $CHOICES_DIR/Settings
         COUNT=0
         IFS=$'\n'
         for MYOPTION in $MYOPTIONS ; do
         (( COUNT++ ))
         declare MYOPTION[$COUNT]=${DEFAULT_OPTION_TAG[$COUNT]}=$MYOPTION
         echo ${MYOPTION[$COUNT]} >> $CHOICES_DIR/Settings
         done
         #
         if ! [[ -d $TRASH_DIR ]] ; then
            Xdialog --wrap --title "Create Directory?" --yesno "The TRASH_DIR doesn't \
            exist yet. Would you like me to create it?" 0 0
            case $? in
               0)
                  mkdir -p $TRASH_DIR
                  if [[ $? = 0 ]] ; then
                    Xdialog --center --title "RecycleBin" --msgbox "$TRASH_DIR created" 0 0
                  fi
                  ;;
            esac
         
         fi
      ;;
      1|255)
         exit
      ;;
      esac
      
   else
     rox $CHOICES_DIR ; exit 0
   fi
elif [[ $1 == '--view' ]] ; then
   rox $TRASH_DIR ; exit 0
elif [[ $1 == '--empty' ]] ; then
   # Use Xdialog, gtk-shell or greq for a simple interface
   Xdialog --under-mouse --title "Empty TrashCan" --yesno "Delete all files from trash?" --default-no 0
   #gtk-shell -t "Empty Recycle Bin" -l "Delete all files from trash?" -b OK -ec 1 -eol
   #greq -t "Empty TrashCan" -p "Delete all files from trash?" -oOK -aCancel ; echo $? 
   if [[ $? = 1 ]] ; then
    exit 0
   else
      cd $TRASH_DIR;
      for OBJ_NAME in $(ls -1d * | grep -v '.Trash.data') ; do
      rm -r $OBJ_NAME
      if [[ $? = 0 ]] ; then
         cat $TRASH_DIR/.Trash.data |grep -v "$OBJ_NAME" > $TRASH_DIR/.Trash.tmp
         rm -f $TRASH_DIR/.Trash.data &> /dev/null
         cp $TRASH_DIR/.Trash.tmp $TRASH_DIR/.Trash.data &> /dev/null
         rm -f $TRASH_DIR/.Trash.tmp &> /dev/null
      fi
      done
      calculate_usage
      update_icon
    exit 0
   fi
elif [[ $1 == '--compile' ]] ; then
   shift
   standard_compile || exit 1
elif [[ $# > 0 ]] ; then
   # What to do if a file or files is dropped on the AppDir
   # This loop will handle multiple file selections
   for f in "$@" ; do
    #xterm -hold -e echo "File Operations for: $f. See line 76"
    # usually:
    OBJECT=${f%/}
    OBJ_NAME=$(basename $OBJECT)
    OBJ_LOC=$(dirname $OBJECT)
   
    if [[ "$OBJECT" = "$TRASH_DIR/$OBJ_NAME" ]] ;then
      if [[ "$(cat $TRASH_DIR/.Trash.data |grep "$OBJ_NAME")" != "" ]] ;then
      # OBJ_NAME=$(cat $TRASH_DIR/.Trash.data |grep "$f")
      ORIG_FILE="$(cat $TRASH_DIR/.Trash.data |grep $OBJ_NAME |cut -f2 -d' ')"
      ORIG_LOC=$(dirname $ORIG_FILE)
      
         # if the item exists in the TRASH_DIR recycle it
         if [[ -z $(ls -1d -- $f |egrep '^${TRASH_DIR}' 2> /dev/null) ]] ; then
         cd $TRASH_DIR;
         cp -R $OBJ_NAME $ORIG_FILE &> /dev/null
            if [[ $? = 0 ]] ; then
             rm -rf $OBJ_NAME &> /dev/null
            fi
            if [[ $? = 0 ]] ; then
             cat $TRASH_DIR/.Trash.data |grep -v "$OBJ_NAME" > $TRASH_DIR/.Trash.tmp
             rm -f $TRASH_DIR/.Trash.data &> /dev/null
             cp $TRASH_DIR/.Trash.tmp $TRASH_DIR/.Trash.data &> /dev/null
             rm -f $TRASH_DIR/.Trash.tmp &> /dev/null
            fi
         fi
      fi
    else
      #xterm -hold -e echo "$OBJ_NAME $OBJ_LOC $f"
      #ft=tar.bz ; echo ${ft#*.}
      #if [[ "$(echo)" ]]
      TIME_STAMP=$(date +%Y%m%d%H%M%S)
      RIGHT_OF_LAST_PERIOD="${OBJ_NAME##*.}"
      LEFT_OF_LAST_PERIOD=$(basename $OBJ_NAME ".$RIGHT_OF_LAST_PERIOD")
      if [[ "$LEFT_OF_LAST_PERIOD" = "$RIGHT_OF_LAST_PERIOD" ]] ; then
         # name has no extension
         NEW_NAME=$OBJ_NAME.$TIME_STAMP
      else
         NEW_NAME=$LEFT_OF_LAST_PERIOD.$TIME_STAMP.$RIGHT_OF_LAST_PERIOD
      fi
      # xterm -hold -e echo "$OBJ_NAME $OBJ_LOC $f $NEW_NAME $LEFT_OF_LAST_PERIOD $RIGHT_OF_LAST_PERIOD"
      cp -R $f $TRASH_DIR/$NEW_NAME
      if [[ $? = 0 ]] ; then
       rm -rf $f
      fi
      if [[ $? = 0 ]] ; then
       echo $NEW_NAME $f >> $TRASH_DIR/.Trash.data
      else
       rm -rf $TRASH_DIR/$NEW_NAME &> /dev/null
      fi
    fi
   done
   # check how much stuff is in the trash and set the icon accordingly
   calculate_usage
   # Then update the display
   update_icon
fi

exit 0

# This is useful if you make symlinks of the program binary names in
# your path and then link them to the AppRun.
EXEC_FILE_PATH="$APP_DIR/$PLATFORM/$EXEC_NAME"
if [[ -x "$EXEC_FILE_PATH" && $EXEC_NAME != 'AppRun' ]] ; then
   exec "$EXEC_FILE_PATH" "$@"
elif [ $EXEC_NAME != 'AppRun' ] ; then
   echo "Unable to find $EXEC_NAME in binary directory."
fi

BIN=$BIN_DIR/$PROG

if [ -x "$BIN" ]; then
  exec $DEBUGGER "$BIN" "$@"
 
  else
  echo "ERROR from $0:" >&2
  echo "I cannot find an executable file for your host type ($PLATFORM)." >&2
  echo "Trying to compile..." >&2
  if [ -n "$DISPLAY" ]; then
    xterm -e "$0" --compile
  else
    "$0" --compile
  fi
  if [ -x "$BIN" ]; then
    exec Trash -r "$@"
  fi
  exit 1
fi


I've attached an archive of the complete app. Note that it refreshes itself, so it has a trap which checks to see if it is refreshing and exits without 'doing' anything else -see line 118 of AppRun
RecycleBin.tar.gz
Description  Recycling trash can
gz

 Download 
Filename  RecycleBin.tar.gz 
Filesize  37.71 KB 
Downloaded  447 Time(s) 
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Sat 26 Sep 2009, 04:05    Post subject:  

Hi amigo; I tried and it didn`t change the icon either...
At the bottom you can see all the lines I tried.
Code:
iconPATH=/usr/local/lib/X11/pixmaps/                  # set path & icons
iconON='usbflash_green-48'
iconOFF='usbflash_red-48'

if [ -n "$1" ];then                  # if argument
 orgGI=$1
else                           # if no argument
 orgGI=/root/Choices/ROX-Filer/globicons
fi
PID=`ps -C auto-drive | grep -v PID`         # get app. process

if [ -z "$PID" ];then                  # if app. not running, run
 auto-drive &
 if [ $? -eq 0 ];then                     # if app. started
  sed -i "s#$iconOFF#$iconON#" $orgGI            # on icon
 fi
else                              # if app. running, kill it
 kill `echo $PID | awk '{print $1}'`
 if [ $? -eq 0 ];then                     # if app. killed
  sed -i "s#$iconON#$iconOFF#" $orgGI            # off icon
 fi
fi

#rox -x /initrd/mnt/dev_save/apps/bin/auto-mnt
rox -x /initrd/mnt/dev_save/apps/bin
#rox -x /root/Choices/ROX-Filer
#rox -x $orgGI
#rox -x globicons

It seems it should be the globicons file in the command, FILE has changed.
ROX --help
Code:
  -x, --examine=FILE    FILE has changed - re-examine it
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2293

PostPosted: Sat 26 Sep 2009, 04:54    Post subject:  

I think this:
/initrd/mnt/dev_save/apps/bin/auto-mnt
would have to be an AppDir for that to work.
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: Sat 26 Sep 2009, 07:58    Post subject:  

my example above was correct, just one error, the <Path> was different in both examples.
One was "/usr/bin/rxvt", the other just "rxvt". Iff you correct that, it works.

Here are two small scripts:

addicon

Code:
#!/bin/bash

 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <PinboardAdd>
   <Path>$1</Path>
   <X>$2</X>
   <Y>$3</Y>
   <Label>$4</Label>
   <Args>$5</Args>
  </PinboardAdd>
 </env:Body>
</env:Envelope>"  | rox -R



addiconpicture

Code:
#!/bin/bash

 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <SetIcon>
    <Path>$1</Path>
    <Icon>$2</Icon>
  </SetIcon>
 </env:Body>
</env:Envelope>"  | rox -R


Usage:
Create a new icon (for rxvt without scrollbar):
addicon /usr/bin/rxvt 200 500 "Console Window" +sb

Add a picture:
addiconpicture /usr/bin/rxvt /usr/local/lib/X11/pixmaps/archive48.png
Set a different picture:
addiconpicture /usr/bin/rxvt /usr/local/lib/X11/pixmaps/console48.png

The changes are visible immedeatly on the desktop without performing further steps.
Tested in Newyearspup rc10.

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Sat 26 Sep 2009, 18:49    Post subject:  

amigo; the app. exec. is auto-mnt, so the path to it is: /root/apps
Is this what you ment by "AppDir"?

Mark; I tried using the code and it makes the icon, but it won`t change it.
I`ve tried it many different ways... This really should work:
Code:
#!/bin/sh
if [ -n "$3" ];then                              ### Make DT icon
 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <PinboardAdd>
   <Path>$1</Path>
   <X>$2</X>
   <Y>$3</Y>
   <Label>$4</Label>
   <Args>$5</Args>
  </PinboardAdd>
 </env:Body>
</env:Envelope>"  | rox -R

 if [ -z "$6" ];then exit ;fi
 icon=$6
else
 icon=$2
fi
                                                   ### Change Icon
 echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
 <env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
  <SetIcon>
    <Path>$1</Path>
    <Icon>$icon</Icon>
  </SetIcon>
 </env:Body>
</env:Envelope>"  | rox -R
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: Sat 26 Sep 2009, 19:14    Post subject:  

yes, your example works here.
./sunburnttest /usr/bin/rxvt /usr/local/lib/X11/pixmaps/console48.png

So you have a different rox?
Which Puppy do you use?
What do you get from
rox --version
?

I get:
Quote:
# rox --version
ROX-Filer 2.6.1
Copyright (C) 2005 Thomas Leonard.
ROX-Filer comes with ABSOLUTELY NO WARRANTY,
to the extent permitted by law.
You may redistribute copies of ROX-Filer
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Compiled with GTK version 2.12.1
Running with GTK version 2.14.4

-- features set at compile time --

Large File Support... Yes
Dnotify support... Yes
Binary compatibility... No (apsymbols.h not found)
Extended attribute support... Yes
#


Do your hotplug icons work? Those drive icons at the bottom of the screen.

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Sat 26 Sep 2009, 19:27    Post subject:  

Mark; I use Puppy 400 SeaMonkey with no hotplug in it, is that the problem?
It will create the icon, but the setting the icon pix doesn`t work.
Code:
# rox --version
ROX-Filer 2.6.1
Copyright (C) 2005 Thomas Leonard.
ROX-Filer comes with ABSOLUTELY NO WARRANTY,
to the extent permitted by law.
You may redistribute copies of ROX-Filer
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Compiled with GTK version 2.12.1
Running with GTK version 2.12.1

-- features set at compile time --

Large File Support... Yes
Dnotify support... Yes
Binary compatibility... No (apsymbols.h not found)
Extended attribute support... Yes

The GTK version is older than yours...
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: Sat 26 Sep 2009, 20:21    Post subject:  

I have no idea unfortunately, why it will not work on your system Sad

Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 3 [36 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1666s ][ Queries: 12 (0.0078s) ][ GZIP on ]