Skip to content

Commit

Permalink
Updates : notification config
Browse files Browse the repository at this point in the history
  • Loading branch information
MobSenpai committed Aug 18, 2023
1 parent 4c92fb1 commit a483ac4
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 28 deletions.
144 changes: 137 additions & 7 deletions home/yashraj/modules/desktop/wm/awesome/default/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ awful.widget.watch(ram_script, update_interval, function(widget, stdout)
memory_widget:emit_signal("widget::redraw_needed")
usage:set_text(used .. " MB ")
end)
-- =============================================

-- Clock widget
-- =============================================
Expand Down Expand Up @@ -92,7 +91,6 @@ local clock_widget = wibox.widget({
bg = beautiful.color4,
widget = wibox.container.background,
})
-- =============================================

-- CPU widget
-- =============================================
Expand Down Expand Up @@ -139,7 +137,6 @@ awful.widget.watch(cpu_idle_script, update_interval, function(widget, stdout)
cpu_widget:emit_signal("widget::redraw_needed")
usage:set_text(used .. "% ")
end)
-- =============================================

-- Weather widget
-- =============================================
Expand Down Expand Up @@ -208,7 +205,6 @@ awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout
temp_current:set_markup(math.floor(result.current.temp) .. "<sup><span>°</span></sup><span>C </span>")
end
end)
-- =============================================

-- Playerctl widget
-- =============================================
Expand Down Expand Up @@ -273,7 +269,6 @@ awful.spawn.easy_async_with_shell("ps x | grep \"playerctl metadata\" | grep -v
end
})
end)
-- =============================================

-- Volume osd
-- needs pamixer installed
Expand Down Expand Up @@ -414,7 +409,6 @@ awesome.connect_signal("signal::volume", function(vol, muted)
hide_volume_adjust:start()
end
end)
-- =============================================

-- ░█░█░▀█▀░█▀▄░█▀█░█▀▄
-- ░█▄█░░█░░█▀▄░█▀█░█▀▄
Expand Down Expand Up @@ -495,13 +489,149 @@ awful.screen.connect_for_each_screen(function(s)
})

-- Place bar at the bottom and add margins
awful.placement.top(s.mywibox, { margins = beautiful.screen_margin })
awful.placement.top(s.mywibox, { margins = beautiful.screen_margin * 0 }) -- I don't want margin so I added "*0"
end)

-- ░█▀█░█▀█░▀█▀░▀█▀░█▀█░█▀█░█▀▀
-- ░█░█░█▀▀░░█░░░█░░█░█░█░█░▀▀█
-- ░▀▀▀░▀░░░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀

-- Notification settings
-- =============================================
naughty.config.defaults.title = "System Notification"

-- Timeouts
naughty.config.defaults.timeout = 5
naughty.config.presets.low.timeout = 2
naughty.config.presets.critical.timeout = 0

-- Notification layout
if beautiful.notification_border_radius > 0 then
beautiful.notification_shape = helpers.rrect(beautiful.notification_border_radius)
end

naughty.connect_signal("request::display", function(n)
local actions = wibox.widget {
notification = n,
base_layout = wibox.widget {
spacing = dpi(5),
layout = wibox.layout.flex.horizontal
},
widget_template = {
{
{
{
font = beautiful.font_name .. "Bold 11",
markup = "<span foreground='" .. beautiful.color4 .. "'>" .. "" .. "</span>",
widget = wibox.widget.textbox
},
{
id = 'text_role',
font = beautiful.notification_font,
widget = wibox.widget.textbox
},
forced_height = dpi(35),
layout = wibox.layout.fixed.horizontal
},
widget = wibox.container.place
},
strategy = "min",
width = dpi(60),
widget = wibox.container.constraint,
},
style = {
underline_normal = false,
underline_selected = true
},
widget = naughty.list.actions
}

naughty.layout.box {
notification = n,
shape = helpers.rrect(beautiful.notification_border_radius),
border_width = beautiful.notification_border_width,
border_color = beautiful.notification_border_color,
position = beautiful.notification_position,
widget_template = {
{
{
{
{
naughty.widget.icon,
{
{
nil,
{
{
align = "left",
font = beautiful.notification_font,
markup = "<b>" .. n.title .. "</b>",
widget = wibox.widget.textbox,
},
{
align = "left",
widget = naughty.widget.message,
},
layout = wibox.layout.fixed.vertical
},
expand = "none",
layout = wibox.layout.align.vertical
},
left = n.icon and beautiful.notification_padding or 0,
widget = wibox.container.margin,
},
layout = wibox.layout.align.horizontal
},
{
wibox.widget {
forced_height = dpi(10),
layout = wibox.layout.fixed.vertical
},
{
nil,
actions,
expand = "none",
layout = wibox.layout.align.horizontal
},
visible = n.actions and #n.actions > 0,
layout = wibox.layout.fixed.vertical
},
layout = wibox.layout.fixed.vertical
},
margins = beautiful.notification_padding,
widget = wibox.container.margin,
},
strategy = "min",
width = beautiful.notification_min_width or dpi(150),
widget = wibox.container.constraint,
},
strategy = "max",
width = beautiful.notification_max_width or dpi(300),
height = beautiful.notification_max_height or dpi(150),
widget = wibox.container.constraint,
}
}
end)

