ShowHideIcons-v1.8 30/11/2014
ShowHideIcons-v1.8 30/11/2014
This is a simple app with one script in ~/my-applications/bin/nicons very simple but works a treat.
v1.8
v1.8
- Attachments
-
- ShowHideIcons-v1.8.pet
- (2.5 KiB) Downloaded 245 times
Last edited by stemsee on Mon 01 Dec 2014, 10:47, edited 7 times in total.
Updated to v1.6
Now no puppypin0 in .pet, also added reset function, and choose function to select some/any icons from original puppypin to add to new puppypin, plus remove some/any icons. It iterates line by line or you can simply type in the name of the app/icon to add it and enter then type exit when finished.
see first post
to do:
Add any icon from /usr/share/applications/*.desktop These supply variables for Name Categories and Icon and Exec command which is all that's needed.
Now no puppypin0 in .pet, also added reset function, and choose function to select some/any icons from original puppypin to add to new puppypin, plus remove some/any icons. It iterates line by line or you can simply type in the name of the app/icon to add it and enter then type exit when finished.
see first post
to do:
Add any icon from /usr/share/applications/*.desktop These supply variables for Name Categories and Icon and Exec command which is all that's needed.
Last edited by stemsee on Fri 28 Nov 2014, 19:25, edited 1 time in total.
Hi stemsee,
You have seemingly been unable to replicate (or even comprehend) the major problem with drive icons that I have twice before reported to you.
If the problem is uniquely mine, it is of no importance to me as, in any event, the Swapicons pet works perfectly.
However I would, at least, be interested to know if this code produces a problem with drive icon display and usage for any other tester.
You have seemingly been unable to replicate (or even comprehend) the major problem with drive icons that I have twice before reported to you.
If the problem is uniquely mine, it is of no importance to me as, in any event, the Swapicons pet works perfectly.
However I would, at least, be interested to know if this code produces a problem with drive icon display and usage for any other tester.
Hi again,
Your reply
For a fast, tried and tested app users have the option of
http://murga-linux.com/puppy/viewtopic. ... 72&t=83991
from rhadon with contributions from LIBL and SFR.
Your reply
exhibits your total lack of comprehension.Menu > Desktop > Desktop Drives Icon Manager
For a fast, tried and tested app users have the option of
http://murga-linux.com/puppy/viewtopic. ... 72&t=83991
from rhadon with contributions from LIBL and SFR.
- Attachments
-
- Swapicons.png
- (21.45 KiB) Downloaded 402 times
@jasper
Had I known this app before, I would not have bothered writing my own. But now that I have I can say mine has more options. Still I am going to give this one a try and maybe I can add its mechanism to my own full featured version as well as a gui! I have been tardy on learning to build GUIs.
However this app doesn't really manage icons generally, from the looks of things. But mine is beginning too.
regards
stemsee
Had I known this app before, I would not have bothered writing my own. But now that I have I can say mine has more options. Still I am going to give this one a try and maybe I can add its mechanism to my own full featured version as well as a gui! I have been tardy on learning to build GUIs.
However this app doesn't really manage icons generally, from the looks of things. But mine is beginning too.
regards
stemsee
@Jasper
I use showhideicons often to show or hide icons, also to add and remove icons. Why on earth would you come to this thread and LIE? You are being absolutely ridiculous. Please change your previous post to reflect the truth. If you are not willing to do that then I will raise an issue with the forum adjudicators.
stemsee
I use showhideicons often to show or hide icons, also to add and remove icons. Why on earth would you come to this thread and LIE? You are being absolutely ridiculous. Please change your previous post to reflect the truth. If you are not willing to do that then I will raise an issue with the forum adjudicators.
stemsee
I absolutely agree - Why would I lie? Have I not praised some of your recent work both publicly and with private support?
The truth is this did not work for me and I wrote that I would be interested to see the results of tests by other forum members.
By all means rewrite my post that offends you and include it below and if I find your words acceptable - I will adopt them.
All publicity may be good publicity and I look forward to a test report/comment from RSH and hopefully others.
The truth is this did not work for me and I wrote that I would be interested to see the results of tests by other forum members.
By all means rewrite my post that offends you and include it below and if I find your words acceptable - I will adopt them.
All publicity may be good publicity and I look forward to a test report/comment from RSH and hopefully others.
@jasper
I owe you an apology and thanks ... the script as it stands doesn't, indeed, install and hide icons. There is a loop created in the last update which copies both pins to each other so nothing changes! Removed and I will correct it.
But I only found it by booting a trusty tahr and installing from scratch, otherwise on EmSee a slightly older version it works fine. Tat was before I added 'nicons custom' and 'nicons nocustom'.
stemsee
I owe you an apology and thanks ... the script as it stands doesn't, indeed, install and hide icons. There is a loop created in the last update which copies both pins to each other so nothing changes! Removed and I will correct it.
But I only found it by booting a trusty tahr and installing from scratch, otherwise on EmSee a slightly older version it works fine. Tat was before I added 'nicons custom' and 'nicons nocustom'.
stemsee
I think it is fixed now and simplified. reset pins, remove icons, add icons, switch iconless desktop/ iconified desktop.
command line usage
begin by creating switch flag and backup original PuppyPin
to switch to iconless desktop PuppyPin0
to switch back to iconified desktop PuppyPin
to add icons from /us/share/applications renamed links (no .desktop suffix)
to remove icons from pressent iconified pin by typing part or all of name/s separated by one space.
to remove all icons from both pins
to have two iconifiable pins
to exit 'nicons two' switching.
to delete all pins created by script
place script in path and name it 'nicons' make executable.
EDITED: 30/11/14 handles xonclock now
Still a bit buggy. Some commands need to be invoked from iconified desktop others from iconless desktop.
command line usage
begin by creating switch flag and backup original PuppyPin
Code: Select all
nicons
Code: Select all
nicons
Code: Select all
nicons
Code: Select all
nicons add
Code: Select all
nicons remove
Code: Select all
nicons removeall
Code: Select all
nicons two
Code: Select all
nicons pip
Code: Select all
nicons reset
place script in path and name it 'nicons' make executable.
EDITED: 30/11/14 handles xonclock now
Code: Select all
##!/bin/bash
#copyright (c) 2014 M arcos Contant
#nicons # first use creates flag and backs-up puppypin, but no apparent change
#nicons # second use switches to iconless dektop
#nicons # third use switches to iconified desktop
#nicons reset # restores original desktop and deletes script created pins
#nicons remove # helps user remove icon/s from iconified desktop
#nicons removeall # removes all icons from iconified pin. Blank page for adding icons.
#nicons noicons # recreates pristine PuppyPin0 (iconless desktop) from script.
#nicons two #copies iconless pin to puppypin; giving two iconifiable desktop pins.
#nicons pip # resets nicons two.
#nicons add #for rox window of icons from applications dir without .desktop extension.
#(nicons add/remove is temporary for iconless desktop but persistent for iconified desktop, except with nicons two)
pp0 () {
echo '<?xml version="1.0"?>' > ~/Choices/ROX-Filer/PuppyPin0
echo "<pinboard>" >> ~/Choices/ROX-Filer/PuppyPin0
echo " <backdrop style="Stretched">/usr/share/backgrounds/default.jpg</backdrop>" >> ~/Choices/ROX-Filer/PuppyPin0
echo \ >> ~/Choices/ROX-Filer/PuppyPin0
echo \ >> ~/Choices/ROX-Filer/PuppyPin0
echo " </pinboard>" >> ~/Choices/ROX-Filer/PuppyPin0
}
if [ ! -e ~/Choices/ROX-Filer/PuppyPin-bak1 ]; then
cp ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin-bak
cp ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin-bak1
fi
if [ "$1" = pip ]; then
rm ~/Choices/ROX-Filer/pip
rm ~/Choices/ROX-Filer/ipp
pp0
fi
if [ -e ~/Choices/ROX-Filer/pip ]; then
pipipp () {
mv ~/Choices/ROX-Filer/pip ~/Choices/ROX-Filer/ipp
mv ~/Choices/ROX-Filer/PuppyPin /tmp/
mv ~/Choices/ROX-Filer/PuppyPin0 ~/Choices/ROX-Filer/PuppyPin
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
gtkdialog-splash -placement top-left -bg blue -text "$(gettext 'Pin 1 of Two iconifiable pins switching.
To remove type - nicons pip - then Enter')" &
SPLASHPID=$!
sleep 2
kill $SPLASHPID 2> /dev/null
exit
}
pipipp
fi
if [ -e ~/Choices/ROX-Filer/ipp ]; then
ipppip () {
mv ~/Choices/ROX-Filer/ipp ~/Choices/ROX-Filer/pip
mv ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin0
cp /tmp/PuppyPin ~/Choices/ROX-Filer/PuppyPin
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
gtkdialog-splash -placement top-left -bg blue -text "$(gettext 'Pin 2 of Two iconifiable pins switching.
To remove type - nicons pip - then Enter')" &
SPLASHPID=$!
sleep 2
kill $SPLASHPID 2> /dev/null
exit
}
ipppip
fi
#if [ "$1" = setup ]; then
set () {
rm ~/Choices/ROX-Filer/PuppyPin-bak
ppbak () {
echo '<?xml version="1.0"?>' > ~/Choices/ROX-Filer/PuppyPin-bak
echo "<pinboard>" >> ~/Choices/ROX-Filer/PuppyPin-bak
echo " <backdrop style="Stretched">/usr/share/backgrounds/default.jpg</backdrop>" >> ~/Choices/ROX-Filer/PuppyPin-bak
echo \ >> ~/Choices/ROX-Filer/PuppyPin-bak
echo \ >> ~/Choices/ROX-Filer/PuppyPin-bak
echo " </pinboard>" >> ~/Choices/ROX-Filer/PuppyPin-bak
echo \ >> ~/Choices/ROX-Filer/PuppyPin-bak
}
ppbak
if [[ -d /usr/shared/renamed ]]; then
rm -r /usr/shared/renamed/
fi
if [[ ! -d /usr/shared/renamed ]]; then
mkdir /usr/share/renamed/
ln -fnv /usr/share/applications/* /usr/share/renamed/ 2> /dev/null
cd /usr/share/renamed/
echo $line | for i in *.desktop; do mv $i `basename $i .desktop`; done 2> /dev/null
fi
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin-bak
rox /usr/share/renamed/ &
gtkdialog-splash -placement top-left -bg blue -text "$(gettext 'Drag & arrange all icons to this desktop')" &
SPLASHPID=$!
sleep 4
kill $SPLASHPID 2> /dev/null
gtkdialog-splash -placement top-left -bg blue -text "$(gettext 'Press Enter when finished.')" &
SPLASHPID=$!
sleep 8
kill $SPLASHPID 2> /dev/null
read dummy
nicons
exit
}
#set
#fi
choice () {
if [[ -d /usr/shared/renamed ]]; then
rm -r /usr/shared/renamed/
fi
if [[ ! -d /usr/shared/renamed ]]; then
mkdir /usr/share/renamed/
ln -fnv /usr/share/applications/* /usr/share/renamed/ 2> /dev/null
cd /usr/share/renamed/
echo $line | for i in *.desktop; do mv $i `basename $i .desktop`; done 2> /dev/null
fi
rox /usr/share/renamed/ &
gtkdialog-splash -placement top-left -bg blue -text "$(gettext 'Drag & arrange all icons to this desktop')" &
SPLASHPID=$!
sleep 4
kill $SPLASHPID 2> /dev/null
rm /root/Choices/ROX-Filer/PuppyPin0
cp /root/Choices/ROX-Filer/PuppyPin /root/Choices/ROX-Filer/PuppyPin0
[ -x /root/Startup/xonclock* ] && /root/Startup/xonclock*
exit
}
if [ "$1" = add ]; then
choice && exit
fi
removeicons () {
rm /tmp/rmvtxt
touch /tmp/rmvtxt
echo "Type space separated name of icon/s to remove and press enter"
read rmv < /dev/tty
echo $rmv | tr ' ' '\n' >> /tmp/rmvtxt
while read line
do
sed -i "/$line/d" ~/Choices/ROX-Filer/PuppyPin
done < /tmp/rmvtxt
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
rm /root/Choices/ROX-Filer/PuppyPin0
cp /root/Choices/ROX-Filer/PuppyPin /root/Choices/ROX-Filer/PuppyPin0
[ -x /root/Startup/xonclock* ] && /root/Startup/xonclock*
exit
}
if [ "$1" = remove ]; then
removeicons && exit
fi
removeallicons () {
rm ~/Choices/ROX-Filer/PuppyPin
cp /root/Choices/ROX-Filer/PuppyPin0 /root/Choices/ROX-Filer/PuppyPin
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin 2> /dev/null
[ -x /root/Startup/xonclock* ] && /root/Startup/xonclock*
exit
}
if [ "$1" = removeall ]; then
removeallicons && exit
fi
resetpins () {
rm ~/Choices/ROX-Filer/pip
rm -r /usr/shared/renamed/
rm ~/Choices/ROX-Filer/PuppyPin-bak
rm ~/Choices/ROX-Filer/PuppyPin-orig
rm ~/Choices/ROX-Filer/PuppyPin-orig-bak
rm ~/Choices/ROX-Filer/ppin 2> /dev/null
rm ~/Choices/ROX-Filer/nipp 2> /dev/null
rm ~/Choices/ROX-Filer/PuppyPin0 2> /dev/null
rm ~/Choices/ROX-Filer/PuppyPin 2> /dev/null
mv ~/Choices/ROX-Filer/PuppyPin-bak1 ~/Choices/ROX-Filer/PuppyPin 2> /dev/null
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin 2> /dev/null
[ -x /root/Startup/xonclock* ] && /root/Startup/xonclock*
exit
}
if [ "$1" = reset ]; then
resetpins
fi
if [ -e ~/Choices/ROX-Filer/nipp ]; then
mv ~/Choices/ROX-Filer/nipp ~/Choices/ROX-Filer/ppin
bd=`grep -e ' <backdrop style' ~/Choices/ROX-Filer/PuppyPin0`
sed -i 3i\ "$bd" ~/Choices/ROX-Filer/PuppyPin-orig 2> /dev/null
sed -i 4\\ ~/Choices/ROX-Filer/PuppyPin-orig
mv ~/Choices/ROX-Filer/PuppyPin-orig ~/Choices/ROX-Filer/PuppyPin
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
elif [ -e ~/Choices/ROX-Filer/ppin ]; then
mv ~/Choices/ROX-Filer/ppin ~/Choices/ROX-Filer/nipp
bd=`grep -e '<backdrop style' ~/Choices/ROX-Filer/PuppyPin`
pp0
if [[ "$1" = noicons ]]; then
pp0 && exit
fi
if [[ "$1" = two ]]; then
rm ~/Choices/ROX-Filer/PuppyPin0
cp ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin0
rm ~/Choices/ROX-Filer/pip
rm ~/Choices/ROX-Filer/ipp
touch ~/Choices/ROX-Filer/pip
exit
fi
sed -i 3i\ "$bd" ~/Choices/ROX-Filer/PuppyPin0 2> /dev/null
sed -i 4\\ ~/Choices/ROX-Filer/PuppyPin0
sed -i 4d ~/Choices/ROX-Filer/PuppyPin0 2> /dev/null
mv ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin-orig
mv ~/Choices/ROX-Filer/PuppyPin0 ~/Choices/ROX-Filer/PuppyPin
DISPLAY=:0.0 rox --pinboard ~/Choices/ROX-Filer/PuppyPin
gtkdialog-splash -placement top-left -bg blue -text "$(gettext 'No Icons')" &
SPLASHPID=$!
sleep 2
kill $SPLASHPID 2> /dev/null
elif [[ ! -e ~/Choices/ROX-Filer/nipp && ! -e ~/Choices/ROX-Filer/ppin ]]; then
touch ~/Choices/ROX-Filer/ppin
fi
[ -x /root/Startup/xonclock* ] && /root/Startup/xonclock*
if [[ ! -e ~/Choices/ROX-Filer/PuppyPin0 ]]; then
cp ~/Choices/ROX-Filer/PuppyPin ~/Choices/ROX-Filer/PuppyPin0
fi
Last edited by stemsee on Tue 02 Dec 2014, 22:34, edited 9 times in total.
Added mechanism for populating PuppyPin-bak with all links from /usr/share/applications which were linked to /usr/share/renamed and 'renamed' to remove .desktop suffix 'nicons add'. This is important for the repo of available icons when using 'nicons add' which iterates through PuppyPin-bak letting the user see line by line the icons/apps available to add simply by pressing 'y Enter' or Enter for 'n' not added. There is also a rox window opens with links from /usr/share/applications renamed and ready to drag to the desktop 'nicons add'.
Now I am trying to use array to make icons grid like android home screen. Any pointers welcome.
EDIT: disabled. Because rox behaves unpredictably at some point. Needs more testing in case laptop tool pan feature interferred.
Now I am trying to use array to make icons grid like android home screen. Any pointers welcome.
EDIT: disabled. Because rox behaves unpredictably at some point. Needs more testing in case laptop tool pan feature interferred.
- Attachments
-
- capture16486.jpg
- (43.09 KiB) Downloaded 201 times
Last edited by stemsee on Tue 02 Dec 2014, 06:41, edited 4 times in total.
Code: Select all
res=`xrandr | grep -w connected | cut -f3 -d ' ' | cut -f1 -d '+' | tr 'x' ' '`
maxx=`echo $res | cut -f1 -d ' '`
maxy=`echo $res | cut -f2 -d ' '`
lines=`ls -1 /usr/share/renamed | wc -l`
echo "$(((maxx) / 12))"
echo "$(((maxy) / 12))"
varx=1
vary=1
varx=$((varx + 70)) #incremental
vary=$((vary + 70))
y1 x[1-12]
y2 x[1-12]
y15 x[1-20]
Code: Select all
BEGIN {
varx=1;
varx=$((varx + 70));
OFS = "\"";
split("2", Fields);
split("$varx", Replacements);
}
{
while (count++<20)
for (i in Fields) {
for (j in Replacements) {
Replace = Replacements[j];
sub(Replace Replace, $Fields[i]);
}
}
print;
}
BEGIN {
vary=1;
vary=$((vary + 70));
OFS = "\"";
split("4", Fields);
split("$vary", Replacements);
}
{
while (count++<15)
for (i in Fields) {
for (j in Replacements) {
Replace = Replacements[j];
sub(Replace Replace, $Fields[i]);
}
}
print;
}
Last edited by stemsee on Mon 01 Dec 2014, 07:26, edited 8 times in total.
Code: Select all
#!/bin/bash
rm ~/Choices/ROX-Filer/PuppyPin-formatted
rm /tmp/files
touch /tmp/files
sed -n '3,16p;16q' ~/Choices/ROX-Filer/PuppyPin-bak >> /tmp/files
touch ~/Choices/ROX-Filer/PuppyPin-formatted
varx=10
vary=10
indexx=2
indexy=4
while read line
do
sed -l '/4/d'
varx=$(($varx + 90))
echo $line | awk -F\" -v OFS=\" '{$'$indexx'='$varx'; print }' | awk -F\" -v OFS=\" '{$'$indexy'='$vary'; print }' >> ~/Choices/ROX-Filer/PuppyPin-formatted
done < /tmp/files
Nicons add = renamed links from /usr/share/applications
- Attachments
-
- capture8647.jpg
- (31.28 KiB) Downloaded 213 times
ok ... I need hellp with these nested loops! I can't think clearly. How to assign 12 increments of x for one increment of y whilst iterating through a list of 300 entries 10 lines at a time. I have spent hours and hours on this ... This code generates 35000 lines. It should be 300. For each y it is generating 335 lines. The problem really is how to feed only twelve lines at a time from the 300 line xml puppypin (this is the icon repo).
Code: Select all
#!/bin/bash
# nested-loop.sh: Nested "for" loops.
rm ~/Choices/ROX-Filer/PuppyPin-formatted
touch ~/Choices/ROX-Filer/PuppyPin-formatted
rm /tmp/files
touch /tmp/files
cat ~/Choices/ROX-Filer/PuppyPin >> /tmp/files
sed -i '1,3d' /tmp/files
sed -i '$d' /tmp/files
#echo $file | head -10 >> /tmp/files
varx=0
vary=0
indexx=2
indexy=4
outer=1 # Set outer loop counter.
for vary in 0 90 170 250 330 410 490 570
do
vary=$(($vary + 1))
inner=1 # Reset inner loop counter.
# Beginning of inner loop.
for varx in 0 90 170 250 330 410 490 570 650 730 810 890 970
do
varx=$(($varx + 1))
cat /tmp/files | awk -F\" -v OFS=\" '{$'$indexx'='$varx'; print }' | awk -F\" -v OFS=\" '{$'$indexy'='$vary'; print }' >> ~/Choices/ROX-Filer/PuppyPin-formatted
echo "Pass $inner in inner loop."
let "inner+=1" # Increment inner loop counter.
# End of inner loop.
let "outer+=1" # Increment outer loop counter.
echo # Space between output blocks in pass of outer loop.
unset varx
done
done
exit 0
Last edited by stemsee on Wed 03 Dec 2014, 20:03, edited 1 time in total.