refactor: UI & Theme

This commit is contained in:
rxyhn 2022-03-30 14:15:02 +07:00
parent 9ff306f72c
commit 43a93fbfda
9 changed files with 41 additions and 38 deletions

View file

@ -62,7 +62,7 @@ theme.volume_muted_icon = gears.surface.load_uncached(gfs.get_configuration_dir(
theme.brightness_icon = gears.surface.load_uncached(gfs.get_configuration_dir() .. "theme/assets/icons/brightness.png")
-- Fonts
theme.font_name = "Iosevka "
theme.font_name = "Iosevka Nerd Font Mono "
theme.font = theme.font_name .. "8"
theme.icon_font_name = "Material Icons "
theme.icon_font = theme.icon_font_name .. "18"
@ -186,10 +186,10 @@ theme.menu_submenu_icon = nil
theme.hotkeys_bg = theme.xbackground
theme.hotkeys_fg = theme.xforeground
theme.hotkeys_modifiers_fg = theme.xforeground
theme.hotkeys_font = theme.font_name .. "10"
theme.hotkeys_font = theme.font_name .. "11"
theme.hotkeys_description_font = theme.font_name .. "9"
theme.hotkeys_shape = helpers.rrect(theme.border_radius)
theme.hotkeys_group_margin = dpi(30)
theme.hotkeys_group_margin = dpi(33)
-- Layout List
theme.layoutlist_border_color = theme.lighter_bg

View file

@ -63,8 +63,8 @@ local notifs_empty = wibox.widget {
}
local notifs_container = wibox.widget{
spacing = dpi(6),
forced_width = beautiful.notifs_width or dpi(240),
spacing = dpi(10),
forced_width = dpi(240),
layout = wibox.layout.fixed.vertical
}
@ -159,7 +159,7 @@ local create_notif = function(icon, n, width)
},
bg = beautiful.xcolor0,
shape = helpers.rrect(dpi(4)),
forced_height = dpi(66),
forced_height = dpi(64),
widget = wibox.container.background
}
@ -169,6 +169,14 @@ local create_notif = function(icon, n, width)
end)
))
box:connect_signal("mouse::enter", function()
box.bg = beautiful.xcolor8
end)
box:connect_signal("mouse::leave", function()
box.bg = beautiful.xcolor0
end)
return box
end

View file