-- Handle notification icon
naughty.connect_signal("request::icon", function(n, context, hints)
-- Handle other contexts here
if context ~= "app_icon" then return end

-- Use XDG icon
local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower())

if path then
n.icon = path
end
end)

-- Use XDG icon
naughty.connect_signal("request::action_icon", function(a, context, hints)
a.icon = menubar.utils.lookup_icon(hints.id)
end)

-- Autostart applications
-- =============================================
-- awful.spawn.once({},false)
-- EOF ------------------------------------------------------------------------
37 changes: 19 additions & 18 deletions home/yashraj/modules/desktop/wm/awesome/default/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,44 +140,42 @@ theme.menu_submenu_icon = nil
-- Gaps
-- ===================================================================
theme.useless_gap = dpi(8)
theme.screen_margin = dpi(0)
theme.screen_margin = dpi(3)

-- Wibar
-- ===================================================================
theme.wibar_position = "top"
theme.wibar_height = dpi(25)
theme.wibar_bg = theme.color0
-- theme.wibar_fg =
--theme.wibar_opacity =
-- theme.wibar_border_color =
-- theme.wibar_fg = theme.color7
--theme.wibar_opacity = 0.7
theme.wibar_border_color = theme.color0
theme.wibar_border_width = dpi(0)
theme.wibar_border_radius = dpi(0)
-- theme.wibar_width = dpi()
-- theme.wibar_width = dpi(565)

-- Systray
-- ===================================================================
theme.bg_systray = theme.wibar_bg

-- Notifications
-- Note: Some of these options are ignored by a custom notification widget (if any)
-- ===================================================================
theme.notification_font = theme.font
theme.notification_bg = theme.background
theme.notification_fg = theme.foreground
theme.notification_border_width = dpi(0)
theme.notification_border_width = dpi(2)
theme.notification_border_color = theme.color8
theme.notification_opacity = 1
theme.notification_margin = dpi(16)
theme.notification_width = dpi(300)
theme.notification_height = dpi(80)
theme.notification_icon_size = dpi(60)
-- variables for custom widget
-- theme.notification_position = "top_right"
-- theme.notification_border_radius = theme.border_radius
-- theme.notification_crit_bg = theme.background
-- theme.notification_crit_fg = theme.color1
-- theme.notification_padding = theme.screen_margin * 2
-- theme.notification_spacing = theme.screen_margin * 2
theme.notification_margin = dpi(15)
-- theme.notification_width = dpi(300)
-- theme.notification_height = dpi(80)
theme.notification_icon_size = dpi(50)
theme.notification_position = "top_right"
theme.notification_border_radius = theme.border_radius
theme.notification_crit_bg = theme.color1
theme.notification_crit_fg = theme.color0
theme.notification_padding = theme.screen_margin * 2
theme.notification_spacing = theme.screen_margin * 2

-- Misc
-- ===================================================================
Expand All @@ -191,5 +189,8 @@ theme.snap_shape = gears.shape.rounded_rect
theme.snap_bg = theme.lighter_bg
theme.snap_border_width = theme.border_width

-- Hotkeys popup
theme.hotkeys_modifiers_fg = theme.color12

return theme
-- EOF ------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,10 @@ lock_screen_box:setup({
--- Vertical centering
nil,
{
wibox.widget({
wibox.widget {
forced_height = dpi(20),
layout = wibox.layout.fixed.vertical,
}),
},
time,
lock_animation,
spacing = dpi(60),
Expand Down
1 change: 0 additions & 1 deletion home/yashraj/modules/desktop/wm/awesome/rc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ awful.rules.rules = {

-- Signals
-- =============================================

if beautiful.border_width > 0 then
client.connect_signal("focus", function(c)
c.border_color = beautiful.border_focus
Expand Down

0 comments on commit a483ac4

Please sign in to comment.