summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--logout-popup-widget/README.md1
-rw-r--r--logout-popup-widget/logout-popup.lua22
-rw-r--r--net-speed-widget/net-speed.lua61
3 files changed, 46 insertions, 38 deletions
diff --git a/logout-popup-widget/README.md b/logout-popup-widget/README.md
index 9b83eed..5eec871 100644
--- a/logout-popup-widget/README.md
+++ b/logout-popup-widget/README.md
@@ -58,6 +58,7 @@ Then
| `bg_color` | `beautiful.bg_normal` | The color the background of the |
| `accent_color` | `beautiful.bg_focus` | The color of the buttons |
| `text_color` | `beautiful.fg_normal` | The color of text |
+| `label_color` | `beautiful.fg_normal` | The color of the button's label |
| `phrases` | `{'Goodbye!'}` | The table with phrase(s) to show, if more than one provided, the phrase is chosen randomly. Leave empty (`{}`) to hide the phrase |
| `onlogout` | `function() awesome.quit() end` | Function which is called when the logout button is pressed |
| `onlock` | `function() awful.spawn.with_shell("systemctl suspend") end` | Function which is called when the lock button is pressed |
diff --git a/logout-popup-widget/logout-popup.lua b/logout-popup-widget/logout-popup.lua
index 4e52b50..4d85a8f 100644
--- a/logout-popup-widget/logout-popup.lua
+++ b/logout-popup-widget/logout-popup.lua
@@ -40,12 +40,12 @@ local phrase_widget = wibox.widget{
widget = wibox.widget.textbox
}
-local function create_button(icon_name, action_name, color, onclick, icon_size, icon_margin)
+local function create_button(icon_name, action_name, accent_color, label_color, onclick, icon_size, icon_margin)
local button = awesomebuttons.with_icon {
type = 'basic',
icon = icon_name,
- color = color,
+ color = accent_color,
icon_size = icon_size,
icon_margin = icon_margin,
onclick = function()
@@ -54,8 +54,11 @@ local function create_button(icon_name, action_name, color, onclick, icon_size,
capi.keygrabber.stop()
end
}
- button:connect_signal("mouse::enter", function() action:set_text(action_name) end)
- button:connect_signal("mouse::leave", function() action:set_text(' ') end)
+ button:connect_signal("mouse::enter",
+ function() action:set_markup('<span color="' .. label_color .. '">' .. action_name .. '</span>') end)
+
+ button:connect_signal("mouse::leave", function() action:set_markup('<span> </span>') end)
+
return button
end
@@ -65,6 +68,7 @@ local function launch(args)
local bg_color = args.bg_color or beautiful.bg_normal
local accent_color = args.accent_color or beautiful.bg_focus
local text_color = args.text_color or beautiful.fg_normal
+ local label_color = args.label_color or beautiful.fg_focus
local phrases = args.phrases or {'Goodbye!'}
local icon_size = args.icon_size or 40
local icon_margin = args.icon_margin or 16
@@ -86,11 +90,11 @@ local function launch(args)
phrase_widget,
{
{
- create_button('log-out', 'Log Out (l)', accent_color, onlogout, icon_size, icon_margin),
- create_button('lock', 'Lock (k)', accent_color, onlock, icon_size, icon_margin),
- create_button('refresh-cw', 'Reboot (r)', accent_color, onreboot, icon_size, icon_margin),
- create_button('moon', 'Suspend (u)', accent_color, onsuspend, icon_size, icon_margin),
- create_button('power', 'Power Off (s)', accent_color, onpoweroff, icon_size, icon_margin),
+ create_button('log-out', 'Log Out (l)', accent_color, label_color, onlogout, icon_size, icon_margin),
+ create_button('lock', 'Lock (k)', accent_color, label_color, onlock, icon_size, icon_margin),
+ create_button('refresh-cw', 'Reboot (r)', accent_color, label_color, onreboot, icon_size, icon_margin),
+ create_button('moon', 'Suspend (u)', accent_color, label_color, onsuspend, icon_size, icon_margin),
+ create_button('power', 'Power Off (s)', accent_color, label_color, onpoweroff, icon_size, icon_margin),
id = 'buttons',
spacing = 8,
layout = wibox.layout.fixed.horizontal
diff --git a/net-speed-widget/net-speed.lua b/net-speed-widget/net-speed.lua
index 409e03d..3fc1090 100644
--- a/net-speed-widget/net-speed.lua
+++ b/net-speed-widget/net-speed.lua
@@ -15,35 +15,7 @@ local HOME_DIR = os.getenv("HOME")
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/net-speed-widget/'
local ICONS_DIR = WIDGET_DIR .. 'icons/'
-local net_speed_widget = wibox.widget {
- {
- id = 'rx_speed',
- forced_width = 55,
- align = 'right',
- widget = wibox.widget.textbox
- },
- {
- image = ICONS_DIR .. 'down.svg',
- widget = wibox.widget.imagebox
- },
- {
- image = ICONS_DIR .. 'up.svg',
- widget = wibox.widget.imagebox
- },
- {
- id = 'tx_speed',
- forced_width = 55,
- align = 'left',
- widget = wibox.widget.textbox
- },
- layout = wibox.layout.fixed.horizontal,
- set_rx_text = function(self, new_rx_speed)
- self:get_children_by_id('rx_speed')[1]:set_text(tostring(new_rx_speed))
- end,
- set_tx_text = function(self, new_tx_speed)
- self:get_children_by_id('tx_speed')[1]:set_text(tostring(new_tx_speed))
- end
-}
+local net_speed_widget = {}
local prev_rx = 0
local prev_tx = 0
@@ -88,6 +60,37 @@ local function worker(user_args)
local interface = args.interface or '*'
local timeout = args.timeout or 1
+ local width = args.width or 55
+
+ local net_speed_widget = wibox.widget {
+ {
+ id = 'rx_speed',
+ forced_width = width,
+ align = 'right',
+ widget = wibox.widget.textbox
+ },
+ {
+ image = ICONS_DIR .. 'down.svg',
+ widget = wibox.widget.imagebox
+ },
+ {
+ image = ICONS_DIR .. 'up.svg',
+ widget = wibox.widget.imagebox
+ },
+ {
+ id = 'tx_speed',
+ forced_width = width,
+ align = 'left',
+ widget = wibox.widget.textbox
+ },
+ layout = wibox.layout.fixed.horizontal,
+ set_rx_text = function(self, new_rx_speed)
+ self:get_children_by_id('rx_speed')[1]:set_text(tostring(new_rx_speed))
+ end,
+ set_tx_text = function(self, new_tx_speed)
+ self:get_children_by_id('tx_speed')[1]:set_text(tostring(new_tx_speed))
+ end
+ }
local update_widget = function(widget, stdout)