awesome: 4.4 (technically latest git) fixes

This commit is contained in:
Cynthia Foxwell 2022-12-29 21:22:23 -07:00
parent d241e19413
commit 5982bd53f4
7 changed files with 581 additions and 35 deletions

View file

@ -0,0 +1,203 @@
local beautiful = require("beautiful")
local naughty = require("naughty")
local ruled = require("ruled")
local wibox = require("wibox")
local win9x = require("modules/win9x")
ruled.notification.connect_signal("request::rules", function()
ruled.notification.append_rule({
rule = {
urgency = "critical",
},
properties = {
bg = beautiful.fg_urgent,
fg = beautiful.fg_normal,
timeout = 0,
icon_size = 128,
},
})
ruled.notification.append_rule({
rule = {
urgency = "normal",
},
properties = {
bg = beautiful.win9x_focus,
fg = beautiful.fg_normal,
timeout = 5,
icon_size = 128,
},
})
ruled.notification.append_rule({
rule = {
urgency = "low",
},
properties = {
bg = beautiful.win9x_unfocus,
fg = beautiful.fg_normal,
timeout = 5,
icon_size = 128,
},
})
end)
beautiful.notification_icon_size = 128
beautiful.notification_icon_resize_strategy = "resize"
naughty.connect_signal("request::display", function(n)
-- idk why bg vars dont work but w/e
local bg = n.bg or beautiful.win9x_focus
if n.urgency == "critical" then
bg = beautiful.fg_urgent
elseif n.urgency == "low" then
bg = beautiful.win9x_unfocus
end
naughty.layout.box({
notification = n,
type = "notification",
position = "top_right",
border_width = 0,
icon_size = 128,
widget_template = {
{
{
{
wibox.widget({}),
shape = win9x.border.top,
forced_height = 4,
layout = wibox.container.background,
},
{
{
wibox.widget({}),
shape = win9x.border.left,
forced_width = 4,
layout = wibox.container.background,
},
{
{
{
{
{
naughty.widget.title,
left = 1,
right = 4,
layout = wibox.container.margin,
},
{
layout = wibox.layout.flex.horizontal
},
{
{
{
{
wibox.widget({}),
shape = win9x.button,
layout = wibox.container.background,
},
top = 1,
bottom = 1,
layout = wibox.container.margin,
},
{
image = beautiful.titlebar_close_button_focus,
forced_width = 16,
forced_height = 16,
widget = wibox.widget.imagebox,
},
layout = wibox.layout.stack,
},
right = 1,
layout = wibox.container.margin,
},
layout = wibox.layout.align.horizontal,
},
margins = 1,
layout = wibox.container.margin,
},
bg = bg,
forced_height = 18,
layout = wibox.container.background,
},
{
wibox.widget({
widget = wibox.widget.separator,
color = beautiful.win9x_main,
orientation = "horizontal",
thickness = 2,
forced_height = 2,
border_width = 0,
}),
strategy = "max",
width = 12,
layout = wibox.container.constraint,
},
layout = wibox.layout.align.vertical,
},
{
wibox.widget({}),
shape = win9x.border.right,
forced_width = 4,
layout = wibox.container.background,
},
layout = wibox.layout.align.horizontal,
},
{
{
wibox.widget({}),
shape = win9x.border.left,
forced_width = 4,
layout = wibox.container.background,
},
{
{
naughty.widget.icon,
{
naughty.widget.message,
naughty.list.actions,
spacing = 8,
layout = wibox.layout.align.vertical,
},
fill_space = true,
spacing = 8,
layout = wibox.layout.fixed.horizontal,
},
margins = 2,
layout = wibox.container.margin,
},
{
wibox.widget({}),
shape = win9x.border.right,
forced_width = 4,
layout = wibox.container.background,
},
layout = wibox.layout.align.horizontal,
},
layout = wibox.layout.align.vertical,
},
{
wibox.widget({}),
shape = win9x.border.bottom,
forced_height = 4,
layout = wibox.container.background,
},
layout = wibox.layout.align.vertical,
},
bg = beautiful.win9x_main,
layout = wibox.container.background,
},
})
end)
--[[for _, urgency in ipairs({"normal", "critical", "low"}) do
naughty.notification({
title = urgency .. " example",
text = "some text",
icon = beautiful.awesome_icon,
urgency = urgency,
timeout = 10,
})
end--]]

View file

