fix more warnings
This commit is contained in:
parent
d9eb3885ee
commit
a0cd854a4d
|
@ -19,7 +19,8 @@ local HOME_DIR = os.getenv("HOME")
|
||||||
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/docker-widget'
|
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/docker-widget'
|
||||||
local ICONS_DIR = WIDGET_DIR .. '/icons/'
|
local ICONS_DIR = WIDGET_DIR .. '/icons/'
|
||||||
|
|
||||||
local LIST_CONTAINERS_CMD = [[bash -c "docker container ls -a -s -n %s --format '{{.Names}}::{{.ID}}::{{.Image}}::{{.Status}}::{{.Size}}'"]]
|
local LIST_CONTAINERS_CMD = [[bash -c "docker container ls -a -s -n %s]]
|
||||||
|
.. [[ --format '{{.Names}}::{{.ID}}::{{.Image}}::{{.Status}}::{{.Size}}'"]]
|
||||||
|
|
||||||
--- Utility function to show warning messages
|
--- Utility function to show warning messages
|
||||||
local function show_warning(message)
|
local function show_warning(message)
|
||||||
|
@ -83,9 +84,9 @@ local status_to_icon_name = {
|
||||||
Paused = ICONS_DIR .. 'pause.svg'
|
Paused = ICONS_DIR .. 'pause.svg'
|
||||||
}
|
}
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
|
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
|
|
||||||
local icon = args.icon or ICONS_DIR .. 'docker.svg'
|
local icon = args.icon or ICONS_DIR .. 'docker.svg'
|
||||||
local number_of_containers = args.number_of_containers or -1
|
local number_of_containers = args.number_of_containers or -1
|
||||||
|
@ -163,10 +164,12 @@ local function worker(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('docker ' .. command .. ' ' .. container['name'], function(stdout, stderr)
|
spawn.easy_async('docker ' .. command .. ' ' .. container['name'], function()
|
||||||
if stderr ~= '' then show_warning(stderr) end
|
if stderr ~= '' then show_warning(stderr) end
|
||||||
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, number_of_containers), function(stdout, stderr)
|
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, number_of_containers),
|
||||||
rebuild_widget(stdout, stderr) end)
|
function(stdout, stderr)
|
||||||
|
rebuild_widget(stdout, stderr)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end) ) )
|
end) ) )
|
||||||
else
|
else
|
||||||
|
@ -250,11 +253,12 @@ local function worker(args)
|
||||||
}
|
}
|
||||||
delete_button:buttons(
|
delete_button:buttons(
|
||||||
awful.util.table.join( awful.button({}, 1, function()
|
awful.util.table.join( awful.button({}, 1, function()
|
||||||
awful.spawn.easy_async('docker rm ' .. container['name'], function(stdout, stderr)
|
awful.spawn.easy_async('docker rm ' .. container['name'], function(_, rm_stderr)
|
||||||
if stderr ~= '' then show_warning(stderr) end
|
if rm_stderr ~= '' then show_warning(rm_stderr) end
|
||||||
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, number_of_containers), function(stdout, stderr)
|
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, number_of_containers),
|
||||||
rebuild_widget(stdout, stderr) end)
|
function(lc_stdout, lc_stderr)
|
||||||
end)
|
rebuild_widget(lc_stdout, lc_stderr) end)
|
||||||
|
end)
|
||||||
end)))
|
end)))
|
||||||
|
|
||||||
local old_cursor, old_wibox
|
local old_cursor, old_wibox
|
||||||
|
@ -350,10 +354,11 @@ local function worker(args)
|
||||||
if popup.visible then
|
if popup.visible then
|
||||||
popup.visible = not popup.visible
|
popup.visible = not popup.visible
|
||||||
else
|
else
|
||||||
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, number_of_containers), function(stdout, stderr)
|
spawn.easy_async(string.format(LIST_CONTAINERS_CMD, number_of_containers),
|
||||||
rebuild_widget(stdout, stderr)
|
function(stdout, stderr)
|
||||||
popup:move_next_to(mouse.current_widget_geometry)
|
rebuild_widget(stdout, stderr)
|
||||||
end)
|
popup:move_next_to(mouse.current_widget_geometry)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,7 +15,7 @@ function widget.get_widget()
|
||||||
valign = 'center',
|
valign = 'center',
|
||||||
layout = wibox.container.place,
|
layout = wibox.container.place,
|
||||||
set_volume_level = function(self, new_value)
|
set_volume_level = function(self, new_value)
|
||||||
local volume_icon_name = ''
|
local volume_icon_name
|
||||||
if self.is_muted then
|
if self.is_muted then
|
||||||
volume_icon_name = 'audio-volume-muted-symbolic.svg'
|
volume_icon_name = 'audio-volume-muted-symbolic.svg'
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,8 +6,8 @@ local gears = require("gears")
|
||||||
|
|
||||||
local storage_bar_widget = {}
|
local storage_bar_widget = {}
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
local mounts = args.mounts or {'/'}
|
local mounts = args.mounts or {'/'}
|
||||||
local timeout = args.timeout or 60
|
local timeout = args.timeout or 60
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ local DOWNLOAD_AVATAR_CMD = [[bash -c "curl --create-dirs -o %s %s"]]
|
||||||
|
|
||||||
local gerrit_widget = {}
|
local gerrit_widget = {}
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
|
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
|
|
||||||
local icon = args.icons or HOME_DIR .. '/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg'
|
local icon = args.icons or HOME_DIR .. '/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg'
|
||||||
local host = args.host or naughty.notify{
|
local host = args.host or naughty.notify{
|
||||||
|
|
|
@ -13,7 +13,8 @@ local naughty = require("naughty")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local widget_themes = require("awesome-wm-widgets.github-contributions-widget.themes")
|
local widget_themes = require("awesome-wm-widgets.github-contributions-widget.themes")
|
||||||
|
|
||||||
local GET_CONTRIBUTIONS_CMD = [[bash -c "curl -s https://github-contributions.now.sh/api/v1/%s | jq -r '[.contributions[] | select ( .date | strptime(\"%%Y-%%m-%%d\") | mktime < now)][:%s]| .[].color'"]]
|
local GET_CONTRIBUTIONS_CMD = [[bash -c "curl -s https://github-contributions.now.sh/api/v1/%s]]
|
||||||
|
.. [[ | jq -r '[.contributions[] | select ( .date | strptime(\"%%Y-%%m-%%d\") | mktime < now)][:%s]| .[].color'"]]
|
||||||
|
|
||||||
local github_contributions_widget = wibox.widget{
|
local github_contributions_widget = wibox.widget{
|
||||||
reflection = {
|
reflection = {
|
||||||
|
@ -30,9 +31,9 @@ local function show_warning(message)
|
||||||
text = message}
|
text = message}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
|
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
|
|
||||||
local username = args.username or 'streetturtle'
|
local username = args.username or 'streetturtle'
|
||||||
local days = args.days or 365
|
local days = args.days or 365
|
||||||
|
@ -62,10 +63,10 @@ local function worker(args)
|
||||||
local r, g, b = hex2rgb(color)
|
local r, g, b = hex2rgb(color)
|
||||||
|
|
||||||
return wibox.widget{
|
return wibox.widget{
|
||||||
fit = function(self, context, width, height)
|
fit = function()
|
||||||
return 3, 3
|
return 3, 3
|
||||||
end,
|
end,
|
||||||
draw = function(self, context, cr, width, height)
|
draw = function(_, _, cr, _, _)
|
||||||
cr:set_source_rgb(r/255, g/255, b/255)
|
cr:set_source_rgb(r/255, g/255, b/255)
|
||||||
cr:rectangle(0, 0, with_border and 2 or 3, with_border and 2 or 3)
|
cr:rectangle(0, 0, with_border and 2 or 3, with_border and 2 or 3)
|
||||||
cr:fill()
|
cr:fill()
|
||||||
|
@ -77,11 +78,11 @@ local function worker(args)
|
||||||
local col = {layout = wibox.layout.fixed.vertical}
|
local col = {layout = wibox.layout.fixed.vertical}
|
||||||
local row = {layout = wibox.layout.fixed.horizontal}
|
local row = {layout = wibox.layout.fixed.horizontal}
|
||||||
local a = 5 - os.date('%w')
|
local a = 5 - os.date('%w')
|
||||||
for i = 0, a do
|
for _ = 0, a do
|
||||||
table.insert(col, get_square(color_of_empty_cells))
|
table.insert(col, get_square(color_of_empty_cells))
|
||||||
end
|
end
|
||||||
|
|
||||||
local update_widget = function(widget, stdout, _, _, _)
|
local update_widget = function(_, stdout, _, _, _)
|
||||||
for colors in stdout:gmatch("[^\r\n]+") do
|
for colors in stdout:gmatch("[^\r\n]+") do
|
||||||
if a%7 == 0 then
|
if a%7 == 0 then
|
||||||
table.insert(row, col)
|
table.insert(row, col)
|
||||||
|
@ -100,7 +101,7 @@ local function worker(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
awful.spawn.easy_async(string.format(GET_CONTRIBUTIONS_CMD, username, days),
|
awful.spawn.easy_async(string.format(GET_CONTRIBUTIONS_CMD, username, days),
|
||||||
function(stdout, stderr)
|
function(stdout)
|
||||||
update_widget(github_contributions_widget, stdout)
|
update_widget(github_contributions_widget, stdout)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ local color = require("gears.color")
|
||||||
|
|
||||||
local HOME_DIR = os.getenv("HOME")
|
local HOME_DIR = os.getenv("HOME")
|
||||||
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/gitlab-widget/'
|
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/gitlab-widget/'
|
||||||
local GET_PRS_CMD= [[bash -c "curl -s --connect-timeout 5 --show-error --header 'PRIVATE-TOKEN: %s' '%s/api/v4/merge_requests?state=opened'"]]
|
local GET_PRS_CMD= [[sh -c "curl -s --connect-timeout 5 --show-error --header 'PRIVATE-TOKEN: %s']]
|
||||||
local DOWNLOAD_AVATAR_CMD = [[bash -c "curl -L --create-dirs -o %s/.cache/awmw/gitlab-widget/avatars/%s %s"]]
|
..[[ '%s/api/v4/merge_requests?state=opened'"]]
|
||||||
|
local DOWNLOAD_AVATAR_CMD = [[sh -c "curl -L --create-dirs -o %s/.cache/awmw/gitlab-widget/avatars/%s %s"]]
|
||||||
|
|
||||||
local gitlab_widget = wibox.widget {
|
local gitlab_widget = wibox.widget {
|
||||||
{
|
{
|
||||||
|
@ -33,7 +34,7 @@ local gitlab_widget = wibox.widget {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = 'error_marker',
|
id = 'error_marker',
|
||||||
draw = function(self, context, cr, width, height)
|
draw = function(_, _, cr, _, height)
|
||||||
cr:set_source(color(beautiful.fg_urgent))
|
cr:set_source(color(beautiful.fg_urgent))
|
||||||
cr:arc(height/4, height/4, height/4, 0, math.pi*2)
|
cr:arc(height/4, height/4, height/4, 0, math.pi*2)
|
||||||
cr:fill()
|
cr:fill()
|
||||||
|
@ -96,7 +97,7 @@ local popup = awful.popup{
|
||||||
--- Converts string representation of date (2020-06-02T11:25:27Z) to date
|
--- Converts string representation of date (2020-06-02T11:25:27Z) to date
|
||||||
local function parse_date(date_str)
|
local function parse_date(date_str)
|
||||||
local pattern = "(%d+)%-(%d+)%-(%d+)T(%d+):(%d+):(%d+)%Z"
|
local pattern = "(%d+)%-(%d+)%-(%d+)T(%d+):(%d+):(%d+)%Z"
|
||||||
local y, m, d, h, min, sec, mil = date_str:match(pattern)
|
local y, m, d, h, min, sec, _ = date_str:match(pattern)
|
||||||
|
|
||||||
return os.time{year = y, month = m, day = d, hour = h, min = min, sec = sec}
|
return os.time{year = y, month = m, day = d, hour = h, min = min, sec = sec}
|
||||||
end
|
end
|
||||||
|
@ -134,9 +135,9 @@ local tooltip = awful.tooltip {
|
||||||
preferred_positions = {'bottom'},
|
preferred_positions = {'bottom'},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
|
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
|
|
||||||
local icon = args.icon or WIDGET_DIR .. '/icons/gitlab-icon.svg'
|
local icon = args.icon or WIDGET_DIR .. '/icons/gitlab-icon.svg'
|
||||||
local api_token = args.api_token or show_warning('API Token is not set')
|
local api_token = args.api_token or show_warning('API Token is not set')
|
||||||
|
@ -318,7 +319,9 @@ local function worker(args)
|
||||||
DOWNLOAD_AVATAR_CMD,
|
DOWNLOAD_AVATAR_CMD,
|
||||||
HOME_DIR,
|
HOME_DIR,
|
||||||
pr.author.id,
|
pr.author.id,
|
||||||
pr.author.avatar_url), function() row:get_children_by_id('avatar')[1]:set_image(path_to_avatar) end)
|
pr.author.avatar_url), function()
|
||||||
|
row:get_children_by_id('avatar')[1]:set_image(path_to_avatar)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end)
|
row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end)
|
||||||
|
@ -342,25 +345,24 @@ local function worker(args)
|
||||||
)
|
)
|
||||||
|
|
||||||
local old_cursor, old_wibox
|
local old_cursor, old_wibox
|
||||||
row:get_children_by_id('title')[1]:connect_signal("mouse::enter", function(c)
|
row:get_children_by_id('title')[1]:connect_signal("mouse::enter", function()
|
||||||
local wb = mouse.current_wibox
|
local wb = mouse.current_wibox
|
||||||
old_cursor, old_wibox = wb.cursor, wb
|
old_cursor, old_wibox = wb.cursor, wb
|
||||||
wb.cursor = "hand1"
|
wb.cursor = "hand1"
|
||||||
end)
|
end)
|
||||||
row:get_children_by_id('title')[1]:connect_signal("mouse::leave", function(c)
|
row:get_children_by_id('title')[1]:connect_signal("mouse::leave", function()
|
||||||
if old_wibox then
|
if old_wibox then
|
||||||
old_wibox.cursor = old_cursor
|
old_wibox.cursor = old_cursor
|
||||||
old_wibox = nil
|
old_wibox = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local old_cursor, old_wibox
|
row:get_children_by_id('avatar')[1]:connect_signal("mouse::enter", function()
|
||||||
row:get_children_by_id('avatar')[1]:connect_signal("mouse::enter", function(c)
|
|
||||||
local wb = mouse.current_wibox
|
local wb = mouse.current_wibox
|
||||||
old_cursor, old_wibox = wb.cursor, wb
|
old_cursor, old_wibox = wb.cursor, wb
|
||||||
wb.cursor = "hand1"
|
wb.cursor = "hand1"
|
||||||
end)
|
end)
|
||||||
row:get_children_by_id('avatar')[1]:connect_signal("mouse::leave", function(c)
|
row:get_children_by_id('avatar')[1]:connect_signal("mouse::leave", function()
|
||||||
if old_wibox then
|
if old_wibox then
|
||||||
old_wibox.cursor = old_cursor
|
old_wibox.cursor = old_cursor
|
||||||
old_wibox = nil
|
old_wibox = nil
|
||||||
|
|
|
@ -54,8 +54,8 @@ local function create_button(icon_name, action_name, color, onclick, icon_size,
|
||||||
capi.keygrabber.stop()
|
capi.keygrabber.stop()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
button:connect_signal("mouse::enter", function(c) action:set_text(action_name) end)
|
button:connect_signal("mouse::enter", function() action:set_text(action_name) end)
|
||||||
button:connect_signal("mouse::leave", function(c) action:set_text(' ') end)
|
button:connect_signal("mouse::leave", function() action:set_text(' ') end)
|
||||||
return button
|
return button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,7 +76,8 @@ local function launch(args)
|
||||||
|
|
||||||
w:set_bg(bg_color)
|
w:set_bg(bg_color)
|
||||||
if #phrases > 0 then
|
if #phrases > 0 then
|
||||||
phrase_widget:set_markup('<span color="'.. text_color .. '" size="20000">' .. phrases[ math.random( #phrases ) ] .. '</span>')
|
phrase_widget:set_markup(
|
||||||
|
'<span color="'.. text_color .. '" size="20000">' .. phrases[ math.random( #phrases ) ] .. '</span>')
|
||||||
end
|
end
|
||||||
|
|
||||||
w:setup {
|
w:setup {
|
||||||
|
|
|
@ -25,7 +25,7 @@ local PAUSE_ICON_NAME = PATH_TO_ICONS .. "/actions/24/player_pause.png"
|
||||||
local PLAY_ICON_NAME = PATH_TO_ICONS .. "/actions/24/player_play.png"
|
local PLAY_ICON_NAME = PATH_TO_ICONS .. "/actions/24/player_play.png"
|
||||||
local STOP_ICON_NAME = PATH_TO_ICONS .. "/actions/24/player_stop.png"
|
local STOP_ICON_NAME = PATH_TO_ICONS .. "/actions/24/player_stop.png"
|
||||||
|
|
||||||
local icon = wibox.widget {
|
local icon = wibox.widget {
|
||||||
id = "icon",
|
id = "icon",
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
image = PLAY_ICON_NAME
|
image = PLAY_ICON_NAME
|
||||||
|
@ -58,7 +58,7 @@ local update_graphic = function(widget, stdout, _, _, _)
|
||||||
stdout = string.gsub(stdout, "\n", "")
|
stdout = string.gsub(stdout, "\n", "")
|
||||||
local mpdpercent = string.match(stdout, "(%d%d)%%")
|
local mpdpercent = string.match(stdout, "(%d%d)%%")
|
||||||
local mpdstatus = string.match(stdout, "%[(%a+)%]")
|
local mpdstatus = string.match(stdout, "%[(%a+)%]")
|
||||||
if mpdstatus == "playing" then
|
if mpdstatus == "playing" then
|
||||||
icon.image = PLAY_ICON_NAME
|
icon.image = PLAY_ICON_NAME
|
||||||
widget.colors = { beautiful.widget_main_color }
|
widget.colors = { beautiful.widget_main_color }
|
||||||
widget.value = tonumber((100-mpdpercent)/100)
|
widget.value = tonumber((100-mpdpercent)/100)
|
||||||
|
@ -93,7 +93,7 @@ mpdarc:connect_signal("button::press", function(_, _, _, button)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local notification
|
local notification
|
||||||
function show_MPD_status()
|
local function show_MPD_status()
|
||||||
spawn.easy_async(GET_MPD_CMD,
|
spawn.easy_async(GET_MPD_CMD,
|
||||||
function(stdout, _, _, _)
|
function(stdout, _, _, _)
|
||||||
notification = naughty.notify {
|
notification = naughty.notify {
|
||||||
|
|
|
@ -29,7 +29,7 @@ local LIBRARY_ICON_NAME = PATH_TO_ICONS .. "/actions/24/music-library.png"
|
||||||
|
|
||||||
local mpdarc_widget = {}
|
local mpdarc_widget = {}
|
||||||
|
|
||||||
local function worker(args)
|
local function worker()
|
||||||
|
|
||||||
-- retriving song info
|
-- retriving song info
|
||||||
local current_song, artist, mpdstatus, art, artUrl
|
local current_song, artist, mpdstatus, art, artUrl
|
||||||
|
@ -123,7 +123,7 @@ local function worker(args)
|
||||||
|
|
||||||
local notification
|
local notification
|
||||||
local function show_MPD_status()
|
local function show_MPD_status()
|
||||||
spawn.easy_async(GET_MPD_CMD, function(stdout, _, _, _)
|
spawn.easy_async(GET_MPD_CMD, function()
|
||||||
notification = naughty.notification {
|
notification = naughty.notification {
|
||||||
margin = 10,
|
margin = 10,
|
||||||
timeout = 5,
|
timeout = 5,
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
-- @copyright 2020 Pavel Makhov
|
-- @copyright 2020 Pavel Makhov
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
local naughty = require("naughty")
|
|
||||||
local watch = require("awful.widget.watch")
|
local watch = require("awful.widget.watch")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
|
||||||
|
@ -16,14 +15,6 @@ local HOME_DIR = os.getenv("HOME")
|
||||||
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/net-speed-widget/'
|
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/net-speed-widget/'
|
||||||
local ICONS_DIR = WIDGET_DIR .. 'icons/'
|
local ICONS_DIR = WIDGET_DIR .. 'icons/'
|
||||||
|
|
||||||
local function show_warning(message)
|
|
||||||
naughty.notify {
|
|
||||||
preset = naughty.config.presets.critical,
|
|
||||||
title = 'Net Speed Widget',
|
|
||||||
text = message
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local net_speed_widget = wibox.widget {
|
local net_speed_widget = wibox.widget {
|
||||||
{
|
{
|
||||||
id = 'rx_speed',
|
id = 'rx_speed',
|
||||||
|
@ -91,21 +82,21 @@ local function split(string_to_split, separator)
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
|
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
|
|
||||||
local interface = args.interface or '*'
|
local interface = args.interface or '*'
|
||||||
local timeout = args.timeout or 1
|
local timeout = args.timeout or 1
|
||||||
|
|
||||||
local update_widget = function(widget, stdout, stderr)
|
local update_widget = function(widget, stdout)
|
||||||
|
|
||||||
local cur_vals = split(stdout, '\r\n')
|
local cur_vals = split(stdout, '\r\n')
|
||||||
|
|
||||||
local cur_rx = 0
|
local cur_rx = 0
|
||||||
local cur_tx = 0
|
local cur_tx = 0
|
||||||
|
|
||||||
for i, v in ipairs(cur_vals) do
|
for i, _ in ipairs(cur_vals) do
|
||||||
if i%2 == 1 then cur_rx = cur_rx + cur_vals[i] end
|
if i%2 == 1 then cur_rx = cur_rx + cur_vals[i] end
|
||||||
if i%2 == 0 then cur_tx = cur_tx + cur_vals[i] end
|
if i%2 == 0 then cur_tx = cur_tx + cur_vals[i] end
|
||||||
end
|
end
|
||||||
|
@ -120,7 +111,8 @@ local function worker(args)
|
||||||
prev_tx = cur_tx
|
prev_tx = cur_tx
|
||||||
end
|
end
|
||||||
|
|
||||||
watch(string.format([[bash -c "cat /sys/class/net/%s/statistics/*_bytes"]], interface), timeout, update_widget, net_speed_widget)
|
watch(string.format([[bash -c "cat /sys/class/net/%s/statistics/*_bytes"]], interface),
|
||||||
|
timeout, update_widget, net_speed_widget)
|
||||||
|
|
||||||
return net_speed_widget
|
return net_speed_widget
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ text.font = "Inconsolata Medium 13"
|
||||||
widget.value = tonumber(pomodoro/(25*60))
|
widget.value = tonumber(pomodoro/(25*60))
|
||||||
text.font = "Inconsolata Medium 13"
|
text.font = "Inconsolata Medium 13"
|
||||||
text.text = "PW"
|
text.text = "PW"
|
||||||
elseif workbreak == "B" then
|
elseif workbreak == "B" then
|
||||||
widget.colors = { beautiful.widget_yellow }
|
widget.colors = { beautiful.widget_yellow }
|
||||||
widget.value = tonumber(pomodoro/(5*60))
|
widget.value = tonumber(pomodoro/(5*60))
|
||||||
text.font = "Inconsolata Medium 13"
|
text.font = "Inconsolata Medium 13"
|
||||||
|
@ -114,7 +114,7 @@ pomodoroarc:connect_signal("button::press", function(_, _, _, button)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local notification
|
local notification
|
||||||
function show_pomodoro_status()
|
local function show_pomodoro_status()
|
||||||
spawn.easy_async(GET_pomodoro_CMD,
|
spawn.easy_async(GET_pomodoro_CMD,
|
||||||
function(stdout, _, _, _)
|
function(stdout, _, _, _)
|
||||||
notification = naughty.notify {
|
notification = naughty.notify {
|
||||||
|
|
|
@ -8,8 +8,8 @@ local wibox = require("wibox")
|
||||||
local ramgraph_widget = {}
|
local ramgraph_widget = {}
|
||||||
|
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(user_args)
|
||||||
local args = args or {}
|
local args = user_args or {}
|
||||||
local timeout = args.timeout or 1
|
local timeout = args.timeout or 1
|
||||||
|
|
||||||
--- Main ram widget shown on wibar
|
--- Main ram widget shown on wibar
|
||||||
|
@ -43,6 +43,7 @@ local function worker(args)
|
||||||
offset = { y = 5 },
|
offset = { y = 5 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--luacheck:ignore 231
|
||||||
local total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap
|
local total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap
|
||||||
|
|
||||||
local function getPercentage(value)
|
local function getPercentage(value)
|
||||||
|
@ -50,7 +51,7 @@ local function worker(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
watch('bash -c "LANGUAGE=en_US.UTF-8 free | grep -z Mem.*Swap.*"', timeout,
|
watch('bash -c "LANGUAGE=en_US.UTF-8 free | grep -z Mem.*Swap.*"', timeout,
|
||||||
function(widget, stdout, stderr, exitreason, exitcode)
|
function(widget, stdout)
|
||||||
total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
||||||
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ local function worker(args)
|
||||||
{'free ' .. getPercentage(free + free_swap), free + free_swap},
|
{'free ' .. getPercentage(free + free_swap), free + free_swap},
|
||||||
{'buff_cache ' .. getPercentage(buff_cache), buff_cache}
|
{'buff_cache ' .. getPercentage(buff_cache), buff_cache}
|
||||||
}
|
}
|
||||||
|
|
||||||
if popup.visible then
|
if popup.visible then
|
||||||
popup.visible = not popup.visible
|
popup.visible = not popup.visible
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
local wibox = require("wibox")
|
|
||||||
local awful = require("awful")
|
|
||||||
local watch = require("awful.widget.watch")
|
|
||||||
|
|
||||||
rhythmbox_widget = wibox.widget.textbox()
|
|
||||||
rhythmbox_widget:set_font('Play 9')
|
|
||||||
|
|
||||||
rhythmbox_icon = wibox.widget.imagebox()
|
|
||||||
rhythmbox_icon:set_image("/usr/share/icons/Arc/devices/22/audio-speakers.png")
|
|
||||||
|
|
||||||
watch(
|
|
||||||
"rhythmbox-client --no-start --print-playing", 1,
|
|
||||||
function(widget, stdout, stderr, exitreason, exitcode)
|
|
||||||
rhythmbox_widget:set_text(stdout)
|
|
||||||
end
|
|
||||||
)
|
|
|
@ -8,10 +8,6 @@
|
||||||
-- @copyright 2019 Pavel Makhov
|
-- @copyright 2019 Pavel Makhov
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
local capi = {
|
|
||||||
screen = screen,
|
|
||||||
client = client,
|
|
||||||
}
|
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local gfs = require("gears.filesystem")
|
local gfs = require("gears.filesystem")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
|
@ -26,8 +22,10 @@ local widget = {}
|
||||||
function widget.new()
|
function widget.new()
|
||||||
local widget_instance = {
|
local widget_instance = {
|
||||||
_cached_wiboxes = {},
|
_cached_wiboxes = {},
|
||||||
_cmd_pixelate = [[bash -c 'ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+%s,20 -vf frei0r=pixeliz0r -vframes 1 /tmp/i3lock-%s.png ; echo done']],
|
_cmd_pixelate = [[sh -c 'ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+%s,20 -vf ]]
|
||||||
_cmd_blur = [[bash -c 'ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+%s,20 -filter_complex "boxblur=9" -vframes 1 /tmp/i3lock-%s.png ; echo done']]
|
.. [[frei0r=pixeliz0r -vframes 1 /tmp/i3lock-%s.png ; echo done']],
|
||||||
|
_cmd_blur = [[sh -c 'ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+%s,20 ]]
|
||||||
|
.. [[-filter_complex "boxblur=9" -vframes 1 /tmp/i3lock-%s.png ; echo done']]
|
||||||
}
|
}
|
||||||
|
|
||||||
function widget_instance:_create_wibox()
|
function widget_instance:_create_wibox()
|
||||||
|
@ -74,21 +72,18 @@ function widget.new()
|
||||||
return w
|
return w
|
||||||
end
|
end
|
||||||
|
|
||||||
function widget_instance:launch(s, c)
|
function widget_instance:launch()
|
||||||
c = c or capi.client.focus
|
local s = mouse.screen
|
||||||
s = mouse.screen
|
|
||||||
-- naughty.notify { text = 'screen ' .. s.index }
|
|
||||||
if not self._cached_wiboxes[s] then
|
if not self._cached_wiboxes[s] then
|
||||||
self._cached_wiboxes[s] = {}
|
self._cached_wiboxes[s] = {}
|
||||||
-- naughty.notify { text = 'nope' }
|
|
||||||
end
|
end
|
||||||
if not self._cached_wiboxes[s][1] then
|
if not self._cached_wiboxes[s][1] then
|
||||||
self._cached_wiboxes[s][1] = self:_create_wibox()
|
self._cached_wiboxes[s][1] = self:_create_wibox()
|
||||||
-- naughty.notify { text = 'nope' }
|
|
||||||
end
|
end
|
||||||
local w = self._cached_wiboxes[s][1]
|
local w = self._cached_wiboxes[s][1]
|
||||||
local rnd = math.random()
|
local rnd = math.random()
|
||||||
awful.spawn.with_line_callback(string.format(self._cmd_blur, tostring(awful.screen.focused().geometry.x), rnd), {
|
awful.spawn.with_line_callback(
|
||||||
|
string.format(self._cmd_blur, tostring(awful.screen.focused().geometry.x), rnd), {
|
||||||
stdout = function()
|
stdout = function()
|
||||||
w.visible = true
|
w.visible = true
|
||||||
w.bgimage = '/tmp/i3lock-' .. rnd ..'.png'
|
w.bgimage = '/tmp/i3lock-' .. rnd ..'.png'
|
||||||
|
|
|
@ -45,6 +45,7 @@ function widget.new()
|
||||||
widget = wibox.widget.imagebox,
|
widget = wibox.widget.imagebox,
|
||||||
resize = false,
|
resize = false,
|
||||||
opacity = 0.2,
|
opacity = 0.2,
|
||||||
|
--luacheck:ignore 432
|
||||||
set_hover = function(self, opacity)
|
set_hover = function(self, opacity)
|
||||||
self.opacity = opacity
|
self.opacity = opacity
|
||||||
self.image = '/usr/share/icons/Arc/actions/symbolic/system-shutdown-symbolic.svg'
|
self.image = '/usr/share/icons/Arc/actions/symbolic/system-shutdown-symbolic.svg'
|
||||||
|
|
|
@ -23,7 +23,7 @@ local GET_TODO_ITEMS = 'bash -c "cat ' .. STORAGE .. '"'
|
||||||
|
|
||||||
local rows = { layout = wibox.layout.fixed.vertical }
|
local rows = { layout = wibox.layout.fixed.vertical }
|
||||||
local todo_widget = {}
|
local todo_widget = {}
|
||||||
|
local update_widget
|
||||||
todo_widget.widget = wibox.widget {
|
todo_widget.widget = wibox.widget {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ add_button:connect_signal("button::press", function()
|
||||||
local res = json.decode(stdout)
|
local res = json.decode(stdout)
|
||||||
table.insert(res.todo_items, {todo_item = input_text, status = false})
|
table.insert(res.todo_items, {todo_item = input_text, status = false})
|
||||||
spawn.easy_async_with_shell("echo '" .. json.encode(res) .. "' > " .. STORAGE, function()
|
spawn.easy_async_with_shell("echo '" .. json.encode(res) .. "' > " .. STORAGE, function()
|
||||||
spawn.easy_async(GET_TODO_ITEMS, function(stdout) update_widget(stdout) end)
|
spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -202,7 +202,7 @@ local function worker(user_args)
|
||||||
trash_button:connect_signal("button::press", function()
|
trash_button:connect_signal("button::press", function()
|
||||||
table.remove(result.todo_items, i)
|
table.remove(result.todo_items, i)
|
||||||
spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function ()
|
spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function ()
|
||||||
spawn.easy_async(GET_TODO_ITEMS, function(stdout) update_widget(stdout) end)
|
spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ local function worker(user_args)
|
||||||
result.todo_items[i] = result.todo_items[i-1]
|
result.todo_items[i] = result.todo_items[i-1]
|
||||||
result.todo_items[i-1] = temp
|
result.todo_items[i-1] = temp
|
||||||
spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function ()
|
spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function ()
|
||||||
spawn.easy_async(GET_TODO_ITEMS, function(stdout) update_widget(stdout) end)
|
spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ local function worker(user_args)
|
||||||
result.todo_items[i] = result.todo_items[i+1]
|
result.todo_items[i] = result.todo_items[i+1]
|
||||||
result.todo_items[i+1] = temp
|
result.todo_items[i+1] = temp
|
||||||
spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function ()
|
spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function ()
|
||||||
spawn.easy_async(GET_TODO_ITEMS, function(stdout) update_widget(stdout) end)
|
spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -242,13 +242,11 @@ local function worker(user_args)
|
||||||
layout = wibox.layout.fixed.vertical
|
layout = wibox.layout.fixed.vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
if 1 == #result.todo_items then
|
if i == 1 and #result.todo_items > 1 then
|
||||||
-- one item, no need in arrows
|
|
||||||
elseif i == 1 then
|
|
||||||
table.insert(move_buttons, move_down)
|
table.insert(move_buttons, move_down)
|
||||||
elseif i == #result.todo_items then
|
elseif i == #result.todo_items and #result.todo_items > 1 then
|
||||||
table.insert(move_buttons, move_up)
|
table.insert(move_buttons, move_up)
|
||||||
else
|
elseif #result.todo_items > 1 then
|
||||||
table.insert(move_buttons, move_up)
|
table.insert(move_buttons, move_up)
|
||||||
table.insert(move_buttons, move_down)
|
table.insert(move_buttons, move_down)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue