Change the volume osd design to something less invasive

This commit is contained in:
Alice Gaudon 2019-08-27 23:39:14 +02:00
parent 41e377b06c
commit 366811bd37
2 changed files with 61 additions and 43 deletions

View File

@ -58,25 +58,6 @@ theme.notification_fg = theme.fg_focus
-- Hotkeys (awesome help menu) -- Hotkeys (awesome help menu)
theme.hotkeys_border_color = theme.border_normal theme.hotkeys_border_color = theme.border_normal
-- Volume OSD
theme.volume_osd_bg = theme.bg_normal
theme.volume_osd_border_color = theme.border_normal
theme.volume_osd_border_width = dpi(0)
theme.volume_osd_progress_bg = theme.bg_minimize
theme.volume_osd_progress_color = "#ffffff"
theme.volume_osd_progress_border_color = theme.volume_osd_border_color
theme.volume_osd_progress_border_width = dpi(0)
theme.volume_osd_shape = function(cr, width, height)
return gears.shape.rounded_rect(cr, width, height, 5)
end
theme.volume_osd_width = dpi(128)
theme.volume_osd_height = dpi(128)
theme.volume_osd_image_color = "#ffffff"
theme.volume_osd_icon_0 = simple_awesome_path .. "/assets/icons/volume-x.svg"
theme.volume_osd_icon_1 = simple_awesome_path .. "/assets/icons/volume.svg"
theme.volume_osd_icon_2 = simple_awesome_path .. "/assets/icons/volume-1.svg"
theme.volume_osd_icon_3 = simple_awesome_path .. "/assets/icons/volume-2.svg"
-- System resources widget -- System resources widget
theme.system_resources_widget_bar_bg = theme.bg_focus theme.system_resources_widget_bar_bg = theme.bg_focus
theme.system_resources_widget_bar_color = "#ffffff" theme.system_resources_widget_bar_color = "#ffffff"
@ -184,6 +165,33 @@ theme.awesome_icon = theme_assets.awesome_icon(
-- from /usr/share/icons and /usr/share/icons/hicolor will be used. -- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil theme.icon_theme = nil
-- Volume OSD
theme.volume_osd_width = dpi(48)
theme.volume_osd_bar_height = dpi(196)
theme.volume_osd_padding = dpi(8)
theme.volume_osd_shape = function(cr, width, height)
return gears.shape.rounded_rect(cr, width, height, 5)
end
theme.volume_osd_position = function(screen_width, screen_height, osd_width, osd_height)
return {
dpi(8),
theme.menu_height + dpi(8)
}
end
theme.volume_osd_bg = theme.bg_normal
theme.volume_osd_border_color = theme.border_normal
theme.volume_osd_border_width = dpi(0)
theme.volume_osd_progress_bg = theme.bg_minimize
theme.volume_osd_progress_color = "#ffffff"
theme.volume_osd_progress_border_color = theme.volume_osd_border_color
theme.volume_osd_progress_border_width = dpi(0)
theme.volume_osd_image_color = "#ffffff"
theme.volume_osd_icon_0 = simple_awesome_path .. "/assets/icons/volume-x.svg"
theme.volume_osd_icon_1 = simple_awesome_path .. "/assets/icons/volume.svg"
theme.volume_osd_icon_2 = simple_awesome_path .. "/assets/icons/volume-1.svg"
theme.volume_osd_icon_3 = simple_awesome_path .. "/assets/icons/volume-2.svg"
return theme return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -69,41 +69,50 @@ local volumeWibox = wibox({
border_color = beautiful.volume_osd_border_color, border_color = beautiful.volume_osd_border_color,
shape = beautiful.volume_osd_shape, shape = beautiful.volume_osd_shape,
width = beautiful.volume_osd_width, width = beautiful.volume_osd_width,
height = beautiful.volume_osd_height, height = beautiful.volume_osd_bar_height + beautiful.volume_osd_padding * 3,
widget = wibox.widget { widget = wibox.widget {
{ {
{ {
image = getVolumeImage(1), image = getVolumeImage(1),
widget = wibox.widget.imagebox widget = wibox.widget.imagebox
}, },
forced_height = beautiful.volume_osd_height - 42, left = beautiful.volume_osd_padding,
left = 38, right = beautiful.volume_osd_padding,
right = 16, top = beautiful.volume_osd_padding,
top = 24, bottom = 0,
bottom = 16, widget = wibox.container.margin,
widget = wibox.container.margin
}, },
{ {
max_value = 1, {
value = 0.33, {
shape = gears.shape.rounded_bar, max_value = 1,
bar_shape = gears.shape.rounded_bar, value = 0.33,
forced_height = 38, shape = gears.shape.rounded_bar,
margins = 18, bar_shape = gears.shape.rounded_bar,
color = beautiful.volume_osd_progress_color, margins = beautiful.volume_osd_padding + 4,
background_color = beautiful.volume_osd_progress_bg, color = beautiful.volume_osd_progress_color,
border_color = beautiful.volume_osd_progress_border_color, background_color = beautiful.volume_osd_progress_bg,
border_width = beautiful.volume_osd_progress_border_width, border_color = beautiful.volume_osd_progress_border_color,
widget = wibox.widget.progressbar border_width = beautiful.volume_osd_progress_border_width,
widget = wibox.widget.progressbar
},
forced_width = 80,
forced_height = 80,
direction = "east",
layout = wibox.container.rotate,
},
left = beautiful.volume_osd_padding,
right = beautiful.volume_osd_padding,
top = 0,
bottom = beautiful.volume_osd_padding,
widget = wibox.container.margin,
}, },
margins = 8,
widget = wibox.container.margin,
layout = wibox.layout.align.vertical layout = wibox.layout.align.vertical
} },
}) })
local imagebox = volumeWibox.widget:get_children()[1]:get_children()[1] local imagebox = volumeWibox.widget:get_children()[1]:get_children()[1]
local progressbar = volumeWibox.widget:get_children()[2] local progressbar = volumeWibox.widget:get_children()[2]:get_children()[1]:get_children()[1]
local timer = nil local timer = nil
@ -138,9 +147,10 @@ local displayVolume = function()
volumeWibox.screen = screen volumeWibox.screen = screen
-- Position -- Position
local position = beautiful.volume_osd_position(screen.geometry.width, screen.geometry.height, beautiful.volume_osd_width, beautiful.volume_osd_height)
volumeWibox:geometry({ volumeWibox:geometry({
x = (screen.geometry.x + screen.geometry.width / 2 - beautiful.volume_osd_width / 2), x = (screen.geometry.x + position[1]),
y = (screen.geometry.y + screen.geometry.height / 2 - beautiful.volume_osd_height / 2) y = (screen.geometry.y + position[2])
}) })
-- Get volume -- Get volume