You are not logged in.
This is a great script, thanks.
I've partly ported it to FVWM (Just the info menu left to do.) I'll post it here once I'm satisfied with it.
Thanks for the feedback, and I look forward to seeing your port!
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Thank you for your script. A very nice addition to my openbox-toolbox. It helps me getting free from un-necessaries dependancies involved by adopting an obese kde or a stincky gnome.
Offline
fvwm-menu-udisks: http://pastebin.com/D8tT8gkV *Updated. Info menu now works*
You'll need obdevicemenu.conf from v1.4.0 in $HOME and the following in your fvwm config file.
DestroyMenu FvwmMenuUdisks
AddToMenu FvwmMenuUdisks
+ DynamicPopupAction Piperead '$[fvwm_script]/fvwm-menu-udisks'
DestroyFunc FuncFvwmMenuUdisks
AddToFunc FuncFvwmMenuUdisks
+ I DestroyMenu $0
+ I Piperead '$[fvwm_script]/fvwm-menu-udisks --mount-menu $0'
I gave up on the Info Menu for now. Perfectly functional without it.
Last edited by greatant (2011-07-18 14:01:17)
Offline
fvwm-menu-udisks:
...
<snip>
Looks good greatant, thanks for porting
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
I managed to get the info menu working. I'll keep any more updates out of your thread and in my own future thread with some more fvwm pipemenu scripts I'm working on.
fvwm-menu-udisks:
http://pastebin.com/D8tT8gkV
Offline
Looks nice greatant. Thanks for porting to fvwm
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Amazing piece of work you got here jnguyen. Was annoyed that thunar/exo/whatever it was that made thunar rely on gfvs for mounting devices but not only didn't I have the time to find a proper replacement/fix at the moment, when I actually did search for one, I overlooked this great contribution of yours. So first of all -- thank you.
Got it configured and working properly but have two things I'd like to point out:
- After connecting my device(s), if I go straight to the open option, the device is just mounted, instead of mount-and-open. Only when I choose open a second time (after the device is mounted) then it is indeed opened.
- Didn't create a local config file, and the only thing I changed in the global config file was
show_notifications="1"
to
show_notifications="0"
and I'm getting these messages on tty
/usr/bin/obdevicemenu: line 120: Mounting: command not found
/usr/bin/obdevicemenu: line 120: Mounted: command not found
whenever I mount my device(s) and
/usr/bin/obdevicemenu: line 120: Unmounting: command not found
whenever I unmount.
Like I said everything else is working properly so far, so I'm just curious as to what is causing this. Regarding the latter, I took a peek at that line #120 and apparently it is the else case inside the notify function that simply calls whatever is passed as argument by the various action_* functions. This doesn't seem to happen when using notifications as notify-send is actually called with said arguments.
Any insight?
Offline
Amazing piece of work you got here jnguyen. Was annoyed that thunar/exo/whatever it was that made thunar rely on gfvs for mounting devices but not only didn't I have the time to find a proper replacement/fix at the moment, when I actually did search for one, I overlooked this great contribution of yours. So first of all -- thank you.
You are very welcome
- After connecting my device(s), if I go straight to the open option, the device is just mounted, instead of mount-and-open. Only when I choose open a second time (after the device is mounted) then it is indeed opened.
- Didn't create a local config file, and the only thing I changed in the global config file was
show_notifications="0"
and I'm getting these messages on tty
/usr/bin/obdevicemenu: line 120: Mounting: command not found /usr/bin/obdevicemenu: line 120: Mounted: command not found
Like I said everything else is working properly so far, so I'm just curious as to what is causing this. Regarding the latter, I took a peek at that line #120 and apparently it is the else case inside the notify function that simply calls whatever is passed as argument by the various action_* functions. This doesn't seem to happen when using notifications as notify-send is actually called with said arguments.
Thanks very much for the bug report! It appears to be a simple error in my code. So simple in fact that all you really need to do is delete the "else" line and the one after it. Well, there's a little more to it than that, so I've released obdevicemenu 1.4.1 to fix the issue. You should no longer get weird messages on tty, and "open" should work as expected.
Again, thanks for reporting
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Just reporting everything's fine on my end now. This program is steamrolling on my desktop like mad. Much appreciated once again jnguyen.
Offline
obdevicemenu 1.6.0 released.
Apologies to anyone who was using the configuration file to display custom text (such as in your own language). I have removed this functionality for the sake of code clarity. If anyone is in need of that particular feature, please do say so. I may try and implement it in a different way that doesn't make the code harder to read.
Development can now be followed at Gitorious.
Last edited by jnguyen (2011-09-16 22:29:36)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
The latest update seems to have caused some problems with fancy sort. Not that big a deal, since it seems I'm the only one using it, but I thought I'd bring it to your attention anyway.
With fancy sort on, obdevicemenu produces the following output:
wormzy@sakura[pts/0]:~$ obdevicemenu
<openbox_pipe_menu>
<separator label="Removable media" />
/usr/bin/obdevicemenu: line 377: ðÎd: 08: value too great for base (error token is "08")
No idea what those non-standard characters after the line number are for, but they seem to variate wildly.
With fancy sort off, obdevice menu works as advertised.
wormzy@sakura[pts/0]:~$ obdevicemenu
<openbox_pipe_menu>
<separator label="Removable media" />
<menu id="mount/dev/sda1" label="sda1: Videos (mounted)" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sda1" />
<menu id="mount/dev/sda2" label="sda2: backups" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sda2" />
<menu id="mount/dev/sdb1" label="sdb1: Terastore (mounted)" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdb1" />
<menu id="mount/dev/sdc1" label="sdc1: No label ( ST3250410AS)" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdc1" />
<menu id="mount/dev/sdc2" label="sdc2: grub" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdc2" />
<menu id="mount/dev/sdc5" label="sdc5: Work" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdc5" />
<menu id="mount/dev/sdc6" label="sdc6: WIN-WORK" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdc6" />
<menu id="mount/dev/sdd1" label="sdd1: Karmic" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd1" />
<menu id="mount/dev/sdd10" label="sdd10: Natty" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd10" />
<menu id="mount/dev/sdd11" label="sdd11: Arch64-TERM" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd11" />
<menu id="mount/dev/sdd2" label="sdd2: Lucid" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd2" />
<menu id="mount/dev/sdd3" label="sdd3: Vista" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd3" />
<menu id="mount/dev/sdd4" label="sdd4: No label (HD103UJ)" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd4" />
<menu id="mount/dev/sdd5" label="sdd5: No label (HD103UJ)" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd5" />
<menu id="mount/dev/sdd6" label="sdd6: Pro" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd6" />
<menu id="mount/dev/sdd7" label="sdd7: Arch64-Open (mounted)" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd7" />
<menu id="mount/dev/sdd8" label="sdd8: Arch" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd8" />
<menu id="mount/dev/sdd9" label="sdd9: Arch32" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sdd9" />
<menu id="mount/dev/sde1" label="sde1: USB-Data" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sde1" />
<menu id="mount/dev/sde2" label="sde2: Arch-USB" execute="/usr/bin/obdevicemenu --mount-menu removable /dev/sde2" />
<item label="Unmount all">
<action name="Execute">
<command>/usr/bin/obdevicemenu --unmount-all-removable /dev/sda1 /dev/sdb1 /dev/sdd7</command>
<prompt>Unmount all removable devices?</prompt>
</action>
</item>
<separator label="Optical media" />
<item label="sr0: None" />
</openbox_pipe_menu>
A fix would be appreciated, but don't lose any sleep over it.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Hi WorMzy, thanks very much for your bug report. Your feedback is much appreciated
Unfortunately I cannot take a look until Tuesday night, but I can assure you a fix is on the way. It is probably a simple coding error that is trivial to fix.
I'm now pretty happy I put a warning about fancy_sort in the config file. I didn't expect it to break, but looks like it did
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
The latest update seems to have caused some problems with fancy sort. Not that big a deal, since it seems I'm the only one using it, but I thought I'd bring it to your attention anyway.
With fancy sort on, obdevicemenu produces the following output:
wormzy@sakura[pts/0]:~$ obdevicemenu <openbox_pipe_menu> <separator label="Removable media" /> /usr/bin/obdevicemenu: line 377: ðÎd: 08: value too great for base (error token is "08")
No idea what those non-standard characters after the line number are for, but they seem to variate wildly.
With fancy sort off, obdevice menu works as advertised.
OK fixed in obdevicemenu 1.6.1.
It was indeed due to a simple coding error. I inadvertently declared a variable as a number, even though I put a comment just above that line telling me not to declare the variable as a number The errors are due to bash interpreting "08" as hex. It should work as advertised now.
Last edited by jnguyen (2011-09-20 19:52:59)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Can confirm that it works fine now. Thanks.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I really like this program a lot; ive used pmount for awhile, but it gets old running fdisk to find out the dev name of a flash drive and then pmounting it. Love the Open option.
I do have a question: is there someway to blacklist a device from showing? My printer has a memory card slot and I guess as a result udisks/obdevicemenu is showing it in the devices list of my menu. Id like to remove it, but thats just a nitpick/OCD.
If not, thats cool- absolutely perfect program. I installed gvfs-lite from the AUR to cut out the gvfs bloat as Thunar doesnt give as much information as easily as obdevicemenu. Thank you
Offline
I really like this program a lot; ive used pmount for awhile, but it gets old running fdisk to find out the dev name of a flash drive and then pmounting it. Love the Open option.
Thanks very much for the kind words
I do have a question: is there someway to blacklist a device from showing? My printer has a memory card slot and I guess as a result udisks/obdevicemenu is showing it in the devices list of my menu. Id like to remove it, but thats just a nitpick/OCD.
Have a look in "/etc/obdevicemenu.conf" at the following option:
# Set removable devices location. The default is to ignore /dev/sda*, which is
# usually the primary system drive. Devices such as SD card readers show up as
# /dev/mmcblk* and are also matched. This string is matched using grep like so:
# udisks --enumerate-device-files | grep -ow ${removable_devices} | sort
# See the grep man page for more information.
removable_devices="-E ^/dev/sd[b-z][0-9]*|^/dev/mmcblk[0-9]+p*[0-9]*"
I'm guessing that your memory card slot comes up as /dev/mmcblk0p0 or something similar? If you don't want obdevicemenu to match memory cards at all, then change the above line to this:
removable_devices="-E ^/dev/sd[b-z][0-9]*"
If on the other hand you'd rather ignore only /dev/mmcblk0p0 but show other memory cards:
removable_devices="-E ^/dev/sd[b-z][0-9]*|^/dev/mmcblk[1-9]+p*[0-9]*"
This last one only works if your printer memory card always shows up as /dev/mmcblk0p0.
Last edited by jnguyen (2011-11-17 11:50:19)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
GSF1200S wrote:I really like this program a lot; ive used pmount for awhile, but it gets old running fdisk to find out the dev name of a flash drive and then pmounting it. Love the Open option.
Thanks very much for the kind words
I do have a question: is there someway to blacklist a device from showing? My printer has a memory card slot and I guess as a result udisks/obdevicemenu is showing it in the devices list of my menu. Id like to remove it, but thats just a nitpick/OCD.
Have a look in "/etc/obdevicemenu.conf" at the following option:
# Set removable devices location. The default is to ignore /dev/sda*, which is # usually the primary system drive. Devices such as SD card readers show up as # /dev/mmcblk* and are also matched. This string is matched using grep like so: # udisks --enumerate-device-files | grep -ow ${removable_devices} | sort # See the grep man page for more information. removable_devices="-E ^/dev/sd[b-z][0-9]*|^/dev/mmcblk[0-9]+p*[0-9]*"
I'm guessing that your memory card slot comes up as /dev/mmcblk0p0 or something similar? If you don't want obdevicemenu to match memory cards at all, then change the above line to this:
removable_devices="-E ^/dev/sd[b-z][0-9]*"
If on the other hand you'd rather ignore only /dev/mmcblk0p0 but show other memory cards:
removable_devices="-E ^/dev/sd[b-z][0-9]*|^/dev/mmcblk[1-9]+p*[0-9]*"
This last one only works if your printer memory card always shows up as /dev/mmcblk0p0.
Hmmm, strange. If I do udisks --enumerate-device-files, i get the following in regards to my printer:
/dev/sdd
/dev/disk/by-id/usb-HP_Photosmart_C4400_CN87THG06T0557-0:0
/dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.3-scsi-0:0:0:0
When I run fdisk, I see my sda/sdb/sdc partitions (which are all legitimate harddrives/partitions which I have managed via fstab), and the thumbdrive is listed as /dev/sde1. So, it seems its (the printer) showing up as a normal scsi device, though I have no idea why. I have no memory card IN the reader, and its not a fancy printer (doesnt even have wireless printing). I actually checked the config file, but upon noticing my printer is not /dev/mmcblk, I skipped it.
Going to /dev (which I understand is virtual and essentially generated at boot and loaded into RAM), I dont see any device listed even close to what you suggested. Really really strange.. Is there a way I can tell obdevicemenu to do some kind of string search to ignore a devices vendor/model?
Anyways, if not I can deal with it I guess. Stellar program, I just have a weird configuration/printer I guess.. Thanks for the program and the help
**EDIT** I suppose I could just do something like: removable_devices="-E ^/dev/disk/by-id/usb-HP_Photosmart_C4400_CN87THG06T0557-0:0 in that part of the config file yeah? Im not too familiar with udisks so..
Last edited by GSF1200S (2011-11-18 04:18:09)
Offline
Could you try running this and posting the output:
udisks --show-info /dev/disk/by-id/usb-HP_Photosmart_C4400_CN87THG06T0557-0:0
Unfortunately obdevicemenu (and bashmount) doesn't really support blacklisting yet, though I suppose I could implement some kind of blacklist based on the device label.
Last edited by jnguyen (2011-11-18 08:36:33)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Could you try running this and posting the output:
udisks --show-info /dev/disk/by-id/usb-HP_Photosmart_C4400_CN87THG06T0557-0:0
Unfortunately obdevicemenu (and bashmount) doesn't really support blacklisting yet, though I suppose I could implement some kind of blacklist based on the device label.
[poeticrpm@geekdom ~]$ udisks --show-info /dev/disk/by-id/usb-HP_Photosmart_C4400_CN87THG06T0557-0:0
Showing information for /org/freedesktop/UDisks/devices/sdd
native-path: /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.3/host9/target9:0:0/9:0:0:0/block/sdd
device: 8:48
device-file: /dev/sdd
presentation: /dev/sdd
by-id: /dev/disk/by-id/usb-HP_Photosmart_C4400_CN87THG06T0557-0:0
by-path: /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.3-scsi-0:0:0:0
detected at: Wed 16 Nov 2011 09:11:13 PM CST
system internal: 0
removable: 1
has media: 0
detects change: 1
detection by polling: 1
detection inhibitable: 1
detection inhibited: 0
is read only: 0
is mounted: 0
mount paths:
mounted by uid: 0
presentation hide: 0
presentation nopolicy: 0
presentation name:
presentation icon:
automount hint:
size: 0
block size: 0
job underway: no
usage:
type:
version:
uuid:
label:
drive:
vendor: HP
model: Photosmart C4400
revision: 1.00
serial: CN87THG06T0557
WWN:
detachable: 1
can spindown: 0
rotational media: Yes, unknown rate
write-cache: unknown
ejectable: 0
adapter: Unknown
ports:
similar devices:
media:
compat:
interface: usb
if speed: 480000000 bits/s
ATA SMART: not available
I wouldnt really worry about it- i mean REALLY how many people would have devices that they need to blacklist? I cant "blacklist" devices with gvfs or whatever, so.. it was just an annoyance, though I do appreciate all the help youve offered and your determination
I would say if it takes more than 10 lines of code to implement, dont worry about it- no need to complicate code maintenance for a use case few would use..
Offline
Thanks for posting the output.
I actually thought about blacklisting before. I used to have a USB mobile broadband dongle that would show up as a removable device, but obviously it wasn't meant to be mounted/unmounted. So the number of users of such a feature is at least two people
I'm kind of swamped at the moment, but watch this space and hopefully at some point I'll get around to implementing it (I think it should be fairly straightforward).
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Thanks for posting the output.
I actually thought about blacklisting before. I used to have a USB mobile broadband dongle that would show up as a removable device, but obviously it wasn't meant to be mounted/unmounted. So the number of users of such a feature is at least two people
I'm kind of swamped at the moment, but watch this space and hopefully at some point I'll get around to implementing it (I think it should be fairly straightforward).
Cool, sounds good. Great program as is, but ill be sure to let you know when/if you make changes how it goes Thanks again..
Offline
I'm only using my FVWM version of this script, that I've been keeping up-to-date, but it seems the device label is always missing the first word. Does anyone else experience this?
Eg. Optical disc labelled "Fawlty Towers" will only display "Towers"
The problem is the awk part of the info_label() function. I'm having a poke around now, but thought I'd post as I've not used awk much.
vvvvvv Bingo!
Last edited by greatant (2011-11-22 14:30:52)
Offline
Yeah, I got that too, I have a solution, but I don't know how well it'll play with other locales.
Just replace line 125 of obdevicemenu:
| awk '{$1="";gsub(/_/,"");print substr($0, index($0,$2))}')"
with
| sed 's: *label\: *::')"
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
obdevicemenu 1.7.0 released now with support for blacklisting.
Please do let me know if it doesn't work as expected, or if you notice any other bugs.
I'm only using my FVWM version of this script, that I've been keeping up-to-date, but it seems the device label is always missing the first word. Does anyone else experience this?
Eg. Optical disc labelled "Fawlty Towers" will only display "Towers"
This is also fixed. Thanks very much for reporting
Last edited by jnguyen (2011-11-23 10:11:55)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
obdevicemenu 1.7.0 released now with support for blacklisting.
Please do let me know if it doesn't work as expected, or if you notice any other bugs.
greatant wrote:I'm only using my FVWM version of this script, that I've been keeping up-to-date, but it seems the device label is always missing the first word. Does anyone else experience this?
Eg. Optical disc labelled "Fawlty Towers" will only display "Towers"This is also fixed. Thanks very much for reporting
Awesome- blacklist worked perfect for me. Thank you very much for the code addition
Offline