Fix some more bugs related to the new icon implementation

This commit is contained in:
Rene
2022-08-03 04:19:42 +02:00
parent 2422b9a07f
commit 535c763a30
40 changed files with 152 additions and 263 deletions

View File

@@ -13,7 +13,6 @@ local rubato = require("src.lib.rubato")
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
-- TODO: Figure out how to use hover effects without messing up the actions
naughty.config.defaults.ontop = true naughty.config.defaults.ontop = true
naughty.config.defaults.icon_size = dpi(80) naughty.config.defaults.icon_size = dpi(80)
naughty.config.defaults.timeout = Theme_config.notification.timeout naughty.config.defaults.timeout = Theme_config.notification.timeout
@@ -25,9 +24,6 @@ naughty.config.defaults.border_width = Theme_config.notification.border_width
naughty.config.defaults.border_color = Theme_config.notification.border_color naughty.config.defaults.border_color = Theme_config.notification.border_color
naughty.config.defaults.spacing = Theme_config.notification.spacing naughty.config.defaults.spacing = Theme_config.notification.spacing
--naughty.config.defaults.screen = screen.primary.index
Theme.notification_spacing = Theme_config.notification.corner_spacing Theme.notification_spacing = Theme_config.notification.corner_spacing
naughty.connect_signal( naughty.connect_signal(
@@ -242,6 +238,7 @@ naughty.connect_signal(
}, },
id = "background1", id = "background1",
fg = Theme_config.notification.fg_close, fg = Theme_config.notification.fg_close,
bg = Theme_config.notification.bg_close,
widget = wibox.container.background widget = wibox.container.background
}, },
strategy = "exact", strategy = "exact",
@@ -380,7 +377,7 @@ naughty.connect_signal(
) )
end end
Hover_signal(close, nil, Theme_config.notification.fg_close) Hover_signal(close)
close:connect_signal( close:connect_signal(
"button::press", "button::press",

View File

@@ -83,32 +83,29 @@ client.connect_signal(
--- Takes a wibox.container.background and connects four signals to it --- Takes a wibox.container.background and connects four signals to it
---@param widget wibox.container.background ---@param widget wibox.container.background
---@param bg string | nil function Hover_signal(widget, bg_override)
---@param fg string | nil
---@param border_color string | nil
function Hover_signal(widget, bg, fg, border_color)
local old_wibox, old_cursor, old_bg, old_fg, old_border local old_wibox, old_cursor, old_bg, old_fg, old_border
local r, g, b local r, g, b
bg = bg or nil widget.bg = widget.bg or ""
fg = fg or nil widget.fg = widget.fg or ""
border_color = border_color or nil widget.border_color = widget.border_color or ""
local mouse_enter = function() local mouse_enter = function()
if bg ~= nil then _, r, g, b, _ = widget.bg:get_rgba()
_, r, g, b, _ = widget.bg:get_rgba() old_bg = RGB_to_hex(r, g, b)
old_bg = RGB_to_hex(r, g, b) if bg_override or old_bg then
widget.bg = bg .. "dd" widget.bg = bg_override or old_bg .. "dd"
end end
if fg then _, r, g, b, _ = widget.fg:get_rgba()
_, r, g, b, _ = widget.fg:get_rgba() old_fg = RGB_to_hex(r, g, b)
old_fg = RGB_to_hex(r, g, b) if old_fg then
widget.fg = fg .. "dd" widget.fg = old_fg .. "dd"
end end
if border_color then old_border = widget.border_color
old_border = widget.border_color if old_border then
widget.border_color = border_color .. "dd" widget.border_color = old_border .. "dd"
end end
local w = mouse.current_wibox local w = mouse.current_wibox
if w then if w then
@@ -118,31 +115,31 @@ function Hover_signal(widget, bg, fg, border_color)
end end
local button_press = function() local button_press = function()
if bg then if old_bg or bg_override then
widget.bg = bg widget.bg = bg_override or old_bg .. "bb"
end end
if fg then if old_fg then
widget.fg = fg widget.fg = old_fg .. "bb"
end end
end end
local button_release = function() local button_release = function()
if bg then if old_bg or bg_override then
widget.bg = bg widget.bg = bg_override or old_bg .. "dd"
end end
if fg then if old_fg then
widget.fg = fg widget.fg = old_fg .. "dd"
end end
end end
local mouse_leave = function() local mouse_leave = function()
if bg then if old_bg then
widget.bg = old_bg widget.bg = old_bg
end end
if fg then if old_fg then
widget.fg = old_fg widget.fg = old_fg
end end
if border_color then if old_border then
widget.border_color = old_border widget.border_color = old_border
end end
if old_wibox then if old_wibox then
@@ -151,13 +148,8 @@ function Hover_signal(widget, bg, fg, border_color)
end end
end end
--[[ widget:disconnect_signal("mouse::enter", mouse_enter)
widget:disconnect_signal("button::press", button_press)
widget:disconnect_signal("button::release", button_release)
widget:disconnect_signal("mouse::leave", mouse_leave) ]]
widget:connect_signal("mouse::enter", mouse_enter) widget:connect_signal("mouse::enter", mouse_enter)
widget:connect_signal("button::press", button_press) widget:connect_signal("button::press", button_press)
widget:connect_signal("button::release", button_release) widget:connect_signal("button::release", button_release)
widget:connect_signal("mouse::leave", mouse_leave) widget:connect_signal("mouse::leave", mouse_leave)
end end

Binary file not shown.

View File

@@ -88,6 +88,7 @@ return function()
border_color = Theme_config.application_launcher.application.border_color, border_color = Theme_config.application_launcher.application.border_color,
border_width = Theme_config.application_launcher.application.border_width, border_width = Theme_config.application_launcher.application.border_width,
bg = Theme_config.application_launcher.application.bg, bg = Theme_config.application_launcher.application.bg,
fg = Theme_config.application_launcher.application.fg,
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(8)) gears.shape.rounded_rect(cr, width, height, dpi(8))
end, end,
@@ -108,6 +109,7 @@ return function()
) )
) )
) )
Hover_signal(app_widget)
table.insert(list, app_widget) table.insert(list, app_widget)
end end
end end
@@ -151,8 +153,6 @@ return function()
end end
) )
awesome.emit_signal("update::selected") awesome.emit_signal("update::selected")
Hover_signal(application, Theme_config.application_launcher.application.bg,
Theme_config.application_launcher.application.fg, application.border_color)
end end
end end
@@ -221,10 +221,13 @@ return function()
local selected_widget = application_grid:get_widgets_at(curser.y, curser.x)[1] local selected_widget = application_grid:get_widgets_at(curser.y, curser.x)[1]
if selected_widget.terminal then if selected_widget.terminal then
awful.spawn(User_config.terminal .. " -e " .. selected_widget.exec) awful.spawn(User_config.terminal ..
" -e " ..
selected_widget.exec:gsub("%%F", ""):gsub("%%u", ""):gsub("%%U", ""):gsub("%%f", ""):gsub("%%i", ""):gsub("%%c"
, ""):gsub("%%k", ""))
else else
print(selected_widget.exec) awful.spawn.with_shell(selected_widget.exec:gsub("%%F", ""):gsub("%%u", ""):gsub("%%U", ""):gsub("%%f", ""):gsub("%%i"
awful.spawn.with_shell(selected_widget.exec) , ""):gsub("%%c", ""):gsub("%%k", ""))
end end
end end
) )