@ -101,20 +101,25 @@ client.connect_signal("request::titlebars", function(c)
end end
local shadow_title = awful.titlebar.widget.titlewidget(c) local shadow_title = awful.titlebar.widget.titlewidget(c)
shadow_title:set_markup_silently(lain.util.markup(beautiful.win9x_outer, c.name or awful.titlebar.fallback_name)) shadow_title.update = function() end
local name = gears.string.xml_escape(c.name or awful.titlebar.fallback_name)
shadow_title:set_markup_silently(lain.util.markup(beautiful.win9x_outer, name))
c:connect_signal("focus", function() c:connect_signal("focus", function()
shadow_title:set_markup_silently(lain.util.markup(beautiful.__colors.color0, c.name or awful.titlebar.fallback_name)) name = gears.string.xml_escape(c.name or awful.titlebar.fallback_name)
shadow_title:set_markup_silently(lain.util.markup(beautiful.__colors.color0, name))
update_lines(true) update_lines(true)
end) end)
c:connect_signal("unfocus", function() c:connect_signal("unfocus", function()
shadow_title:set_markup_silently(lain.util.markup(beautiful.win9x_outer, c.name or awful.titlebar.fallback_name)) name = gears.string.xml_escape(c.name or awful.titlebar.fallback_name)
shadow_title:set_markup_silently(lain.util.markup(beautiful.win9x_outer, name))
update_lines(false) update_lines(false)
end) end)
c:connect_signal("property::name", function() c:connect_signal("property::name", function()
name = gears.string.xml_escape(c.name or awful.titlebar.fallback_name)
local focused = c == client.focus local focused = c == client.focus
local col = focused and beautiful.__colors.color0 or beautiful.win9x_outer local col = focused and beautiful.__colors.color0 or beautiful.win9x_outer
shadow_title:set_markup_silently(lain.util.markup(col, c.name or awful.titlebar.fallback_name)) shadow_title:set_markup_silently(lain.util.markup(col, name))
end) end)
local titlebar = awful.titlebar(c, { local titlebar = awful.titlebar(c, {

View file

@ -40,9 +40,22 @@ local function format_size(size)
return gm_round(size / (1024 * 1024 * 1024), 2) .. " GB" return gm_round(size / (1024 * 1024 * 1024), 2) .. " GB"
end end
local function getupvalues(func)
local info = debug.getinfo(func, "u")
local upvalues = {}
for i = 1, info.nups do
local k, v = debug.getupvalue(func, i)
upvalues[k] = v
end
return upvalues
end
return { return {
set_wallpaper = set_wallpaper, set_wallpaper = set_wallpaper,
format_time = format_time, format_time = format_time,
round = gm_round, round = gm_round,
format_size = format_size, format_size = format_size,
getupvalues = getupvalues,
} }

View file

@ -97,6 +97,18 @@ awful.rules.rules = {
fullscreen = true, fullscreen = true,
}, },
}, },
-- gamescope
{
rule = {
class = "gamescope",
},
properties = {
titlebars_enabled = false,
floating = true,
fullscreen = true,
},
},
} }
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.

View file

@ -6,37 +6,17 @@ local beautiful = require("beautiful")
local cyclefocus = require("cyclefocus") local cyclefocus = require("cyclefocus")
local lain = require("lain") local lain = require("lain")
local naughty = require("naughty") local naughty = require("naughty")
local wibox = require("wibox")
require("awful.autofocus") require("awful.autofocus")
require("awful.hotkeys_popup.keys") require("awful.hotkeys_popup.keys")
-- Check if awesome encountered an error during startup and fell back to naughty.connect_signal("request::display_error", function(message, startup)
-- another config (This code will only ever execute for the fallback config) naughty.notification({
if awesome.startup_errors then urgency = "critical",
naughty.notify({ title = "Oops, an error happened"..(startup and " during startup!" or "!"),
preset = naughty.config.presets.critical, message = debug.traceback(message),
title = "Oops, there were errors during startup!",
text = awesome.startup_errors
}) })
end end)
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({
preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err)
})
in_error = false
end)
end
function debug_print(...) function debug_print(...)
local str = "" local str = ""
@ -45,7 +25,7 @@ function debug_print(...)
str = str .. tostring(val) .. (i == #args and "" or "\n") str = str .. tostring(val) .. (i == #args and "" or "\n")
end end
naughty.notify({ naughty.notification({
title = "debug", title = "debug",
text = str text = str
}) })
@ -80,6 +60,7 @@ require("modules/bar")
require("modules/binds") require("modules/binds")
require("modules/windows") require("modules/windows")
require("modules/titlebar") require("modules/titlebar")
require("modules/notifs")
-- cyclefocus settings -- cyclefocus settings
cyclefocus.move_mouse_pointer = false cyclefocus.move_mouse_pointer = false
@ -119,15 +100,14 @@ awful.spawn.with_line_callback(vars.env.HOME .. "/.local/bin/autostart.sh", {
exit = function(reason, code) exit = function(reason, code)
local data = { local data = {
title = "autostart exited", title = "autostart exited",
text = reason .. ' ' .. code, text = reason .. " " .. code,
timeout = 4, timeout = 4,
} }
if reason ~= "exit" and code ~= 0 then if reason ~= "exit" and code ~= 0 then
data.preset = naughty.config.presets.critical data.urgency = "critical"
end end
naughty.notify(data) naughty.notification(data)
end end
}) })
--}}}