@ -34,7 +34,7 @@ awful.screen.connect_for_each_screen(function(s)
if s == screen.primary then
s.mylockscreen = lock_screen_box
else
s.mylockscreen = helpers.screen_mask(s, beautiful.lock_screen_bg or beautiful.exit_screen_bg or beautiful.xbackground)
s.mylockscreen = helpers.screen_mask(s, beautiful.xbackground)
end
end)
@ -397,14 +397,6 @@ lock_screen_box:setup {
helpers.vertical_pad(dpi(80)),
time,
{
nil,
{
notifs,
batt,
date,
spacing = dpi(30),
layout = wibox.layout.fixed.horizontal
},
visible = false,
expand = "none",
layout = wibox.layout.align.horizontal

View file

@ -132,7 +132,7 @@ notifbox_box = function(notif, icon, title, message, app, bgcolor)
end
-- Delete notifbox on LMB
notifbox:buttons(
notifbox_dismiss:buttons(
awful.util.table.join(
awful.button(
{},

View file

@ -8,7 +8,7 @@ local find_widget_in_wibox = function(wb, widget)
return h
end
local result
for _, ch in ipairs(h:get_children()) do
result = result or find_widget_in_hierarchy(ch, widget)
end
@ -23,10 +23,7 @@ local focused = awful.screen.focused()
local h = find_widget_in_wibox(focused.top_panel, focused.music)
local x, y, width, height = h:get_matrix_to_device():transform_rectangle(0, 0, h:get_size())
-- local geo = focused.mywibox:geometry()
-- x, y = x + geo.x, y + geo.y
-- print(string.format("The widget is inside of the rectangle (%d, %d, %d, %d) on the screen", x, y, width, height)

View file

@ -8,10 +8,10 @@ local helpers = require('helpers')
local button_container = require('ui.widgets.button')
local ui_noti_builder = {}
local ui_notif_builder = {}
-- Notification icon container
ui_noti_builder.notifbox_icon = function(ico_image)
ui_notif_builder.notifbox_icon = function(ico_image)
local noti_icon = wibox.widget {
{
id = 'icon',
@ -27,7 +27,7 @@ ui_noti_builder.notifbox_icon = function(ico_image)
end
-- Notification title container
ui_noti_builder.notifbox_title = function(title)
ui_notif_builder.notifbox_title = function(title)
return wibox.widget {
markup = title,
font = beautiful.font_name .. 'Bold 12',
@ -38,7 +38,7 @@ ui_noti_builder.notifbox_title = function(title)
end
-- Notification message container
ui_noti_builder.notifbox_message = function(msg)
ui_notif_builder.notifbox_message = function(msg)
return wibox.widget {
markup = msg,
font = beautiful.font_name .. 'medium 10',
@ -49,7 +49,7 @@ ui_noti_builder.notifbox_message = function(msg)
end
-- Notification app name container
ui_noti_builder.notifbox_appname = function(app)
ui_notif_builder.notifbox_appname = function(app)
return wibox.widget {
markup = app,
font = beautiful.font_name .. 'Bold 12',
@ -60,7 +60,7 @@ ui_noti_builder.notifbox_appname = function(app)
end
-- Notification actions container
ui_noti_builder.notifbox_actions = function(n)
ui_notif_builder.notifbox_actions = function(n)
actions_template = wibox.widget {
notification = n,
base_layout = wibox.widget {
@ -85,7 +85,7 @@ ui_noti_builder.notifbox_actions = function(n)
forced_height = dpi(30),
widget = wibox.container.background
},
margins = 4,
margins = dpi(4),
widget = wibox.container.margin
},
style = { underline_normal = false, underline_selected = true },
@ -97,9 +97,9 @@ end
-- Notification dismiss button
ui_noti_builder.notifbox_dismiss = function()
ui_notif_builder.notifbox_dismiss = function()
local dismiss_imagebox = wibox.widget {
local dismiss_icon = wibox.widget {
{
id = 'dismiss_icon',
markup = helpers.colorize_text("", beautiful.xcolor1),
@ -113,7 +113,7 @@ ui_noti_builder.notifbox_dismiss = function()
local dismiss_button = wibox.widget {
{
dismiss_imagebox,
dismiss_icon,
margins = dpi(5),
widget = wibox.container.margin
},
@ -132,4 +132,4 @@ ui_noti_builder.notifbox_dismiss = function()
end
return ui_noti_builder
return ui_notif_builder

View file

@ -9,7 +9,7 @@ local button_container = require('ui.widgets.button')
local notifbox_core = require('ui.notifs.notif-center.build-notifbox')
local reset_notifbox_layout = notifbox_core.reset_notifbox_layout
local clear_all_imagebox = wibox.widget {
local clear_all_icon = wibox.widget {
{
markup = "",
font = beautiful.icon_font_name .. "Round 16",
@ -22,7 +22,7 @@ local clear_all_imagebox = wibox.widget {
local clear_all_button = wibox.widget {
{
clear_all_imagebox,
clear_all_icon,
margins = dpi(7),
widget = wibox.container.margin
},

View file

@ -39,13 +39,13 @@ local function update_icon()
end
local check_disturb_status = function()
awful.spawn.easy_async_with_shell(
'cat ' .. widget_dir .. 'disturb_status',
'cat ' .. widget_dir .. 'disturb_status',
function(stdout)
local status = stdout
if status:match('true') then
dont_disturb = true
elseif status:match('false') then
@ -109,7 +109,7 @@ local dont_disturb_wrapped = wibox.widget {
-- Create a notification sound
naughty.connect_signal(
'request::display',
'request::display',
function(n)
if not dont_disturb then
awful.spawn.with_shell('canberra-gtk-play -i message')

View file

@ -2,6 +2,11 @@ local wibox = require('wibox')
local beautiful = require('beautiful')
local dpi = require('beautiful').xresources.apply_dpi
-- Notification Center
-------------------------
-- header
local notif_header = wibox.widget {
text = 'Notification Center',
font = beautiful.font_name .. 'Bold 14',
@ -10,6 +15,7 @@ local notif_header = wibox.widget {
widget = wibox.widget.textbox
}
-- build notif-center
local notif_center = function(s)
s.dont_disturb = require('ui.notifs.notif-center.dont-disturb')