View File

@@ -227,7 +227,6 @@ return function()
searchbar:buttons(gears.table.join( searchbar:buttons(gears.table.join(
awful.button({}, 1, function() awful.button({}, 1, function()
if not awful.keygrabber.is_running then if not awful.keygrabber.is_running then
keygrabber_start()
searchbar.s_background.border_color = Theme_config.application_launcher.searchbar.border_active searchbar.s_background.border_color = Theme_config.application_launcher.searchbar.border_active
searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg searchbar.s_background.fg = Theme_config.application_launcher.searchbar.fg
search_text:set_markup(promt_text_with_cursor("", 1)) search_text:set_markup(promt_text_with_cursor("", 1))

View File

@@ -145,8 +145,7 @@ return function(s)
end end
) )
end end
Hover_signal(device_widget, Theme_config.bluetooth_controller.device_bg_hover, Hover_signal(device_widget)
Theme_config.bluetooth_controller.device_fg_hover)
return device_widget return device_widget
end end

View File

@@ -54,6 +54,7 @@ return function(screen, programs)
gears.shape.rounded_rect(cr, width, height, dpi(10)) gears.shape.rounded_rect(cr, width, height, dpi(10))
end, end,
bg = Theme_config.dock.element_bg, bg = Theme_config.dock.element_bg,
fg = "#000000",
widget = wibox.container.background, widget = wibox.container.background,
id = "background" id = "background"
}, },
@@ -69,7 +70,7 @@ return function(screen, programs)
end end
end end
Hover_signal(dock_element.background, Theme_config.dock.element_focused_hover_bg) Hover_signal(dock_element.background, Theme_config.dock.element_focused_bg .. "dd")
dock_element:connect_signal( dock_element:connect_signal(
"button::press", "button::press",

View File

@@ -368,8 +368,7 @@ return function(s)
end end
) )
Hover_signal(clear_all_widget.margin3.background4, Theme_config.notification_center.clear_all_button.bg, Hover_signal(clear_all_widget.margin3.background4)
Theme_config.notification_center.clear_all_button.fg)
--#endregion --#endregion
end end

View File

@@ -82,6 +82,7 @@ function nl.create_notification(n)
}, },
id = "background", id = "background",
fg = Theme_config.notification_center.notification_list.close_color, fg = Theme_config.notification_center.notification_list.close_color,
bg = Theme_config.notification_center.notification_list.close_bg,
widget = wibox.container.background widget = wibox.container.background
}, },
strategy = "exact", strategy = "exact",
@@ -233,8 +234,7 @@ function nl.create_notification(n)
end end
) )
Hover_signal(close_widget.const.background, nil, Hover_signal(close_widget.const.background)
Theme_config.notification_center.notification_list.close_color)
notification:connect_signal( notification:connect_signal(
"mouse::enter", "mouse::enter",

View File

@@ -394,8 +394,6 @@ return function(s)
function(stdout) function(stdout)
-- Only fetch info if the track changed or if the title/artist is empty -- Only fetch info if the track changed or if the title/artist is empty
if skip_check or (not stdout:match(trackid)) or (not stdout:match(artist)) or (not stdout:match(title)) then if skip_check or (not stdout:match(trackid)) or (not stdout:match(artist)) or (not stdout:match(title)) then
update_loop()
update_shuffle()
-- Get the song title -- Get the song title
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"playerctl metadata xesam:title", "playerctl metadata xesam:title",

View File

@@ -149,11 +149,11 @@ return function(s)
local lock_button = button("Lock", icondir .. "lock.svg", Theme_config.powermenu.lock_button_bg, lock_command) local lock_button = button("Lock", icondir .. "lock.svg", Theme_config.powermenu.lock_button_bg, lock_command)
-- Signals to change color on hover -- Signals to change color on hover
Hover_signal(shutdown_button.background, Theme_config.powermenu.shutdown_button_bg, Theme_config.powermenu.button_fg) Hover_signal(shutdown_button.background)
Hover_signal(reboot_button.background, Theme_config.powermenu.reboot_button_bg, Theme_config.powermenu.button_fg) Hover_signal(reboot_button.background)
Hover_signal(suspend_button.background, Theme_config.powermenu.suspend_button_bg, Theme_config.powermenu.button_fg) Hover_signal(suspend_button.background)
Hover_signal(logout_button.background, Theme_config.powermenu.logout_button_bg, Theme_config.powermenu.button_fg) Hover_signal(logout_button.background)
Hover_signal(lock_button.background, Theme_config.powermenu.lock_button_bg, Theme_config.powermenu.button_fg) Hover_signal(lock_button.background)
-- The powermenu widget -- The powermenu widget
local powermenu = wibox.widget { local powermenu = wibox.widget {

View File

@@ -132,9 +132,9 @@ local create_titlebar = function(c, size)
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
id = "main" id = "main"
} }
Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg) Hover_signal(titlebar.main.margin.spacing.closebutton)
Hover_signal(titlebar.main.margin.spacing.maximizebutton, Theme_config.titlebar.minimize_button_bg) Hover_signal(titlebar.main.margin.spacing.maximizebutton)
Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.maximize_button_bg) Hover_signal(titlebar.main.margin.spacing.minimizebutton)
end end
local create_titlebar_dialog_modal = function(c, size) local create_titlebar_dialog_modal = function(c, size)
@@ -187,8 +187,8 @@ local create_titlebar_dialog_modal = function(c, size)
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
id = "main" id = "main"
} }
Hover_signal(titlebar.main.margin.spacing.closebutton, Theme_config.titlebar.close_button_bg) Hover_signal(titlebar.main.margin.spacing.closebutton)
Hover_signal(titlebar.main.margin.spacing.minimizebutton, Theme_config.titlebar.minimize_button_bg) Hover_signal(titlebar.main.margin.spacing.minimizebutton)
end end
client.connect_signal( client.connect_signal(

View File

@@ -51,11 +51,13 @@ return function(s)
if sink == true then if sink == true then
device:connect_signal( device:connect_signal(
"button::press", "button::press",
function() function(_, _, _, key)
if node then if key == 1 then
awful.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node) if node then
awful.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
awesome.emit_signal("update::bg_sink", node)
end
end end
awesome.emit_signal("update::bg_sink", node)
end end
) )
awesome.connect_signal( awesome.connect_signal(
@@ -92,14 +94,17 @@ return function(s)
end end
) )
awesome.emit_signal("update::bg_sink", node) awesome.emit_signal("update::bg_sink", node)
Hover_signal(device)
else else
device:connect_signal( device:connect_signal(
"button::press", "button::press",
function() function(_, _, _, key)
if node then if key == 1 then
awful.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node) if node then
awful.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
awesome.emit_signal("update::bg_source", node)
end
end end
awesome.emit_signal("update::bg_source", node)
end end
) )
awesome.connect_signal( awesome.connect_signal(
@@ -136,6 +141,7 @@ return function(s)
end end
) )
awesome.emit_signal("update::bg_source", node) awesome.emit_signal("update::bg_source", node)
Hover_signal(device)
end end
return device return device
end end
@@ -320,7 +326,7 @@ return function(s)
gears.shape.rounded_rect(cr, width, height, dpi(5)) gears.shape.rounded_rect(cr, width, height, dpi(5))
end, end,
bar_height = dpi(5), bar_height = dpi(5),
bar_color = Theme_config.device_border_color, bar_color = Theme_config.volume_controller.border_color,
bar_active_color = Theme_config.volume_controller.volume_fg, bar_active_color = Theme_config.volume_controller.volume_fg,
handle_color = Theme_config.volume_controller.volume_fg, handle_color = Theme_config.volume_controller.volume_fg,
handle_shape = gears.shape.circle, handle_shape = gears.shape.circle,
@@ -409,31 +415,33 @@ return function(s)
-- Click event for the audio dropdown -- Click event for the audio dropdown
audio_selector_margin:connect_signal( audio_selector_margin:connect_signal(
"button::press", "button::press",
function() function(_, _, _, key)
local rubato_timer = rubato.timed { if key == 1 then
duration = 0.4, local rubato_timer = rubato.timed {
intro = 0.1, duration = 0.4,
outro = 0.1, intro = 0.1,
pos = volume_list.forced_height, outro = 0.1,
easing = rubato.linear, pos = volume_list.forced_height,
subscribed = function(v) easing = rubato.linear,
volume_list.forced_height = v subscribed = function(v)
volume_list.forced_height = v
end
}
if volume_list.forced_height == 0 then
rubato_timer.target = dpi(200)
audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.volume_controller.device_headphones_selected_icon_color))
else
rubato_timer.target = 0
audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.volume_controller.device_headphones_selected_icon_color))
end end
}
if volume_list.forced_height == 0 then
rubato_timer.target = dpi(200)
audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.volume_controller.device_headphones_selected_icon_color))
else
rubato_timer.target = 0
audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.volume_controller.device_headphones_selected_icon_color))
end end
end end
) )
@@ -447,31 +455,33 @@ return function(s)
-- Click event for the microphone dropdown -- Click event for the microphone dropdown
mic_selector_margin:connect_signal( mic_selector_margin:connect_signal(
"button::press", "button::press",
function() function(_, _, _, key)
local rubato_timer = rubato.timed { if key == 1 then
duration = 0.4, local rubato_timer = rubato.timed {
intro = 0.1, duration = 0.4,
outro = 0.1, intro = 0.1,
pos = mic_list.forced_height, outro = 0.1,
easing = rubato.linear, pos = mic_list.forced_height,
subscribed = function(v) easing = rubato.linear,
mic_list.forced_height = v subscribed = function(v)
mic_list.forced_height = v
end
}
if mic_list.forced_height == 0 then
rubato_timer.target = dpi(200)
mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.volume_controller.device_microphone_selected_icon_color))
else
rubato_timer.target = 0
mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.volume_controller.device_microphone_selected_icon_color))
end end
}
if mic_list.forced_height == 0 then
rubato_timer.target = dpi(200)
mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg",
Theme_config.volume_controller.device_microphone_selected_icon_color))
else
rubato_timer.target = 0
mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(4))
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg",
Theme_config.volume_controller.device_microphone_selected_icon_color))
end end
end end
) )
@@ -482,7 +492,7 @@ return function(s)
audio_slider_margin:connect_signal( audio_slider_margin:connect_signal(
"property::value", "property::value",
function() function()
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(audio_slider_margin.value) .. "%") awful.spawn.with_shell("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(audio_slider_margin.value) .. "%")
end end
) )

