commit
3201c81197
|
@ -21,7 +21,6 @@ local function script_path()
|
||||||
return str:match("(.*/)")
|
return str:match("(.*/)")
|
||||||
end
|
end
|
||||||
|
|
||||||
local HOME_DIR = os.getenv("HOME")
|
|
||||||
local WIDGET_DIR = script_path()
|
local WIDGET_DIR = script_path()
|
||||||
local ICONS_DIR = WIDGET_DIR .. "/icons/"
|
local ICONS_DIR = WIDGET_DIR .. "/icons/"
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ local process_rows = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Remove spaces at end and beggining of a string
|
-- Remove spaces at end and beggining of a string
|
||||||
function trim(s)
|
local function trim(s)
|
||||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ local docker_widget = wibox.widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
local parse_container = function(line)
|
local parse_container = function(line)
|
||||||
local name, id, image, how_long, size, actual_status
|
local name, id, image, status, how_long, size, actual_status
|
||||||
if string.find(line, '::Created::') then
|
if string.find(line, '::Created::') then
|
||||||
name, id, image, size = line:match(DOCKER_CREATED_STATUS_PATTERN)
|
name, id, image, size = line:match(DOCKER_CREATED_STATUS_PATTERN)
|
||||||
actual_status = 'Created'
|
actual_status = 'Created'
|
||||||
|
@ -182,14 +182,19 @@ local function worker(user_args)
|
||||||
status_icon:set_opacity(0.2)
|
status_icon:set_opacity(0.2)
|
||||||
status_icon:emit_signal('widget::redraw_needed')
|
status_icon:emit_signal('widget::redraw_needed')
|
||||||
|
|
||||||
spawn.easy_async(executable_name .. ' ' .. command .. ' ' .. container['name'], function(_, stderr)
|
spawn.easy_async(executable_name .. ' ' .. command .. ' ' .. container['name'],
|
||||||
if stderr ~= '' then show_warning(stderr) end
|
function(_, stderr)
|
||||||
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, executable_name, number_of_containers),
|
if stderr ~= '' then show_warning(stderr) end
|
||||||
function(stdout, container_errors)
|
spawn.easy_async(
|
||||||
rebuild_widget(stdout, container_errors)
|
string.format(LIST_CONTAINERS_CMD,executable_name, number_of_containers),
|
||||||
end)
|
function(stdout, container_errors)
|
||||||
end)
|
rebuild_widget(stdout, container_errors)
|
||||||
end) ) )
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end) )
|
||||||
|
)
|
||||||
else
|
else
|
||||||
start_stop_button = nil
|
start_stop_button = nil
|
||||||
end
|
end
|
||||||
|
@ -241,12 +246,14 @@ local function worker(user_args)
|
||||||
status_icon:set_opacity(0.2)
|
status_icon:set_opacity(0.2)
|
||||||
status_icon:emit_signal('widget::redraw_needed')
|
status_icon:emit_signal('widget::redraw_needed')
|
||||||
|
|
||||||
awful.spawn.easy_async(executable_name .. ' ' .. command .. ' ' .. container['name'], function(_, stderr)
|
awful.spawn.easy_async(executable_name .. ' ' .. command .. ' ' .. container['name'],
|
||||||
if stderr ~= '' then show_warning(stderr) end
|
function(_, stderr)
|
||||||
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, executable_name, number_of_containers),
|
if stderr ~= '' then show_warning(stderr) end
|
||||||
function(stdout, container_errors)
|
spawn.easy_async(string.format(LIST_CONTAINERS_CMD,
|
||||||
rebuild_widget(stdout, container_errors)
|
executable_name, number_of_containers),
|
||||||
end)
|
function(stdout, container_errors)
|
||||||
|
rebuild_widget(stdout, container_errors)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end) ) )
|
end) ) )
|
||||||
else
|
else
|
||||||
|
@ -273,12 +280,15 @@ local function worker(user_args)
|
||||||
}
|
}
|
||||||
delete_button:buttons(
|
delete_button:buttons(
|
||||||
gears.table.join( awful.button({}, 1, function()
|
gears.table.join( awful.button({}, 1, function()
|
||||||
awful.spawn.easy_async(executable_name .. ' rm ' .. container['name'], function(_, rm_stderr)
|
awful.spawn.easy_async(executable_name .. ' rm ' .. container['name'],
|
||||||
if rm_stderr ~= '' then show_warning(rm_stderr) end
|
function(_, rm_stderr)
|
||||||
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, executable_name, number_of_containers),
|
if rm_stderr ~= '' then show_warning(rm_stderr) end
|
||||||
function(lc_stdout, lc_stderr)
|
spawn.easy_async(string.format(LIST_CONTAINERS_CMD,
|
||||||
rebuild_widget(lc_stdout, lc_stderr) end)
|
executable_name, number_of_containers),
|
||||||
end)
|
function(lc_stdout, lc_stderr)
|
||||||
|
rebuild_widget(lc_stdout, lc_stderr)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)))
|
end)))
|
||||||
|
|
||||||
local old_cursor, old_wibox
|
local old_cursor, old_wibox
|
||||||
|
|
|
@ -179,13 +179,14 @@ local function worker()
|
||||||
watch(string.format(GET_MPD_CMD, "'" .. default_player .. "'"), 1, update_graphic, mpris_widget)
|
watch(string.format(GET_MPD_CMD, "'" .. default_player .. "'"), 1, update_graphic, mpris_widget)
|
||||||
|
|
||||||
local mpris_popup = awful.widget.watch(
|
local mpris_popup = awful.widget.watch(
|
||||||
"playerctl metadata --format '{{ status }}: {{ artist }} - {{ title }}\nDuration: {{ duration(position) }}/{{ duration(mpris:length) }}'",
|
"playerctl metadata --format '{{ status }}: {{ artist }} - {{ title }}\n"
|
||||||
|
.. "Duration: {{ duration(position) }}/{{ duration(mpris:length) }}'",
|
||||||
1,
|
1,
|
||||||
function(popup, stdout)
|
function(callback_popup, stdout)
|
||||||
local metadata = stdout
|
local metadata = stdout
|
||||||
if popup.visible then
|
if callback_popup.visible then
|
||||||
popup:get_widget().text = metadata
|
callback_popup:get_widget().text = metadata
|
||||||
popup:move_next_to(mouse.current_widget_geometry)
|
callback_popup:move_next_to(mouse.current_widget_geometry)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
awful.popup {
|
awful.popup {
|
||||||
|
|
Loading…
Reference in New Issue