View file

@ -0,0 +1,29 @@
local vars = require("modules/vars")
local theme = dofile(vars.env.THEME_DIR .. "/_base.lua")({
background = "#272822",
foreground = "#f1ebeb",
secondary = "#1d1e19",
tertiary = "#161613",
accent = "#8fc029",
color0 = "#48483e",
color1 = "#dc2566",
color2 = "#8fc029",
color3 = "#d4c96e",
color4 = "#55bcce",
color5 = "#9358fe",
color6 = "#56b7a5",
color7 = "#acada1",
color8 = "#76715e",
color9 = "#fa2772",
color10 = "#a7e22e",
color11 = "#e7db75",
color12 = "#66d9ee",
color13 = "#ae82ff",
color14 = "#66efd5",
color15 = "#cfd0c2",
})
return theme

View file

@ -0,0 +1,304 @@
-- 4.3 release version of container.background
-- because ive been fucking pissed for 2 hours now over this bullshit change
---------------------------------------------------------------------------
-- A container capable of changing the background color, foreground color
-- widget shape.
--
--@DOC_wibox_container_defaults_background_EXAMPLE@
-- @author Uli Schlachter
-- @copyright 2010 Uli Schlachter
-- @classmod wibox.container.background
---------------------------------------------------------------------------
local base = require("wibox.widget.base")
local color = require("gears.color")
local surface = require("gears.surface")
local beautiful = require("beautiful")
local cairo = require("lgi").cairo
local gtable = require("gears.table")
local setmetatable = setmetatable
local type = type
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
local background = { mt = {} }
-- Draw this widget
function background:draw(context, cr, width, height)
if not self._private.widget or not self._private.widget:get_visible() then
return
end
-- Keep the shape path in case there is a border
self._private.path = nil
if self._private.shape then
-- Only add the offset if there is something to draw
local offset = ((self._private.shape_border_width and self._private.shape_border_color)
and self._private.shape_border_width or 0) / 2
cr:translate(offset, offset)
self._private.shape(cr, width - 2*offset, height - 2*offset, unpack(self._private.shape_args or {}))
cr:translate(-offset, -offset)
self._private.path = cr:copy_path()
cr:clip()
end
if self._private.background then
cr:set_source(self._private.background)
cr:paint()
end
if self._private.bgimage then
if type(self._private.bgimage) == "function" then
self._private.bgimage(context, cr, width, height,unpack(self._private.bgimage_args))
else
local pattern = cairo.Pattern.create_for_surface(self._private.bgimage)
cr:set_source(pattern)
cr:paint()
end
end
end
-- Draw the border
function background:after_draw_children(_, cr)
-- Draw the border
if self._private.path and self._private.shape_border_width and self._private.shape_border_width > 0 then
cr:append_path(self._private.path)
cr:set_source(color(self._private.shape_border_color or self._private.foreground or beautiful.fg_normal))
cr:set_line_width(self._private.shape_border_width)
cr:stroke()
self._private.path = nil
end
end
-- Prepare drawing the children of this widget
function background:before_draw_children(_, cr)
if self._private.foreground then
cr:set_source(self._private.foreground)
end
-- Clip the shape
if self._private.path and self._private.shape_clip then
cr:append_path(self._private.path)
cr:clip()
end
end
-- Layout this widget
function background:layout(_, width, height)
if self._private.widget then
return { base.place_widget_at(self._private.widget, 0, 0, width, height) }
end
end
-- Fit this widget into the given area
function background:fit(context, width, height)
if not self._private.widget then
return 0, 0
end
return base.fit_widget(self, context, self._private.widget, width, height)
end
--- The widget displayed in the background widget.
-- @property widget
-- @tparam widget widget The widget to be disaplayed inside of the background
-- area
function background:set_widget(widget)
if widget then
base.check_widget(widget)
end
self._private.widget = widget
self:emit_signal("widget::layout_changed")
end
function background:get_widget()
return self._private.widget
end
-- Get children element
-- @treturn table The children
function background:get_children()
return {self._private.widget}
end
-- Replace the layout children
-- This layout only accept one children, all others will be ignored
-- @tparam table children A table composed of valid widgets
function background:set_children(children)
self:set_widget(children[1])
end
--- The background color/pattern/gradient to use.
--@DOC_wibox_container_background_bg_EXAMPLE@
-- @property bg
-- @param bg A color string, pattern or gradient
-- @see gears.color
function background:set_bg(bg)
if bg then
self._private.background = color(bg)
else
self._private.background = nil
end
self:emit_signal("widget::redraw_needed")
end
function background:get_bg()
return self._private.background
end
--- The foreground (text) color/pattern/gradient to use.
--@DOC_wibox_container_background_fg_EXAMPLE@
-- @property fg
-- @param fg A color string, pattern or gradient
-- @see gears.color
function background:set_fg(fg)
if fg then
self._private.foreground = color(fg)
else
self._private.foreground = nil
end
self:emit_signal("widget::redraw_needed")
end
function background:get_fg()
return self._private.foreground
end
--- The background shap e.
--
-- Use `set_shape` to set additional shape paramaters.
--
--@DOC_wibox_container_background_shape_EXAMPLE@
-- @property shape
-- @param shape A function taking a context, width and height as arguments
-- @see gears.shape
-- @see set_shape
--- Set the background shape.
--
-- Any other arguments will be passed to the shape function
-- @param shape A function taking a context, width and height as arguments
-- @see gears.shape
-- @see shape
function background:set_shape(shape, ...)
local args = {...}
if shape == self._private.shape and #args == 0 then return end
self._private.shape = shape
self._private.shape_args = {...}
self:emit_signal("widget::redraw_needed")
end
function background:get_shape()
return self._private.shape
end
--- When a `shape` is set, also draw a border.
--
-- See `wibox.container.background.shape` for an usage example.
-- @property shape_border_width
-- @tparam number width The border width
function background:set_shape_border_width(width)
if self._private.shape_border_width == width then return end
self._private.shape_border_width = width
self:emit_signal("widget::redraw_needed")
end
function background:get_shape_border_width()
return self._private.shape_border_width
end
--- When a `shape` is set, also draw a border.
--
-- See `wibox.container.background.shape` for an usage example.
-- @property shape_border_color
-- @param[opt=self._private.foreground] fg The border color, pattern or gradient
-- @see gears.color
function background:set_shape_border_color(fg)
if self._private.shape_border_color == fg then return end
self._private.shape_border_color = fg
self:emit_signal("widget::redraw_needed")
end
function background:get_shape_border_color()
return self._private.shape_border_color
end
--- When a `shape` is set, make sure nothing is drawn outside of it.
--@DOC_wibox_container_background_clip_EXAMPLE@
-- @property shape_clip
-- @tparam boolean value If the shape clip is enable
function background:set_shape_clip(value)
if self._private.shape_clip == value then return end
self._private.shape_clip = value
self:emit_signal("widget::redraw_needed")
end
function background:get_shape_clip()
return self._private.shape_clip or false
end
--- The background image to use
-- If `image` is a function, it will be called with `(context, cr, width, height)`
-- as arguments. Any other arguments passed to this method will be appended.
-- @property bgimage
-- @param image A background image or a function
-- @see gears.surface
function background:set_bgimage(image, ...)
self._private.bgimage = type(image) == "function" and image or surface.load(image)
self._private.bgimage_args = {...}
self:emit_signal("widget::redraw_needed")
end
function background:get_bgimage()
return self._private.bgimage
end
--- Returns a new background container.
--
-- A background container applies a background and foreground color
-- to another widget.
-- @param[opt] widget The widget to display.
-- @param[opt] bg The background to use for that widget.
-- @param[opt] shape A `gears.shape` compatible shape function
-- @function wibox.container.background
local function new(widget, bg, shape)
local ret = base.make_widget(nil, nil, {
enable_properties = true,
})
gtable.crush(ret, background, true)
ret._private.shape = shape
ret:set_widget(widget)
ret:set_bg(bg)
return ret
end
function background.mt:__call(...)
return new(...)
end
--@DOC_widget_COMMON@
--@DOC_object_COMMON@
return setmetatable(background, background.mt)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80