diff options
-rw-r--r-- | cpu-widget/cpu-widget.lua | 41 | ||||
-rw-r--r-- | jira-widget/jira.lua | 62 |
2 files changed, 78 insertions, 25 deletions
diff --git a/cpu-widget/cpu-widget.lua b/cpu-widget/cpu-widget.lua index 7f87d02..76f739f 100644 --- a/cpu-widget/cpu-widget.lua +++ b/cpu-widget/cpu-widget.lua @@ -57,7 +57,7 @@ local function create_textbox(args) end local function create_process_header(params) - return wibox.widget{ + local res = wibox.widget{ create_textbox{markup = '<b>PID</b>'}, create_textbox{markup = '<b>Name</b>'}, { @@ -66,8 +66,11 @@ local function create_process_header(params) params.with_action_column and create_textbox{forced_width = 20} or nil, layout = wibox.layout.align.horizontal }, - layout = wibox.layout.align.horizontal + layout = wibox.layout.ratio.horizontal } + res:ajust_ratio(2, 0.2, 0.47, 0.33) + + return res end local function create_kill_process_button() @@ -180,9 +183,9 @@ local function worker(args) widget = wibox.widget.progressbar, }, - layout = wibox.layout.align.horizontal + layout = wibox.layout.ratio.horizontal } - + row:ajust_ratio(2, 0.15, 0.15, 0.7) cpu_rows[i] = row i = i + 1 else @@ -198,19 +201,22 @@ local function worker(args) local kill_proccess_button = enable_kill_button and create_kill_process_button() or nil + local pid_name_rest = wibox.widget{ + create_textbox{text = pid}, + create_textbox{text = comm}, + { + create_textbox{text = cpu, align = 'center'}, + create_textbox{text = mem, align = 'center'}, + kill_proccess_button, + layout = wibox.layout.fixed.horizontal + }, + layout = wibox.layout.ratio.horizontal + } + pid_name_rest:ajust_ratio(2, 0.2, 0.47, 0.33) + local row = wibox.widget { { - { - create_textbox{text = pid}, - create_textbox{text = comm}, - { - create_textbox{text = cpu, align = 'center'}, - create_textbox{text = mem, align = 'center'}, - kill_proccess_button, - layout = wibox.layout.fixed.horizontal - }, - layout = wibox.layout.align.horizontal - }, + pid_name_rest, top = 4, bottom = 4, widget = wibox.container.margin @@ -226,7 +232,10 @@ local function worker(args) row:connect_signal("mouse::leave", function(c) kill_proccess_button.icon.opacity = 0.1 end) kill_proccess_button:buttons( - awful.util.table.join( awful.button({}, 1, function() awful.spawn.with_shell('kill -9 ' .. pid) end) ) ) + awful.util.table.join( awful.button({}, 1, function() + row:set_bg('#ff0000') + awful.spawn.with_shell('kill -9 ' .. pid) + end) ) ) end awful.tooltip { diff --git a/jira-widget/jira.lua b/jira-widget/jira.lua index d8b20b3..1ed6de8 100644 --- a/jira-widget/jira.lua +++ b/jira-widget/jira.lua @@ -18,6 +18,7 @@ local gears = require("gears") local beautiful = require("beautiful") local gfs = require("gears.filesystem") local gs = require("gears.string") +local color = require("gears.color") local HOME_DIR = os.getenv("HOME") @@ -44,6 +45,13 @@ local function worker(args) local current_number_of_reviews local previous_number_of_reviews = 0 + local warning_shown = false + local tooltip = awful.tooltip { + mode = 'outside', + preferred_positions = {'bottom'}, + } + + local rows = { { widget = wibox.widget.textbox }, layout = wibox.layout.fixed.vertical, @@ -63,9 +71,26 @@ local function worker(args) jira_widget = wibox.widget { { { - image = icon, - widget = wibox.widget.imagebox + { + id = 'c', + image = icon, + widget = wibox.widget.imagebox + }, + { + id = 'd', + draw = function(self, context, cr, width, height) + cr:set_source(color(beautiful.fg_urgent)) + cr:arc(height/4, height/4, height/4, 0, math.pi*2) + cr:fill() + end, + visible = false, + layout = wibox.widget.base.make_widget, + + }, + id = 'b', + layout = wibox.layout.stack }, + id = 'a', margins = 4, layout = wibox.container.margin }, @@ -73,25 +98,44 @@ local function worker(args) id = "txt", widget = wibox.widget.textbox }, - { - id = "new_rev", - widget = wibox.widget.textbox - }, layout = wibox.layout.fixed.horizontal, set_text = function(self, new_value) self.txt.text = new_value end, - set_unseen_review = function(self, is_new_review) - self.new_rev.text = is_new_review and '*' or '' + is_everything_ok = function(self, is_ok) + if is_ok then + self.a.b.d:set_visible(false) + self.a.b.c:set_opacity(1) + self.a.b.c:emit_signal('widget:redraw_needed') + else + self.txt:set_text('') + self.a.b.d:set_visible(true) + self.a.b.c:set_opacity(0.2) + self.a.b.c:emit_signal('widget:redraw_needed') + end end } local update_widget = function(widget, stdout, stderr, _, _) if stderr ~= '' then - show_warning(stderr) + if not warning_shown then + show_warning(stderr) + warning_shown = true + widget:is_everything_ok(false) + tooltip:add_to_object(jira_widget) + + widget:connect_signal('mouse::enter', function() + tooltip.text = stderr + end) + end return end + warning_shown = false + tooltip:remove_from_object(jira_widget) + widget:is_everything_ok(true) + + local result = json.decode(stdout) current_number_of_reviews = rawlen(result.issues) |