Script to put usbdrive icon in systray (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
wow
Posts: 1052
Joined: Fri 30 Jun 2006, 00:18
Location: Peru

#16 Post by wow »

http://www.murga-linux.com/puppy/viewto ... 888#946888

Español Algunos cambios:
  • Nueva diseño u orden para los elementos del menú: Pmount || Nombre de Dispositivo1 | Particiones de Dispositivo1 || Nombre de Dispositivo2 | Particiones de Dispositivo2 || Actualizar.
    Menu: Añadido un nuevo botón [Nombre de Dispositivo] para abrir la/las carpeta/"punto de montaje" si está montada alguna partición del dispositivo
English: Few changes:
  • Menu, New layout: Pmount || Device1 Name | Device1 partitions || Device2 Name | Device2 partitions || Reload/Refresh.
    Menu: Added button [Device name] to open mount-point(s) if mounted.
Por defecto/Default:
Image

Mínimo/Minimal: -n
Image

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#17 Post by Argolance »

Bonjour,
Waou, this script is really a good idea and the result quite amazing!
Thank you!
May I say 2 little (silly?) things?
  • - Why not use English inside the script to comment how it is built and how it works (I am of those who are very interested in this - it is how I learn - but do absolutely/unfortunately not speak Spanish!)?
    - There is a window that displays messages down right of the screen. For me and probably some other users, who have their taskbar top of the screen and (or) run in dualscreen, it is not convenient. I firstly didn't see this popup window so much I was glazing over my notification area in the taskbar on the other screen :P ...
[EDIT]: French po/mo as attached files.

Cordialement.
Attachments
pusitray_fr.tar.gz
(1.81 KiB) Downloaded 332 times

User avatar
nilsonmorales
Posts: 972
Joined: Fri 15 Apr 2011, 14:39
Location: El Salvador

#18 Post by nilsonmorales »

Hello Argolance, you mean the comment lines translated in english?
what notifier are you using, dunst, gxmessage, yaf-splash, i think you need configure that thing in you local configuration.
[b][url=http://nilsonmorales.blogspot.com/]My blog |[/url][/b][b][url=https://github.com/woofshahenzup]| Github[/url][/b]
[img]https://i.postimg.cc/5tz5vrrX/imag018la6.gif[/img]
[img]http://s5.postimg.org/7h2fid8pz/botones_logos3.png[/img]

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#19 Post by Argolance »

Hello Nilson,
nilsonmorales wrote:you mean the comment lines translated in english?
what notifier are you using, dunst, gxmessage, yaf-splash, i think you need configure that thing in you local configuration.
The only language we have in common is English. We may regret it but that is the way it is. So I think it is a pity not to use English to comment code lines inside scripts (to make them understandable), instead of the creator's native language (here Spanish!) as well as gettexted lines which are originally in Spanish, excluding all the people who do NOT speak Spanish and overall, must be translated into English... for English speaking users (as long as you have got the language package):, :shock:
Obviously, that is my personal opinion. On the French Forum, we have a talented script creator (musher0), who does the same, against all odds, and I still believe it is (not a shame!) just a pity! :wink:

Cordialement.

wow
Posts: 1052
Joined: Fri 30 Jun 2006, 00:18
Location: Peru

#20 Post by wow »

http://www.murga-linux.com/puppy/viewto ... 888#946888
Particiones de tipo vfat ahora deberían montarse rápidamente.

vfat partitions should now be mounted faster.

wow
Posts: 1052
Joined: Fri 30 Jun 2006, 00:18
Location: Peru

#21 Post by wow »

http://www.murga-linux.com/puppy/viewto ... 888#946888

Arreglado: el montaje de partiticones vfat era demasiado rápido para darle tiempo al menú de actualizarse.

Fixed: vfat partition mounting was too fast for the menu to update.

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#22 Post by B.K. Johnson »

@wow, nilson
I called wow's first script usb_systray, placed it in /root/my-applications/bin/ and put a symlink to it in /root/Startup. . The icon shows in the tray and seemed to work. Clicking the Plus sign before an unmounted device, mounted it and clicking Minus unmounted it. The NTFS device (sda1) was not listed. PMount worked. I didn't know what Actualizer meant and nothing visible seem to happen when activated.

I set up the new script, pusitray (the last version after Edit9 here), on a different tahr-6.0.5 as before. Additionally, I unzipped pusitray_langpack_english01.zip, renamed *.mo to pusitray.mo and put it in /usr/share/locale/en/LC_MESSAGES/. See attached screenshots. Nothing happens neither when I click the script in /root/my-applications/bin/ nor on booting. The icon does not show.

Do I have the right script? Am I missing something? What am I doing wrong?

Edit10 was posted just before mine so haven't tried the revision yet, but don't anticipate any change. I'll report later.
Attachments
pusitray_placements.png
confirmation of files placement
(57.32 KiB) Downloaded 522 times
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

wow
Posts: 1052
Joined: Fri 30 Jun 2006, 00:18
Location: Peru

#23 Post by wow »

Español: Esta es una nueva versión de prueba, es ligeramente más rapida porque ahora solo realiza actualizaciones parciales en lugar de generar todos desde 0. Pero me parece que consume algo más de cpu.

English:This is a new test version, it is slightly faster because now it only writes partial updates instead of generate all items from 0. But it seems to me that it uses more cpu.

Bugfix: puppy boot(usbflash) device is now detected properly. and won't be un/mounted when clicked.
https://app.box.com/s/7nvvc5qpbbuol6jqhzyyr9ylvl2tpuaf
corvus wrote:...I personally use, via command line, a script (created by Yan Li in 2009), that need sdparm.

http://sg.danny.cz/sg/sdparm.html: "sdparm is designed for both the 2.6 and 2.4 Linux kernel series."
Argolance wrote:- There is a window that displays messages down right of the screen.
That's just an small notification to tell me the script has updated its menu and is ready to mount or unmount the next device. It is set to "echo" but it will use the next line if available, gxmessage, then yaf-splash, yad and notify-send.
You can comment out these lines to disable it.

Code: Select all

[ "$(which gxmessage)" ] && MSG_CMD="gxmessage -borderless -nofocus -bg black -fg white -timeout 3"
[ "$(which yaf-splash)" ] && MSG_CMD="yaf-splash -close box -timeout 3 -placement bottom-right -bg black -fg white -text"
[ -e "/usr/lib/gtkdialog/box_splash" ] && MSG_CMD="/usr/lib/gtkdialog/box_splash -close box -timeout 3 -placement bottom-right -bg black -fg white -text"
[ "$(which yad)" ] && MSG_CMD="yad --no-buttons --borders 10 --skip-taskbar --no-focus --undecorated --timeout-indicator bottom --text-align=left --timeout 5 --geometry=200x50-10-50 --text"
[ "$(which notify-send)" ] && MSG_CMD="notify-send -t 5000 -u normal"	
B.K. Johnson wrote:I called wow's usb_systray, ... renamed *.mo to pusitray.mo and put it in /usr/share/locale/en/LC_MESSAGES/
Try to rename the .mo file to usb_systray.mo. Both must have the same filename.
B.K. Johnson wrote:The NTFS device (sda1) was not listed. PMount worked.
This script its designed to work only with usb drives, it will ignore puppy boot device, internal sata drives or other storage devices.
B.K. Johnson wrote:Nothing happens neither when I click the script in /root/my-applications/bin/ nor on booting. The icon does not show.
Try to install a more recent version of yad, also try to run the script from command line.
Last edited by wow on Wed 29 Mar 2017, 18:43, edited 3 times in total.

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#24 Post by B.K. Johnson »

wow suggested here
Try to install a more recent version of yad, also try to run the script from command line.
Sure enough, when pusitray is executed from the command line, I got this error:

Code: Select all

root# pusitray
MSG_CMD=yad
Unable parse command line: Unknown option --borders
root# 
YAD-0.38.2 is available from SourceForge.
From the README, it doesn't look like the standard ./configure && make && make install procedure.
Can some good soul please compile and prepare a pet or sfs?
Thanks.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

User avatar
nilsonmorales
Posts: 972
Joined: Fri 15 Apr 2011, 14:39
Location: El Salvador

#25 Post by nilsonmorales »

Version 11: I've tried to do different events, so far everything seems to work fine. Is nice 'honesty' :D
Image
[b][url=http://nilsonmorales.blogspot.com/]My blog |[/url][/b][b][url=https://github.com/woofshahenzup]| Github[/url][/b]
[img]https://i.postimg.cc/5tz5vrrX/imag018la6.gif[/img]
[img]http://s5.postimg.org/7h2fid8pz/botones_logos3.png[/img]

User avatar
nilsonmorales
Posts: 972
Joined: Fri 15 Apr 2011, 14:39
Location: El Salvador

#26 Post by nilsonmorales »

B.K. Johnson
greengeek provides this package for 32 bits here http://murga-linux.com/puppy/viewtopic. ... 055#890055
[b][url=http://nilsonmorales.blogspot.com/]My blog |[/url][/b][b][url=https://github.com/woofshahenzup]| Github[/url][/b]
[img]https://i.postimg.cc/5tz5vrrX/imag018la6.gif[/img]
[img]http://s5.postimg.org/7h2fid8pz/botones_logos3.png[/img]

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#27 Post by B.K. Johnson »

nilsonmorales
Thanks for the link, Let you know how it works out.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#28 Post by B.K. Johnson »

Nilson wrote:

greengeek provides this package for 32 bits here http://murga-linux.com/puppy/viewtopic. ... 055#890055
Got it. It is a version several revisions earlier than the latest on the website. However, it is good enough for psuitray to display its icon in the tray. WORKING (almost, see below). Thanks again.

However there is a particular niggle that needs work.
Nilson, as your command of English is better than wow's, please translate for him.

ATM, I have 3 storage devices attached
sda1 HD NTFS
sdb1 Flash FAT32 boot drive tahr-6.0.5
sdc1 Flash FAT32
Prior to installing pusitray and since installing it, at boot, sdb1 is mounted and so indicated with a tab; other devices are unmounted - no tabs.
In the psuitray infobox, sda1, being an NTFS it doesn't appear (understood). Both sdb1 and sdc1 have + before them in the infobox to indicate unmounted.but this is not true. sdb1 is mounted. It is /home, is always mounted and should have a permanent '-' sign. Secondly, when the '+' before sdc1 is clicked, the contents are displayed, but a tab on the icon to indicate mounted does not appear. Thirdly, if I click on the sdc1 icon, the indicator tab appears and contents listed, but the '+' in psuitray does not change. Clicking '+' once displays the contents and message that it is being mounted when it already has been. Then on clicking the '-' sign, the device is unmounted and the tab correctly removed.

To summarize:
(1) the boot drive should always have a '-'
(2) when '+' is selected to mount a device, an indicator tab should appear on the corresponding icon.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

wow
Posts: 1052
Joined: Fri 30 Jun 2006, 00:18
Location: Peru

#29 Post by wow »

B.K. Johnson wrote:...
sdb1 Flash FAT32 boot drive tahr-6.0.5
...
Both sdb1 and sdc1 have + before them in the infobox to indicate unmounted.but this is not true. sdb1 is mounted. It is /home, is always mounted and should have a permanent '-' sign
Fixed. It now displays puppy version and won't allow user to mount or unmount.
Image
http://murga-linux.com/puppy/viewtopic. ... 888#946888

User avatar
nilsonmorales
Posts: 972
Joined: Fri 15 Apr 2011, 14:39
Location: El Salvador

#30 Post by nilsonmorales »

YAD version 0.38.2 shows the icon too small in the tray, so I compiled 0.38.1 in x-tahr (tahrpup fork), that seems to work fine

Code: Select all

autoreconf -ivf
./configure --prefix=/usr
make
make DESTDIR=/tmp/yad-0.38.1 install
cd /tmp
dir2pet yad-0.38.1
petget yad-0.38.1.pet
$ yad --version
0.38.1 (GTK+ 2.24.23)
https://my.pcloud.com/publink/show?code ... 3IHFiyrJH7
[b][url=http://nilsonmorales.blogspot.com/]My blog |[/url][/b][b][url=https://github.com/woofshahenzup]| Github[/url][/b]
[img]https://i.postimg.cc/5tz5vrrX/imag018la6.gif[/img]
[img]http://s5.postimg.org/7h2fid8pz/botones_logos3.png[/img]

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#31 Post by B.K. Johnson »

@wow, nilson
Thanks guys. I'll get around to testing soon.
BK
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#32 Post by slavvo67 »

I'm not sure if this is solved. Maybe this runs different in Quirky than Puppy but I notice the following:

1. There is no way to remove. Luckily, I rebooted and it went away.

2. It did not recognize SDA1 and SDA2. It only recognized SDB1 and SDB2.

Possibly unrelated but I had trouble opening my browsers after installing, too.

Nice little project but not sure how practical this is.

Slavvo67

User avatar
nilsonmorales
Posts: 972
Joined: Fri 15 Apr 2011, 14:39
Location: El Salvador

#33 Post by nilsonmorales »

slavvo67
The script tries to show when a usb is inserted from the system tray, that way I do not forget that physically there is one inserted in my computer, the other are extras that the programmer has added, eg, mount and unmount, tooltips, etc. from the systray.
1. There is no way to remove. Luckily, I rebooted and it went away
.
to test the script you need open a terminal and type ./the-script-name, to cancel just type ctrl+c or close the terminal, if you did a click on it, just open the terminal and type pkill the-script-name
2. It did not recognize SDA1 and SDA2. It only recognized SDB1 and SDB2.

Are sda1,sda2 hard disks? this don't work with hard disk just usb drives
Possibly unrelated but I had trouble opening my browsers after installing
Yes, unrelated.
not sure how practical this is.
It is to me, forgive my alzhaimer
[b][url=http://nilsonmorales.blogspot.com/]My blog |[/url][/b][b][url=https://github.com/woofshahenzup]| Github[/url][/b]
[img]https://i.postimg.cc/5tz5vrrX/imag018la6.gif[/img]
[img]http://s5.postimg.org/7h2fid8pz/botones_logos3.png[/img]

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#34 Post by slavvo67 »

Thanks for the though on this. Yes, for remembering the USB is there is quite important!! I tend to have other problems such as having multiple USB's plugged in and forgetting which is the system. LOL

Anyway, based on what your telling me the project is for, it seems to work good.

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#35 Post by B.K. Johnson »

@Nilson
Sorry to say, It's not solved!
@wow
It needs another tweak to make the script GUI and the desktop drive icon be always in sync, conveying the same info on the device's mount/unmount status.
.
In the attached screenshots, sdb1 is the boot drive with always mounted indicator.

When a usb drive is mounted from the script's dialogbox, rhe drive contents are displayed in ROX and the "Mounting" message is displayed, but the mount indicator tab is not appended to the desktop drive icon. A subsequent right-click shows the Minus sign against that drive. So, I can't tell from the desktop drive icon that the drive is already mounted. And since the drive is indeed mounted, a subsequent clicking on the drive icon in that state does not add the indicator. I get only the ROX display. Of course, Reload (GUI) changes nothing in the GUI, and has no effect on the drive icon. See Fig. 1.

Fig. 2 shows what happens from a fresh boot followed by a click of the drive icon.

If after booting to a virgin desktop and executed script, I click on a drive icon, the mount indicator is attached to the drive icon, but the script's display is unchanged i.e. it retains its Plus sign, indicating an unmounted state. The script GUI and the desktop drive icon is out of sync - .the drive icon is shown as mounted, but the GUI does not reflect this state Although Reload brings them back in sync, that IMHO is a crutch we don't want.

It seems to me that the script needs code to check the drive state, and to bring the GUI and drive icon in synch..
Attachments
attachment-pusitray-bug.png
GUI and drive icon mount indicator out of sync
(45.23 KiB) Downloaded 203 times
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

Post Reply