Add application launcher and rewritten window switcher, remove rofi as its no longer needed and replaced by widgets. Fixed a lot of bugs and weird behaviour

This commit is contained in:
Rene
2022-07-29 13:21:56 +02:00
parent b2e22fdf8a
commit e727015e81
35 changed files with 964 additions and 639 deletions

View File

@@ -34,6 +34,15 @@ return function(s)
layout = wibox.layout.fixed.horizontal
})
awesome.connect_signal(
"notification_center_activation::toggle",
function(screen, hide)
if screen == s then
activation_area.visible = hide
end
end
)
--#endregion
--#region Widgets
@@ -70,7 +79,6 @@ return function(s)
margins = dpi(10),
widget = wibox.container.margin
},
id = "place",
widget = wibox.container.place,
valign = "bottom",
halign = "right",
@@ -193,7 +201,6 @@ return function(s)
halign = "right",
}
-- TODO: Add rubato animation. For this the widget needs to be rewritten to use a single moving square
local no_notification_widget = wibox.widget {
{
{
@@ -220,7 +227,6 @@ return function(s)
halign = "center",
widget = wibox.container.place
}
--#endregion
--#region Notification center
@@ -240,7 +246,6 @@ return function(s)
end,
}
-- TODO: Currently awesome doesn't come with a scroll container, there is a PR(#3309) and once its merged we can use it
local function notification_center_setup()
notification_center:setup({
widget = notification_center,
@@ -363,7 +368,7 @@ return function(s)
end
)
Hover_signal(clear_all_widget, Theme_config.notification_center.clear_all_button.bg,
Hover_signal(clear_all_widget.margin3.background4, Theme_config.notification_center.clear_all_button.bg,
Theme_config.notification_center.clear_all_button.fg)
--#endregion

View File

@@ -14,7 +14,8 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
local nl = {}
nl.notification_list = { layout = wibox.layout.overflow.vertical, scrollbar_width = 0, step = dpi(10), spacing = dpi(20) }
nl.notification_list = { layout = require("src.lib.overflow_widget.overflow").vertical, scrollbar_width = 0,
step = dpi(20), spacing = dpi(20) }
-- @param {table} notification
-- @return {widget} notifications_list
@@ -91,7 +92,6 @@ function nl.create_notification(n)
},
margins = dpi(10),
widget = wibox.container.margin,
id = "arc_margin"
}
local timer_close_widget = timer_widget
@@ -224,7 +224,7 @@ function nl.create_notification(n)
if button == 1 then
for i, b in pairs(nl.notification_list) do
if b.pk == notification.pk then
table.remove(nl.notification_list, i)
table.remove(nl.notification_list, math.tointeger(i))
awesome.emit_signal("notification_center:update::needed")
break
end
@@ -233,7 +233,7 @@ function nl.create_notification(n)
end
)
Hover_signal(close_widget.const.background, Theme_config.notification_center.notification_list.close_bg,
Hover_signal(close_widget.const.background, nil,
Theme_config.notification_center.notification_list.close_color)
notification:connect_signal(

View File

@@ -55,11 +55,11 @@ return function(s)
if stdout:match("On") then
awful.spawn.with_shell("playerctl shuffle off")
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_enabled)
Theme_config.notification_center.song_info.shuffle_disabled)
else
awful.spawn.with_shell("playerctl shuffle on")
shuffle_button.image = gears.color.recolor_image(icondir .. "shuffle.svg",
Theme_config.notification_center.song_info.shuffle_disabled)
Theme_config.notification_center.song_info.shuffle_enabled)
end
end
)
@@ -428,6 +428,7 @@ return function(s)
"curl -s " .. url .. " -o /tmp/album_art.jpg && echo /tmp/album_art.jpg && sleep 0.5",
function()
music_widget:get_children_by_id("imagebox")[1].image = gears.surface.load_uncached("/tmp/album_art.jpg")
or icondir .. "default_image.svg"
end
)
end
@@ -439,8 +440,8 @@ return function(s)
function(stdout2)
local length = stdout2:gsub("\n", "")
if length ~= "" then
local length_formated = string.format("%02d:%02d", math.floor(tonumber(length or 1) / 60000000) or 0,
(math.floor(tonumber(length or 1) / 1000000) % 60) or 0)
local length_formated = string.format("%02d:%02d", math.floor((tonumber(length) or 1) / 60000000) or 0,
(math.floor((tonumber(length) or 1) / 1000000) % 60) or 0)
music_widget:get_children_by_id("progressbar1")[1].max_value = tonumber(math.floor(tonumber(length) /
1000000))
music_widget:get_children_by_id("text1")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>"
@@ -467,8 +468,8 @@ return function(s)
function(stdout)
local time = stdout:gsub("\n", "")
if time ~= "" then
local time_formated = string.format("%02d:%02d", math.floor(tonumber(time or "1") / 60),
math.floor(tonumber(time or "1")) % 60)
local time_formated = string.format("%02d:%02d", math.floor((tonumber(time) or 1) / 60),
math.floor(tonumber(time) or 1) % 60)
music_widget:get_children_by_id("textbox2")[1].markup = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, Bold 14'>%s</span>"
, Theme_config.notification_center.song_info.duration_fg, time_formated)
music_widget:get_children_by_id("progressbar1")[1].value = tonumber(time)

View File

@@ -19,7 +19,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/"
return function()
---Creates a layout with bar widgets based on the given table
---@param widget_table string{}
---@param widget_table table
---@return table
local function create_bar_layout(widget_table)
local bar_layout = { layout = wibox.layout.flex.horizontal, spacing = dpi(10) }
@@ -388,7 +388,7 @@ return function()
"update::gpu_temp",
function(gpu_temp)
local temp_icon
local temp_num = tonumber(gpu_temp)
local temp_num = tonumber(gpu_temp) or "NaN"
if temp_num then
@@ -478,6 +478,9 @@ return function()
function(muted, volume)
local icon = icondir .. "audio/volume"
volume = tonumber(volume)
if not volume then
return
end
if muted then
icon = icon .. "-mute"
else
@@ -564,8 +567,14 @@ return function()
awesome.connect_signal(
"microphone::get",
function(muted, volume)
if not volume then
return
end
local icon = icondir .. "audio/microphone"
volume = tonumber(volume)
if not volume then
return
end
if muted or (volume < 1) then
icon = icon .. "-off"
end