Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 51 additions & 14 deletions .udisks-glue.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,63 @@
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
post_mount_command = "echo \'udisks_glue:mount_device(\"%device_file\",\"%mount_point\",\"Cdrom\")\' | awesome-client"
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"
}



Binary file added icons/usb_eject.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/usb_mount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/usb_remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/usb_unmount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 14 additions & 7 deletions udisks_glue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down