Wine, extract icon and set it for Rox Filer in XenialPup 7.5

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
fabrice_035
Posts: 765
Joined: Mon 28 Apr 2014, 17:54
Location: Bretagne / France

Wine, extract icon and set it for Rox Filer in XenialPup 7.5

#1 Post by fabrice_035 »

EDIT [ 26 / 01 / 2020] V1.1 Modify code because I found a bug in the handling of folder names with spaces. Solved.

Hi,

I use programs with Wine, but icons are never visible and you often have to do a lot of manipulations to get an icon that matches the program and if you make a shortcut on the desktop by default it's not very nice

An example :

Image

I couldn't come up with a ready-made solution to solve this problem so I made a program
Just drag the Windows icon on this program or do an "open with" by choosing executable to do the work.

Look :
Image

And rather quickly here is the result on the desktop :

Image

But in order for this to be possible it is necessary to install icoutils from the Puppy Packet Manager!

...And to be most effective :
1) Open folder /usr/local/apps
2) Create empty dir, rename as SetWindowsIcon
3) Enter into this new folder
4) create file named AppRun
5) edit this file (use a file editor such as Geany)
6) copy paste this simple and unpretentious little program :

Code: Select all

#!/bin/sh
# set icon, extract and attribute icon to Rox Filer
# need icoutils tools
#
# 26 JAN 2020, version 1.1
# --> update, found bug with folder name with space... add double quote in arg string
# ckeck command exist
cmd=$(command -v  wrestool)

if [ "$cmd" = "" ] ; then
xmessage "For working, you need install icoutils_ from Puppy Package Manager!"
exit
fi
#

# get argument
PASSED="$1"

if [ "$PASSED" = "" ] ; then
xmessage "Please, drag and drop Windows executable to set new icon."
exit
fi

BASEDIR=$(dirname "$0")
tmp=$(date +"%d_%m_%y.%H%M%S")
# extract filename and basedir
path=$(dirname "$1")
name=$(basename "$1")


# defaut Rox-Filer globicons file 
source="/root/.config/rox.sourceforge.net/ROX-Filer/globicons"


# extract icon and write icon file
filetest="$path/$name.ico"
# check already exist
if [ -f  "$filetest" ] ; then
xmessage -c "Icon already exist! Continue ?" -buttons yes,no -default no
ANSWER=$?
else
ANSWER="101"
fi

case ${ANSWER} in
101)
# check globicons file 
if grep -Fxq "<icon>$filetest</icon>" $source ; then
xmessage "Checking globicons file... an icon exist! Do nothing."
exit
fi

# comment/uncomment this line for create or not tmp file 
#cp $source $source.$tmp

# extract icon -
# you need install icoutils_ from Puppy Package Manager!

wrestool -x -t 14 "$1" > "$path/$name.ico"

# check extracting file
checkicon=$(file  "$path/$name.ico" | grep icon)
if [ "$checkicon" = "" ] ; then
xmessage "Sorry, icon can't extract, exit"
rm $path/$name.ico
exit
fi


# rox_filer globicons modify
a='  <rule match="'$1'">'
b='    <icon>'$path/$name'.ico</icon>'
c='  </rule>'
d='</special-files>'

file="/root/.config/rox.sourceforge.net/ROX-Filer/globicons"
cat $file | head -n -1 > $file".tmp"
echo $a >> $file".tmp"
echo $b >> $file".tmp"
echo $c >> $file".tmp"
echo -e "$d\c" >> $file".tmp"
rm -f $file
sleep .5
mv $file".tmp" $file
xmessage "Success, new icon created!" 
#redraw Desktop option
#/usr/local/apps/ROX-Filer/ROX-Filer -p /root/Choices/ROX-Filer/PuppyPin
exit
;;
esac

7) Create AppInfo.xml (always in /usr/local/apps/SetWindowsIcon) file, edit and add

Code: Select all

<?xml version="1.0"?>
<AppInfo>
  <Summary>Extract Windows .exe icon and set globicons file</Summary>
</AppInfo>
8) Create a link (absolute) from your new folder to

Code: Select all

/root/.config/rox.sourceforge.net/SendTo/.application_x-ms-dos-executable/
Try it!

Image

Regard
Last edited by fabrice_035 on Sun 26 Jan 2020, 20:34, edited 2 times in total.
Bionicpup64-8.0 _ Kernel 5.4.27-64oz _ Asus Rog GL752

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#2 Post by rockedge »

I've needed this for years! Thank you for sharing the script.

I am going to try it out in Bionic64 where I am using Photofiltre Studio X and Total Commander

**

Post Reply