diff --git a/.udisks-glue.conf b/.udisks-glue.conf index d76aff6..d0d4d96 100755 --- a/.udisks-glue.conf +++ b/.udisks-glue.conf @@ -1,22 +1,56 @@ -filter disks { - optical = false - partition_table = false - usage = filesystem - } +filter disks_ext4 { + optical = false + partition_table = false + type = ext4 + usage = filesystem +} +match disks_ext4 { + automount = true + automount_options = {sync,noatime,rw} + + + post_mount_command = "echo \'udisks_glue:mount_device(\"%device_file\",\"%mount_point\",\"USB\",\"ext4\")\' | awesome-client" + post_unmount_command = "echo \'udisks_glue:unmount_device(\"%device_file\",\"%mount_point\",\"USB\")\' | awesome-client" + post_removal_command = "echo \'udisks_glue:remove_device(\"%device_file\",\"%mount_point\",\"USB\")\' | awesome-client" + +} + +filter disks_ntfs { + optical = false + partition_table = false + type = ntfs-3g + usage = filesystem +} +match disks_ntfs { + automount = true + automount_options = {sync,noatime,rw} + + + post_mount_command = "echo \'udisks_glue:mount_device(\"%device_file\",\"%mount_point\",\"USB\",\"NTFS\")\' | awesome-client" + post_unmount_command = "echo \'udisks_glue:unmount_device(\"%device_file\",\"%mount_point\",\"USB\")\' | awesome-client" + post_removal_command = "echo \'udisks_glue:remove_device(\"%device_file\",\"%mount_point\",\"USB\")\' | awesome-client" + +} +filter disks_vfat { + optical = false + partition_table = false + type = vfat + usage = filesystem +} +match disks_vfat { + automount = true + automount_options = {sync,noatime,rw} + + post_mount_command = "echo \'udisks_glue:mount_device(\"%device_file\",\"%mount_point\",\"USB\",\"vFAT\")\' | awesome-client" + post_unmount_command = "echo \'udisks_glue:unmount_device(\"%device_file\",\"%mount_point\",\"USB\")\' | awesome-client" + post_removal_command = "echo \'udisks_glue:remove_device(\"%device_file\",\"%mount_point\",\"USB\")\' | awesome-client" + +} filter optical { optical = true } -match disks { - automount = true - automount_options = sync - post_mount_command = "echo \'udisks_glue:mount_device(\"%device_file\",\"%mount_point\",\"Usb\")\' | awesome-client" - post_unmount_command = "echo \'udisks_glue:unmount_device(\"%device_file\",\"%mount_point\",\"Usb\")\' | awesome-client" - post_removal_command = "echo \'udisks_glue:remove_device(\"%device_file\",\"%mount_point\",\"Usb\")\' | awesome-client" - } - - match optical { automount = true automount_options = ro @@ -24,3 +58,6 @@ match optical { post_unmount_command = "echo \'udisks_glue:unmount_device(\"%device_file\",\"%mount_point\",\"Cdrom\")\' | awesome-client" post_removal_command = "echo \'udisks_glue:remove_device(\"%device_file\",\"%mount_point\",\"Cdrom\")\' | awesome-client" } + + + diff --git a/icons/usb_eject.png b/icons/usb_eject.png new file mode 100644 index 0000000..720b967 Binary files /dev/null and b/icons/usb_eject.png differ diff --git a/icons/usb_mount.png b/icons/usb_mount.png new file mode 100644 index 0000000..b79e8fe Binary files /dev/null and b/icons/usb_mount.png differ diff --git a/icons/usb_remove.png b/icons/usb_remove.png new file mode 100644 index 0000000..b6b5447 Binary files /dev/null and b/icons/usb_remove.png differ diff --git a/icons/usb_unmount.png b/icons/usb_unmount.png new file mode 100644 index 0000000..a66f90b Binary files /dev/null and b/icons/usb_unmount.png differ diff --git a/udisks_glue.lua b/udisks_glue.lua index d749ff9..3eb30b2 100644 --- a/udisks_glue.lua +++ b/udisks_glue.lua @@ -51,7 +51,7 @@ local function generate_menu(ud_menu) for k,v in pairs(data[ud_menu].all_devices) do local device_type=data[ud_menu].devices_type[k] local action="" - if device_type == "Usb" then + if device_type == "USB" then action="detach" else action="eject" @@ -103,9 +103,11 @@ local function display_menu(ud_menu) )) end -function mount_device(ud_menu,device, mount_point, device_type) +function mount_device(ud_menu,device, mount_point, device_type, filesystem) +--local variable filesystem = filesystem in argument if not nil or empty string "" + local filesystem = filesystem or "" -- generate the device_name - if device_type == "Usb" then + if device_type == "USB" then device_name = string.gsub(device,"%d*","") else device_name=device @@ -131,19 +133,23 @@ function mount_device(ud_menu,device, mount_point, device_type) data[ud_menu].partition_state[device]="mounted" data[ud_menu].menu:hide() data[ud_menu].menu_visible = "false" - naughty.notify({title = device_type..":", text =device .. " mounted on" .. mount_point, timeout = 10}) + -- naughty.notify({title = device_type..":", text =device .. " mounted on" .. mount_point, timeout = 10}) + naughty.notify({title = "Udisks " .. device_type .. " " .. filesystem .. ":", text =device .. " mounted on" .. mount_point, icon=data[ud_menu].mount_icon, timeout = 10, width = 300}) + end function unmount_device(ud_menu, device, mount_point, device_type) data[ud_menu].partition_state[device]="unmounted" data[ud_menu].menu:hide() data[ud_menu].menu_visible = "false" - naughty.notify({title = device_type..":", text = device .." unmounted", timeout = 10}) + -- naughty.notify({title = device_type..":", text = device .." unmounted", timeout = 10}) + naughty.notify({title = device_type ..":", text = device .." removed", icon=data[ud_menu].umount_icon, timeout = 10, width = 300}) + end function remove_device(ud_menu, device, mount_point, device_type ) local device_name="" - if device_type == "Usb" then + if device_type == "USB" then device_name=string.gsub(device,"%d*","") else device_name = device @@ -164,7 +170,8 @@ function remove_device(ud_menu, device, mount_point, device_type ) end data[ud_menu].menu:hide() data[ud_menu].menu_visible = "false" - naughty.notify({title = device_type ..":", text = device .." removed", timeout = 10}) + -- naughty.notify({title = device_type ..":", text = device .." removed", timeout = 10}) + naughty.notify({title = device_type ..":", text = device .." removed", icon=data[ud_menu].detach_icon, timeout = 10, width = 300}) end function set_mount_icon(ud_menu,an_image)