Awesome updates.

Setup naughty for the notification manager.
Stoped default notification service.
Made better rules for window placement.
This commit is contained in:
2026-07-02 07:06:06 +02:00
parent d3c89f89f6
commit 1a49af00cc
+65 -7
View File
@@ -10,6 +10,14 @@ local naughty = require("naughty")
local menubar = require("menubar") local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup")
-- Kill xfce4-notifyd on awesome startup (with a short delay + retry,
-- in case xfce4-notifyd hasn't started yet at this point in the session)
awful.spawn.easy_async_with_shell("pkill xfce4-notifyd", function() end)
gears.timer.start_new(3, function()
awful.spawn.easy_async_with_shell("pkill xfce4-notifyd", function() end)
return false -- don't repeat
end)
-- {{{ Error handling -- {{{ Error handling
if awesome.startup_errors then if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({ preset = naughty.config.presets.critical,
@@ -41,7 +49,7 @@ local colors = {
background = "#111111", background = "#111111",
background_alt = "#1a1a1a", background_alt = "#1a1a1a",
foreground = "#d3dae3", foreground = "#d3dae3",
accent = "#616161", accent = "#6e6e6e",
accent_alt = "#6ba0e8", accent_alt = "#6ba0e8",
red = "#e35b5b", red = "#e35b5b",
green = "#98c379", green = "#98c379",
@@ -50,6 +58,38 @@ local colors = {
white = "#ffffff", white = "#ffffff",
} }
-- {{{ Naughty (notifications) — styled to match wibar/client theme
naughty.config.defaults.position = "top_right"
naughty.config.defaults.timeout = 5
naughty.config.padding = 12
naughty.config.defaults.margin = 12
naughty.config.defaults.spacing = 8
naughty.config.defaults.icon_size = 48
naughty.config.defaults.border_width = 3
naughty.config.defaults.font = "JetBrainsMono Nerd Font 12"
naughty.config.defaults.shape = function(cr, w, h) gears.shape.rounded_rect(cr, w, h, 13) end
-- Base look, matches wibar/border palette
naughty.config.presets.normal = {
bg = colors.background,
fg = colors.foreground,
border_color = colors.background_alt,
border_width = 3,
font = "JetBrainsMono Nerd Font 12",
timeout = 5,
}
naughty.config.presets.low = naughty.config.presets.normal
naughty.config.presets.critical = {
bg = colors.background,
fg = colors.red,
border_color = colors.red,
border_width = 3,
font = "JetBrainsMono Nerd Font 12",
timeout = 0, -- stays until dismissed
}
-- }}}
-- Bar font (matches your polybar JetBrainsMono Nerd Font; bump the number to 14 -- Bar font (matches your polybar JetBrainsMono Nerd Font; bump the number to 14
-- if you want it as large as polybar's size=14). -- if you want it as large as polybar's size=14).
beautiful.font = "JetBrainsMono Nerd Font 12" beautiful.font = "JetBrainsMono Nerd Font 12"
@@ -86,6 +126,8 @@ awful.layout.layouts = {
awful.layout.suit.floating, awful.layout.suit.floating,
} }
-- }}} -- }}}
--
naughty.config.defaults.position = "top_right"
-- {{{ Bar helpers --------------------------------------------------------- -- {{{ Bar helpers ---------------------------------------------------------
@@ -98,7 +140,7 @@ end
-- A slim "|" separator in the disabled color, like polybar's separator. -- A slim "|" separator in the disabled color, like polybar's separator.
local function sep() local function sep()
local w = wibox.widget.textbox() local w = wibox.widget.textbox()
w.markup = string.format("<span foreground='%s'> </span>", colors.disabled) w.markup = string.format("<span foreground='%s00'> </span>", colors.disabled)
return w return w
end end
@@ -169,7 +211,7 @@ local function make_vol()
-- left click: toggle mute -- left click: toggle mute
awful.button({ }, 1, function () awful.spawn.easy_async_with_shell( [[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']], function() refresh() end) end), awful.button({ }, 1, function () awful.spawn.easy_async_with_shell( [[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']], function() refresh() end) end),
-- right click: open the mixer -- right click: open the mixer
awful.button({ }, 3, function () awful.spawn("pavucontrol") end), awful.button({ }, 3, function () awful.spawn("/home/jason/.local/bin/audioswitch") end),
-- scroll up: +2% -- scroll up: +2%
awful.button({ }, 4, function () awful.spawn.easy_async_with_shell( [[sh -c 'pactl set-sink-volume "$(pactl get-default-sink)" +2%']], function() refresh() end) end), awful.button({ }, 4, function () awful.spawn.easy_async_with_shell( [[sh -c 'pactl set-sink-volume "$(pactl get-default-sink)" +2%']], function() refresh() end) end),
-- scroll down: -2% -- scroll down: -2%
@@ -278,7 +320,7 @@ awful.screen.connect_for_each_screen(function(s)
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
padded(s.mytaglist, 8, 4), padded(s.mytaglist, 8, 4),
s.mypromptbox, s.mypromptbox,
{ title, left = 8, widget = wibox.container.margin }, { title, left = 18, widget = wibox.container.margin },
}, },
nil, -- empty center nil, -- empty center
padded(right, 4, 12), padded(right, 4, 12),
@@ -327,7 +369,7 @@ globalkeys = gears.table.join(
awful.key({ modkey }, "p", function () awful.spawn("xfce4-screenshooter") end, {description = "screenshot", group = "system"}), awful.key({ modkey }, "p", function () awful.spawn("xfce4-screenshooter") end, {description = "screenshot", group = "system"}),
-- Alt tab only in max mode -- Alt tab only in max mode
awful.key({ "Mod1" }, "Tab", function () if awful.layout.get(mouse.screen) == awful.layout.suit.max then awful.client.focus.byidx(1) if client.focus then client.focus:raise() end end end), awful.key({ "Mod1" }, "Tab", function () awful.client.focus.byidx(1) end),
-- Media keys: volume up/down/mute (works even without a hardware key -- Media keys: volume up/down/mute (works even without a hardware key
-- if you bind these in your compositor/DE too) -- if you bind these in your compositor/DE too)
@@ -335,9 +377,12 @@ globalkeys = gears.table.join(
awful.key({ }, "XF86AudioLowerVolume", function () awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-volume "$(pactl get-default-sink)" -2%']]) end, {description = "volume down", group = "media"}), awful.key({ }, "XF86AudioLowerVolume", function () awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-volume "$(pactl get-default-sink)" -2%']]) end, {description = "volume down", group = "media"}),
awful.key({ }, "XF86AudioMute", function () awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']]) end, {description = "toggle mute", group = "media"}), awful.key({ }, "XF86AudioMute", function () awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']]) end, {description = "toggle mute", group = "media"}),
-- rofi menus
awful.key({ modkey }, "a", function () awful.spawn("/home/jason/.local/bin/audioswitch") end, {description = "audio output", group = "system"}),
awful.key({ modkey, "Shift" }, "p", function () awful.spawn("/home/jason/.local/bin/powermenu") end, {description = "power menu", group = "system"}),
-- Awesome control -- Awesome control
awful.key({ modkey, "Shift" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), awful.key({ modkey, "Shift" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"})
awful.key({ modkey, "Shift" }, "e", awesome.quit, {description = "quit awesome", group = "awesome"})
) )
-- Workspace keys 1..5: Alt+N view, Alt+Shift+N move client to tag -- Workspace keys 1..5: Alt+N view, Alt+Shift+N move client to tag
@@ -398,6 +443,7 @@ awful.rules.rules = {
name = { "Event Tester" }, name = { "Event Tester" },
role = { "AlarmWindow", "pop-up" }, role = { "AlarmWindow", "pop-up" },
}, properties = { floating = true }}, }, properties = { floating = true }},
} }
-- }}} -- }}}
@@ -420,6 +466,18 @@ client.connect_signal("manage", function (c)
end end
end) end)
client.connect_signal("property::floating", function(c)
if c.floating and c.type ~= "notification" then
awful.placement.centered(c, { honor_workarea = true })
end
end)
client.connect_signal("manage", function(c)
if c.floating and c.type ~= "notification" then
awful.placement.centered(c, { honor_workarea = true })
end
end)
-- Focus follows mouse (i3-like). Comment out for click-to-focus only. -- Focus follows mouse (i3-like). Comment out for click-to-focus only.
client.connect_signal("mouse::enter", function(c) client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})