View File

@@ -10,11 +10,12 @@ local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local gears = require("gears") local gears = require("gears")
require("src.theme.user_config")
require("src.theme.theme_config")
Theme_path = awful.util.getdir("config") .. "/src/theme/" Theme_path = awful.util.getdir("config") .. "/src/theme/"
Theme = {} Theme = {}
--dofile(Theme_path .. "theme_config.lua")
-- Default font, change it in user_config, not here. -- Default font, change it in user_config, not here.
Theme.font = User_config.font.bold Theme.font = User_config.font.bold

View File

@@ -446,6 +446,7 @@ Theme_config.application_launcher = {
border_color_active = color["Purple200"], border_color_active = color["Purple200"],
border_width = dpi(2), border_width = dpi(2),
bg = "#313131", bg = "#313131",
fg = color["Grey100"],
hover_bg = color["Grey700"], hover_bg = color["Grey700"],
}, },
searchbar = { searchbar = {

View File

@@ -20,7 +20,7 @@ User_config = {
"picom --experimental-backends", "picom --experimental-backends",
"xfce4-power-manager", "xfce4-power-manager",
"light-locker --lock-on-suspend --lock-on-lid &", "light-locker --lock-on-suspend --lock-on-lid &",
"flatpak run com.spotify.Client", "spotify",
"discord", "discord",
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1", "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1",
"setxkbmap -option caps:swapescape", "setxkbmap -option caps:swapescape",
@@ -66,9 +66,9 @@ User_config = {
--[[ --[[
Dock program size in dpi. Dock program size in dpi.
Example: Example:
dock_size = dpi(50) dock_size = dpi(48)
]] -- ]] --
dock_icon_size = dpi(50), dock_icon_size = dpi(64),
--[[ --[[
Add your programs to the dock. You need to provide the name of the .desktop file Add your programs to the dock. You need to provide the name of the .desktop file
@@ -84,7 +84,7 @@ User_config = {
"com.brave.Browser.desktop", "com.brave.Browser.desktop",
"steam.desktop", "steam.desktop",
"discord.desktop", "discord.desktop",
"com.spotify.Client.desktop", "spotify.desktop",
"code.desktop", "code.desktop",
"arduino-arduinoide.desktop", "arduino-arduinoide.desktop",
"us.zoom.Zoom.desktop", "us.zoom.Zoom.desktop",

View File

@@ -32,8 +32,8 @@ end
---@param name string ---@param name string
---@return string | nil icon_path ---@return string | nil icon_path
function Get_icon(class, name) function Get_icon(class, name)
class = string.lower(class) or "" class = string.lower(class or "")
name = string.lower(name) or "" name = string.lower(name or "")
for _, app in ipairs(app_list) do for _, app in ipairs(app_list) do
local desktop_app_info = Gio.DesktopAppInfo.new(app_info.get_id(app)) local desktop_app_info = Gio.DesktopAppInfo.new(app_info.get_id(app))
local icon_string = Gio.DesktopAppInfo.get_string(desktop_app_info, "Icon") local icon_string = Gio.DesktopAppInfo.get_string(desktop_app_info, "Icon")

View File

@@ -90,7 +90,7 @@ return function(s)
) )
-- Signals -- Signals
Hover_signal(audio_widget, Theme_config.audio.bg, Theme_config.audio.fg) Hover_signal(audio_widget)
audio_widget:connect_signal( audio_widget:connect_signal(
"button::press", "button::press",

View File

@@ -67,7 +67,7 @@ return function(battery_kind)
} }
-- Color change on mouse over -- Color change on mouse over
Hover_signal(battery_widget, Theme_config.battery.bg, Theme_config.battery.fg) Hover_signal(battery_widget)
-- Open an energy manager on click -- Open an energy manager on click
battery_widget:connect_signal( battery_widget:connect_signal(
@@ -90,7 +90,7 @@ return function(battery_kind)
---Takes a path and returns the glib object ---Takes a path and returns the glib object
---@param path string battery device path ---@param path string battery device path
---@return UPowerGlib.Device battery battery device object ---@return UPowerGlib.Device | nil battery battery device object
local function get_device_from_path(path) local function get_device_from_path(path)
local devices = upower_glib.Client():get_devices() local devices = upower_glib.Client():get_devices()

View File

@@ -40,7 +40,7 @@ return function(s)
widget = wibox.container.background widget = wibox.container.background
} }
-- Hover signal to change color when mouse is over -- Hover signal to change color when mouse is over
Hover_signal(bluetooth_widget, Theme_config.bluetooth.bg, Theme_config.bluetooth.fg) Hover_signal(bluetooth_widget)
awesome.connect_signal("state", function(state) awesome.connect_signal("state", function(state)
if state then if state then

View File

@@ -58,7 +58,7 @@ return function()
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(clock_widget, Theme_config.clock.bg, Theme_config.clock.fg) Hover_signal(clock_widget)
return clock_widget return clock_widget
end end

View File

@@ -164,7 +164,6 @@ return function(widget, _)
temp_color = Theme_config.cpu_temp.bg_high temp_color = Theme_config.cpu_temp.bg_high
temp_icon = icon_dir .. "thermometer-high.svg" temp_icon = icon_dir .. "thermometer-high.svg"
end end
Hover_signal(cpu_temp, temp_color, Theme_config.cpu_temp.fg)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon) cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
cpu_temp:set_bg(temp_color) cpu_temp:set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp) .. "°C" cpu_temp.container.cpu_layout.label.text = math.floor(temp) .. "°C"
@@ -186,8 +185,9 @@ return function(widget, _)
end end
) )
Hover_signal(cpu_usage_widget, Theme_config.cpu_usage.bg, Theme_config.cpu_usage.fg) Hover_signal(cpu_temp)
Hover_signal(cpu_clock, Theme_config.cpu_freq.bg, Theme_config.cpu_freq.bg) Hover_signal(cpu_usage_widget)
Hover_signal(cpu_clock)
if widget == "usage" then if widget == "usage" then
return cpu_usage_widget return cpu_usage_widget

View File

@@ -60,7 +60,7 @@ return function()
} }
-- Signals -- Signals
Hover_signal(date_widget, Theme_config.date.bg, Theme_config.date.fg) Hover_signal(date_widget)
return date_widget return date_widget
end end

View File

@@ -53,7 +53,6 @@ return function(widget)
end, end,
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(gpu_usage_widget, Theme_config.gpu_usage.bg, Theme_config.gpu_usage.fg)
local gpu_temp_widget = wibox.widget { local gpu_temp_widget = wibox.widget {
{ {
@@ -98,6 +97,9 @@ return function(widget)
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(gpu_temp_widget)
Hover_signal(gpu_usage_widget)
-- GPU Utilization -- GPU Utilization
awesome.connect_signal( awesome.connect_signal(
"update::gpu_usage", "update::gpu_usage",
@@ -113,7 +115,7 @@ return function(widget)
local temp_icon local temp_icon
local temp_color local temp_color
local temp_num = tonumber(stdout) local temp_num = tonumber(stdout) or "N/A"
if temp_num then if temp_num then
@@ -128,7 +130,7 @@ return function(widget)
temp_icon = icon_dir .. "thermometer-high.svg" temp_icon = icon_dir .. "thermometer-high.svg"
end end
else else
temp_num = "NaN" temp_num = "N/A"
temp_color = Theme_config.gpu_temp.bg_low temp_color = Theme_config.gpu_temp.bg_low
temp_icon = icon_dir .. "thermometer-low.svg" temp_icon = icon_dir .. "thermometer-low.svg"
end end

View File

@@ -214,7 +214,6 @@ return function(s)
keymap = keymap keymap = keymap
} }
-- TODO: Hover effects, this is more pain than I'm willing to take for now
awesome.connect_signal( awesome.connect_signal(
"update::background:kblayout", "update::background:kblayout",
function() function()
@@ -235,7 +234,6 @@ return function(s)
) )
end end
) )
get_kblayout() get_kblayout()
kb_layout_item:connect_signal( kb_layout_item:connect_signal(
@@ -352,7 +350,7 @@ return function(s)
) )
-- Signals -- Signals
Hover_signal(kblayout_widget, Theme_config.kblayout.bg, Theme_config.kblayout.fg) Hover_signal(kblayout_widget)
local kblayout_keygrabber = awful.keygrabber { local kblayout_keygrabber = awful.keygrabber {
autostart = false, autostart = false,

View File

@@ -47,7 +47,7 @@ return function()
} }
-- Signals -- Signals
Hover_signal(layout, Theme_config.layout_list.bg) Hover_signal(layout)
layout:connect_signal( layout:connect_signal(
"button::press", "button::press",

View File

@@ -328,7 +328,7 @@ return function()
} }
-- Signals -- Signals
Hover_signal(network_widget, Theme_config.network.bg, Theme_config.network.fg) Hover_signal(network_widget)
network_widget:connect_signal( network_widget:connect_signal(
"button::press", "button::press",

View File

@@ -50,7 +50,7 @@ return function()
} }
-- Signals -- Signals
Hover_signal(power_widget, Theme_config.power_button.bg, Theme_config.power_button.fg) Hover_signal(power_widget)
power_widget:connect_signal( power_widget:connect_signal(
"button::release", "button::release",

View File

@@ -55,7 +55,7 @@ return function()
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(ram_widget, Theme_config.ram_info.bg, Theme_config.ram_info.fg) Hover_signal(ram_widget)
awesome.connect_signal( awesome.connect_signal(
"update::ram_widget", "update::ram_widget",

View File

@@ -28,8 +28,6 @@ return function(s)
end, end,
bg = Theme_config.systray.bg bg = Theme_config.systray.bg
} }
-- Signals
Hover_signal(systray, Theme_config.systray.bg)
awesome.connect_signal("systray::update", function() awesome.connect_signal("systray::update", function()
local num_entries = awesome.systray() local num_entries = awesome.systray()

View File

@@ -102,61 +102,7 @@ local list_update = function(widget, buttons, _, _, objects)
}) })
end end
--#region Hover_signal Hover_signal(tag_widget)
local old_wibox, old_cursor
tag_widget:connect_signal(
"mouse::enter",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = Theme_config.taglist.bg_focus_hover .. 'dd'
else
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
)
tag_widget:connect_signal(
"button::press",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = Theme_config.taglist.bg_focus_pressed .. 'dd'
else
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
end
)
tag_widget:connect_signal(
"button::release",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = Theme_config.taglist.bg_focus_hover .. 'dd'
else
tag_widget.bg = Theme_config.taglist.bg .. 'dd'
end
end
)
tag_widget:connect_signal(
"mouse::leave",
function()
if object == awful.screen.focused().selected_tag then
tag_widget.bg = Theme_config.taglist.bg_focus
else
tag_widget.bg = Theme_config.taglist.bg
end
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
--#endregion
widget:add(tag_widget) widget:add(tag_widget)
widget:set_spacing(dpi(6)) widget:set_spacing(dpi(6))

View File

@@ -115,65 +115,10 @@ local list_update = function(widget, buttons, label, _, objects)
task_widget.container.layout_it.title:set_text('') task_widget.container.layout_it.title:set_text('')
end end
Hover_signal(task_widget)
widget:add(task_widget) widget:add(task_widget)
widget:set_spacing(dpi(6)) widget:set_spacing(dpi(6))
--#region Hover_signal
local old_wibox, old_cursor
task_widget:connect_signal(
"mouse::enter",
function()
if object == client.focus then
task_widget.bg = Theme_config.tasklist.bg_focus_hover .. "dd"
else
task_widget.bg = Theme_config.tasklist.bg .. 'dd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
)
task_widget:connect_signal(
"button::press",
function()
if object == client.focus then
task_widget.bg = Theme_config.tasklist.bg_focus_pressed .. "dd"
else
task_widget.bg = Theme_config.tasklist.bg .. "dd"
end
end
)
task_widget:connect_signal(
"button::release",
function()
if object == client.focus then
task_widget.bg = Theme_config.tasklist.bg_focus_hover .. "dd"
else
task_widget.bg = Theme_config.tasklist.bg .. "dd"
end
end
)
task_widget:connect_signal(
"mouse::leave",
function()
if object == client.focus then
task_widget.bg = Theme_config.tasklist.bg_focus
else
task_widget.bg = Theme_config.tasklist.bg
end
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
--#endregion
end end
return widget return widget
end end