aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/ui
diff options
context:
space:
mode:
authordelta <darkussdelta@gmail.com>2024-03-05 14:48:59 +0100
committerdelta <darkussdelta@gmail.com>2024-03-05 14:48:59 +0100
commit510ef8e178929cf5e0c7fd5a5120fecf5f1b79f2 (patch)
tree3582e5cd7d000335ca94f2a009f3aed57bd86919 /.config/awesome/ui
parent95ba8030f722a616cff06c122dcfb2f63e25cf45 (diff)
idk anymore
Diffstat (limited to '.config/awesome/ui')
-rw-r--r--.config/awesome/ui/conductor/init.lua24
-rw-r--r--.config/awesome/ui/decorations/mpd.lua13
-rw-r--r--.config/awesome/ui/decorations/wallpaper.lua30
-rw-r--r--.config/awesome/ui/fresnel/init.lua181
-rw-r--r--.config/awesome/ui/init.lua2
-rw-r--r--.config/awesome/ui/insightful/init.lua80
-rw-r--r--.config/awesome/ui/osd.lua102
-rw-r--r--.config/awesome/ui/powermenu/init.lua114
-rw-r--r--.config/awesome/ui/statusbar/init.lua75
-rw-r--r--.config/awesome/ui/statusbar/panel/init.lua20
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/battery.lua70
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/calendar.lua155
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/displays.lua36
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/imagebox.lua144
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/linegraph.lua154
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/music.lua187
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/power_menu.lua36
-rw-r--r--.config/awesome/ui/statusbar/panel/widgets/wifi.lua18
-rw-r--r--.config/awesome/ui/statusbar/widgets/clock.lua8
-rw-r--r--.config/awesome/ui/statusbar/widgets/displays.lua34
-rw-r--r--.config/awesome/ui/statusbar/widgets/keyboardlayout.lua307
-rw-r--r--.config/awesome/ui/statusbar/widgets/taglist.lua127
-rw-r--r--.config/awesome/ui/statusbar/widgets/tasklist.lua30
-rw-r--r--.config/awesome/ui/wicked/_default.lua94
-rw-r--r--.config/awesome/ui/wicked/init.lua258
-rw-r--r--.config/awesome/ui/wicked/widgets/message.lua0
26 files changed, 1287 insertions, 1012 deletions
diff --git a/.config/awesome/ui/conductor/init.lua b/.config/awesome/ui/conductor/init.lua
index b5ac82b..e6fe552 100644
--- a/.config/awesome/ui/conductor/init.lua
+++ b/.config/awesome/ui/conductor/init.lua
@@ -3,24 +3,6 @@ local q = require "quarrel"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
-awful.keygrabber {
- keybindings = {
- awful.key {
- modifiers = qvars.mods.A,
- key = "Tab",
- on_press = awful.client.focus.history.previous
- },
- awful.key {
- modifiers = qvars.mods.AS,
- key = "Tab",
- on_press = awful.client.focus.history.next
- },
- },
- -- Note that it is using the key name and not the modifier name.
- stop_key = "Mod1",
- stop_event = "release",
- -- start_callback = awful.client.focus.history.disable_tracking,
- stop_callback = awful.client.focus.history.enable_tracking,
- export_keybindings = true,
- autostart = true
-}
+local conductor = {}
+
+return conductor
diff --git a/.config/awesome/ui/decorations/mpd.lua b/.config/awesome/ui/decorations/mpd.lua
new file mode 100644
index 0000000..a03b579
--- /dev/null
+++ b/.config/awesome/ui/decorations/mpd.lua
@@ -0,0 +1,13 @@
+local mpd = {}
+
+function mpd.left() end
+
+function mpd.bottom() end
+
+function mpd.setup(c) end
+
+function mpd:next() end
+
+function mpd:previous() end
+
+function mpd:stop() end
diff --git a/.config/awesome/ui/decorations/wallpaper.lua b/.config/awesome/ui/decorations/wallpaper.lua
index dbe54ee..3a204c2 100644
--- a/.config/awesome/ui/decorations/wallpaper.lua
+++ b/.config/awesome/ui/decorations/wallpaper.lua
@@ -1,4 +1,4 @@
--- local gfs = require "gears.filesystem"
+local qmarkup = require "quarrel.markup"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local wallpaper = require "awful.wallpaper"
@@ -16,24 +16,14 @@ screen.connect_signal("request::wallpaper", function(s)
widget = wibox.widget.textbox,
font = qui.font(1.5),
markup = table.concat({
- qui.markup_fg(qvars.colors.red, " ___"),
- qui.markup_fg(qvars.colors.green, " /\\ \\"),
- qui.markup_fg(qvars.colors.yellow, " /::\\ \\"),
- qui.markup_fg(qvars.colors.blue, "/::\\:\\__\\"),
- qui.markup_fg(qvars.colors.pink, "\\/\\::/ /"),
- qui.markup_fg(qvars.colors.cyan, " \\/__/")
- }, "\n")
- }
- -- {
- -- -- image = gfs.get_configuration_dir() .. "assets/nightmare_fuel.png",
- -- image = "/home/delta/Desktop/offline vs online.jpg",
- -- resize = true,
- -- widget = wibox.widget.imagebox,
- -- },
- -- valign = "center",
- -- halign = "center",
- -- tiled = false,
- -- widget = wibox.container.tile,
- }
+ qmarkup(" ___", { fg = qvars.colors.red }),
+ qmarkup(" /\\ \\", { fg = qvars.colors.green }),
+ qmarkup(" /::\\ \\", { fg = qvars.colors.yellow }),
+ qmarkup("/::\\:\\__\\", { fg = qvars.colors.blue }),
+ qmarkup("\\/\\::/ /", { fg = qvars.colors.pink }),
+ qmarkup(" \\/__/", { fg = qvars.colors.cyan }),
+ }, "\n"),
+ },
+ },
}
end)
diff --git a/.config/awesome/ui/fresnel/init.lua b/.config/awesome/ui/fresnel/init.lua
index f31da12..9905741 100644
--- a/.config/awesome/ui/fresnel/init.lua
+++ b/.config/awesome/ui/fresnel/init.lua
@@ -49,10 +49,10 @@ function fresnel:_update(query, scrolled)
self._entries_exec = {}
layout:reset()
-
+
for _, provider in qtable.opairs(qnative.lenses) do
local entries = provider(query)
-
+
table.sort(entries, function(a, b)
return a.message < b.message
end)
@@ -63,72 +63,76 @@ function fresnel:_update(query, scrolled)
self._entries_count = #all_providers
for i, entry in ipairs(all_providers) do
- if i <= self._entries_offset then
- goto continue
- end
- if entries_count == max_entries then break end
- table.insert(self._entries_exec, entry.exec)
+ if i > self._entries_offset then
+ if entries_count == max_entries then
+ break
+ end
+ table.insert(self._entries_exec, entry.exec)
- local entry_widget = wibox.widget {
- widget = wibox.container.background,
- shape = qvars.shape,
- {
- widget = wibox.container.margin,
- margins = qvars.padding,
+ local entry_widget = wibox.widget {
+ widget = wibox.container.background,
+ shape = qvars.shape,
{
- widget = wibox.container.constraint,
- strategy = "max",
- height = qvars.char_height,
+ widget = wibox.container.margin,
+ margins = qvars.padding,
{
+ widget = wibox.container.constraint,
+ strategy = "max",
+ height = qvars.char_height,
{
- widget = wibox.container.background,
- fg = qvars.colors.dim.fg,
+ {
+ widget = wibox.container.background,
+ fg = qvars.colors.dim.fg,
+ {
+ widget = wibox.widget.textbox,
+ text = entry.provider .. " | ",
+ },
+ },
{
widget = wibox.widget.textbox,
- text = entry.provider .. " | "
- }
+ text = entry.message,
+ },
+ spacing = qvars.padding,
+ layout = wibox.layout.fixed.horizontal,
},
- {
- widget = wibox.widget.textbox,
- text = entry.message
- },
- spacing = qvars.padding,
- layout = wibox.layout.fixed.horizontal
- }
- }
- },
- buttons = {
- awful.button {
- modifiers = {},
- button = btn.LEFT,
- on_press = function()
- self:_exec_entry(i)
- end
- }
- },
- _selected = false
- }
+ },
+ },
+ buttons = {
+ awful.button {
+ modifiers = {},
+ button = btn.LEFT,
+ on_press = function()
+ self:_exec_entry(i)
+ end,
+ },
+ },
+ _selected = false,
+ }
- if self._selected_index + self._entries_offset == i then
- entry_widget._selected = true
- entry_widget.bg = qvars.colors.black
- end
+ if self._selected_index + self._entries_offset == i then
+ entry_widget._selected = true
+ entry_widget.bg = qvars.colors.black
+ end
- entry_widget:connect_signal("mouse::enter", function()
- if entry_widget._selected == true then return end
- entry_widget.bg = qvars.colors.black
- end)
+ entry_widget:connect_signal("mouse::enter", function()
+ if entry_widget._selected == true then
+ return
+ end
+ entry_widget.bg = qvars.colors.black
+ end)
- entry_widget:connect_signal("mouse::leave", function()
- if entry_widget._selected == true then return end
- entry_widget.bg = qvars.colors.bg
- end)
+ entry_widget:connect_signal("mouse::leave", function()
+ if entry_widget._selected == true then
+ return
+ end
+ entry_widget.bg = qvars.colors.bg
+ end)
- layout:add(entry_widget)
+ layout:add(entry_widget)
- entries_count = entries_count + 1
- self._visible_entries = entries_count
- ::continue::
+ entries_count = entries_count + 1
+ self._visible_entries = entries_count
+ end
end
status.text = self._entries_offset + self._selected_index .. "/" .. self._entries_count
@@ -141,8 +145,12 @@ fresnel._prompt = al_prompt {
ul_cursor = "low",
bg_cursor = qvars.colors.black,
changed_callback = function(text)
- if fresnel._text == text then return end
- if fresnel._toggled == false then return end
+ if fresnel._text == text then
+ return
+ end
+ if fresnel._toggled == false then
+ return
+ end
fresnel:_update(text)
fresnel._text = text
end,
@@ -154,7 +162,7 @@ fresnel._prompt = al_prompt {
fresnel:hide()
elseif key == "Up" then
local next_index = fresnel._selected_index - 1
- if next_index < 1 and fresnel._entries_offset == 0 then
+ if next_index < 1 and fresnel._entries_offset == 0 then
return
elseif next_index < 1 and fresnel._entries_offset > 0 then
fresnel._entries_offset = fresnel._entries_offset - 1
@@ -165,9 +173,15 @@ fresnel._prompt = al_prompt {
fresnel:_update(fresnel._text, true)
elseif key == "Down" then
local next_index = fresnel._selected_index + 1
- if next_index > fresnel._visible_entries and fresnel._entries_offset + fresnel._visible_entries == fresnel._entries_count then
+ if
+ next_index > fresnel._visible_entries
+ and fresnel._entries_offset + fresnel._visible_entries == fresnel._entries_count
+ then
return
- elseif next_index > fresnel._visible_entries and fresnel._entries_offset + fresnel._visible_entries < fresnel._entries_count then
+ elseif
+ next_index > fresnel._visible_entries
+ and fresnel._entries_offset + fresnel._visible_entries < fresnel._entries_count
+ then
fresnel._entries_offset = fresnel._entries_offset + 1
else
fresnel._selected_index = next_index
@@ -175,7 +189,7 @@ fresnel._prompt = al_prompt {
fresnel:_update(fresnel._text, true)
end
- end
+ end,
}
fresnel._widget = qui.popup {
@@ -184,12 +198,12 @@ fresnel._widget = qui.popup {
placement = function(d)
awful.placement.top(d, {
margins = {
- top = beautiful.useless_gap * 2
- }
+ top = beautiful.useless_gap * 2,
+ },
})
end,
- minimum_width = screen[1].geometry.width / 2,
- maximum_width = screen[1].geometry.width / 2,
+ minimum_width = awful.screen.focused().geometry.width / 2,
+ maximum_width = awful.screen.focused().geometry.width / 2,
widget = {
{
widget = wibox.container.background,
@@ -202,13 +216,13 @@ fresnel._widget = qui.popup {
{
{
widget = wibox.widget.textbox,
- text = ">"
+ text = ">",
},
{
widget = wibox.container.margin,
margins = {
left = qvars.padding,
- right = qvars.padding
+ right = qvars.padding,
},
{
widget = wibox.container.constraint,
@@ -217,34 +231,37 @@ fresnel._widget = qui.popup {
{
widget = wibox.container.background,
fg = qvars.colors.fg,
- fresnel._prompt.textbox
- }
- }
+ fresnel._prompt.textbox,
+ },
+ },
},
{
widget = wibox.widget.textbox,
text = "0/0",
- id = "status"
+ id = "status",
},
- layout = wibox.layout.align.horizontal
- }
- }
+ layout = wibox.layout.align.horizontal,
+ },
+ },
},
{
widget = wibox.container.margin,
margins = {
- top = qvars.padding
+ top = qvars.padding,
},
{
spacing = qvars.padding,
layout = wibox.layout.fixed.vertical,
- id = "entry_layout"
- }
+ id = "entry_layout",
+ },
},
- layout = wibox.layout.align.vertical
- }
+ layout = wibox.layout.align.vertical,
+ },
}
-fresnel._widget.maximum_height = qvars.big_padding * 2 + (qvars.padding * 2 + qvars.char_height) * (1 + 10) + qvars.padding + qvars.padding * 9
+fresnel._widget.maximum_height = qvars.big_padding * 2
+ + (qvars.padding * 2 + qvars.char_height) * (1 + 10)
+ + qvars.padding
+ + qvars.padding * 9
function fresnel:show()
self._toggled = true
@@ -271,7 +288,7 @@ fresnel._timed = rubato.timed {
else
fresnel._widget.visible = true
end
- end
+ end,
}
return fresnel
diff --git a/.config/awesome/ui/init.lua b/.config/awesome/ui/init.lua
index e41644f..dd93ad1 100644
--- a/.config/awesome/ui/init.lua
+++ b/.config/awesome/ui/init.lua
@@ -1,2 +1,4 @@
require "ui.statusbar"
require "ui.decorations"
+require "ui.conductor"
+require "ui.osd"
diff --git a/.config/awesome/ui/insightful/init.lua b/.config/awesome/ui/insightful/init.lua
index e8a4a4d..3dcbbea 100644
--- a/.config/awesome/ui/insightful/init.lua
+++ b/.config/awesome/ui/insightful/init.lua
@@ -64,7 +64,7 @@ insightful._keymap = {
XF86AudioStop = "⏹",
[tostring(btn.LEFT)] = mouse .. "Left",
[tostring(btn.MIDDLE)] = mouse .. "Middle",
- [tostring(btn.RIGHT)] = mouse .. "Right"
+ [tostring(btn.RIGHT)] = mouse .. "Right",
}
insightful._widget = qui.popup {
@@ -73,17 +73,17 @@ insightful._widget = qui.popup {
placement = function(d)
awful.placement.top(d, {
margins = {
- top = beautiful.useless_gap * 2
- }
+ top = beautiful.useless_gap * 2,
+ },
})
end,
- minimum_height = screen[1].geometry.height / 2,
- minimum_width = screen[1].geometry.width / 2,
+ minimum_height = awful.screen.focused().geometry.height / 2,
+ minimum_width = awful.screen.focused().geometry.width / 2,
widget = {
layout = wibox.layout.fixed.vertical,
spacing = qvars.big_padding,
- id = "layout_container"
- }
+ id = "layout_container",
+ },
}
function insightful:_generate()
@@ -98,55 +98,59 @@ function insightful:_generate()
grouped_binds[group] = {}
end
- table.insert(grouped_binds[group], {
+ table.insert(grouped_binds[group], {
mods = keybind.mods,
triggers = keybind.triggers,
- desc = keybind.desc
+ desc = keybind.desc,
})
end
for group, keybinds in qtable.opairs(grouped_binds) do
local group_layout = {
spacing = qvars.padding,
- layout = wibox.layout.fixed.vertical
+ layout = wibox.layout.fixed.vertical,
}
for _, keybind in ipairs(keybinds) do
local key_layout = {
- layout = wibox.layout.fixed.horizontal
+ layout = wibox.layout.fixed.horizontal,
}
local key_and_desc_layout = {
nil, -- key
nil,
nil, -- description?
- layout = wibox.layout.align.horizontal
+ layout = wibox.layout.align.horizontal,
}
-
+
for _, mod in ipairs(keybind.mods) do
- table.insert(key_layout, 1, qui.styled {
- widget = wibox.container.background,
- bg = qvars.colors.bright.black,
- border_width = 0,
- {
- widget = wibox.container.margin,
- margins = qvars.padding,
+ table.insert(
+ key_layout,
+ 1,
+ qui.styled {
+ widget = wibox.container.background,
+ bg = qvars.colors.bright.black,
+ border_width = 0,
{
- widget = wibox.widget.textbox,
- text = insightful._keymap[mod] or mod
- }
+ widget = wibox.container.margin,
+ margins = qvars.padding,
+ {
+ widget = wibox.widget.textbox,
+ text = insightful._keymap[mod] or mod,
+ },
+ },
}
- })
+ )
table.insert(key_layout, 2, {
widget = wibox.widget.textbox,
- text = " + "
+ text = " + ",
})
end
if type(keybind.triggers) == "string" or type(keybind.triggers) == "number" then
table.insert(key_layout, {
widget = wibox.widget.textbox,
- text = insightful._keymap[tostring(keybind.triggers)] or keybind.triggers
+ text = insightful._keymap[tostring(keybind.triggers)] or keybind.triggers,
})
elseif type(keybind.triggers) == "table" then
local display_trigger = {}
@@ -155,7 +159,7 @@ function insightful:_generate()
end
table.insert(key_layout, {
widget = wibox.widget.textbox,
- text = table.concat(display_trigger, "/")
+ text = table.concat(display_trigger, "/"),
})
end
@@ -165,16 +169,16 @@ function insightful:_generate()
fg = qvars.colors.dim.fg,
{
widget = wibox.widget.textbox,
- text = keybind.desc
- }
+ text = keybind.desc,
+ },
}
end
key_and_desc_layout[1] = key_layout
table.insert(group_layout, key_and_desc_layout)
- end
-
+ end
+
layout_container:add {
{
{
@@ -187,16 +191,16 @@ function insightful:_generate()
margins = qvars.padding,
{
widget = wibox.widget.textbox,
- text = group
- }
- }
+ text = group,
+ },
+ },
},
nil,
- layout = wibox.layout.align.horizontal
+ layout = wibox.layout.align.horizontal,
},
group_layout,
spacing = qvars.padding,
- layout = wibox.layout.fixed.vertical
+ layout = wibox.layout.fixed.vertical,
}
end
end
@@ -213,11 +217,11 @@ local timed = rubato.timed {
else
insightful._widget.visible = true
end
- end
+ end,
}
function insightful:toggle()
- if first_time then
+ if first_time then
insightful:_generate()
first_time = false
end
diff --git a/.config/awesome/ui/osd.lua b/.config/awesome/ui/osd.lua
new file mode 100644
index 0000000..fc74ed9
--- /dev/null
+++ b/.config/awesome/ui/osd.lua
@@ -0,0 +1,102 @@
+--- Heavy inspiration from a design made by https://github.com/tsukki9696
+
+local awful = require "awful"
+local beautiful = require "beautiful"
+local gtimer = require "gears.timer"
+local phosphor = require "assets.phosphor"
+local qmath = require "quarrel.math"
+local qui = require "quarrel.ui"
+local qvars = require "quarrel.vars"
+local rubato = require "lib.rubato"
+local wibox = require "wibox"
+
+local osd = {}
+
+local widget = qui.popup {
+ ontop = true,
+ visible = false,
+ placement = function(d)
+ awful.placement.top(d, {
+ margins = {
+ top = beautiful.useless_gap * 2,
+ },
+ })
+ end,
+ minimum_height = qvars.char_height * 2,
+ -- minimum_width = awful.screen.focused().geometry.width / 2,
+ widget = {
+ {
+ widget = wibox.container.place,
+
+ qui.icon {
+ icon = phosphor.speaker_simple_none_fill,
+ widget = {
+ forced_height = qvars.char_height * 1.2,
+ forced_width = qvars.char_height * 1.2,
+ id = "icon",
+ },
+ },
+ },
+ {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.progressbar,
+ max_value = 100,
+ value = 20,
+ forced_height = qvars.char_height / 1.5,
+ forced_width = qvars.expanded_bar_size
+ - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2)
+ - (qvars.char_height / 1.25 + qvars.padding) * 3,
+ color = qvars.colors.yellow,
+ background_color = qvars.colors.black,
+ shape = qvars.shape,
+ id = "progress",
+ },
+ },
+
+ {
+ widget = wibox.widget.textbox,
+ text = "20%",
+ font = qui.font(1.2),
+ id = "percentage",
+ },
+ layout = wibox.layout.fixed.horizontal,
+ spacing = qvars.big_padding,
+ },
+}
+
+local timer
+
+local anim = rubato.timed {
+ duration = qvars.anim_duration,
+ intro = qvars.anim_intro,
+ pos = 0,
+ subscribed = function(pos)
+ widget.opacity = pos
+ if pos == 0 then
+ widget.visible = false
+ elseif not widget.visible then
+ widget.visible = true
+ elseif pos == 1 then
+ timer:start()
+ end
+ end,
+}
+
+timer = gtimer {
+ timeout = 1,
+ callback = function()
+ anim.target = 0
+ end,
+ single_shot = true,
+}
+
+function osd.notify(icon, value, max)
+ anim.target = 1
+ widget:get_children_by_id("icon")[1].image = icon
+ widget:get_children_by_id("progress")[1].value = value
+ widget:get_children_by_id("progress")[1].max_value = max
+ widget:get_children_by_id("percentage")[1].text = tostring(qmath.percentage(value, max)) .. "%"
+end
+
+return osd
diff --git a/.config/awesome/ui/powermenu/init.lua b/.config/awesome/ui/powermenu/init.lua
new file mode 100644
index 0000000..81d2ea3
--- /dev/null
+++ b/.config/awesome/ui/powermenu/init.lua
@@ -0,0 +1,114 @@
+local awful = require "awful"
+local phosphor = require "assets.phosphor"
+local qui = require "quarrel.ui"
+local qvars = require "quarrel.vars"
+local rubato = require "lib.rubato"
+local wibox = require "wibox"
+
+local function create_button(title, icon, color, exec)
+ return wibox.widget {
+ widget = wibox.container.background,
+ shape = qvars.shape,
+ {
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ {
+ qui.styled {
+ widget = wibox.container.background,
+ border_color = color,
+ {
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ qui.icon {
+ widget = {
+ forced_height = qvars.char_height * 4 - qvars.big_padding * 2,
+ forced_width = qvars.char_height * 4 - qvars.big_padding * 2,
+ },
+ icon = icon,
+ color = color,
+ },
+ },
+ },
+ {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.textbox,
+ text = title,
+ },
+ },
+ layout = wibox.layout.fixed.vertical,
+ spacing = qvars.big_padding,
+ exec = exec,
+ },
+ },
+ select = function(self)
+ self.bg = qvars.colors.black
+ end,
+ }
+end
+
+local powermenu = {}
+local toggled = false
+
+screen.connect_signal("request::desktop_decoration", function(s)
+ powermenu._widget = qui.popup {
+ ontop = true,
+ visible = false,
+ minimum_width = s.geometry.width,
+ minimum_height = s.geometry.height,
+ bg = qvars.colors.bg .. "ee",
+ border_width = 0,
+ widget = {
+ widget = wibox.container.place,
+ qui.styled {
+ widget = wibox.container.background,
+ {
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ {
+ layout = wibox.layout.fixed.horizontal,
+ spacing = qvars.big_padding * 2,
+ id = "list",
+ },
+ },
+ },
+ },
+ }
+
+ local layout = powermenu._widget.widget:get_children_by_id("list")[1]
+
+ layout:add(create_button("Shutdown", phosphor.power_bold, qvars.colors.red, function()
+ awful.spawn "poweroff"
+ end))
+ layout:add(create_button("Log out", phosphor.sign_out_bold, qvars.colors.green, function()
+ awesome.quit()
+ end))
+ layout:add(create_button("Lock", phosphor.lock_simple_fill, qvars.colors.blue, function()
+ require("quarrel").debug "locked!l"
+ end))
+ layout:add(create_button("Restart", phosphor.arrow_clockwise_bold, qvars.colors.pink, function()
+ awful.spawn "reboot"
+ end))
+end)
+
+local timed = rubato.timed {
+ duration = qvars.anim_duration,
+ intro = qvars.anim_intro,
+ pos = 0,
+ subscribed = function(pos)
+ powermenu._widget.opacity = pos
+
+ if pos == 0 then
+ powermenu._widget.visible = false
+ else
+ powermenu._widget.visible = true
+ end
+ end,
+}
+
+function powermenu:toggle()
+ timed.target = toggled and 0 or 1
+ toggled = not toggled
+end
+
+return powermenu
diff --git a/.config/awesome/ui/statusbar/init.lua b/.config/awesome/ui/statusbar/init.lua
index d4f2001..77a28f7 100644
--- a/.config/awesome/ui/statusbar/init.lua
+++ b/.config/awesome/ui/statusbar/init.lua
@@ -1,9 +1,8 @@
local awful = require "awful"
local beautiful = require "beautiful"
-local gcolor = require "gears.color"
local panel = require "ui.statusbar.panel"
local phosphor = require "assets.phosphor"
-local qbind = require "quarrel.bind"
+local qstore = require "quarrel.store"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local rubato = require "lib.rubato"
@@ -13,38 +12,26 @@ local clock = require "ui.statusbar.widgets.clock"
local displays = require "ui.statusbar.widgets.displays"
local keyboardlayout = require "ui.statusbar.widgets.keyboardlayout"
local taglist = require "ui.statusbar.widgets.taglist"
+local tasklist = require "ui.statusbar.widgets.tasklist"
screen.connect_signal("request::desktop_decoration", function(s)
- local expand_button = wibox.widget {
- widget = wibox.container.place,
- valign = "center",
- halign = "center",
- {
- widget = wibox.widget.imagebox,
- image = gcolor.recolor_image(phosphor.caret_right_fill, qvars.colors.fg),
- forced_width = qvars.char_height,
- forced_height = qvars.char_height
- },
- _expanded = false
- }
-
local bar = qui.popup {
placement = function(d)
- local place = awful.placement.left
- return place(d, {
- margins = beautiful.useless_gap * 2
+ return awful.placement.left(d, {
+ margins = beautiful.useless_gap * 2,
})
end,
minimum_height = s.geometry.height - (beautiful.useless_gap * 4 + qvars.border_width * 2),
widget = {
{
{
- expand_button,
- taglist,
+ taglist(s),
layout = wibox.layout.fixed.vertical,
spacing = qvars.padding * 2,
+ id = "top",
},
nil,
+ -- tasklist(s),
{
widget = wibox.container.place,
valign = "bottom",
@@ -55,11 +42,16 @@ screen.connect_signal("request::desktop_decoration", function(s)
displays.wifi,
{
widget = wibox.container.place,
- keyboardlayout
+ {
+ widget = wibox.container.constraint,
+ height = qvars.char_height,
+ width = qvars.char_height,
+ keyboardlayout,
+ },
},
clock,
layout = wibox.layout.fixed.vertical,
- spacing = qvars.padding * 2
+ spacing = qvars.padding * 2,
},
},
layout = wibox.layout.align.vertical,
@@ -74,23 +66,24 @@ screen.connect_signal("request::desktop_decoration", function(s)
local bar_width = bar.width + qvars.border_width * 2
bar:struts {
- left = bar_width + beautiful.useless_gap * 4
+ left = bar_width + beautiful.useless_gap * 4,
}
local panel_width
+ local panel_toggle = { toggled = false } -- hacky but it works
local timed = rubato.timed {
duration = qvars.anim_duration,
intro = qvars.anim_intro,
pos = bar_width,
subscribed = function(pos)
- if pos ~= bar_width and expand_button._expanded then
+ if pos ~= bar_width and panel_toggle.toggled then
bar.widget.widget.third = panel
if panel_width == nil then
panel_width = bar.widget.widget.third.width
end
bar.ontop = true
- elseif pos == bar_width and not expand_button._expanded then
+ elseif pos == bar_width and not panel_toggle.toggled then
bar.widget.widget.third = nil
bar.ontop = false
end
@@ -98,25 +91,21 @@ screen.connect_signal("request::desktop_decoration", function(s)
bar.shape = function(cr, _, h)
qvars.shape(cr, pos, h)
end
- end
+ end,
}
- expand_button.buttons = {
- qbind:new {
- triggers = qvars.btns.left,
- press = function()
- if expand_button._expanded then
- timed.target = bar_width
- else
- timed.target = bar_width + qvars.expanded_bar_size
- -- timed.target = bar_width + qvars.big_padding + (qvars.big_padding * 2 + qvars.element_size * 4) * 3 + qvars.padding * 2
- end
-
- -- q.debug(tostring(panel_width))
- expand_button._expanded = not expand_button._expanded
- end,
- hidden = true
- }
+ panel_toggle = qui.toggle {
+ off = phosphor.arrows_out_simple_fill,
+ on = phosphor.arrows_in_simple_fill,
+ press = function(self)
+ if not self.toggled then
+ timed.target = bar_width
+ else
+ timed.target = bar_width + qvars.expanded_bar_size
+ end
+ end,
}
-
+
+ bar.widget:get_children_by_id("top")[1]:insert(1, panel_toggle)
+ qstore.panel_toggle = panel_toggle
end)
diff --git a/.config/awesome/ui/statusbar/panel/init.lua b/.config/awesome/ui/statusbar/panel/init.lua
index 7685451..31c2860 100644
--- a/.config/awesome/ui/statusbar/panel/init.lua
+++ b/.config/awesome/ui/statusbar/panel/init.lua
@@ -1,6 +1,8 @@
local qvars = require "quarrel.vars"
local wibox = require "wibox"
+local battery = require "ui.statusbar.panel.widgets.battery"
+local calendar = require "ui.statusbar.panel.widgets.calendar"
local displays = require "ui.statusbar.panel.widgets.displays"
local music = require "ui.statusbar.panel.widgets.music"
local power_menu = require "ui.statusbar.panel.widgets.power_menu"
@@ -9,7 +11,7 @@ local wifi = require "ui.statusbar.panel.widgets.wifi"
local panel = wibox.widget {
widget = wibox.container.margin,
margins = {
- left = qvars.big_padding
+ left = qvars.big_padding,
},
{
{
@@ -24,25 +26,27 @@ local panel = wibox.widget {
spacing = qvars.padding,
},
wifi,
- music,
+ -- battery,
+ -- music,
+ calendar,
layout = wibox.layout.fixed.vertical,
- spacing = qvars.padding
- }
+ spacing = qvars.padding,
+ },
},
{
widget = wibox.container.background,
{
widget = wibox.widget.textbox,
- text = ":)"
- }
+ text = ":)",
+ },
},
{
widget = wibox.container.place,
valign = "bottom",
- power_menu
+ power_menu,
},
layout = wibox.layout.align.vertical,
- }
+ },
}
return panel
diff --git a/.config/awesome/ui/statusbar/panel/widgets/battery.lua b/.config/awesome/ui/statusbar/panel/widgets/battery.lua
new file mode 100644
index 0000000..52685b7
--- /dev/null
+++ b/.config/awesome/ui/statusbar/panel/widgets/battery.lua
@@ -0,0 +1,70 @@
+local gears = require "gears"
+local lit = require "lib.lit"
+local qbezier = require "quarrel.bezier"
+local qui = require "quarrel.ui"
+local wibox = require "wibox"
+
+local widget = wibox.widget {
+ widget = wibox.container.constraint,
+ height = 120,
+ width = 120,
+ strategy = "exact",
+ {
+ widget = lit.widget.linechart,
+ -- max_value = 30,
+ -- step_width = 10,
+ -- scale = true,
+ -- stack = false,
+ -- forced_height = 30,
+ -- step_hook = curvaceous
+ -- values = { 1, 10, 100 },
+ fill = true,
+ fill_color = "#00ff00",
+ -- fill_border = true,
+ fill_border_color = "#ff0000",
+ draw_bg = function(cr, width, _, min, max, transform)
+ cr:set_line_width(1)
+ local min_abs = math.abs(min)
+ local dash_pattern = { 6, 4 }
+ local rendered_zero, zero_overlap = false, false
+ for i = 0, 4 do
+ local temp = ((min_abs + max) * (i / 4)) - min_abs
+ rendered_zero = rendered_zero or temp == 0
+ if rendered_zero and not zero_overlap and min < 0 then
+ cr:set_source_rgba(gears.color.parse_color "#0000ff")
+ zero_overlap = true
+ else
+ cr:set_dash(dash_pattern, 1, 0)
+ cr:set_source_rgba(gears.color.parse_color "#ff0000ff")
+ end
+ local y = transform(temp)
+ cr:move_to(0, y)
+ cr:line_to(width, y)
+ cr:stroke()
+ cr:set_dash({}, 0, 0)
+ end
+
+ if not rendered_zero then
+ cr:set_source_rgba(gears.color.parse_color "#0000ff")
+ local h_0 = transform(0)
+ cr:move_to(0, h_0)
+ cr:line_to(width, h_0)
+ cr:stroke()
+ end
+ end,
+ },
+}
+
+-- for _ = 1, 100 do
+-- widget.widget:add_value(math.random(0, 30))
+-- end
+
+-- require "gears.timer" {
+-- autostart = true,
+-- timeout = 0.2,
+-- callback = function ()
+-- widget.widget:add_value(math.random(0, 30))
+-- end
+-- }
+
+return widget
diff --git a/.config/awesome/ui/statusbar/panel/widgets/calendar.lua b/.config/awesome/ui/statusbar/panel/widgets/calendar.lua
index 8b13789..8933543 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/calendar.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/calendar.lua
@@ -1 +1,156 @@
+local awful = require "awful"
+local phosphor = require "assets.phosphor"
+local qbind = require "quarrel.bind"
+local qmarkup = require "quarrel.markup"
+local qui = require "quarrel.ui"
+local qvars = require "quarrel.vars"
+local wibox = require "wibox"
+local weekday_map = { 7, 1, 2, 3, 4, 5, 6 }
+
+local calendar = wibox.widget(qui.styled {
+ widget = wibox.container.background,
+ {
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ {
+ {
+ {
+ widget = wibox.container.place,
+ qui.icon {
+ icon = phosphor.caret_left_bold,
+ },
+ },
+ {
+ widget = wibox.container.place,
+ {
+ widget = wibox.widget.textbox,
+ text = "January 2024",
+ },
+ },
+ {
+ widget = wibox.container.place,
+ qui.icon {
+ icon = phosphor.caret_right_bold,
+ },
+ },
+ layout = wibox.layout.align.horizontal,
+ expand = "outside",
+ },
+ {
+ layout = wibox.layout.grid,
+ forced_num_rows = 7,
+ forced_num_cols = 7,
+ spacing = qvars.padding,
+ id = "grid",
+ },
+ layout = wibox.layout.fixed.vertical,
+ spacing = qvars.big_padding,
+ },
+ },
+})
+
+-- Logic heavily inspired by https://github.com/Sinomor/dotfiles/blob/e409f9a84bf40daf1e39c0179ec749232ed827c9/home/.config/awesome/ui/control/moment/calendar.lua#L134-L173
+function calendar:compute_grid(year, month)
+ local calendar_table = { {}, {}, {}, {}, {}, {} }
+ local current = os.date("*t", os.time())
+ local first_day = os.date("*t", os.time { year = year, month = month, day = 1 })
+ local last_day = os.date("*t", os.time { year = year, month = month + 1, day = 0 })
+
+ local days = last_day.day
+
+ local prev_days = os.date("*t", os.time { year = year, month = month, day = 0 })
+ local prev_offset = weekday_map[first_day.wday] - 1
+ local prev_month = month - 1 == -1 and 12 or month - 1
+ local prev_year = prev_month == 12 and year - 1 or year
+
+ if prev_offset ~= -1 then
+ for offset = prev_offset, 1, -1 do
+ local day = prev_days.day - offset + 1
+ table.insert(
+ calendar_table[1],
+ { day, day == current.day and prev_month == current.month and prev_year == current.year, false }
+ )
+ end
+ end
+
+ do
+ local row = 1
+ local weekday = weekday_map[first_day.wday]
+ for day = 1, days do
+ table.insert(
+ calendar_table[row],
+ { day, day == current.day and month == current.month and year == current.year, true }
+ )
+ if weekday == 7 then
+ row = row + 1
+ weekday = 1
+ else
+ weekday = weekday + 1
+ end
+ end
+
+ local next_month = month + 1 == 13 and 1 or month + 1
+ local next_year = next_month == 1 and year + 1 or year
+ for day = 1, 42 - prev_offset - days do
+ table.insert(
+ calendar_table[row],
+ { day, day == current.day and next_month + 1 == current.month and next_year == current.year, false }
+ )
+ if weekday == 7 then
+ row = row + 1
+ weekday = 1
+ else
+ weekday = weekday + 1
+ end
+ end
+ end
+
+ for i, row in ipairs(calendar_table) do
+ for j, col in ipairs(row) do
+ local widget = self:get_children_by_id("grid")[1]:get_widgets_at(i + 1, j)[1]
+ widget.widget.widget.text = col[1]
+ if col[2] then
+ widget.bg = qvars.colors.yellow
+ widget.fg = qvars.colors.bg
+ else
+ widget.bg = qvars.colors.bg
+ widget.fg = col[3] and qvars.colors.fg or qvars.colors.dim.fg
+ end
+ end
+ end
+end
+
+local cells = {}
+local function cell(content)
+ local widget = wibox.widget {
+ widget = wibox.container.background,
+ shape = qvars.shape,
+ {
+ widget = wibox.container.place,
+ forced_height = qvars.char_height * 1.5,
+ forced_width = qvars.char_height * 1.5,
+ {
+ widget = wibox.widget.textbox,
+ markup = content,
+ },
+ },
+ }
+ table.insert(cells, widget)
+end
+
+cell "Mo"
+cell "Tu"
+cell "We"
+cell "Th"
+cell "Fr"
+cell(qmarkup("Sa", { bold = true }))
+cell(qmarkup("Su", { bold = true }))
+
+for _ = 1, 42 do
+ cell()
+end
+calendar:get_children_by_id("grid")[1]:add(table.unpack(cells))
+calendar:compute_grid(2024, 1)
+
+return calendar
diff --git a/.config/awesome/ui/statusbar/panel/widgets/displays.lua b/.config/awesome/ui/statusbar/panel/widgets/displays.lua
index de15bd5..b52c986 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/displays.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/displays.lua
@@ -1,3 +1,5 @@
+local backlight = require "services.backlight"
+local battery = require "services.battery"
local phosphor = require "assets.phosphor"
local qmath = require "quarrel.math"
local qui = require "quarrel.ui"
@@ -23,23 +25,29 @@ local function create_display(icon, color)
forced_width = qvars.element_size * 4,
{
widget = wibox.container.place,
- qui.icon(icon, color, { id = "icon" })
+ qui.icon {
+ icon = icon,
+ color = color,
+ widget = {
+ id = "icon",
+ },
+ },
},
- id = "indicator"
+ id = "indicator",
},
{
widget = wibox.container.place,
{
widget = wibox.widget.textbox,
text = "0%",
- id = "text"
- }
+ id = "text",
+ },
},
layout = wibox.layout.fixed.vertical,
- spacing = qvars.big_padding
- }
- }
- }
+ spacing = qvars.big_padding,
+ },
+ },
+ },
})
end
@@ -58,23 +66,23 @@ awesome.connect_signal("services::audio::icon", function(icon, color)
end)
local d_battery = create_display(phosphor.battery_vertical_warning_fill, qvars.colors.red)
-awesome.connect_signal("services::battery", function(capacity)
- d_battery:get_children_by_id("indicator")[1].value = capacity
- d_battery:get_children_by_id("text")[1].text = capacity .. "%"
+battery:connect_signal("level", function(_, level)
+ d_battery:get_children_by_id("indicator")[1].value = level
+ d_battery:get_children_by_id("text")[1].text = level .. "%"
end)
-awesome.connect_signal("services::battery::icon", function(icon, color)
+battery:connect_signal("icon", function(_, icon, color)
d_battery:get_children_by_id("indicator")[1].color = color
d_battery:get_children_by_id("icon")[1].image = icon
d_battery:get_children_by_id("icon")[1].stylesheet = qui.recolor(color)
end)
local d_brightness = create_display(phosphor.sun_fill, qvars.colors.fg)
-awesome.connect_signal("services::brightness", function(brightness)
+backlight:connect_signal("value", function(_, brightness)
brightness = math.floor(qmath.translate_range(brightness, 0, 255, 0, 100))
d_brightness:get_children_by_id("indicator")[1].value = brightness
d_brightness:get_children_by_id("text")[1].text = brightness .. "%"
end)
-awesome.connect_signal("services::brightness::icon", function(icon, color)
+backlight:connect_signal("icon", function(_, icon, color)
d_brightness:get_children_by_id("icon")[1].image = icon
d_brightness:get_children_by_id("icon")[1].stylesheet = qui.recolor(color)
end)
diff --git a/.config/awesome/ui/statusbar/panel/widgets/imagebox.lua b/.config/awesome/ui/statusbar/panel/widgets/imagebox.lua
index 8c6e8a5..5caadc5 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/imagebox.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/imagebox.lua
@@ -24,13 +24,13 @@
-- @supermodule wibox.widget.base
---------------------------------------------------------------------------
-local lgi = require("lgi")
+local lgi = require "lgi"
local cairo = lgi.cairo
-local base = require("wibox.widget.base")
-local surface = require("gears.surface")
-local gtable = require("gears.table")
-local gdebug = require("gears.debug")
+local base = require "wibox.widget.base"
+local gdebug = require "gears.debug"
+local gtable = require "gears.table"
+local surface = require "gears.surface"
local setmetatable = setmetatable
local type = type
local math = math
@@ -40,7 +40,9 @@ local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility
-- Safe load for optional Rsvg module
local Rsvg = nil
do
- local success, err = pcall(function() Rsvg = lgi.Rsvg end)
+ local success, err = pcall(function()
+ Rsvg = lgi.Rsvg
+ end)
if not success then
gdebug.print_warning(debug.traceback("Could not load Rsvg: " .. tostring(err)))
end
@@ -48,14 +50,16 @@ end
local imagebox = { mt = {} }
-local rsvg_handle_cache = setmetatable({}, { __mode = 'k' })
+local rsvg_handle_cache = setmetatable({}, { __mode = "k" })
---Load rsvg handle form image file
-- @tparam string file Path to svg file.
-- @return Rsvg handle
-- @treturn table A table where cached data can be stored.
local function load_rsvg_handle(file)
- if not Rsvg then return end
+ if not Rsvg then
+ return
+ end
local cache = (rsvg_handle_cache[file] or {})["handle"]
@@ -65,7 +69,7 @@ local function load_rsvg_handle(file)
local handle, err
- if file:match("<[?]?xml") or file:match("<svg") then
+ if file:match "<[?]?xml" or file:match "<svg" then
handle, err = Rsvg.Handle.new_from_data(file)
else
handle, err = Rsvg.Handle.new_from_file(file)
@@ -81,7 +85,9 @@ end
---Apply cairo surface for given imagebox widget
local function set_surface(ib, surf)
local is_surf_valid = surf.width > 0 and surf.height > 0
- if not is_surf_valid then return false end
+ if not is_surf_valid then
+ return false
+ end
ib._private.default = { width = surf.width, height = surf.height }
ib._private.handle = nil
@@ -93,7 +99,9 @@ end
local function set_handle(ib, handle, cache)
local dim = handle:get_dimensions()
local is_handle_valid = dim.width > 0 and dim.height > 0
- if not is_handle_valid then return false end
+ if not is_handle_valid then
+ return false
+ end
ib._private.default = { width = dim.width, height = dim.height }
ib._private.handle = handle
@@ -124,18 +132,15 @@ end
-- It's necessary because a single RSVG handle can be used by
-- many imageboxes. So DPI and Stylesheet need to be set each time.
local function update_dpi(self, ctx)
- if not self._private.handle then return end
+ if not self._private.handle then
+ return
+ end
- local dpi = self._private.auto_dpi and
- ctx.dpi or
- self._private.dpi or
- nil
+ local dpi = self._private.auto_dpi and ctx.dpi or self._private.dpi or nil
- local need_dpi = dpi and
- self._private.last_dpi ~= dpi
+ local need_dpi = dpi and self._private.last_dpi ~= dpi
- local need_style = self._private.handle.set_stylesheet and
- self._private.stylesheet
+ local need_style = self._private.handle.set_stylesheet and self._private.stylesheet
local old_size = self._private.default and self._private.default.width
@@ -163,14 +168,16 @@ local function update_dpi(self, ctx)
-- This can happen in the constructor when `dpi` is set after `image`.
if old_size and old_size ~= self._private.default.width then
- self:emit_signal("widget::redraw_needed")
- self:emit_signal("widget::layout_changed")
+ self:emit_signal "widget::redraw_needed"
+ self:emit_signal "widget::layout_changed"
end
end
-- Draw an imagebox with the given cairo context in the given geometry.
function imagebox:draw(ctx, cr, width, height)
- if width == 0 or height == 0 or not self._private.default then return end
+ if width == 0 or height == 0 or not self._private.default then
+ return
+ end
-- For valign = "top" and halign = "left"
local translate = {
@@ -186,15 +193,15 @@ function imagebox:draw(ctx, cr, width, height)
-- That's for the "fit" policy.
local aspects = {
w = width / w,
- h = height / h
+ h = height / h,
}
local policy = {
w = self._private.horizontal_fit_policy or "auto",
- h = self._private.vertical_fit_policy or "auto"
+ h = self._private.vertical_fit_policy or "auto",
}
- for _, aspect in ipairs {"w", "h"} do
+ for _, aspect in ipairs { "w", "h" } do
if self._private.upscale == false and (w < width and h < height) then
aspects[aspect] = 1
elseif self._private.downscale == false and (w >= width and h >= height) then
@@ -209,15 +216,15 @@ function imagebox:draw(ctx, cr, width, height)
end
if self._private.halign == "center" then
- translate.x = math.floor((width - w*aspects.w)/2)
+ translate.x = math.floor((width - w * aspects.w) / 2)
elseif self._private.halign == "right" then
- translate.x = math.floor(width - (w*aspects.w))
+ translate.x = math.floor(width - (w * aspects.w))
end
if self._private.valign == "center" then
- translate.y = math.floor((height - h*aspects.h)/2)
+ translate.y = math.floor((height - h * aspects.h) / 2)
elseif self._private.valign == "bottom" then
- translate.y = math.floor(height - (h*aspects.h))
+ translate.y = math.floor(height - (h * aspects.h))
end
cr:translate(translate.x, translate.y)
@@ -226,25 +233,25 @@ function imagebox:draw(ctx, cr, width, height)
local threshold, max_factor = self._private.max_scaling_factor, math.max(aspects.w, aspects.h)
if threshold and threshold > 0 and threshold < max_factor then
- aspects.w = (aspects.w*threshold)/max_factor
- aspects.h = (aspects.h*threshold)/max_factor
+ aspects.w = (aspects.w * threshold) / max_factor
+ aspects.h = (aspects.h * threshold) / max_factor
end
-- Set the clip
if self._private.clip_shape then
- cr:clip(self._private.clip_shape(cr, w*aspects.w, h*aspects.h, unpack(self._private.clip_args)))
+ cr:clip(self._private.clip_shape(cr, w * aspects.w, h * aspects.h, unpack(self._private.clip_args)))
end
cr:scale(aspects.w, aspects.h)
else
if self._private.halign == "center" then
- translate.x = math.floor((width - w)/2)
+ translate.x = math.floor((width - w) / 2)
elseif self._private.halign == "right" then
translate.x = math.floor(width - w)
end
if self._private.valign == "center" then
- translate.y = math.floor((height - h)/2)
+ translate.y = math.floor((height - h) / 2)
elseif self._private.valign == "bottom" then
translate.y = math.floor(height - h)
end
@@ -274,7 +281,9 @@ end
-- Fit the imagebox into the given geometry
function imagebox:fit(ctx, width, height)
- if not self._private.default then return 0, 0 end
+ if not self._private.default then
+ return 0, 0
+ end
update_dpi(self, ctx)
@@ -349,11 +358,13 @@ function imagebox:set_image(image)
self._private.default = nil
end
- if not setup_succeed then return false end
+ if not setup_succeed then
+ return false
+ end
- self:emit_signal("widget::redraw_needed")
- self:emit_signal("widget::layout_changed")
- self:emit_signal("property::image")
+ self:emit_signal "widget::redraw_needed"
+ self:emit_signal "widget::layout_changed"
+ self:emit_signal "property::image"
return true
end
@@ -383,8 +394,8 @@ end
-- @see clip_shape
function imagebox:set_clip_shape(clip_shape, ...)
self._private.clip_shape = clip_shape
- self._private.clip_args = {...}
- self:emit_signal("widget::redraw_needed")
+ self._private.clip_args = { ... }
+ self:emit_signal "widget::redraw_needed"
self:emit_signal("property::clip_shape", clip_shape)
end
@@ -468,14 +479,14 @@ end
-- @propemits true false
-- @see dpi
-for _, prop in ipairs {"stylesheet", "dpi", "auto_dpi"} do
+for _, prop in ipairs { "stylesheet", "dpi", "auto_dpi" } do
imagebox["set_" .. prop] = function(self, value)
-- It will be set in :fit and :draw. The handle is shared
-- by multiple imagebox, so it cannot be set just once.
self._private[prop] = value
- self:emit_signal("widget::redraw_needed")
- self:emit_signal("widget::layout_changed")
+ self:emit_signal "widget::redraw_needed"
+ self:emit_signal "widget::layout_changed"
self:emit_signal("property::" .. prop)
end
end
@@ -490,12 +501,12 @@ function imagebox:set_resize(allowed)
self:emit_signal("property::upscale", allowed)
end
- self:emit_signal("widget::redraw_needed")
- self:emit_signal("widget::layout_changed")
+ self:emit_signal "widget::redraw_needed"
+ self:emit_signal "widget::layout_changed"
self:emit_signal("property::resize", allowed)
end
-for _, prop in ipairs {"downscale", "upscale" } do
+for _, prop in ipairs { "downscale", "upscale" } do
imagebox["set_" .. prop] = function(self, allowed)
self._private[prop] = allowed
@@ -504,9 +515,9 @@ for _, prop in ipairs {"downscale", "upscale" } do
self:emit_signal("property::resize", self._private.resize)
end
- self:emit_signal("widget::redraw_needed")
- self:emit_signal("widget::layout_changed")
- self:emit_signal("property::"..prop, allowed)
+ self:emit_signal "widget::redraw_needed"
+ self:emit_signal "widget::layout_changed"
+ self:emit_signal("property::" .. prop, allowed)
end
end
@@ -542,7 +553,6 @@ end
-- @see horizontal_fit_policy
-- @see resize
-
--- The vertical alignment.
--
-- @DOC_wibox_widget_imagebox_valign_EXAMPLE@
@@ -627,30 +637,34 @@ end
-- @see max_scaling_factor
local defaults = {
- halign = "left",
- valign = "top",
+ halign = "left",
+ valign = "top",
horizontal_fit_policy = "auto",
- vertical_fit_policy = "auto",
- max_scaling_factor = 0,
- scaling_quality = "good"
+ vertical_fit_policy = "auto",
+ max_scaling_factor = 0,
+ scaling_quality = "good",
}
local function get_default(prop, value)
- if value == nil then return defaults[prop] end
+ if value == nil then
+ return defaults[prop]
+ end
return value
end
for prop in pairs(defaults) do
- imagebox["set_"..prop] = function(self, value)
- if value == self._private[prop] then return end
+ imagebox["set_" .. prop] = function(self, value)
+ if value == self._private[prop] then
+ return
+ end
self._private[prop] = get_default(prop, value)
- self:emit_signal("widget::redraw_needed")
- self:emit_signal("property::"..prop, self._private[prop])
+ self:emit_signal "widget::redraw_needed"
+ self:emit_signal("property::" .. prop, self._private[prop])
end
- imagebox["get_"..prop] = function(self)
+ imagebox["get_" .. prop] = function(self)
if self._private[prop] == nil then
return defaults[prop]
end
@@ -678,7 +692,7 @@ end
-- @treturn wibox.widget.imagebox A new `wibox.widget.imagebox` widget instance.
-- @constructorfct wibox.widget.imagebox
local function new(image, resize_allowed, clip_shape, ...)
- local ret = base.make_widget(nil, nil, {enable_properties = true})
+ local ret = base.make_widget(nil, nil, { enable_properties = true })
gtable.crush(ret, imagebox, true)
ret._private.resize = true
@@ -692,7 +706,7 @@ local function new(image, resize_allowed, clip_shape, ...)
end
ret._private.clip_shape = clip_shape
- ret._private.clip_args = {...}
+ ret._private.clip_args = { ... }
return ret
end
diff --git a/.config/awesome/ui/statusbar/panel/widgets/linegraph.lua b/.config/awesome/ui/statusbar/panel/widgets/linegraph.lua
deleted file mode 100644
index 9a42632..0000000
--- a/.config/awesome/ui/statusbar/panel/widgets/linegraph.lua
+++ /dev/null
@@ -1,154 +0,0 @@
-local gcolor = require "gears.color"
-local gtable = require "gears.table"
-local wibox = require "wibox"
-
-local linegraph = { mt = {} }
-
-function linegraph:fit(_, width, height)
- if #self._private.values < 2 then
- return 0, 0
- end
- return width, height
-end
-
-function linegraph:draw(_, cr, width, height)
- if #self._private.values < 2 then
- return
- end
- local line_width = self._private.line_width
- local values = self._private.values
-
- local max, min = self._private.max or 0, self._private.min or 0
- if not (self._private.max and self._private.min) then
- for _, value in ipairs(values) do
- if not self._private.max then
- max = max < value and value or max
- end
- if not self._private.min then
- min = min > value and value or min
- end
- end
- end
-
- local usable_height = height - line_width
- local min_abs = math.abs(min)
- local h_factor = usable_height / (min_abs + max)
-
- local function transform(value)
- return usable_height - math.floor((value + min_abs) * h_factor) + line_width / 2
- end
-
- local graph_values = {}
- for i = 1, #values, math.ceil(#values / width) do
- table.insert(graph_values, transform(values[i]))
- end
-
- if self._private.draw_bg then
- cr:save()
- self._private.draw_bg(cr, width, height, min, max, transform)
- cr:restore()
- end
-
- cr:set_line_width(line_width)
- cr:set_source(gcolor(self.color))
- cr:move_to(line_width / 2, graph_values[1])
- for i = 2, #graph_values do
- cr:line_to((width - line_width / 2) / (#graph_values - 1) * (i - 1), graph_values[i])
- end
-
- if self._private.fill then
- cr:line_to(width - line_width / 2, transform(min))
- cr:line_to(line_width / 2, transform(min))
- cr:line_to(line_width / 2, graph_values[1])
- cr:stroke_preserve()
- cr:set_source(gcolor(self.fill_color))
- cr:fill()
- else
- cr:stroke()
- end
-end
-
-function linegraph:set_values(values)
- self._private.values = values
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_values()
- return self._private.values
-end
-
-function linegraph:set_draw_bg(draw_bg)
- self._private.draw_bg = draw_bg
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_draw_bg()
- return self._private.draw_bg
-end
-
-function linegraph:set_max(max)
- self._private.max = max
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_max()
- return self._private.max
-end
-
-function linegraph:set_min(min)
- self._private.max = min
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_min()
- return self._private.min
-end
-
-function linegraph:set_line_width(line_width)
- self._private.line_width = line_width
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:set_color(color)
- self._private.color = color
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_color()
- return self._private.color
-end
-
-function linegraph:set_fill_color(fill_color)
- self._private.fill_color = fill_color
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_fill_color()
- return self._private.fill_color
-end
-
-function linegraph:set_fill(fill)
- self._private.fill = fill
- self:emit_signal "widget::redraw_needed"
-end
-
-function linegraph:get_fill()
- return self._private.fill
-end
-
-local function new()
- local ret = wibox.widget.base.make_widget(nil, nil, { enable_properties = true })
- gtable.crush(ret, linegraph, true)
-
- ret.line_width = 1
- ret.color = "#ffffff"
- ret.fill_color = "#000000"
-
- return ret
-end
-
-function linegraph.mt:__call()
- return new()
-end
-
-return setmetatable(linegraph, linegraph.mt)
diff --git a/.config/awesome/ui/statusbar/panel/widgets/music.lua b/.config/awesome/ui/statusbar/panel/widgets/music.lua
index 3eedb55..eea7335 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/music.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/music.lua
@@ -1,28 +1,10 @@
-local cairo = require "lgi".cairo
-local gcolor = require "gears.color"
-local gsurface = require "gears.surface"
-local imagebox = require "ui.statusbar.panel.widgets.imagebox"
-local phosphor = require "assets.phosphor"
-local playerctl = require "services.playerctl"
local qnative = require "quarrel.native"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local wibox = require "wibox"
-local default_cover = phosphor.vinyl_record_fill
local default_text = "Nothing playing"
-local function faded_cover(cover)
- local surface = gsurface(cover)
- local w,h = gsurface.get_size(surface)
- local cr = cairo.Context(surface)
- local pattern = gcolor(qvars.colors.bg .. "aa")
- cr:rectangle(0, 0, w, h)
- cr:set_source(pattern)
- cr:fill_preserve()
- return surface
-end
-
local w_title = wibox.widget {
widget = wibox.widget.textbox,
text = "Nothing playing",
@@ -33,20 +15,8 @@ local w_artist = wibox.widget {
fg = qvars.colors.dim.fg,
{
widget = wibox.widget.textbox,
- text = ""
- }
-}
-
-local w_cover = wibox.widget {
- widget = imagebox,
- image = default_cover,
- stylesheet = qui.recolor(qvars.colors.bright.black),
- forced_height = qvars.char_height * 6 + qvars.big_padding * 2,
- forced_width = qvars.expanded_bar_size - qvars.big_padding,
- horizontal_fit_policy = "cover",
- vertical_fit_policy = "cover",
- valign = "center",
- halign = "center"
+ text = "",
+ },
}
local w_progress_bar = wibox.widget {
@@ -54,100 +24,22 @@ local w_progress_bar = wibox.widget {
max_value = 0,
value = 0,
forced_height = qvars.char_height / 2,
- forced_width = qvars.expanded_bar_size - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2) - (qvars.char_height / 1.25 + qvars.padding) * 3,
+ forced_width = qvars.expanded_bar_size
+ - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2)
+ - (qvars.char_height / 1.25 + qvars.padding) * 3,
color = qvars.colors.yellow,
background_color = qvars.colors.black,
shape = qvars.shape,
}
-local w_play_pause = qui.toggle {
- widget = {
- forced_height = qvars.char_height / 1.25,
- forced_width = qvars.char_height / 1.25
- },
- off = phosphor.play_fill,
- on = phosphor.pause_fill,
- manual = true,
- press = function()
- playerctl:play_pause()
- end
-}
-
-local w_skip_forward = qui.button {
- widget = {
- forced_height = qvars.char_height / 1.25,
- forced_width = qvars.char_height / 1.25
- },
- image = phosphor.skip_forward_fill,
- press = function()
- playerctl:next()
- end
-}
-
-local w_skip_back = qui.button {
- widget = {
- forced_height = qvars.char_height / 1.25,
- forced_width = qvars.char_height / 1.25
- },
- image = phosphor.skip_back_fill,
- press = function()
- playerctl:previous()
- end
-}
-
local music = wibox.widget(qui.styled {
widget = wibox.container.background,
{
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
{
- widget = wibox.container.background,
- bg = qvars.colors.black
- },
- w_cover,
- {
- widget = wibox.container.margin,
- margins = qvars.big_padding,
{
{
- {
- widget = wibox.container.background,
- bg = qvars.colors.bg,
- shape = qvars.shape,
- {
- widget = wibox.container.margin,
- margins = qvars.padding,
- {
- {
- widget = wibox.container.constraint,
- width = qvars.expanded_bar_size - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2),
- height = qvars.char_height,
- {
- widget = wibox.container.scroll.horizontal,
- speed = 50,
- step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
- w_title
- }
- },
- {
- widget = wibox.container.constraint,
- width = qvars.expanded_bar_size - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2),
- height = qvars.char_height,
- {
- widget = wibox.container.scroll.horizontal,
- speed = 50,
- step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
- w_artist
- }
- },
- layout = wibox.layout.fixed.vertical
- }
- }
- },
- nil,
- nil,
- layout = wibox.layout.align.horizontal
- },
- nil,
- {
widget = wibox.container.background,
bg = qvars.colors.bg,
shape = qvars.shape,
@@ -155,29 +47,53 @@ local music = wibox.widget(qui.styled {
widget = wibox.container.margin,
margins = qvars.padding,
{
- w_play_pause,
- w_skip_back,
{
- widget = wibox.container.place,
- w_progress_bar
+ widget = wibox.container.constraint,
+ width = qvars.expanded_bar_size
+ - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2),
+ height = qvars.char_height,
+ {
+ widget = wibox.container.scroll.horizontal,
+ speed = 50,
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ w_title,
+ },
},
- w_skip_forward,
- layout = wibox.layout.fixed.horizontal,
- spacing = qvars.padding
- }
- }
+ {
+ widget = wibox.container.constraint,
+ width = qvars.expanded_bar_size
+ - (qvars.big_padding + qvars.big_padding * 2 + qvars.padding * 2),
+ height = qvars.char_height,
+ {
+ widget = wibox.container.scroll.horizontal,
+ speed = 50,
+ step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
+ w_artist,
+ },
+ },
+ layout = wibox.layout.fixed.vertical,
+ },
+ },
},
- layout = wibox.layout.align.vertical
- }
+ nil,
+ nil,
+ layout = wibox.layout.align.horizontal,
+ },
+ nil,
+ {
+ widget = wibox.container.background,
+ bg = qvars.colors.bg,
+ shape = qvars.shape,
+ w_progress_bar,
+ },
+ layout = wibox.layout.align.vertical,
},
- layout = wibox.layout.stack
- }
+ },
})
awesome.connect_signal("services::playerctl::metadata", function(title, artist, album_path)
- w_title.text = title ~= "" and qnative.decode_html(title) or default_text
- w_artist.widget.text = qnative.decode_html(artist)
- w_cover.image = faded_cover(album_path)
+ w_title.text = title ~= "" and qnative.util.decode_html(title) or default_text
+ w_artist.widget.text = qnative.util.decode_html(artist)
end)
awesome.connect_signal("services::playerctl::position", function(position, length)
@@ -186,15 +102,10 @@ awesome.connect_signal("services::playerctl::position", function(position, lengt
end)
awesome.connect_signal("services::playerctl::no_players", function()
- w_title = default_text
- w_artist = ""
- w_cover.image = default_cover
+ w_title.text = default_text
+ w_artist.text = ""
w_progress_bar.value = 0
w_progress_bar.max_value = 0
end)
-awesome.connect_signal("services::playerctl::playback_status", function(playing)
- w_play_pause:silent_press(playing)
-end)
-
return music
diff --git a/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua b/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua
index cf0de28..feea829 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/power_menu.lua
@@ -4,7 +4,7 @@ local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local wibox = require "wibox"
-local power_menu = wibox.widget {
+return wibox.widget {
qui.styled {
widget = wibox.container.background,
bg = qvars.colors.black,
@@ -15,12 +15,12 @@ local power_menu = wibox.widget {
qbind:new {
triggers = qvars.btns.left,
press = function()
- q.debug("from 1")
+ q.debug "from 1"
end,
- hidden = true
- }
- }
- }
+ hidden = true,
+ },
+ },
+ },
},
qui.styled {
widget = wibox.container.background,
@@ -32,12 +32,12 @@ local power_menu = wibox.widget {
qbind:new {
triggers = qvars.btns.left,
press = function()
- q.debug("from 2")
+ q.debug "from 2"
end,
- hidden = true
- }
- }
- }
+ hidden = true,
+ },
+ },
+ },
},
qui.styled {
widget = wibox.container.background,
@@ -49,14 +49,12 @@ local power_menu = wibox.widget {
qbind:new {
triggers = qvars.btns.left,
press = function()
- q.debug("from 3")
+ q.debug "from 3"
end,
- hidden = true
- }
- }
- }
+ hidden = true,
+ },
+ },
+ },
},
- layout = wibox.layout.flex.horizontal
+ layout = wibox.layout.flex.horizontal,
}
-
-return power_menu
diff --git a/.config/awesome/ui/statusbar/panel/widgets/wifi.lua b/.config/awesome/ui/statusbar/panel/widgets/wifi.lua
index 579474e..ad2234f 100644
--- a/.config/awesome/ui/statusbar/panel/widgets/wifi.lua
+++ b/.config/awesome/ui/statusbar/panel/widgets/wifi.lua
@@ -1,7 +1,9 @@
+local lgi = require "lgi"
local phosphor = require "assets.phosphor"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local wibox = require "wibox"
+local glib = lgi.GLib
local wifi = wibox.widget(qui.styled {
widget = wibox.container.background,
@@ -13,17 +15,23 @@ local wifi = wibox.widget(qui.styled {
widget = wibox.container.place,
valign = "center",
halign = "center",
- qui.icon(phosphor.wifi_x_fill, qvars.colors.red, { id = "icon" })
+ qui.icon {
+ icon = phosphor.wifi_x_fill,
+ color = qvars.colors.red,
+ widget = {
+ id = "icon",
+ },
+ },
},
{
widget = wibox.widget.textbox,
text = "Disconnected",
- id = "essid"
+ id = "essid",
},
layout = wibox.layout.fixed.horizontal,
- spacing = qvars.padding
- }
- }
+ spacing = qvars.padding,
+ },
+ },
})
awesome.connect_signal("services::wifi", function(essid, _, connected)
diff --git a/.config/awesome/ui/statusbar/widgets/clock.lua b/.config/awesome/ui/statusbar/widgets/clock.lua
index ff57a36..c186dc5 100644
--- a/.config/awesome/ui/statusbar/widgets/clock.lua
+++ b/.config/awesome/ui/statusbar/widgets/clock.lua
@@ -1,13 +1,11 @@
local qvars = require "quarrel.vars"
local wibox = require "wibox"
-local clock = wibox.widget {
+return wibox.widget {
widget = wibox.container.place,
{
format = "%H\n%M",
widget = wibox.widget.textclock,
- font = qvars.font
- }
+ font = qvars.font,
+ },
}
-
-return clock
diff --git a/.config/awesome/ui/statusbar/widgets/displays.lua b/.config/awesome/ui/statusbar/widgets/displays.lua
index 44ff2c6..62e4398 100644
--- a/.config/awesome/ui/statusbar/widgets/displays.lua
+++ b/.config/awesome/ui/statusbar/widgets/displays.lua
@@ -1,3 +1,4 @@
+local battery = require "services.battery"
local phosphor = require "assets.phosphor"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
@@ -8,32 +9,35 @@ local function create_display(icon, color)
widget = wibox.container.place,
valign = "center",
halign = "center",
- qui.icon(icon, color)
+ qui.icon {
+ icon = icon,
+ color = color,
+ },
}
end
-local battery = create_display(phosphor.battery_vertical_warning_fill, qvars.colors.red)
-awesome.connect_signal("services::battery::icon", function(icon, color)
- battery.widget.image = icon
- battery.widget.stylesheet = qui.recolor(color)
+local d_battery = create_display(phosphor.battery_vertical_warning_fill, qvars.colors.red)
+battery:connect_signal("icon", function(_, icon, color)
+ d_battery.widget.image = icon
+ d_battery.widget.stylesheet = qui.recolor(color)
end)
-local brightness = create_display(phosphor.moon_fill, qvars.colors.fg)
+local d_brightness = create_display(phosphor.moon_fill, qvars.colors.fg)
awesome.connect_signal("services::brightness::icon", function(icon, color)
- brightness.widget.image = icon
- brightness.widget.stylesheet = qui.recolor(color)
+ d_brightness.widget.image = icon
+ d_brightness.widget.stylesheet = qui.recolor(color)
end)
-local audio = create_display(phosphor.speaker_simple_slash_fill, qvars.colors.red)
+local d_audio = create_display(phosphor.speaker_simple_slash_fill, qvars.colors.red)
awesome.connect_signal("services::audio::icon", function(icon, color)
- audio.widget.image = icon
- audio.widget.stylesheet = qui.recolor(color)
+ d_audio.widget.image = icon
+ d_audio.widget.stylesheet = qui.recolor(color)
end)
-local wifi = create_display(phosphor.wifi_x_fill, qvars.colors.red)
+local d_wifi = create_display(phosphor.wifi_x_fill, qvars.colors.red)
awesome.connect_signal("services::wifi::icon", function(icon, color)
- wifi.widget.image = icon
- wifi.widget.stylesheet = qui.recolor(color)
+ d_wifi.widget.image = icon
+ d_wifi.widget.stylesheet = qui.recolor(color)
end)
-return { audio = audio, battery = battery, brightness = brightness, wifi = wifi }
+return { audio = d_audio, battery = d_battery, brightness = d_brightness, wifi = d_wifi }
diff --git a/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua b/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua
index 0bbbf14..d9302ff 100644
--- a/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua
+++ b/.config/awesome/ui/statusbar/widgets/keyboardlayout.lua
@@ -10,12 +10,12 @@
-- @supermodule wibox.widget.base
---------------------------------------------------------------------------
-local capi = {awesome = awesome}
+local capi = { awesome = awesome }
local setmetatable = setmetatable
-local textbox = require("wibox.widget.textbox")
-local button = require("awful.button")
-local widget_base = require("wibox.widget.base")
-local gdebug = require("gears.debug")
+local button = require "awful.button"
+local gdebug = require "gears.debug"
+local textbox = require "wibox.widget.textbox"
+local widget_base = require "wibox.widget.base"
--- Keyboard Layout widget.
-- awful.widget.keyboardlayout
@@ -24,109 +24,109 @@ local keyboardlayout = { mt = {} }
-- As to the country-code-like symbols below, refer to the names of XKB's
-- data files in /.../xkb/symbols/*.
keyboardlayout.xkeyboard_country_code = {
- ["ad"] = true, -- Andorra
- ["af"] = true, -- Afganistan
- ["al"] = true, -- Albania
- ["am"] = true, -- Armenia
- ["ara"] = true, -- Arabic
- ["at"] = true, -- Austria
- ["az"] = true, -- Azerbaijan
- ["ba"] = true, -- Bosnia and Herzegovina
- ["bd"] = true, -- Bangladesh
- ["be"] = true, -- Belgium
- ["bg"] = true, -- Bulgaria
- ["br"] = true, -- Brazil
- ["bt"] = true, -- Bhutan
- ["bw"] = true, -- Botswana
- ["by"] = true, -- Belarus
- ["ca"] = true, -- Canada
- ["cd"] = true, -- Congo
- ["ch"] = true, -- Switzerland
- ["cm"] = true, -- Cameroon
- ["cn"] = true, -- China
- ["cz"] = true, -- Czechia
- ["de"] = true, -- Germany
- ["dk"] = true, -- Denmark
- ["ee"] = true, -- Estonia
- ["epo"] = true, -- Esperanto
- ["es"] = true, -- Spain
- ["et"] = true, -- Ethiopia
- ["eu"] = true, -- EurKey
- ["fi"] = true, -- Finland
- ["fo"] = true, -- Faroe Islands
- ["fr"] = true, -- France
- ["gb"] = true, -- United Kingdom
- ["ge"] = true, -- Georgia
- ["gh"] = true, -- Ghana
- ["gn"] = true, -- Guinea
- ["gr"] = true, -- Greece
- ["hr"] = true, -- Croatia
- ["hu"] = true, -- Hungary
- ["ie"] = true, -- Ireland
- ["il"] = true, -- Israel
- ["in"] = true, -- India
- ["iq"] = true, -- Iraq
- ["ir"] = true, -- Iran
- ["is"] = true, -- Iceland
- ["it"] = true, -- Italy
- ["jp"] = true, -- Japan
- ["ke"] = true, -- Kenya
- ["kg"] = true, -- Kyrgyzstan
- ["kh"] = true, -- Cambodia
- ["kr"] = true, -- Korea
- ["kz"] = true, -- Kazakhstan
- ["la"] = true, -- Laos
+ ["ad"] = true, -- Andorra
+ ["af"] = true, -- Afganistan
+ ["al"] = true, -- Albania
+ ["am"] = true, -- Armenia
+ ["ara"] = true, -- Arabic
+ ["at"] = true, -- Austria
+ ["az"] = true, -- Azerbaijan
+ ["ba"] = true, -- Bosnia and Herzegovina
+ ["bd"] = true, -- Bangladesh
+ ["be"] = true, -- Belgium
+ ["bg"] = true, -- Bulgaria
+ ["br"] = true, -- Brazil
+ ["bt"] = true, -- Bhutan
+ ["bw"] = true, -- Botswana
+ ["by"] = true, -- Belarus
+ ["ca"] = true, -- Canada
+ ["cd"] = true, -- Congo
+ ["ch"] = true, -- Switzerland
+ ["cm"] = true, -- Cameroon
+ ["cn"] = true, -- China
+ ["cz"] = true, -- Czechia
+ ["de"] = true, -- Germany
+ ["dk"] = true, -- Denmark
+ ["ee"] = true, -- Estonia
+ ["epo"] = true, -- Esperanto
+ ["es"] = true, -- Spain
+ ["et"] = true, -- Ethiopia
+ ["eu"] = true, -- EurKey
+ ["fi"] = true, -- Finland
+ ["fo"] = true, -- Faroe Islands
+ ["fr"] = true, -- France
+ ["gb"] = true, -- United Kingdom
+ ["ge"] = true, -- Georgia
+ ["gh"] = true, -- Ghana
+ ["gn"] = true, -- Guinea
+ ["gr"] = true, -- Greece
+ ["hr"] = true, -- Croatia
+ ["hu"] = true, -- Hungary
+ ["ie"] = true, -- Ireland
+ ["il"] = true, -- Israel
+ ["in"] = true, -- India
+ ["iq"] = true, -- Iraq
+ ["ir"] = true, -- Iran
+ ["is"] = true, -- Iceland
+ ["it"] = true, -- Italy
+ ["jp"] = true, -- Japan
+ ["ke"] = true, -- Kenya
+ ["kg"] = true, -- Kyrgyzstan
+ ["kh"] = true, -- Cambodia
+ ["kr"] = true, -- Korea
+ ["kz"] = true, -- Kazakhstan
+ ["la"] = true, -- Laos
["latam"] = true, -- Latin America
["latin"] = true, -- Latin
- ["lk"] = true, -- Sri Lanka
- ["lt"] = true, -- Lithuania
- ["lv"] = true, -- Latvia
- ["ma"] = true, -- Morocco
- ["mao"] = true, -- Maori
- ["me"] = true, -- Montenegro
- ["mk"] = true, -- Macedonia
- ["ml"] = true, -- Mali
- ["mm"] = true, -- Myanmar
- ["mn"] = true, -- Mongolia
- ["mt"] = true, -- Malta
- ["mv"] = true, -- Maldives
- ["ng"] = true, -- Nigeria
- ["nl"] = true, -- Netherlands
- ["no"] = true, -- Norway
- ["np"] = true, -- Nepal
- ["ph"] = true, -- Philippines
- ["pk"] = true, -- Pakistan
- ["pl"] = true, -- Poland
- ["pt"] = true, -- Portugal
- ["ro"] = true, -- Romania
- ["rs"] = true, -- Serbia
- ["ru"] = true, -- Russia
- ["se"] = true, -- Sweden
- ["si"] = true, -- Slovenia
- ["sk"] = true, -- Slovakia
- ["sn"] = true, -- Senegal
- ["sy"] = true, -- Syria
- ["th"] = true, -- Thailand
- ["tj"] = true, -- Tajikistan
- ["tm"] = true, -- Turkmenistan
- ["tr"] = true, -- Turkey
- ["tw"] = true, -- Taiwan
- ["tz"] = true, -- Tanzania
- ["ua"] = true, -- Ukraine
- ["us"] = true, -- USA
- ["uz"] = true, -- Uzbekistan
- ["vn"] = true, -- Vietnam
- ["za"] = true, -- South Africa
+ ["lk"] = true, -- Sri Lanka
+ ["lt"] = true, -- Lithuania
+ ["lv"] = true, -- Latvia
+ ["ma"] = true, -- Morocco
+ ["mao"] = true, -- Maori
+ ["me"] = true, -- Montenegro
+ ["mk"] = true, -- Macedonia
+ ["ml"] = true, -- Mali
+ ["mm"] = true, -- Myanmar
+ ["mn"] = true, -- Mongolia
+ ["mt"] = true, -- Malta
+ ["mv"] = true, -- Maldives
+ ["ng"] = true, -- Nigeria
+ ["nl"] = true, -- Netherlands
+ ["no"] = true, -- Norway
+ ["np"] = true, -- Nepal
+ ["ph"] = true, -- Philippines
+ ["pk"] = true, -- Pakistan
+ ["pl"] = true, -- Poland
+ ["pt"] = true, -- Portugal
+ ["ro"] = true, -- Romania
+ ["rs"] = true, -- Serbia
+ ["ru"] = true, -- Russia
+ ["se"] = true, -- Sweden
+ ["si"] = true, -- Slovenia
+ ["sk"] = true, -- Slovakia
+ ["sn"] = true, -- Senegal
+ ["sy"] = true, -- Syria
+ ["th"] = true, -- Thailand
+ ["tj"] = true, -- Tajikistan
+ ["tm"] = true, -- Turkmenistan
+ ["tr"] = true, -- Turkey
+ ["tw"] = true, -- Taiwan
+ ["tz"] = true, -- Tanzania
+ ["ua"] = true, -- Ukraine
+ ["us"] = true, -- USA
+ ["uz"] = true, -- Uzbekistan
+ ["vn"] = true, -- Vietnam
+ ["za"] = true, -- South Africa
}
-- Callback for updating current layout.
-local function update_status (self)
+local function update_status(self)
self._current = awesome.xkb_get_layout_group()
local text = ""
if #self._layout > 0 then
-- Please note that the group number reported by xkb_get_layout_group
-- is lower by one than the group numbers reported by xkb_get_group_names.
- local name = self._layout[self._current+1]
+ local name = self._layout[self._current + 1]
if name then
text = name
end
@@ -155,53 +155,45 @@ function keyboardlayout.get_groups_from_group_names(group_names)
-- pattern.
local pattern_and_callback_pairs = {
-- vendor/file(section):group_idx
- ["^" .. word_pat .. "/" .. word_pat .. sec_pat .. idx_pat .. "$"]
- = function(token, pattern)
- local vendor, file, section, group_idx = string.match(token, pattern)
- return vendor, file, section, group_idx
- end,
+ ["^" .. word_pat .. "/" .. word_pat .. sec_pat .. idx_pat .. "$"] = function(token, pattern)
+ local vendor, file, section, group_idx = string.match(token, pattern)
+ return vendor, file, section, group_idx
+ end,
-- vendor/file(section)
- ["^" .. word_pat .. "/" .. word_pat .. sec_pat .. "$"]
- = function(token, pattern)
- local vendor, file, section = string.match(token, pattern)
- return vendor, file, section, 1
- end,
+ ["^" .. word_pat .. "/" .. word_pat .. sec_pat .. "$"] = function(token, pattern)
+ local vendor, file, section = string.match(token, pattern)
+ return vendor, file, section, 1
+ end,
-- vendor/file:group_idx
- ["^" .. word_pat .. "/" .. word_pat .. idx_pat .. "$"]
- = function(token, pattern)
- local vendor, file, group_idx = string.match(token, pattern)
- return vendor, file, nil, group_idx
- end,
+ ["^" .. word_pat .. "/" .. word_pat .. idx_pat .. "$"] = function(token, pattern)
+ local vendor, file, group_idx = string.match(token, pattern)
+ return vendor, file, nil, group_idx
+ end,
-- vendor/file
- ["^" .. word_pat .. "/" .. word_pat .. "$"]
- = function(token, pattern)
- local vendor, file = string.match(token, pattern)
- return vendor, file, nil, 1
- end,
+ ["^" .. word_pat .. "/" .. word_pat .. "$"] = function(token, pattern)
+ local vendor, file = string.match(token, pattern)
+ return vendor, file, nil, 1
+ end,
-- file(section):group_idx
- ["^" .. word_pat .. sec_pat .. idx_pat .. "$"]
- = function(token, pattern)
- local file, section, group_idx = string.match(token, pattern)
- return nil, file, section, group_idx
- end,
+ ["^" .. word_pat .. sec_pat .. idx_pat .. "$"] = function(token, pattern)
+ local file, section, group_idx = string.match(token, pattern)
+ return nil, file, section, group_idx
+ end,
-- file(section)
- ["^" .. word_pat .. sec_pat .. "$"]
- = function(token, pattern)
- local file, section = string.match(token, pattern)
- return nil, file, section, 1
- end,
+ ["^" .. word_pat .. sec_pat .. "$"] = function(token, pattern)
+ local file, section = string.match(token, pattern)
+ return nil, file, section, 1
+ end,
-- file:group_idx
- ["^" .. word_pat .. idx_pat .. "$"]
- = function(token, pattern)
- local file, group_idx = string.match(token, pattern)
- return nil, file, nil, group_idx
- end,
+ ["^" .. word_pat .. idx_pat .. "$"] = function(token, pattern)
+ local file, group_idx = string.match(token, pattern)
+ return nil, file, nil, group_idx
+ end,
-- file
- ["^" .. word_pat .. "$"]
- = function(token, pattern)
- local file = string.match(token, pattern)
- return nil, file, nil, 1
- end
+ ["^" .. word_pat .. "$"] = function(token, pattern)
+ local file = string.match(token, pattern)
+ return nil, file, nil, 1
+ end,
}
-- Split 'group_names' into 'tokens'. The separator is "+".
@@ -229,10 +221,10 @@ function keyboardlayout.get_groups_from_group_names(group_names)
section = string.gsub(section, "%(([%w-_]+)%)", "%1")
end
- table.insert(layout_groups, { vendor = vendor,
- file = file,
- section = section,
- group_idx = tonumber(group_idx) })
+ table.insert(
+ layout_groups,
+ { vendor = vendor, file = file, section = section, group_idx = tonumber(group_idx) }
+ )
break
end
end
@@ -243,10 +235,10 @@ end
-- Callback for updating list of layouts
local function update_layout(self)
- self._layout = {};
+ self._layout = {}
local layouts = keyboardlayout.get_groups_from_group_names(awesome.xkb_get_group_names())
if layouts == nil or layouts[1] == nil then
- gdebug.print_error("Failed to get list of keyboard groups")
+ gdebug.print_error "Failed to get list of keyboard groups"
return
end
if #layouts == 1 then
@@ -270,7 +262,7 @@ end
-- @treturn awful.widget.keyboardlayout A keyboard layout widget.
function keyboardlayout.new()
local widget = textbox()
- local self = widget_base.make_widget(widget, nil, {enable_properties=true})
+ local self = widget_base.make_widget(widget, nil, { enable_properties = true })
self.widget = widget
@@ -288,30 +280,31 @@ function keyboardlayout.new()
self.set_layout = function(group_number)
if (0 > group_number) or (group_number > #self._layout) then
- error("Invalid group number: " .. group_number ..
- "expected number from 0 to " .. #self._layout)
- return;
+ error("Invalid group number: " .. group_number .. "expected number from 0 to " .. #self._layout)
+ return
end
- awesome.xkb_set_layout_group(group_number);
+ awesome.xkb_set_layout_group(group_number)
end
- update_layout(self);
+ update_layout(self)
-- callback for processing layout changes
- capi.awesome.connect_signal("xkb::map_changed",
- function () update_layout(self) end)
- capi.awesome.connect_signal("xkb::group_changed",
- function () update_status(self) end);
+ capi.awesome.connect_signal("xkb::map_changed", function()
+ update_layout(self)
+ end)
+ capi.awesome.connect_signal("xkb::group_changed", function()
+ update_status(self)
+ end)
-- Mouse bindings
self.buttons = {
- button({ }, 1, self.next_layout)
+ button({}, 1, self.next_layout),
}
return self
end
-local _instance = nil;
+local _instance = nil
function keyboardlayout.mt:__call(...)
if _instance == nil then
@@ -320,8 +313,6 @@ function keyboardlayout.mt:__call(...)
return _instance
end
-
return setmetatable(keyboardlayout, keyboardlayout.mt)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
-
diff --git a/.config/awesome/ui/statusbar/widgets/taglist.lua b/.config/awesome/ui/statusbar/widgets/taglist.lua
index 1072426..df114df 100644
--- a/.config/awesome/ui/statusbar/widgets/taglist.lua
+++ b/.config/awesome/ui/statusbar/widgets/taglist.lua
@@ -1,75 +1,88 @@
local awful = require "awful"
-local gcolor = require "gears.color"
-local gdebug = require "gears.debug"
local phosphor = require "assets.phosphor"
local qbind = require "quarrel.bind"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
local wibox = require "wibox"
-return awful.widget.taglist {
- screen = screen[1],
- filter = awful.widget.taglist.filter.all,
- layout = {
- spacing = qvars.padding,
- layout = wibox.layout.fixed.vertical
- },
- widget_template = {
- widget = wibox.container.place,
- valign = "center",
- halign = "center",
- create_callback = function(self, tag)
- self.widget = qui.icon(tag.icon)
-
- self:connect_signal("mouse::enter", function()
- if tag.selected then return end
- self.widget.stylesheet = qui.recolor(qvars.colors.yellow)
- end)
+return function(s)
+ return awful.widget.taglist {
+ screen = s,
+ filter = awful.widget.taglist.filter.all,
+ layout = {
+ spacing = qvars.padding,
+ layout = wibox.layout.fixed.vertical,
+ },
+ widget_template = {
+ widget = wibox.container.place,
+ valign = "center",
+ halign = "center",
+ create_callback = function(self, tag)
+ self.widget = qui.icon {
+ icon = phosphor[next(tag:clients()) and "circle_fill" or "circle_bold"],
+ widget = {
+ forced_height = qvars.char_height / 1.5,
+ forced_width = qvars.char_height / 1.5,
+ },
+ }
+ -- self.widget = wibox.widget {
+ --
+ -- }
- self:connect_signal("mouse::leave", function()
- if tag.selected then return end
- self.widget.stylesheet = qui.recolor(qvars.colors.fg)
- end)
+ self:connect_signal("mouse::enter", function()
+ if tag.selected then
+ return
+ end
+ self.widget.stylesheet = qui.recolor(qvars.colors.yellow)
+ end)
- if tag.selected then
- self.widget.stylesheet = qui.recolor(qvars.colors.yellow)
- return
- end
+ self:connect_signal("mouse::leave", function()
+ if tag.selected then
+ return
+ end
+ self.widget.stylesheet = qui.recolor(qvars.colors.fg)
+ end)
- self.widget.stylesheet = qui.recolor(qvars.colors.fg)
- end,
- update_callback = function(self, tag)
- -- self.widget.icon = phosphor[next(tag:clients()) and "circle_fill" or "circle_bold"]
+ if tag.selected then
+ self.widget.stylesheet = qui.recolor(qvars.colors.yellow)
+ return
+ end
- if tag.selected then
- self.widget.stylesheet = qui.recolor(qvars.colors.yellow)
- else
self.widget.stylesheet = qui.recolor(qvars.colors.fg)
- end
- end
- },
- buttons = {
- qbind:new {
- triggers = qvars.btns.left,
- press = function(t)
- t:view_only()
end,
- hidden = true
- },
- qbind:new {
- mods = qvars.mods.M,
- triggers = qvars.btns.left,
- press = function(t)
- if client.focus then
- client.focus:move_to_tag(t)
+ update_callback = function(self, tag)
+ self.widget.image = phosphor[next(tag:clients()) and "circle_fill" or "circle_bold"]
+
+ if tag.selected then
+ self.widget.stylesheet = qui.recolor(qvars.colors.yellow)
+ else
+ self.widget.stylesheet = qui.recolor(qvars.colors.fg)
end
end,
- hidden = true
},
- qbind:new {
- triggers = qvars.btns.right,
- press = awful.tag.viewtoggle,
- hidden = true
+ buttons = {
+ qbind:new {
+ triggers = qvars.btns.left,
+ press = function(t)
+ t:view_only()
+ end,
+ hidden = true,
+ },
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = qvars.btns.left,
+ press = function(t)
+ if client.focus then
+ client.focus:move_to_tag(t)
+ end
+ end,
+ hidden = true,
+ },
+ qbind:new {
+ triggers = qvars.btns.right,
+ press = awful.tag.viewtoggle,
+ hidden = true,
+ },
},
}
-}
+end
diff --git a/.config/awesome/ui/statusbar/widgets/tasklist.lua b/.config/awesome/ui/statusbar/widgets/tasklist.lua
new file mode 100644
index 0000000..9656185
--- /dev/null
+++ b/.config/awesome/ui/statusbar/widgets/tasklist.lua
@@ -0,0 +1,30 @@
+local awful = require "awful"
+local gears = require "gears"
+local qvars = require "quarrel.vars"
+local wibox = require "wibox"
+
+return function(s)
+ return awful.widget.tasklist {
+ screen = s,
+ filter = awful.widget.tasklist.filter.currenttags,
+ -- buttons = tasklist_buttons,
+ layout = {
+ spacing = qvars.padding,
+ layout = wibox.layout.flex.vertical,
+ },
+ widget_template = {
+ widget = wibox.container.place,
+ valign = "center",
+ halign = "center",
+ -- {
+ -- widget = awful.widget.clienticon,
+
+ -- }
+ {
+ widget = awful.widget.clienticon,
+ forced_width = qvars.char_height,
+ forced_height = qvars.char_height,
+ },
+ },
+ }
+end
diff --git a/.config/awesome/ui/wicked/_default.lua b/.config/awesome/ui/wicked/_default.lua
deleted file mode 100644
index 25283f9..0000000
--- a/.config/awesome/ui/wicked/_default.lua
+++ /dev/null
@@ -1,94 +0,0 @@
-----------------------------------------------------------------------------
---- The default widget template for the notifications.
---
--- @author Emmanuel Lepage Vallee &lt;elv1313@gmail.com&gt;
--- @copyright 2019 Emmanuel Lepage Vallee
--- @classmod naughty.widget._default
-----------------------------------------------------------------------------
-
-local wibox = require("wibox")
-local actionlist = require("naughty.list.actions")
-local wtitle = require("naughty.widget.title")
-local wmessage = require("naughty.widget.message")
-local wicon = require("naughty.widget.icon")
-local wbg = require("naughty.container.background")
-local beautiful = require("beautiful")
-local dpi = require("beautiful").xresources.apply_dpi
-
--- It is not worth doing a special widget for this.
-local function notif_size()
- local constraint = wibox.container.constraint()
- constraint:set_strategy("max")
- constraint:set_width(beautiful.notification_max_width or dpi(500))
-
- rawset(constraint, "set_notification", function(_, notif)
- constraint._private.notification = setmetatable({notif}, {__mode = "v"})
- local s = false
-
- if notif.width and notif.width ~= beautiful.notification_max_width then
- constraint.width = notif.width
- s = true
- end
- if notif.height then
- constraint.height = notif.height
- s = true
- end
-
- constraint.strategy = s and "exact" or "max"
- end)
-
- rawset(constraint, "get_notification", function()
- return constraint._private.notification[1]
- end)
-
- return constraint
-end
-
--- It is not worth doing a special widget for this either.
-local function notif_margins()
- local margins = wibox.container.margin()
- margins:set_margins(beautiful.notification_margin or 4)
-
- rawset(margins, "set_notification", function(_, notif)
- if notif.margin then
- margins:set_margins(notif.margin)
- end
- end)
-
- return margins
-end
-
--- Used as a fallback when no widget_template is provided, emulate the legacy
--- widget.
-return {
- {
- {
- {
- {
- wicon,
- {
- widget = wibox.container.place,
- valign = "center",
- halign = "center",
- {
- wtitle,
- wmessage,
- -- spacing = 4,
- layout = wibox.layout.fixed.vertical,
- }
- },
- fill_space = true,
- -- spacing = 4,
- layout = wibox.layout.fixed.horizontal
- },
- actionlist,
- -- spacing = 10,
- layout = wibox.layout.fixed.vertical,
- },
- widget = notif_margins,
- },
- id = "background_role",
- widget = wbg,
- },
- widget = notif_size,
-}
diff --git a/.config/awesome/ui/wicked/init.lua b/.config/awesome/ui/wicked/init.lua
index 76d77cf..ddbf912 100644
--- a/.config/awesome/ui/wicked/init.lua
+++ b/.config/awesome/ui/wicked/init.lua
@@ -1,97 +1,203 @@
local awful = require "awful"
-local debug = require "gears.debug"
-local default = require "ui.wicked._default"
-local gtimer = require "gears.timer"
+local beautiful = require "beautiful"
+local gshape = require "gears.shape"
local naughty = require "naughty"
local qui = require "quarrel.ui"
local qvars = require "quarrel.vars"
--- local rubato = require "lib.rubato"
local wibox = require "wibox"
+local rtimed = require("lib.rubato").timed
+local easing = require("lib.rubato").easing
+local gtimer = require "gears.timer"
+local qmarkup = require "quarrel.markup"
-local wicked = {}
+return function(n)
+ local intertext_margin = (n.title ~= "" or n.message ~= "") and qvars.padding or 0
+ local title_height = n.title ~= "" and qvars.char_height or 0
+ local message_height = n.message ~= "" and qvars.char_height or 0
+ -- local app_name_height = n.app_name ~= "" and
+ local app_name
+ if n.app_name == "" then
+ app_name = n._private._foreign and "Unknown" or "Awesome"
+ else
+ app_name = n.app_name
+ end
-wicked._active_notififcations = {}
+ local notif = naughty.layout.box {
+ notification = n,
+ placement = function(d)
+ return awful.placement.right(d, {
+ margins = beautiful.useless_gap * 2,
+ })
+ end,
+ bg = qvars.colors.transparent,
+ border_width = 0,
+ shape = gshape.rectangle,
+ widget_template = {
+ widget = wibox.container.constraint,
+ height = qvars.big_padding * 2
+ + qvars.char_height
+ + qvars.border_width
+ + qvars.big_padding * 2
+ -- + title_height
+ -- + message_height
+ -- + intertext_margin,
+ + (
+ n.icon and qvars.char_height * 2 + qvars.padding
+ or (title_height + message_height + intertext_margin)
+ ),
-function wicked:notify(n)
- -- local notif = wibox.widget {
- local notif = qui.popup {
- -- widget = {
- -- {
- -- {
- -- widget = naughty.widget.icon,
- -- notification = n,
- -- forced_height = 0,
- -- forced_width = 0,
- -- clip_shape = qvars.shape,
- -- id = "icon_role"
- -- },
- -- {
- -- {
- -- widget = naughty.widget.title,
- -- notification = n
- -- },
- -- {
- -- widget = naughty.widget.message,
- -- notification = n
- -- },
- -- layout = wibox.layout.fixed.vertical
- -- },
- -- layout = wibox.layout.fixed.horizontal,
- -- spacing = qvars.padding
- -- },
- -- widget = wibox.container.margin,
- -- margins = qvars.padding
- -- },
- widget = {
- -- {
- {
- widget = naughty.widget.icon,
- notification = n
- },
- {
- widget = wibox.container.place,
- valign = "center",
- halign = "center",
+ strategy = "exact",
+ {
+ qui.styled {
+ widget = wibox.container.background,
+ point = function(geo, args)
+ return {
+ x = args.parent.width,
+ y = args.parent.height - geo.height,
+ }
+ end,
{
{
- widget = naughty.widget.title,
- notification = n
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ {
+ {
+ widget = wibox.widget.textbox,
+ markup = qmarkup(app_name, { bold = true }),
+ },
+ nil,
+ {
+
+ widget = wibox.container.radialprogressbar,
+ max_value = qvars.notif_timeout,
+ border_color = qvars.colors.black,
+ color = qvars.colors.yellow,
+ border_width = qvars.border_width,
+ forced_height = qvars.char_height,
+ forced_width = qvars.char_height,
+ id = "progress",
+ },
+ layout = wibox.layout.align.horizontal,
+ },
},
{
- widget = naughty.widget.message,
- notification = n
+ widget = wibox.container.constraint,
+ height = qvars.border_width,
+ width = beautiful.notification_max_width,
+ strategy = "exact",
+ {
+ widget = wibox.container.background,
+ bg = qvars.colors.bright.black,
+ },
},
- -- spacing = 4,
- layout = wibox.layout.fixed.vertical,
- }
+ {
+ widget = wibox.container.margin,
+ margins = qvars.big_padding,
+ {
+ widget = wibox.container.constraint,
+ height = n.icon and qvars.char_height * 2 + qvars.padding
+ or (title_height + message_height + intertext_margin),
+ strategy = "exact",
+ {
+ {
+ widget = wibox.container.background,
+ {
+ widget = naughty.widget.icon,
+ shape = qvars.shape,
+ notification = n,
+ },
+ },
+ {
+ {
+ widget = wibox.container.constraint,
+ height = title_height,
+ strategy = "exact",
+ {
+ widget = wibox.widget.textbox,
+ text = n.title or "",
+ },
+ },
+ {
+ widget = wibox.container.constraint,
+ height = message_height,
+ strategy = "exact",
+ {
+ widget = wibox.widget.textbox,
+ text = n.message or "",
+ },
+ },
+ spacing = intertext_margin,
+ layout = wibox.layout.fixed.vertical,
+ },
+ fill_space = true,
+ spacing = n.icon and qvars.big_padding or nil,
+ layout = wibox.layout.fixed.horizontal,
+ },
+ },
+ },
+ layout = wibox.layout.fixed.vertical,
+ },
+ id = "bg",
},
- fill_space = true,
- -- spacing = 4,
- layout = wibox.layout.fixed.horizontal
- -- },
- -- actionlist,
- -- spacing = 10,
- -- layout = wibox.layout.fixed.vertical,
+ layout = wibox.layout.manual,
+ id = "manual",
+ },
},
- placement = awful.placement.centered,
- ontop = true
}
- gtimer {
- timeout = qvars.notif_timeout,
- autostart = true,
- callback = function()
- notif.visible = false
- notif = nil
- end
+ local hiding = false
+ local old_destroy = notif._private.destroy_callback
+
+ local progress = rtimed {
+ duration = n.timeout,
+ pos = 0,
+ easing = easing.none,
+ clamp_position = true,
+ subscribed = function(pos)
+ notif.widget:get_children_by_id("progress")[1].value = pos
+ end,
+ }
+
+ local position = rtimed {
+ duration = qvars.anim_duration * 2,
+ intro = qvars.anim_intro * 2,
+ pos = 0,
+ easing = easing.quadratic,
+ clamp_position = true,
+ subscribed = function(pos)
+ gtimer.delayed_call(function()
+ notif.widget.widget:move(1, function(geo, args)
+ if pos == 0 and hiding then
+ old_destroy()
+ end
+ return {
+ x = args.parent.width - pos,
+ y = args.parent.height - geo.height,
+ }
+ end)
+ end)
+ end,
+ }
+ local opacity = rtimed {
+ duration = qvars.anim_duration * 2,
+ intro = qvars.anim_intro * 2,
+ easing = easing.quadratic,
+ pos = 0,
+ clamp_position = true,
+ subscribed = function(pos)
+ notif.opacity = pos
+ end,
}
- -- local icon = notif.widget:get_children_by_id("icon_role")[1]
+ n:disconnect_signal("destroyed", notif._private.destroy_callback)
+ function notif._private.destroy_callback()
+ opacity.target = 0
+ position.target = 0
+ hiding = true
+ end
+ n:weak_connect_signal("destroyed", notif._private.destroy_callback)
- -- if n.image then
- -- icon.forced_height = dpi(32)
- -- icon.forced_width = dpi(32)
- -- end
+ opacity.target = 1
+ position.target = qvars.char_width * 48
+ progress.target = qvars.notif_timeout
end
-
-return wicked
diff --git a/.config/awesome/ui/wicked/widgets/message.lua b/.config/awesome/ui/wicked/widgets/message.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.config/awesome/ui/wicked/widgets/message.lua