Made widget.widget attributes prettier
parent
1c5d1dc553
commit
0ac767d534
|
@ -26,15 +26,15 @@ end
|
||||||
|
|
||||||
function P:_update_widget()
|
function P:_update_widget()
|
||||||
if (not self._ready) then
|
if (not self._ready) then
|
||||||
self.widget:set_state("error")
|
self._widget:set_state("error")
|
||||||
self.widget:set_value(self.max_value);
|
self._widget:set_value(self.max_value);
|
||||||
self.widget:set_tooltip("Backlight error");
|
self._widget:set_tooltip("Backlight error");
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.widget:set_value(self.brightness);
|
self._widget:set_value(self.brightness);
|
||||||
self.widget:set_tooltip("Backlight " .. math.floor(self.brightness) .. "%");
|
self._widget:set_tooltip("Backlight " .. math.floor(self.brightness) .. "%");
|
||||||
self.widget:set_state("ready")
|
self._widget:set_state("ready")
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -102,9 +102,10 @@ function P:new(args)
|
||||||
}
|
}
|
||||||
setmetatable(b, self)
|
setmetatable(b, self)
|
||||||
|
|
||||||
b.widget = widget_types[b.widget_type]:new()
|
b._widget = widget_types[b.widget_type]:new()
|
||||||
|
b.widget = b._widget.widget
|
||||||
|
|
||||||
b.widget.widget:connect_signal("button::press",
|
b.widget:connect_signal("button::press",
|
||||||
function(_, _, _, button, mods)
|
function(_, _, _, button, mods)
|
||||||
if (button == 4) then -- Scroll up
|
if (button == 4) then -- Scroll up
|
||||||
b:backlight_up()
|
b:backlight_up()
|
||||||
|
|
|
@ -34,20 +34,20 @@ end
|
||||||
|
|
||||||
function P:_update_widget()
|
function P:_update_widget()
|
||||||
if (not self._ready) then
|
if (not self._ready) then
|
||||||
self.widget:set_state("error")
|
self._widget:set_state("error")
|
||||||
self.widget:set_value(100);
|
self._widget:set_value(100);
|
||||||
self.widget:set_tooltip("Battery error");
|
self._widget:set_tooltip("Battery error");
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.charging) then
|
if (self.charging) then
|
||||||
self.widget:set_state("charging")
|
self._widget:set_state("charging")
|
||||||
else
|
else
|
||||||
self.widget:set_state("discharging")
|
self._widget:set_state("discharging")
|
||||||
end
|
end
|
||||||
|
|
||||||
self.widget:set_value(self.battery_percent);
|
self._widget:set_value(self.battery_percent);
|
||||||
self.widget:set_tooltip("Battery " .. math.floor(self.battery_percent) .. "%");
|
self._widget:set_tooltip("Battery " .. math.floor(self.battery_percent) .. "%");
|
||||||
end
|
end
|
||||||
|
|
||||||
function P:_check_notification()
|
function P:_check_notification()
|
||||||
|
@ -101,7 +101,8 @@ function P:new(args)
|
||||||
b._warning_log[i] = false
|
b._warning_log[i] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
b.widget = widget_types[b.widget_type]:new()
|
b._widget = widget_types[b.widget_type]:new()
|
||||||
|
b.widget = b._widget.widget
|
||||||
|
|
||||||
setmetatable(b, self)
|
setmetatable(b, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
|
|
|
@ -53,7 +53,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function P:_update_widget()
|
function P:_update_widget()
|
||||||
self.widget:update{
|
self._widget:update{
|
||||||
title = self.current_title,
|
title = self.current_title,
|
||||||
artist = self.current_artist,
|
artist = self.current_artist,
|
||||||
play = self.is_playing,
|
play = self.is_playing,
|
||||||
|
@ -105,9 +105,10 @@ function P:new(args)
|
||||||
setmetatable(m, self)
|
setmetatable(m, self)
|
||||||
|
|
||||||
-- Create widget for this volume interface
|
-- Create widget for this volume interface
|
||||||
m.widget = widget_types[m.widget_type]:new()
|
m._widget = widget_types[m.widget_type]:new()
|
||||||
|
m.widget = m._widget.widget
|
||||||
|
|
||||||
m.widget.widget:connect_signal("button::press",
|
m.widget:connect_signal("button::press",
|
||||||
function(_, _, _, button, mods)
|
function(_, _, _, button, mods)
|
||||||
if (button == 3) or (button == 1)then
|
if (button == 3) or (button == 1)then
|
||||||
m:toggle()
|
m:toggle()
|
||||||
|
@ -115,7 +116,7 @@ function P:new(args)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
m.widget.right:connect_signal("button::press",
|
m._widget.right:connect_signal("button::press",
|
||||||
function(_, _, _, button, mods)
|
function(_, _, _, button, mods)
|
||||||
if (button == 4) then -- Scroll up
|
if (button == 4) then -- Scroll up
|
||||||
m:prev()
|
m:prev()
|
||||||
|
@ -126,7 +127,7 @@ function P:new(args)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
m.widget.left:connect_signal("button::press",
|
m._widget.left:connect_signal("button::press",
|
||||||
function(_, _, _, button, mods)
|
function(_, _, _, button, mods)
|
||||||
if (button == 4) then -- Scroll up
|
if (button == 4) then -- Scroll up
|
||||||
m:volume_up()
|
m:volume_up()
|
||||||
|
|
|
@ -54,19 +54,19 @@ end
|
||||||
|
|
||||||
function P:_update_widget()
|
function P:_update_widget()
|
||||||
if (not self._ready) then
|
if (not self._ready) then
|
||||||
self.widget:set_state("error")
|
self._widget:set_state("error")
|
||||||
self.widget:set_value(self.max_value);
|
self._widget:set_value(self.max_value);
|
||||||
self.widget:set_tooltip("Volume error");
|
self._widget:set_tooltip("Volume error");
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.widget:set_value(self.volume);
|
self._widget:set_value(self.volume);
|
||||||
self.widget:set_tooltip("Volume " .. self.volume .. "%");
|
self._widget:set_tooltip("Volume " .. self.volume .. "%");
|
||||||
|
|
||||||
if (self.muted) then
|
if (self.muted) then
|
||||||
self.widget:set_state("muted")
|
self._widget:set_state("muted")
|
||||||
else
|
else
|
||||||
self.widget:set_state("unmuted")
|
self._widget:set_state("unmuted")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -183,10 +183,11 @@ function P:new(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create widget for this volume interface
|
-- Create widget for this volume interface
|
||||||
v.widget = widget_types[v.widget_type]:new()
|
v._widget = widget_types[v.widget_type]:new()
|
||||||
|
v.widget = v._widget.widget
|
||||||
|
|
||||||
-- Attach button press signals
|
-- Attach button press signals
|
||||||
v.widget.widget:connect_signal("button::press",
|
v.widget:connect_signal("button::press",
|
||||||
function(_, _, _, button, mods)
|
function(_, _, _, button, mods)
|
||||||
if (button == 3) then -- Right-click
|
if (button == 3) then -- Right-click
|
||||||
v:toggle_mute()
|
v:toggle_mute()
|
||||||
|
|
|
@ -157,7 +157,7 @@ awful.screen.connect_for_each_screen(
|
||||||
|
|
||||||
if (conf.mpc_enabled) then
|
if (conf.mpc_enabled) then
|
||||||
rightside = gears.table.join(rightside, {
|
rightside = gears.table.join(rightside, {
|
||||||
mpc.widget.widget,
|
mpc.widget,
|
||||||
desktop.widgets.space(5),
|
desktop.widgets.space(5),
|
||||||
desktop.widgets.separator(2, 5, 3),
|
desktop.widgets.separator(2, 5, 3),
|
||||||
desktop.widgets.space(15),
|
desktop.widgets.space(15),
|
||||||
|
@ -169,9 +169,9 @@ awful.screen.connect_for_each_screen(
|
||||||
desktop.widgets.textclock,
|
desktop.widgets.textclock,
|
||||||
desktop.widgets.space(8),
|
desktop.widgets.space(8),
|
||||||
|
|
||||||
batt.widget.widget,
|
batt.widget,
|
||||||
bck.widget.widget,
|
bck.widget,
|
||||||
vol.widget.widget,
|
vol.widget,
|
||||||
desktop.widgets.space(8),
|
desktop.widgets.space(8),
|
||||||
|
|
||||||
desktop.widgets.keymap,
|
desktop.widgets.keymap,
|
||||||
|
@ -198,7 +198,7 @@ awful.screen.connect_for_each_screen(
|
||||||
desktop.widgets.launcher,
|
desktop.widgets.launcher,
|
||||||
|
|
||||||
desktop.widgets.space(18),
|
desktop.widgets.space(18),
|
||||||
s.tagger.widget.widget,
|
s.tagger.widget,
|
||||||
s.layoutmanager.widget,
|
s.layoutmanager.widget,
|
||||||
|
|
||||||
s.shortcuts,
|
s.shortcuts,
|
||||||
|
|
|
@ -35,7 +35,8 @@ function Tagger:new(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
t.widget = Widget:new(t)
|
t._widget = Widget:new(t)
|
||||||
|
t.widget = t._widget.widget
|
||||||
|
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
@ -82,16 +83,16 @@ function Tagger:update_widget()
|
||||||
-- Make that the currently active tag is checked and that all
|
-- Make that the currently active tag is checked and that all
|
||||||
-- others are not.
|
-- others are not.
|
||||||
if (tgs[i].index == self.screen.selected_tag.index) then
|
if (tgs[i].index == self.screen.selected_tag.index) then
|
||||||
self.widget.tagindicators[i].checked = true
|
self._widget.tagindicators[i].checked = true
|
||||||
else
|
else
|
||||||
self.widget.tagindicators[i].checked = false
|
self._widget.tagindicators[i].checked = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Highlight tags that are not empty
|
-- Highlight tags that are not empty
|
||||||
if (#clients == 0) then
|
if (#clients == 0) then
|
||||||
self.widget.tagindicators[i].border_color = beautiful.color.bar.inactive
|
self._widget.tagindicators[i].border_color = beautiful.color.bar.inactive
|
||||||
else
|
else
|
||||||
self.widget.tagindicators[i].border_color = beautiful.color.bar.active
|
self._widget.tagindicators[i].border_color = beautiful.color.bar.active
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue