Use _role suffix
This commit is contained in:
parent
61a21a125a
commit
c6a245365b
|
@ -95,12 +95,12 @@ local function select_app(self, x, y)
|
|||
self._private.active_widget = widgets[1]
|
||||
if self._private.active_widget ~= nil then
|
||||
self._private.active_widget.selected = true
|
||||
self._private.active_widget:get_children_by_id("background")[1].bg = self.app_selected_color
|
||||
local name_widget = self._private.active_widget:get_children_by_id("name")[1]
|
||||
self._private.active_widget:get_children_by_id("background_role")[1].bg = self.app_selected_color
|
||||
local name_widget = self._private.active_widget:get_children_by_id("name_role")[1]
|
||||
if name_widget then
|
||||
name_widget.markup = string.format("<span foreground='%s'>%s</span>", self.app_name_selected_color, name_widget.text)
|
||||
end
|
||||
local generic_name_widget = self._private.active_widget:get_children_by_id("generic_name")[1]
|
||||
local generic_name_widget = self._private.active_widget:get_children_by_id("generic_name_role")[1]
|
||||
if generic_name_widget then
|
||||
generic_name_widget.markup = string.format("<i><span weight='300'foreground='%s'>%s</span></i>", self.app_name_selected_color, generic_name_widget.text)
|
||||
end
|
||||
|
@ -111,12 +111,12 @@ end
|
|||
local function unselect_app(self)
|
||||
if self._private.active_widget ~= nil then
|
||||
self._private.active_widget.selected = false
|
||||
self._private.active_widget:get_children_by_id("background")[1].bg = self.app_normal_color
|
||||
local name_widget = self._private.active_widget:get_children_by_id("name")[1]
|
||||
self._private.active_widget:get_children_by_id("background_role")[1].bg = self.app_normal_color
|
||||
local name_widget = self._private.active_widget:get_children_by_id("name_role")[1]
|
||||
if name_widget then
|
||||
name_widget.markup = string.format("<span foreground='%s'>%s</span>", self.app_name_normal_color, name_widget.text)
|
||||
end
|
||||
local generic_name_widget = self._private.active_widget:get_children_by_id("generic_name")[1]
|
||||
local generic_name_widget = self._private.active_widget:get_children_by_id("generic_name_role")[1]
|
||||
if generic_name_widget then
|
||||
generic_name_widget.markup = string.format("<i><span weight='300'foreground='%s'>%s</span></i>", self.app_name_normal_color, generic_name_widget.text)
|
||||
end
|
||||
|
@ -128,6 +128,7 @@ local function create_app_widget(self, entry)
|
|||
local icon = self.app_show_icon == true and
|
||||
{
|
||||
widget = wibox.widget.imagebox,
|
||||
id = "icon_role",
|
||||
halign = self.app_icon_halign,
|
||||
forced_width = self.app_icon_width,
|
||||
forced_height = self.app_icon_height,
|
||||
|
@ -137,7 +138,7 @@ local function create_app_widget(self, entry)
|
|||
local name = self.app_show_name == true and
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
id = "name",
|
||||
id = "name_role",
|
||||
font = self.app_name_font,
|
||||
markup = string.format("<span foreground='%s'>%s</span>", self.app_name_normal_color, entry.name)
|
||||
} or nil
|
||||
|
@ -145,7 +146,7 @@ local function create_app_widget(self, entry)
|
|||
local generic_name = entry.generic_name ~= nil and self.app_show_generic_name == true and
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
id = "generic_name",
|
||||
id = "generic_name_role",
|
||||
font = self.app_name_font,
|
||||
markup = entry.generic_name ~= "" and "<span weight='300'> <i>(" .. entry.generic_name .. ")</i></span>" or ""
|
||||
} or nil
|
||||
|
@ -153,7 +154,7 @@ local function create_app_widget(self, entry)
|
|||
local app = wibox.widget
|
||||
{
|
||||
widget = wibox.container.background,
|
||||
id = "background",
|
||||
id = "background_role",
|
||||
forced_width = self.app_width,
|
||||
forced_height = self.app_height,
|
||||
shape = self.app_shape,
|
||||
|
@ -206,7 +207,7 @@ local function create_app_widget(self, entry)
|
|||
|
||||
local app = _self
|
||||
if app.selected then
|
||||
app:get_children_by_id("background")[1].bg = self.app_selected_hover_color
|
||||
app:get_children_by_id("background_role")[1].bg = self.app_selected_hover_color
|
||||
else
|
||||
local is_opaque = color.is_opaque(self.app_normal_color)
|
||||
local is_dark = color.is_dark(self.app_normal_color)
|
||||
|
@ -214,7 +215,7 @@ local function create_app_widget(self, entry)
|
|||
local hover_color = (is_dark or is_opaque) and
|
||||
color.rgba_to_hex(color.multiply(app_normal_color, 2.5)) or
|
||||
color.rgba_to_hex(color.multiply(app_normal_color, 0.5))
|
||||
app:get_children_by_id("background")[1].bg = self.app_normal_hover_color
|
||||
app:get_children_by_id("background_role")[1].bg = self.app_normal_hover_color
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -226,9 +227,9 @@ local function create_app_widget(self, entry)
|
|||
|
||||
local app = _self
|
||||
if app.selected then
|
||||
app:get_children_by_id("background")[1].bg = self.app_selected_color
|
||||
app:get_children_by_id("background_role")[1].bg = self.app_selected_color
|
||||
else
|
||||
app:get_children_by_id("background")[1].bg = self.app_normal_color
|
||||
app:get_children_by_id("background_role")[1].bg = self.app_normal_color
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Reference in New Issue