diff --git a/config/awesome/ui/dash/date.lua b/config/awesome/ui/dashboard/date.lua
similarity index 100%
rename from config/awesome/ui/dash/date.lua
rename to config/awesome/ui/dashboard/date.lua
diff --git a/config/awesome/ui/dash/init.lua b/config/awesome/ui/dashboard/init.lua
similarity index 54%
rename from config/awesome/ui/dash/init.lua
rename to config/awesome/ui/dashboard/init.lua
index 02e71ff..1a9cc69 100644
--- a/config/awesome/ui/dash/init.lua
+++ b/config/awesome/ui/dashboard/init.lua
@@ -20,7 +20,7 @@ local screen_width = awful.screen.focused().geometry.width
local screen_height = awful.screen.focused().geometry.height
--- dash
+-- dashboard
------------
-- Helpers
@@ -70,43 +70,37 @@ local function create_boxed_widget(widget_to_be_boxed, width, height, bg_color)
return boxed_widget
end
+
-- Widget
-local profile = require("ui.dash.profile")
-local music = require("ui.dash.music")
-local media = require("ui.dash.mediakeys")
-local time = require("ui.dash.time")
-local date = require("ui.dash.date")
-local todo = require("ui.dash.todo")
-local weather = require("ui.dash.weather")
-local stats = require("ui.dash.stats")
-local notifs = require("ui.dash.notifs")
+local profile = require("ui.dashboard.profile")
+local music = require("ui.dashboard.music")
+local media = require("ui.dashboard.mediakeys")
+local time = require("ui.dashboard.time")
+local date = require("ui.dashboard.date")
+local todo = require("ui.dashboard.todo")
+local weather = require("ui.dashboard.weather")
+local stats = require("ui.dashboard.stats")
+local notifs = require("ui.dashboard.notifs")
local time_boxed = create_boxed_widget(centered_widget(time), dpi(260), dpi(95), beautiful.transparent)
-local date_boxed = create_boxed_widget(date, dpi(120), dpi(50), beautiful.dash_box_bg)
-local todo_boxed = create_boxed_widget(todo, dpi(120), dpi(120), beautiful.dash_box_bg)
-local weather_boxed = create_boxed_widget(weather, dpi(120), dpi(120), beautiful.dash_box_bg)
-local stats_boxed = create_boxed_widget(stats, dpi(120), dpi(190), beautiful.dash_box_bg)
-local notifs_boxed = create_boxed_widget(notifs, dpi(260), dpi(155), beautiful.dash_box_bg)
+local date_boxed = create_boxed_widget(date, dpi(120), dpi(50), beautiful.dashboard_box_bg)
+local todo_boxed = create_boxed_widget(todo, dpi(120), dpi(120), beautiful.dashboard_box_bg)
+local weather_boxed = create_boxed_widget(weather, dpi(120), dpi(120), beautiful.dashboard_box_bg)
+local stats_boxed = create_boxed_widget(stats, dpi(120), dpi(190), beautiful.dashboard_box_bg)
+local notifs_boxed = create_boxed_widget(notifs, dpi(260), dpi(190), beautiful.dashboard_box_bg)
--- Dashboard
-dash = wibox({
+-- dashboard
+dashboard = wibox({
type = "dock",
- screen = screen.primary,
- height = screen_height,
- width = beautiful.dash_width or dpi(300),
ontop = true,
+ screen = screen.primary,
+ height = screen_height - dpi(50),
+ width = beautiful.dashboard_width or dpi(300),
visible = false
})
-
-awful.placement.left(dash)
-
-dash:buttons(gears.table.join(
- -- Middle click - Hide dash
- awful.button({}, 2, function()
- dash_hide()
- end)
-))
+dashboard.y = dpi(25)
+dashboard.bg = "#00000000"
local slide = rubato.timed{
pos = dpi(-300),
@@ -115,7 +109,7 @@ local slide = rubato.timed{
duration = 0.8,
easing = rubato.quadratic,
awestore_compat = true,
- subscribed = function(pos) dash.x = pos end
+ subscribed = function(pos) dashboard.x = pos end
}
local slide_strut = rubato.timed{
@@ -125,68 +119,72 @@ local slide_strut = rubato.timed{
duration = 0.8,
easing = rubato.quadratic,
awestore_compat = true,
- subscribed = function(width) dash:struts{left = width, right = 0, top = 0, bottom = 0} end
+ subscribed = function(width) dashboard:struts{left = width, right = 0, top = 0, bottom = 0} end
}
-local dash_status = false
+local dashboard_status = false
slide.ended:subscribe(function()
- if dash_status then
- dash.visible = false
+ if dashboard_status then
+ dashboard.visible = false
end
end)
-dash_show = function()
- dash.visible = true
- slide:set(0)
- slide_strut:set(300)
- dash_status = false
+dashboard_show = function()
+ dashboard.visible = true
+ slide:set(100)
+ slide_strut:set(375)
+ dashboard_status = false
end
-dash_hide = function()
- slide:set(-300)
+dashboard_hide = function()
+ slide:set(-375)
slide_strut:set(0)
- dash_status = true
+ dashboard_status = true
end
-dash_toggle = function()
- if dash.visible then
- dash_hide()
+dashboard_toggle = function()
+ if dashboard.visible then
+ dashboard_hide()
else
- dash_show()
+ dashboard_show()
end
end
-dash:setup {
+dashboard:setup {
{
- nil,
{
- time_boxed,
+ nil,
{
{
- profile,
- stats_boxed,
- layout = wibox.layout.fixed.vertical
+ {
+ profile,
+ stats_boxed,
+ layout = wibox.layout.fixed.vertical
+ },
+ {
+ date_boxed,
+ todo_boxed,
+ weather_boxed,
+ layout = wibox.layout.fixed.vertical
+ },
+ layout = wibox.layout.fixed.horizontal
},
{
- date_boxed,
- todo_boxed,
- weather_boxed,
- layout = wibox.layout.fixed.vertical
+ music,
+ media,
+ layout = wibox.layout.fixed.horizontal
},
- layout = wibox.layout.fixed.horizontal
+ notifs_boxed,
+ layout = wibox.layout.fixed.vertical
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal
},
- {
- music,
- media,
- layout = wibox.layout.fixed.horizontal
- },
- notifs_boxed,
- layout = wibox.layout.fixed.vertical
+ margins = dpi(10),
+ widget = wibox.container.margin
},
- expand = "none",
- layout = wibox.layout.align.horizontal
- },
- margins = dpi(10),
- widget = wibox.container.margin
-}
+ bg = beautiful.xbackground,
+ shape = helpers.rrect(beautiful.dashboard_radius),
+ widget = wibox.container.background
+ }
diff --git a/config/awesome/ui/dash/mediakeys.lua b/config/awesome/ui/dashboard/mediakeys.lua
similarity index 78%
rename from config/awesome/ui/dash/mediakeys.lua
rename to config/awesome/ui/dashboard/mediakeys.lua
index 5f8d156..7ebd589 100644
--- a/config/awesome/ui/dash/mediakeys.lua
+++ b/config/awesome/ui/dashboard/mediakeys.lua
@@ -16,6 +16,9 @@ local helpers = require("helpers")
-- Media Keys
---------------
+--playerctl
+local playerctl = require("module.bling").signal.playerctl.lib()
+
-- Helpers
local create_media_button = function(symbol, color, command, playpause)
@@ -27,12 +30,12 @@ local create_media_button = function(symbol, color, command, playpause)
widget = wibox.widget.textbox()
}
- awesome.connect_signal("bling::playerctl::status", function(playing)
+ playerctl:connect_signal("playback_status", function(_, playing, __)
if playpause then
if playing then
- icon.markup = helpers.colorize_text("", color)
+ icon:set_markup_silently(helpers.colorize_text("", color))
else
- icon.markup = helpers.colorize_text("", color)
+ icon:set_markup_silently(helpers.colorize_text("", color))
end
end
end)
@@ -51,9 +54,9 @@ local create_media_button = function(symbol, color, command, playpause)
end
-- Widget
-local media_play_command = function() helpers.music_control("toggle") end
-local media_prev_command = function() helpers.music_control("prev") end
-local media_next_command = function() helpers.music_control("next") end
+local media_play_command = function() playerctl:play_pause() end
+local media_prev_command = function() playerctl:previous() end
+local media_next_command = function() playerctl:next() end
local media_play = create_media_button("", beautiful.xforeground, media_play_command, true)
local media_prev = create_media_button("", beautiful.xforeground, media_prev_command, false)
@@ -72,7 +75,7 @@ local media = wibox.widget{
margins = dpi(9),
widget = wibox.container.margin
},
- bg = beautiful.dash_box_bg,
+ bg = beautiful.dashboard_box_bg,
shape = helpers.rrect(5),
forced_width = dpi(40),
forced_height = dpi(120),
diff --git a/config/awesome/ui/dash/music.lua b/config/awesome/ui/dashboard/music.lua
similarity index 73%
rename from config/awesome/ui/dash/music.lua
rename to config/awesome/ui/dashboard/music.lua
index 9d1361e..84f5d31 100644
--- a/config/awesome/ui/dash/music.lua
+++ b/config/awesome/ui/dashboard/music.lua
@@ -18,7 +18,6 @@ local helpers = require("helpers")
local music_text = wibox.widget{
font = beautiful.font_name .. "medium 8",
- markup = helpers.colorize_text("Music", beautiful.xforeground .. "b3"),
valign = "center",
widget = wibox.widget.textbox
}
@@ -40,7 +39,7 @@ local filter_color = {
type = 'linear',
from = {0, 0},
to = {0, 120},
- stops = {{0, beautiful.dash_box_bg .. "cc"}, {1, beautiful.dash_box_bg}}
+ stops = {{0, beautiful.dashboard_box_bg .. "cc"}, {1, beautiful.dashboard_box_bg}}
}
local music_art_filter = wibox.widget {
@@ -54,50 +53,56 @@ local music_art_filter = wibox.widget {
widget = wibox.container.rotate
}
-local music_artist = wibox.widget{
- font = beautiful.font_name .. "medium 12",
- markup = helpers.colorize_text("Nothing Playing", beautiful.xforeground .. "e6"),
+local music_title = wibox.widget{
+ font = beautiful.font_name .. "medium 9",
valign = "center",
widget = wibox.widget.textbox
}
-local music_title = wibox.widget{
- font = beautiful.font_name .. "medium 9",
- markup = helpers.colorize_text("Nothing Playing", beautiful.xforeground .. "b3"),
+local music_artist = wibox.widget{
+ font = beautiful.font_name .. "medium 12",
valign = "center",
widget = wibox.widget.textbox
}
local music_pos = wibox.widget{
font = beautiful.font_name .. "medium 8",
- markup = helpers.colorize_text("- / -", beautiful.xforeground .. "66"),
valign = "center",
widget = wibox.widget.textbox
}
-awesome.connect_signal("bling::playerctl::status", function(playing)
+
+-- playerctl
+---------------
+
+local playerctl = require("module.bling").signal.playerctl.lib()
+
+playerctl:connect_signal("metadata", function(_, title, artist, album_path, __, ___, ____)
+ if title == "" then title = "Nothing Playing" end
+ if artist == "" then artist = "Nothing Playing" end
+ if album_path == "" then album_path = gears.filesystem.get_configuration_dir() .. "theme/assets/no_music.png" end
+
+ music_art:set_image(gears.surface.load_uncached(album_path))
+ music_title:set_markup_silently(helpers.colorize_text(title, beautiful.xforeground .. "b3"))
+ music_artist:set_markup_silently(helpers.colorize_text(artist, beautiful.xforeground .. "e6"))
+end)
+
+playerctl:connect_signal("playback_status", function(_, playing, __)
if playing then
- music_text.markup = helpers.colorize_text("Now Playing", beautiful.xforeground .. "cc")
+ music_text:set_markup_silently(helpers.colorize_text("Now Playing", beautiful.xforeground .. "cc"))
else
- music_text.markup = helpers.colorize_text("Music", beautiful.xforeground .. "cc")
+ music_text:set_markup_silently(helpers.colorize_text("Music", beautiful.xforeground .. "cc"))
end
end)
-awesome.connect_signal("bling::playerctl::title_artist_album", function(title_current, artist_current, art_path)
+playerctl:connect_signal("position", function(_, interval_sec, length_sec, player_name)
+ local pos_now = tostring(os.date("!%M:%S", math.floor(interval_sec)))
+ local pos_length = tostring(os.date("!%M:%S", math.floor(length_sec)))
+ local pos_markup = helpers.colorize_text(pos_now .. " / " .. pos_length, beautiful.xforeground .. "66")
- music_art:set_image(gears.surface.load_uncached(art_path))
-
- music_title:set_markup_silently('' .. title_current .. '')
- music_artist:set_markup_silently('' .. artist_current .. '')
+ music_pos:set_markup_silently(pos_markup)
end)
-awesome.connect_signal("bling::playerctl::position", function(pos, length)
- local pos_now = tostring(os.date("!%M:%S", math.floor(pos)))
- local pos_length = tostring(os.date("!%M:%S", math.floor(length)))
- local pos_markup = pos_now .. " / " .. pos_length
-
- music_pos.markup = helpers.colorize_text(pos_markup, beautiful.xforeground .. "66")
-end)
local music = wibox.widget{
{
@@ -151,7 +156,7 @@ local music = wibox.widget{
},
layout = wibox.layout.stack
},
- bg = beautiful.dash_box_bg,
+ bg = beautiful.dashboard_box_bg,
shape = helpers.rrect(dpi(5)),
forced_width = dpi(200),
forced_height = dpi(120),
diff --git a/config/awesome/ui/dash/notifs.lua b/config/awesome/ui/dashboard/notifs.lua
similarity index 94%
rename from config/awesome/ui/dash/notifs.lua
rename to config/awesome/ui/dashboard/notifs.lua
index c2c0cff..2bc71e1 100644
--- a/config/awesome/ui/dash/notifs.lua
+++ b/config/awesome/ui/dashboard/notifs.lua
@@ -21,7 +21,7 @@ local helpers = require("helpers")
local notifs_text = wibox.widget{
font = beautiful.font_name .. "medium 8",
- markup = helpers.colorize_text("Notifications", beautiful.dash_box_fg),
+ markup = helpers.colorize_text("Notifications", beautiful.dashboard_box_fg),
valign = "center",
widget = wibox.widget.textbox
}
@@ -64,18 +64,6 @@ local notifs_empty = wibox.widget {
local notifs_container = wibox.widget{
spacing = dpi(6),
- spacing_widget = {
- {
- bg = beautiful.xcolor0,
- shape = gears.shape.rounded_rect,
- widget = wibox.container.background,
- },
- top = dpi(2),
- bottom = dpi(2),
- left = dpi(53),
- right = dpi(6),
- widget = wibox.container.margin
- },
forced_width = beautiful.notifs_width or dpi(240),
layout = wibox.layout.fixed.vertical
}
@@ -149,7 +137,7 @@ local create_notif = function(icon, n, width)
layout = wibox.layout.align.horizontal
},
{
- markup = helpers.colorize_text(n.message, beautiful.dash_box_fg),
+ markup = helpers.colorize_text(n.message, beautiful.dashboard_box_fg),
align = "left",
font = beautiful.font_name .. "medium 8",
forced_width = dpi(165),
@@ -166,12 +154,12 @@ local create_notif = function(icon, n, width)
},
layout = wibox.layout.align.horizontal
},
- margins = dpi(6),
+ margins = dpi(8),
widget = wibox.container.margin
},
bg = beautiful.xcolor0,
shape = helpers.rrect(dpi(4)),
- forced_height = dpi(104),
+ forced_height = dpi(66),
widget = wibox.container.background
}
diff --git a/config/awesome/ui/dash/profile.lua b/config/awesome/ui/dashboard/profile.lua
similarity index 100%
rename from config/awesome/ui/dash/profile.lua
rename to config/awesome/ui/dashboard/profile.lua
diff --git a/config/awesome/ui/dash/stats.lua b/config/awesome/ui/dashboard/stats.lua
similarity index 93%
rename from config/awesome/ui/dash/stats.lua
rename to config/awesome/ui/dashboard/stats.lua
index 7b06029..2022dc8 100644
--- a/config/awesome/ui/dash/stats.lua
+++ b/config/awesome/ui/dashboard/stats.lua
@@ -24,7 +24,7 @@ local helpers = require("helpers")
local stats_text = wibox.widget{
font = beautiful.font_name .. "medium 8",
- markup = helpers.colorize_text("Stats", beautiful.dash_box_fg),
+ markup = helpers.colorize_text("Stats", beautiful.dashboard_box_fg),
valign = "center",
widget = wibox.widget.textbox
}
@@ -134,15 +134,16 @@ awesome.connect_signal("signal::ram", function(used, total)
end)
vol:buttons(gears.table.join(
+ awful.button({}, 1, function() helpers.volume_control(0) end),
-- Scrolling
- awful.button({}, 4, function() helpers.volume_control(2) end),
- awful.button({}, 5, function() helpers.volume_control(-2) end)
+ awful.button({}, 4, function() helpers.volume_control(5) end),
+ awful.button({}, 5, function() helpers.volume_control(-5) end)
))
brightness:buttons(gears.table.join(
-- Scrolling
- awful.button({}, 4, function() awful.spawn.with_shell("brightnessctl set 2%+ -q") end),
- awful.button({}, 5, function() awful.spawn.with_shell("brightnessctl set 2%- -q") end)
+ awful.button({}, 4, function() awful.spawn.with_shell("brightnessctl set 5%+ -q") end),
+ awful.button({}, 5, function() awful.spawn.with_shell("brightnessctl set 5%- -q") end)
))
local stats = wibox.widget{
diff --git a/config/awesome/ui/dash/time.lua b/config/awesome/ui/dashboard/time.lua
similarity index 100%
rename from config/awesome/ui/dash/time.lua
rename to config/awesome/ui/dashboard/time.lua
diff --git a/config/awesome/ui/dash/todo.lua b/config/awesome/ui/dashboard/todo.lua
similarity index 97%
rename from config/awesome/ui/dash/todo.lua
rename to config/awesome/ui/dashboard/todo.lua
index d24e631..c453a33 100644
--- a/config/awesome/ui/dash/todo.lua
+++ b/config/awesome/ui/dashboard/todo.lua
@@ -17,7 +17,7 @@ local helpers = require("helpers")
local todo_text = wibox.widget{
font = beautiful.font_name .. "medium 8",
- markup = helpers.colorize_text("Todo", beautiful.dash_box_fg),
+ markup = helpers.colorize_text("Todo", beautiful.dashboard_box_fg),
valign = "center",
widget = wibox.widget.textbox
}
diff --git a/config/awesome/ui/dash/weather.lua b/config/awesome/ui/dashboard/weather.lua
similarity index 97%
rename from config/awesome/ui/dash/weather.lua
rename to config/awesome/ui/dashboard/weather.lua
index 17ee84d..1c7d46b 100644
--- a/config/awesome/ui/dash/weather.lua
+++ b/config/awesome/ui/dashboard/weather.lua
@@ -18,7 +18,7 @@ local helpers = require("helpers")
local weather_text = wibox.widget{
font = beautiful.font_name .. "medium 8",
- markup = helpers.colorize_text("Weather unavailable", beautiful.dash_box_fg),
+ markup = helpers.colorize_text("Weather unavailable", beautiful.dashboard_box_fg),
valign = "center",
widget = wibox.widget.textbox
}
@@ -60,7 +60,7 @@ awesome.connect_signal("signal::weather", function(temperature, description, ico
end
weather_icon.markup = icon_widget
- weather_text.markup = helpers.colorize_text(description, beautiful.dash_box_fg)
+ weather_text.markup = helpers.colorize_text(description, beautiful.dashboard_box_fg)
weather_temp.markup = temperature .. weather_temp_symbol
end)
diff --git a/config/awesome/ui/decorations/init.lua b/config/awesome/ui/decorations/init.lua
index 5be0343..a776258 100644
--- a/config/awesome/ui/decorations/init.lua
+++ b/config/awesome/ui/decorations/init.lua
@@ -33,3 +33,4 @@ else
end
require("ui.decorations.titlebar")
+require("ui.decorations.music")
diff --git a/config/awesome/ui/decorations/music.lua b/config/awesome/ui/decorations/music.lua
new file mode 100644
index 0000000..f661953
--- /dev/null
+++ b/config/awesome/ui/decorations/music.lua
@@ -0,0 +1,468 @@
+-- Standard awesome library
+local gears = require("gears")
+local awful = require("awful")
+
+-- Theme library
+local beautiful = require("beautiful")
+
+-- Ruled
+local ruled = require("ruled")
+
+-- Widget library
+local wibox = require("wibox")
+
+-- Helpers
+local helpers = require("helpers")
+
+
+-- Music icon
+----------------
+
+local big_music_icon = wibox.widget{
+ align = "center",
+ font = beautiful.icon_font_name .. "Bold 16",
+ markup = helpers.colorize_text("", beautiful.xcolor4),
+ widget = wibox.widget.textbox()
+}
+
+local small_music_icon = wibox.widget{
+ align = "center",
+ font = beautiful.icon_font_name .. "Bold 12",
+ markup = helpers.colorize_text("", beautiful.xforeground),
+ widget = wibox.widget.textbox()
+}
+
+local container_music_icon = wibox.widget {
+ big_music_icon,
+ {
+ small_music_icon,
+ top = dpi(12),
+ widget = wibox.container.margin
+ },
+ spacing = dpi(-8),
+ layout = wibox.layout.fixed.horizontal
+}
+
+local music_icon = wibox.widget{
+ nil,
+ {
+ container_music_icon,
+ spacing = dpi(14),
+ layout = wibox.layout.fixed.horizontal
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal,
+ }
+
+-- Helpers
+-------------
+
+local control_button_bg = "#00000000"
+local control_button_bg_hover = beautiful.xcolor0
+local control_button = function(c, symbol, color, font, size, on_click, on_right_click)
+ local icon = wibox.widget{
+ markup = helpers.colorize_text(symbol, color),
+ font = font,
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox()
+ }
+
+ local button = wibox.widget {
+ icon,
+ bg = control_button_bg,
+ shape = helpers.rrect(dpi(5)),
+ widget = wibox.container.background
+ }
+
+ local container = wibox.widget {
+ button,
+ strategy = "min",
+ width = dpi(30),
+ widget = wibox.container.constraint,
+ }
+
+ container:buttons(gears.table.join(
+ awful.button({ }, 1, on_click),
+ awful.button({ }, 3, on_right_click)
+ ))
+
+ container:connect_signal("mouse::enter", function ()
+ button.bg = control_button_bg_hover
+ end)
+ container:connect_signal("mouse::leave", function ()
+ button.bg = control_button_bg
+ end)
+
+ return container
+end
+
+local music_play_pause = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 22", dpi(30), function()
+ awful.spawn.with_shell("mpc -q toggle")
+end)
+
+-- Loop button
+local loop = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 12", dpi(30), function()
+ awful.spawn.with_shell("mpc repeat")
+end)
+
+-- Shuffle playlist
+local shuffle = control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 12", dpi(30), function()
+ awful.spawn.with_shell("mpc random")
+end)
+
+local function create_slider_widget(slider_color)
+ local slider_widget = wibox.widget {
+ {
+ id = "slider",
+ max_value = 100,
+ value = 20,
+ margins = {
+ top = dpi(7),
+ bottom = dpi(7),
+ left = dpi(6),
+ right = dpi(6),
+ },
+ forced_width = dpi(60),
+ shape = gears.shape.rounded_bar,
+ bar_shape = gears.shape.rounded_bar,
+ color = slider_color,
+ background_color = beautiful.xcolor0,
+ widget = wibox.widget.progressbar
+ },
+ expand = "none",
+ forced_width = 60,
+ layout = wibox.layout.align.horizontal
+ }
+
+ return slider_widget
+end
+
+local stats_tooltip = wibox.widget {
+ visible = false,
+ top_only = true,
+ layout = wibox.layout.stack
+}
+
+local tooltip_counter = 0
+local function create_tooltip(w)
+ local tooltip = wibox.widget {
+ font = beautiful.font_name .. "bold 10",
+ align = "right",
+ valign = "center",
+ widget = wibox.widget.textbox
+ }
+
+ tooltip_counter = tooltip_counter + 1
+ local index = tooltip_counter
+
+ stats_tooltip:insert(index, tooltip)
+
+ w:connect_signal("mouse::enter", function()
+ -- Raise tooltip to the top of the stack
+ stats_tooltip:set(1, tooltip)
+ stats_tooltip.visible = true
+ end)
+ w:connect_signal("mouse::leave", function ()
+ stats_tooltip.visible = false
+ end)
+
+ return tooltip
+end
+
+
+-- Decorations
+----------------
+
+local music_art = wibox.widget {
+ image = gears.filesystem.get_configuration_dir() .. "theme/assets/no_music.png",
+ resize = true,
+ widget = wibox.widget.imagebox
+}
+
+local music_art_container = wibox.widget{
+ music_art,
+ shape = helpers.rrect(dpi(5)),
+ widget = wibox.container.background
+}
+
+local music_now = wibox.widget{
+ font = beautiful.font_name .. "bold 10",
+ valign = "center",
+ widget = wibox.widget.textbox
+}
+
+local music_pos = wibox.widget{
+ font = beautiful.font_name .. "bold 10",
+ valign = "center",
+ widget = wibox.widget.textbox
+}
+
+local music_bar = wibox.widget {
+ max_value = 100,
+ value = 0,
+ background_color = beautiful.xcolor0,
+ color = beautiful.xcolor4,
+ forced_height = dpi(3),
+ widget = wibox.widget.progressbar
+}
+
+music_bar:connect_signal("button::press", function(_, lx, __, button, ___, w)
+ if button == 1 then
+ awful.spawn.with_shell("mpc seek " .. math.ceil(lx * 100 / w.width) .. "%")
+ end
+end)
+
+
+local music_play_pause_textbox = music_play_pause:get_all_children()[1]:get_all_children()[1]
+local loop_textbox = loop:get_all_children()[1]:get_all_children()[1]
+local shuffle_textbox = shuffle:get_all_children()[1]:get_all_children()[1]
+
+-- Volume
+--------
+
+local vol_color = beautiful.xcolor4
+local vol_slider = create_slider_widget(vol_color)
+local vol_tooltip = create_tooltip(vol_slider)
+
+local vol_icon = wibox.widget{
+ align = "center",
+ font = "icomoon 16",
+ markup = "",
+ widget = wibox.widget.textbox
+}
+
+local vol_button = wibox.widget{
+ vol_icon,
+ bg = control_button_bg,
+ shape = helpers.rrect(dpi(5)),
+ widget = wibox.container.background
+}
+
+local vol = wibox.widget {
+ vol_button,
+ strategy = "min",
+ width = dpi(30),
+ widget = wibox.container.constraint,
+}
+
+vol:connect_signal("mouse::enter", function ()
+ vol_button.bg = control_button_bg_hover
+end)
+vol:connect_signal("mouse::leave", function ()
+ vol_button.bg = control_button_bg
+end)
+vol:buttons(gears.table.join(
+ awful.button({}, 1, function() helpers.volume_control(0) end)
+))
+
+awesome.connect_signal("signal::volume", function(value, muted)
+ local fill_color
+ local vol_value = value or 0
+
+ if muted then
+ vol_icon.markup = helpers.colorize_text("", beautiful.xcolor8)
+ fill_color = beautiful.xcolor8
+ else
+ vol_icon.markup = helpers.colorize_text("", beautiful.xforeground)
+ fill_color = vol_color
+ end
+
+ vol_slider.slider.value = vol_value
+ vol_slider.slider.color = fill_color
+ vol_tooltip.markup = helpers.colorize_text(vol_value .. "%", vol_color)
+end)
+
+vol_slider:buttons(gears.table.join(
+ awful.button({}, 1, function() helpers.volume_control(0) end),
+ -- Scrolling
+ awful.button({}, 4, function() helpers.volume_control(5) end),
+ awful.button({}, 5, function() helpers.volume_control(-5) end)
+))
+
+-- Playerctl
+---------------
+
+local playerctl = require("module.bling").signal.playerctl.lib()
+local music_length = 0
+
+playerctl:connect_signal("metadata", function(_, title, artist, album_path, album, ___, player_name)
+ if player_name == "mpd" then
+ local m_now = artist .. " - " .. title .. "/" .. album
+
+ music_art:set_image(gears.surface.load_uncached(album_path))
+ music_now:set_markup_silently(m_now)
+ end
+end)
+
+playerctl:connect_signal("position", function(_, interval_sec, length_sec, player_name)
+ if player_name == "mpd" then
+ local pos_now = tostring(os.date("!%M:%S", math.floor(interval_sec)))
+ local pos_length = tostring(os.date("!%M:%S", math.floor(length_sec)))
+ local pos_markup = pos_now .. helpers.colorize_text(" / " .. pos_length, beautiful.xcolor8)
+
+ music_art:set_image(gears.surface.load_uncached(album_path))
+ music_pos:set_markup_silently(pos_markup)
+ music_bar.value = (interval_sec / length_sec) * 100
+ music_length = length_sec
+ end
+end)
+
+playerctl:connect_signal("playback_status", function(_, playing, player_name)
+ if player_name == "mpd" then
+ if playing then
+ music_play_pause_textbox:set_markup_silently(helpers.colorize_text("", beautiful.xcolor4))
+ else
+ music_play_pause_textbox:set_markup_silently(helpers.colorize_text("", beautiful.xcolor4))
+ end
+ end
+end)
+
+playerctl:connect_signal("loop_status", function(_, loop_status, player_name)
+ if player_name == "mpd" then
+ if loop_status == "none" then
+ loop_textbox:set_markup_silently("")
+ else
+ loop_textbox:set_markup_silently("")
+ end
+ end
+end)
+
+playerctl:connect_signal("shuffle", function(_, shuffle, player_name)
+ if player_name == "mpd" then
+ if shuffle then
+ shuffle_textbox:set_markup_silently("")
+ else
+ shuffle_textbox:set_markup_silently("")
+ end
+ end
+end)
+
+local music_create_decoration = function (c)
+
+ -- Hide default titlebar
+ awful.titlebar.hide(c, beautiful.titlebar_pos)
+
+ -- Titlebar
+ awful.titlebar(c, { position = "top", size = beautiful.titlebar_size, bg = beautiful.xbackground }):setup {
+ {
+ {
+ {
+ {
+ vol,
+ nil,
+ vol_slider,
+ spacing = dpi(2),
+ layout = wibox.layout.fixed.horizontal
+ },
+ stats_tooltip,
+ layout = wibox.layout.align.horizontal
+ },
+ top = dpi(10),
+ bottom = dpi(10),
+ right = dpi(10),
+ left = dpi(15),
+ widget = wibox.container.margin
+ },
+ forced_width = dpi(200),
+ widget = wibox.container.background
+ },
+ {
+ widget = music_icon
+ },
+ layout = wibox.layout.align.horizontal
+ }
+
+ -- Sidebar
+ awful.titlebar(c, { position = "left", size = dpi(200), bg = beautiful.xbackground }):setup {
+ {
+ nil,
+ {
+ music_art_container,
+ bottom = dpi(20),
+ left = dpi(25),
+ right = dpi(25),
+ widget = wibox.container.margin
+ },
+ nil,
+ expand = "none",
+ layout = wibox.layout.align.vertical
+ },
+ bg = beautiful.bg_accent,
+ shape = helpers.prrect(dpi(10), false, true, false, false),
+ widget = wibox.container.background,
+ }
+
+ -- Toolbar
+ awful.titlebar(c, { position = "bottom", size = dpi(63), bg = beautiful.bg_secondary }):setup {
+ music_bar,
+ {
+ {
+ {
+ -- Go to playlist and focus currently playing song
+ control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 14", dpi(30), function()
+ awful.spawn.with_shell("mpc -q prev")
+ end),
+ -- Toggle play pause
+ music_play_pause,
+ -- Go to list of playlists
+ control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 14", dpi(30), function()
+ awful.spawn.with_shell("mpc -q next")
+ end),
+ layout = wibox.layout.flex.horizontal
+ },
+ {
+ {
+ step_function = wibox.container.scroll
+ .step_functions
+ .waiting_nonlinear_back_and_forth,
+ speed = 50,
+ {
+ widget = music_now,
+ },
+ -- forced_width = dpi(110),
+ widget = wibox.container.scroll.horizontal
+ },
+ left = dpi(15),
+ right = dpi(20),
+ widget = wibox.container.margin
+ },
+ {
+ music_pos,
+ {
+ loop,
+ shuffle,
+ -- Go to list of playlists
+ control_button(c, "", beautiful.xforeground, beautiful.icon_font_name .. "Round 12", dpi(30), function()
+ helpers.send_key(c, "1")
+ end),
+ -- Go to visualizer
+ control_button(c, "", beautiful.xforeground, "icomoon 12", dpi(30), function()
+ helpers.send_key(c, "8")
+ end),
+ layout = wibox.layout.flex.horizontal
+ },
+ spacing = dpi(10),
+ layout = wibox.layout.fixed.horizontal
+ },
+ layout = wibox.layout.align.horizontal
+ },
+ margins = dpi(15),
+ widget = wibox.container.margin
+ },
+ layout = wibox.layout.align.vertical
+ }
+
+ -- Set custom decoration flags
+ c.custom_decoration = { top = true, left = true, bottom = true }
+end
+
+-- Add the titlebar whenever a new music client is spawned
+ruled.client.connect_signal("request::rules", function()
+ ruled.client.append_rule {
+ id = "music",
+ rule = {instance = "music"},
+ callback = music_create_decoration
+ }
+end)
+
diff --git a/config/awesome/ui/init.lua b/config/awesome/ui/init.lua
index 78d7728..5a73094 100644
--- a/config/awesome/ui/init.lua
+++ b/config/awesome/ui/init.lua
@@ -1,8 +1,8 @@
local lock_screen = require("ui.lockscreen")
lock_screen.init()
+require("ui.bar")
+require("ui.dashboard")
+require("ui.decorations")
require("ui.notifs")
require("ui.tooltip")
-require("ui.bar")
-require("ui.dash")
-require("ui.decorations")
diff --git a/config/awesome/ui/notifs/init.lua b/config/awesome/ui/notifs/init.lua
index a182ef3..be1e4f2 100644
--- a/config/awesome/ui/notifs/init.lua
+++ b/config/awesome/ui/notifs/init.lua
@@ -25,7 +25,7 @@ require("ui.notifs.notifications-center")
naughty.config.defaults.ontop = true
naughty.config.defaults.screen = awful.screen.focused()
naughty.config.defaults.timeout = 3
-naughty.config.defaults.title = "System Notification"
+naughty.config.defaults.title = "Notification"
naughty.config.defaults.position = "bottom_right"
-- Timeouts
@@ -33,19 +33,19 @@ naughty.config.presets.low.timeout = 3
naughty.config.presets.critical.timeout = 0
naughty.config.presets.normal = {
- font = beautiful.font,
+ font = beautiful.font_name .. "medium 8",
fg = beautiful.fg_normal,
bg = beautiful.bg_normal
}
naughty.config.presets.low = {
- font = beautiful.font,
+ font = beautiful.font_name .. "medium 8",
fg = beautiful.fg_normal,
bg = beautiful.bg_normal
}
naughty.config.presets.critical = {
- font = beautiful.font_name .. "10",
+ font = beautiful.font_name .. "medium 8",
fg = beautiful.xcolor1,
bg = beautiful.bg_normal,
timeout = 0
@@ -74,7 +74,7 @@ naughty.connect_signal("request::display", function(n)
id = "text_role",
align = "center",
valign = "center",
- font = beautiful.font_name .. "8",
+ font = beautiful.font_name .. "medium 8",
widget = wibox.widget.textbox
},
left = dpi(6),
@@ -84,7 +84,7 @@ naughty.connect_signal("request::display", function(n)
bg = beautiful.xcolor0,
forced_height = dpi(25),
forced_width = dpi(20),
- shape = helpers.rrect(dpi(4)),
+ shape = helpers.rrect(dpi(6)),
widget = wibox.container.background
}
@@ -99,6 +99,8 @@ naughty.connect_signal("request::display", function(n)
widget = naughty.list.actions
}
+ helpers.add_hover_cursor(actions, "hand2")
+
naughty.layout.box {
notification = n,
type = "notification",
@@ -115,7 +117,7 @@ naughty.connect_signal("request::display", function(n)
image = appicon,
resize = true,
clip_shape = helpers.rrect(
- beautiful.border_radius - 3),
+ dpi(6)),
widget = wibox.widget.imagebox
},
strategy = "max",
@@ -128,18 +130,18 @@ naughty.connect_signal("request::display", function(n)
{
markup = n.app_name,
align = "left",
- font = beautiful.font,
+ font = beautiful.font_name .. "medium 9",
widget = wibox.widget.textbox
},
{
markup = time,
align = "right",
- font = beautiful.font,
+ font = beautiful.font_name .. "medium 9",
widget = wibox.widget.textbox
},
layout = wibox.layout.align.horizontal
},
- top = dpi(7),
+ top = dpi(5),
left = dpi(20),
right = dpi(20),
bottom = dpi(5),
@@ -159,13 +161,12 @@ naughty.connect_signal("request::display", function(n)
.waiting_nonlinear_back_and_forth,
speed = 50,
{
- markup = "" ..
- n.title .. "",
- font = beautiful.font,
+ markup = n.title,
+ font = beautiful.font_name .. "medium 9",
align = "left",
widget = wibox.widget.textbox
},
- forced_width = dpi(204),
+ forced_width = dpi(205),
widget = wibox.container.scroll
.horizontal
},
@@ -173,7 +174,7 @@ naughty.connect_signal("request::display", function(n)
{
markup = n.message,
align = "left",
- font = beautiful.font,
+ font = beautiful.font_name .. "medium 8",
widget = wibox.widget.textbox
},
right = 10,
@@ -197,7 +198,7 @@ naughty.connect_signal("request::display", function(n)
image = n.icon,
resize = true,
clip_shape = helpers.rrect(
- beautiful.border_radius - 3),
+ dpi(6)),
widget = wibox.widget.imagebox
},
strategy = "max",
@@ -208,10 +209,10 @@ naughty.connect_signal("request::display", function(n)
expand = "none",
layout = wibox.layout.align.vertical
},
- top = dpi(0),
+ top = dpi(10),
left = dpi(10),
right = dpi(10),
- bottom = dpi(0),
+ bottom = dpi(5),
widget = wibox.container.margin
},
layout = wibox.layout.fixed.horizontal
@@ -224,13 +225,11 @@ naughty.connect_signal("request::display", function(n)
},
layout = wibox.layout.fixed.vertical
},
- top = dpi(0),
+ top = dpi(5),
bottom = dpi(5),
widget = wibox.container.margin
},
bg = beautiful.xbackground,
- border_width = 0,
- border_color = beautiful.widget_border_color,
shape = helpers.rrect(beautiful.border_radius),
widget = wibox.container.background
}
diff --git a/config/awesome/ui/notifs/notifications-center/init.lua b/config/awesome/ui/notifs/notifications-center/init.lua
index db747b3..a32067e 100644
--- a/config/awesome/ui/notifs/notifications-center/init.lua
+++ b/config/awesome/ui/notifs/notifications-center/init.lua
@@ -24,8 +24,8 @@ local helpers = require("helpers")
-- Header
local notif_header = wibox.widget {
- markup = 'Notifications',
- font = beautiful.font_name .. "12",
+ markup = "Notifications Center",
+ font = beautiful.font_name .. "Bold 12",
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
@@ -34,7 +34,7 @@ local notif_header = wibox.widget {
-- Clear button
local clear = wibox.widget {
markup = "",
- font = beautiful.icon_font_name .. "14",
+ font = beautiful.icon_font_name .. "Round 16",
align = "center",
valign = "center",
widget = wibox.widget.textbox
@@ -46,7 +46,7 @@ clear:buttons(gears.table.join(
end)
))
-helpers.add_hover_cursor(clear, "hand1")
+helpers.add_hover_cursor(clear, "hand2")
-- Empty notifs
local empty = wibox.widget {
@@ -56,32 +56,33 @@ local empty = wibox.widget {
layout = wibox.layout.align.horizontal,
nil,
{
- markup = "",
- font = beautiful.icon_font_name .. "28",
- align = "center",
+ image = beautiful.notification_icon,
+ forced_width = dpi(60),
+ forced_height = dpi(60),
+ halign = "center",
valign = "center",
- widget = wibox.widget.textbox
+ widget = wibox.widget.imagebox
},
nil
},
{
markup = 'You have no notifs!',
- font = beautiful.font_name .. '10',
+ font = beautiful.font_name .. 'medium 10',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
},
layout = wibox.layout.fixed.vertical,
- spacing = dpi(5)
+ spacing = dpi(10)
},
- top = dpi(75),
+ top = dpi(100),
widget = wibox.container.margin
}
-- Mouse scroll
local notif_container = wibox.layout.fixed.vertical()
notif_container.spacing = dpi(15)
-notif_container.forced_width = beautiful.notifs_width or dpi(270)
+notif_container.forced_width = dpi(270)
local remove_notif_empty = true
@@ -100,52 +101,118 @@ remove_notifbox = function(box)
end
end
-local create_notif = function(icon, n, width)
- local time = os.date("%H:%M")
- local box = {}
+local return_date_time = function(format)
+ return os.date(format)
+end
- local dismiss = wibox.widget {
- markup = helpers.colorize_text("", beautiful.xcolor1),
- font = beautiful.icon_font_name .. "9",
+local parse_to_seconds = function(time)
+ local hourInSec = tonumber(string.sub(time, 1, 2)) * 3600
+ local minInSec = tonumber(string.sub(time, 4, 5)) * 60
+ local getSec = tonumber(string.sub(time, 7, 8))
+ return (hourInSec + minInSec + getSec)
+end
+
+local create_notif = function(icon, n, width)
+
+ --Time
+ local time_of_pop = return_date_time('%H:%M:%S')
+ local exact_time = return_date_time('%I:%M %p')
+ local exact_date_time = return_date_time('%b %d, %I:%M %p')
+
+ local timepop = wibox.widget {
+ id = 'time_pop',
+ markup = nil,
+ font = beautiful.font_name .. "medium 8",
align = "center",
valign = "center",
- widget = wibox.widget.textbox
+ visible = true,
+ widget = wibox.widget.textbox
+ }
+
+ local time_of_popup = gears.timer {
+ timeout = 60,
+ call_now = true,
+ autostart = true,
+ callback = function()
+
+ local time_difference = nil
+
+ time_difference = parse_to_seconds(return_date_time('%H:%M:%S')) - parse_to_seconds(time_of_pop)
+ time_difference = tonumber(time_difference)
+
+ if time_difference < 60 then
+ timepop:set_markup('now')
+
+ elseif time_difference >= 60 and time_difference < 3600 then
+ local time_in_minutes = math.floor(time_difference / 60)
+ timepop:set_markup(time_in_minutes .. 'm ago')
+
+ elseif time_difference >= 3600 and time_difference < 86400 then
+ timepop:set_markup(exact_time)
+
+ elseif time_difference >= 86400 then
+ timepop:set_markup(exact_date_time)
+ return false
+
+ end
+
+ collectgarbage('collect')
+ end
+ }
+
+ local box = {}
+
+ -- Dismiss button
+ local dismiss= wibox.widget {
+ {
+ {
+ markup = helpers.colorize_text("", beautiful.xcolor1),
+ font = beautiful.icon_font_name .. "Round 10",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox
+ },
+ margins = dpi(2),
+ widget = wibox.container.margin
+ },
+ shape = gears.shape.circle,
+ widget = wibox.container.background
}
+ dismiss:connect_signal("mouse::enter", function()
+ dismiss.bg = beautiful.xcolor8
+ end)
+
+ dismiss:connect_signal("mouse::leave", function()
+ dismiss.bg = beautiful.xcolor0
+ end)
+
dismiss:buttons(gears.table.join(
awful.button({}, 1, function()
_G.remove_notifbox(box)
end)
))
- helpers.add_hover_cursor(dismiss, "hand1")
+ helpers.add_hover_cursor(dismiss, "hand2")
+
+ -- Create notifs
box = wibox.widget {
{
{
{
{
- {
- {
- image = icon,
- resize = true,
- clip_shape = helpers.rrect(dpi(2)),
- halign = "center",
- valign = "center",
- widget = wibox.widget.imagebox
- },
- strategy = 'exact',
- height = 40,
- width = 40,
- widget = wibox.container.constraint
- },
- layout = wibox.layout.align.vertical
+ image = icon,
+ resize = true,
+ clip_shape = helpers.rrect(dpi(6)),
+ halign = "center",
+ valign = "center",
+ widget = wibox.widget.imagebox
},
- left = dpi(14),
- right = dpi(4),
- top = dpi(12),
- bottom = dpi(12),
- widget = wibox.container.margin
+ strategy = 'exact',
+ height = dpi(50),
+ width = dpi(50),
+ widget = wibox.container.constraint
},
{
{
@@ -154,75 +221,65 @@ local create_notif = function(icon, n, width)
{
{
step_function = wibox.container.scroll
- .step_functions
- .waiting_nonlinear_back_and_forth,
+ .step_functions
+ .waiting_nonlinear_back_and_forth,
speed = 50,
{
- markup = "" .. n.title .. "",
- font = beautiful.font_name .. "10",
+ markup = n.title,
+ font = beautiful.font_name .. "medium 10",
align = "left",
- -- visible = title_visible,
widget = wibox.widget.textbox
},
forced_width = dpi(140),
widget = wibox.container.scroll.horizontal
},
+ nil,
{
- {
- dismiss,
- halign = "right",
- widget = wibox.container.place
- },
- left = dpi(10),
- widget = wibox.container.margin
+ timepop,
+ layout = wibox.layout.fixed.horizontal
},
- layout = wibox.layout.fixed.horizontal
+ expand = "none",
+ layout = wibox.layout.align.horizontal
},
{
{
step_function = wibox.container.scroll
- .step_functions
- .waiting_nonlinear_back_and_forth,
+ .step_functions
+ .waiting_nonlinear_back_and_forth,
speed = 50,
{
markup = n.message,
+ font = beautiful.font_name .. "medium 8",
align = "left",
- font = beautiful.font_name .. "9",
widget = wibox.widget.textbox
},
- forced_width = dpi(125),
+ forced_width = dpi(165),
widget = wibox.container.scroll.horizontal
},
+ nil,
{
- {
- markup = time,
- align = "right",
- valign = "bottom",
- font = beautiful.font,
- widget = wibox.widget.textbox
- },
- left = dpi(10),
- widget = wibox.container.margin
+ dismiss,
+ layout = wibox.layout.fixed.horizontal
},
- layout = wibox.layout.fixed.horizontal
+ expand = "none",
+ layout = wibox.layout.align.horizontal
},
+ spacing = dpi(2),
layout = wibox.layout.fixed.vertical
},
- nil,
expand = "none",
layout = wibox.layout.align.vertical
},
- margins = dpi(8),
+ left = dpi(12),
widget = wibox.container.margin
},
layout = wibox.layout.align.horizontal
},
- top = dpi(2),
- bottom = dpi(2),
+ margins = dpi(8),
widget = wibox.container.margin
},
bg = beautiful.xcolor0,
- shape = helpers.rrect(dpi(2)),
+ shape = helpers.rrect(dpi(6)),
widget = wibox.container.background
}
@@ -262,6 +319,7 @@ naughty.connect_signal("request::display", function(n)
notif_container:insert(1, create_notif(appicon, n, width))
end)
+-- Init widgets
local notif_center = wibox.widget {
{
{
@@ -278,37 +336,30 @@ local notif_center = wibox.widget {
},
notif_container,
- spacing = dpi(10),
+ spacing = dpi(20),
layout = wibox.layout.fixed.vertical
}
notifs = wibox({
type = "dock",
screen = screen.primary,
- height = beautiful.notifs_height or dpi(310),
- width = beautiful.notifs_width or dpi(270),
- shape = helpers.rrect(dpi(8)),
+ height = dpi(380),
+ width = dpi(300),
+ shape = helpers.rrect(beautiful.border_radius),
ontop = true,
visible = false
})
+notifs.y = dpi(365)
-awful.placement.bottom_left(
- notifs,
- {
- honor_workarea = true,
- margins = {
- left = beautiful.wibar_width + 11
- }
- })
-
+-- Rubato
local slide = rubato.timed{
- pos = dpi(896),
+ pos = dpi(-300),
rate = 60,
- intro = 0.025,
- duration = 0.5,
+ intro = 0.3,
+ duration = 0.8,
easing = rubato.quadratic,
awestore_compat = true,
- subscribed = function(pos) notifs.y = pos end
+ subscribed = function(pos) notifs.x = pos end
}
local notifs_status = false
@@ -319,14 +370,15 @@ slide.ended:subscribe(function()
end
end)
+-- Make toogle button
notifs_show = function()
notifs.visible = true
- slide:set(dpi(448))
+ slide:set(dpi(100))
notifs_status = false
end
notifs_hide = function()
- slide:set(dpi(896))
+ slide:set(dpi(-375))
notifs_status = true
end
@@ -338,6 +390,7 @@ notifs_toggle = function()
end
end
+-- notifs setup
notifs:setup {
notif_center,
margins = dpi(15),
diff --git a/config/awesome/ui/notifs/popup.lua b/config/awesome/ui/notifs/popup.lua
index cb502b0..6f52cbf 100644
--- a/config/awesome/ui/notifs/popup.lua
+++ b/config/awesome/ui/notifs/popup.lua
@@ -12,13 +12,20 @@ local wibox = require("wibox")
-- Helpers
local helpers = require("helpers")
--- Pop up
+
+-- Pop Up Notification
------------
local pop_icon = wibox.widget{
- font = beautiful.icon_font_name .. "Round 48",
- align = "center",
- widget = wibox.widget.textbox
+ {
+ id = "icon",
+ resize = true,
+ widget = wibox.widget.imagebox
+ },
+ forced_height = dpi(150),
+ top = dpi(12),
+ bottom = dpi(12),
+ widget = wibox.container.margin
}
local pop_bar = wibox.widget {
@@ -28,7 +35,7 @@ local pop_bar = wibox.widget {
color = beautiful.bg_accent,
shape = gears.shape.rounded_bar,
bar_shape = gears.shape.rounded_bar,
- forced_height = dpi(5),
+ forced_height = dpi(24),
widget = wibox.widget.progressbar
}
@@ -47,16 +54,22 @@ pop:setup {
{
{
{
- helpers.vertical_pad(dpi(10)),
+ layout = wibox.layout.align.horizontal,
+ expand = 'none',
+ nil,
pop_icon,
- layout = wibox.layout.fixed.vertical
+ nil
},
- nil,
- pop_bar,
- layout = wibox.layout.align.vertical
+ layout = wibox.layout.fixed.vertical
},
- margins = dpi(30),
- widget = wibox.container.margin
+ {
+ pop_bar,
+ left = dpi(24),
+ right = dpi(24),
+ bottom = dpi(24),
+ widget = wibox.container.margin
+ },
+ layout = wibox.layout.align.vertical
},
bg = beautiful.xbackground,
shape = helpers.rrect(beautiful.pop_border_radius),
@@ -83,27 +96,127 @@ end
local vol_first_time = true
awesome.connect_signal("signal::volume", function(value, muted)
+ local icon = beautiful.volume_icon
+
if vol_first_time then
vol_first_time = false
else
- pop_icon.markup = ""
+ local vol_icon = gears.color.recolor_image(icon, beautiful.xforeground)
+ icon = vol_icon
pop_bar.value = value
if muted then
- pop_icon.markup = ""
+ local muted_icon = gears.color.recolor_image(icon, beautiful.xcolor8)
+ icon = muted_icon
pop_bar.color = beautiful.xcolor8
else
pop_bar.color = beautiful.pop_vol_color
end
+
+ pop_icon.icon.image = icon
toggle_pop()
end
end)
awesome.connect_signal("signal::brightness", function(value)
- pop_icon.markup = ""
- pop_bar.value = value
- pop_bar.color = beautiful.pop_brightness_color
+ local icon = beautiful.brightness_icon
+ if value ~= 0 then
+ pop_bar.color = beautiful.pop_brightness_color
+ else
+ local bri_icon = gears.color.recolor_image(icon, beautiful.xcolor8)
+ icon = bri_icon
+ end
+
+
+ pop_bar.value = value
+ pop_icon.icon.image = icon
toggle_pop()
end)
+
+
+-- Layout list
+-----------------
+
+local layout_list = awful.widget.layoutlist {
+ source = awful.widget.layoutlist.source.default_layouts, -- DOC_HIDE
+ spacing = dpi(24),
+ base_layout = wibox.widget {
+ spacing = dpi(24),
+ forced_num_cols = 4,
+ layout = wibox.layout.grid.vertical
+ },
+ widget_template = {
+ {
+ {
+ id = "icon_role",
+ forced_height = dpi(68),
+ forced_width = dpi(68),
+ widget = wibox.widget.imagebox
+ },
+ margins = dpi(24),
+ widget = wibox.container.margin
+ },
+ id = "background_role",
+ forced_width = dpi(68),
+ forced_height = dpi(68),
+ widget = wibox.container.background
+ }
+}
+
+local layout_popup = awful.popup {
+ widget = wibox.widget {
+ {layout_list, margins = dpi(24), widget = wibox.container.margin},
+ bg = beautiful.xbackground,
+ shape = helpers.rrect(beautiful.border_radius),
+ border_color = beautiful.widget_border_color,
+ border_width = beautiful.widget_border_width,
+ widget = wibox.container.background
+ },
+ placement = awful.placement.centered,
+ ontop = true,
+ visible = false,
+ bg = beautiful.xbackground .. "00"
+}
+
+function gears.table.iterate_value(t, value, step_size, filter, start_at)
+ local k = gears.table.hasitem(t, value, true, start_at)
+ if not k then return end
+
+ step_size = step_size or 1
+ local new_key = gears.math.cycle(#t, k + step_size)
+
+ if filter and not filter(t[new_key]) then
+ for i = 1, #t do
+ local k2 = gears.math.cycle(#t, new_key + i)
+ if filter(t[k2]) then return t[k2], k2 end
+ end
+ return
+ end
+
+ return t[new_key], new_key
+end
+
+awful.keygrabber {
+ start_callback = function() layout_popup.visible = true end,
+ stop_callback = function() layout_popup.visible = false end,
+ export_keybindings = true,
+ stop_event = "release",
+ stop_key = {"Escape", "Super_L", "Super_R", "Mod4"},
+ keybindings = {
+ {
+ {modkey, "Shift"}, " ", function()
+ awful.layout.set(gears.table.iterate_value(layout_list.layouts,
+ layout_list.current_layout, -1),
+ nil)
+ end
+ }, {
+ {modkey}, " ", function()
+ awful.layout.set(gears.table.iterate_value(layout_list.layouts,
+ layout_list.current_layout, 1),
+ nil)
+ end
+ }
+ }
+}
diff --git a/config/awesome/ui/tooltip/init.lua b/config/awesome/ui/tooltip/init.lua
index 8e501bd..85400fe 100644
--- a/config/awesome/ui/tooltip/init.lua
+++ b/config/awesome/ui/tooltip/init.lua
@@ -21,10 +21,9 @@ local screen_width = awful.screen.focused().geometry.width
local screen_height = awful.screen.focused().geometry.height
--- Tooltip
-------------
-
-- Helpers
+-------------
+
local function create_boxed_widget(widget_to_be_boxed, width, height, inner_pad)
local box_container = wibox.container.background()
box_container.bg = beautiful.xcolor0
@@ -56,114 +55,120 @@ local function create_boxed_widget(widget_to_be_boxed, width, height, inner_pad)
return boxed_widget
end
- -- Battery
- local batt_bar = wibox.widget {
- max_value = 100,
- value = 20,
- background_color = beautiful.transparent,
- color = beautiful.xcolor8,
- widget = wibox.widget.progressbar
- }
- local batt_bar_container = wibox.widget {
- batt_bar,
- direction = "east",
- widget = wibox.container.rotate
- }
+-- Battery
+-------------
- local batt_icon = wibox.widget{
- markup = helpers.colorize_text("", beautiful.xcolor1),
- font = beautiful.icon_font_name .. "Round 18",
- align = "center",
- valign = "center",
- widget = wibox.widget.textbox
- }
+local batt_bar = wibox.widget {
+ max_value = 100,
+ value = 20,
+ background_color = beautiful.transparent,
+ color = beautiful.xcolor8,
+ widget = wibox.widget.progressbar
+}
- local batt_icon_container = wibox.widget{
+local batt_bar_container = wibox.widget {
+ batt_bar,
+ direction = "east",
+ widget = wibox.container.rotate
+}
+
+local batt_icon = wibox.widget{
+ markup = helpers.colorize_text("", beautiful.xcolor1),
+ font = beautiful.icon_font_name .. "Round 18",
+ align = "center",
+ valign = "center",
+ widget = wibox.widget.textbox
+}
+
+local batt_icon_container = wibox.widget{
+ nil,
+ {
nil,
- {
- nil,
- batt_icon,
- expand = "none",
- layout = wibox.layout.align.vertical
- },
+ batt_icon,
expand = "none",
- layout = wibox.layout.align.horizontal
- }
+ layout = wibox.layout.align.vertical
+ },
+ expand = "none",
+ layout = wibox.layout.align.horizontal
+}
- local batt = wibox.widget{
- batt_bar_container,
- batt_icon_container,
- layout = wibox.layout.stack
- }
+local batt = wibox.widget{
+ batt_bar_container,
+ batt_icon_container,
+ layout = wibox.layout.stack
+}
- local batt_val = 0
- local batt_charger
+local batt_val = 0
+local batt_charger
- awesome.connect_signal("signal::battery", function(value)
- batt_val = value
- awesome.emit_signal("widget::battery")
- end)
+awesome.connect_signal("signal::battery", function(value)
+ batt_val = value
+ awesome.emit_signal("widget::battery")
+end)
- awesome.connect_signal("signal::charger", function(state)
- batt_charger = state
- awesome.emit_signal("widget::battery")
- end)
+awesome.connect_signal("signal::charger", function(state)
+ batt_charger = state
+ awesome.emit_signal("widget::battery")
+end)
- awesome.connect_signal("widget::battery", function()
- local b = ""
- local fill_color = beautiful.xcolor2
+awesome.connect_signal("widget::battery", function()
+ local b = ""
+ local fill_color = beautiful.xcolor2
- if batt_val >= 88 and batt_val <= 100 then
- b = ""
- elseif batt_val >= 76 and batt_val < 88 then
- b = ""
- elseif batt_val >= 64 and batt_val < 76 then
- b = ""
- elseif batt_val >= 52 and batt_val < 64 then
- b = ""
- elseif batt_val >= 40 and batt_val < 52 then
- b = ""
- elseif batt_val >= 28 and batt_val < 40 then
- b = ""
- elseif batt_val >= 16 and batt_val < 28 then
- b = ""
- else
- b = ""
- end
+ if batt_val >= 88 and batt_val <= 100 then
+ b = ""
+ elseif batt_val >= 76 and batt_val < 88 then
+ b = ""
+ elseif batt_val >= 64 and batt_val < 76 then
+ b = ""
+ elseif batt_val >= 52 and batt_val < 64 then
+ b = ""
+ elseif batt_val >= 40 and batt_val < 52 then
+ b = ""
+ elseif batt_val >= 28 and batt_val < 40 then
+ b = ""
+ elseif batt_val >= 16 and batt_val < 28 then
+ b = ""
+ else
+ b = ""
+ end
- if batt_charger then
- b = ""
- if batt_val >= 11 and batt_val <= 30 then
- fill_color = beautiful.xcolor3
- elseif batt_val <= 10 then
- fill_color = beautiful.xcolor1
- end
- else
+ if batt_charger then
+ b = ""
if batt_val >= 11 and batt_val <= 30 then
fill_color = beautiful.xcolor3
elseif batt_val <= 10 then
fill_color = beautiful.xcolor1
end
+ else
+ if batt_val >= 11 and batt_val <= 30 then
+ fill_color = beautiful.xcolor3
+ elseif batt_val <= 10 then
+ fill_color = beautiful.xcolor1
end
+ end
- batt_bar.value = batt_val
- batt_icon.markup = helpers.colorize_text(b, fill_color)
- end)
+ batt_bar.value = batt_val
+ batt_icon.markup = helpers.colorize_text(b, fill_color)
+end)
----- Calendar
-- Date
+----------
+
local date_day = wibox.widget{
- font = beautiful.font_name .. "medium 9",
+ font = beautiful.font_name .. "bold 10",
format = helpers.colorize_text("%A", beautiful.xcolor4),
+ align = "center",
valign = "center",
widget = wibox.widget.textclock
}
local date_month = wibox.widget{
font = beautiful.font_name .. "bold 14",
- format = "%d %B",
+ format = "%d %B %Y",
+ align = "center",
valign = "center",
widget = wibox.widget.textclock
}
@@ -175,11 +180,14 @@ local date = wibox.widget{
layout = wibox.layout.align.vertical
}
+
-- Separator
+---------------
+
local separator = wibox.widget{
{
bg = beautiful.xcolor5,
- shape = helpers.rrect(dpi(3)),
+ shape = helpers.rrect(dpi(5)),
forced_width = dpi(3),
widget = wibox.container.background
},
@@ -187,22 +195,16 @@ local separator = wibox.widget{
widget = wibox.container.margin
}
--- Time
-local time_hour = wibox.widget{
- font = beautiful.font_name .. "bold 18",
- format = "%H",
- align = "center",
- widget = wibox.widget.textclock
-}
-local time_min = wibox.widget{
- font = beautiful.font_name .. "bold 18",
- format = "%M",
- align = "center",
- widget = wibox.widget.textclock
-}
+-- Analog clock
+------------------
+
+local analog_clock = require("ui.widgets.analog_clock")
+
-- Wifi
+----------
+
local wifi_status_icon = wibox.widget{
markup = "Offline",
font = beautiful.icon_font_name .. "Round 14",
@@ -213,12 +215,10 @@ local wifi_status_icon = wibox.widget{
local wifi = wibox.widget{
wifi_status_icon,
- forced_width = dpi(35),
- forced_height = dpi(35),
- bg = beautiful.xcolor0,
- shape = helpers.rrect(beautiful.tooltip_box_border_radius),
- shape_border_width = dpi(3),
- shape_border_color = beautiful.xcolor1,
+ forced_width = dpi(30),
+ forced_height = dpi(30),
+ bg = beautiful.xcolor8,
+ shape = gears.shape.circle,
widget = wibox.container.background
}
@@ -243,7 +243,10 @@ awesome.connect_signal("widget::network", function ()
wifi_status_icon.markup = helpers.colorize_text(w, fill_color)
end)
+
-- UpTime
+------------
+
local uptime_label = wibox.widget{
font = beautiful.font_name .. "medium 9",
markup = helpers.colorize_text("Uptime", beautiful.xcolor5),
@@ -277,52 +280,57 @@ local uptime_container = wibox.widget{
layout = wibox.layout.align.horizontal
}
+
-- Widget
-local date_boxed = create_boxed_widget(date, dpi(110), dpi(50), true)
-local hour_boxed = create_boxed_widget(time_hour, dpi(50), dpi(50), true)
-local min_boxed = create_boxed_widget(time_min, dpi(50), dpi(50), true)
+------------
+
local batt_boxed = create_boxed_widget(batt, dpi(50), dpi(110))
local uptime_boxed = create_boxed_widget(uptime_container, dpi(170), dpi(50), true)
+local analog_clock_boxed = create_boxed_widget(analog_clock, dpi(110), dpi(110), true)
--- Tooltip
-cal_tooltip = wibox({
+
+-- Tooltip setup
+-------------------
+
+stats_tooltip = wibox({
type = "dock",
screen = screen.primary,
- height = dpi(200),
- width = dpi(200),
- shape = helpers.rrect(beautiful.tooltip_border_radius - 1),
+ height = beautiful.tooltip_height,
+ width = beautiful.tooltip_width,
+ shape = helpers.rrect(beautiful.tooltip_box_border_radius),
bg = beautiful.transparent,
ontop = true,
visible = false
})
-awful.placement.bottom_left(cal_tooltip, {honor_workarea = true, margins = {left = beautiful.wibar_width + 11, bottom = dpi(44)}})
+awful.placement.bottom_left(stats_tooltip, {
+ margins = {
+ left = beautiful.wibar_width + 55,
+ bottom = dpi(33)
+ }
+})
-cal_tooltip_show = function()
- cal_tooltip.visible = true
+stats_tooltip_show = function()
+ stats_tooltip.visible = true
end
-cal_tooltip_hide = function()
- cal_tooltip.visible = false
+stats_tooltip_hide = function()
+ stats_tooltip.visible = false
end
-cal_tooltip:setup {
+stats_tooltip:setup {
{
{
{
{
- date_boxed,
+ date,
{
- hour_boxed,
- min_boxed,
+ analog_clock_boxed,
+ batt_boxed,
layout = wibox.layout.fixed.horizontal
},
layout = wibox.layout.fixed.vertical
},
- {
- batt_boxed,
- layout = wibox.layout.fixed.vertical
- },
layout = wibox.layout.fixed.horizontal
},
{
@@ -335,6 +343,6 @@ cal_tooltip:setup {
widget = wibox.container.margin
},
shape = helpers.rrect(beautiful.tooltip_border_radius),
- bg = beautiful.xbackground,
+ bg = beautiful.tooltip_bg,
widget = wibox.container.background
}
diff --git a/config/awesome/ui/widgets/analog_clock.lua b/config/awesome/ui/widgets/analog_clock.lua
new file mode 100644
index 0000000..d15c74a
--- /dev/null
+++ b/config/awesome/ui/widgets/analog_clock.lua
@@ -0,0 +1,78 @@
+-- Standard awesome library
+local gears = require("gears")
+local wibox = require("wibox")
+local math = require("math")
+
+-- Theme handling library
+local beautiful = require("beautiful")
+
+-- C libraries
+local cairo = require("lgi").cairo
+
+-- Analog clock
+------------------
+
+local function create_minute_pointer(minute)
+ local img = cairo.ImageSurface(cairo.Format.ARGB32, 1000, 1000)
+ local cr = cairo.Context(img)
+ local angle = (minute / 60) * 2 * math.pi
+ cr:translate(500, 500)
+ cr:rotate(angle)
+ cr:translate(-500, -500)
+ cr:set_source(gears.color(beautiful.xforeground))
+ cr:rectangle(485, 100, 30, 420)
+ cr:fill()
+ return img
+end
+
+local function create_hour_pointer(hour)
+ local img = cairo.ImageSurface(cairo.Format.ARGB32, 1000, 1000)
+ local cr = cairo.Context(img)
+ local angle = ((hour % 12) / 12) * 2 * math.pi
+ cr:translate(500, 500)
+ cr:rotate(angle)
+ cr:translate(-500, -500)
+ cr:set_source(gears.color(beautiful.xcolor4))
+ cr:rectangle(480, 200, 40, 320)
+ cr:fill()
+ return img
+end
+
+local minute_pointer = create_minute_pointer(37)
+local hour_pointer = create_hour_pointer(17)
+
+local minute_pointer_img = wibox.widget.imagebox()
+local hour_pointer_img = wibox.widget.imagebox()
+
+local analog_clock = wibox.widget {
+ { -- circle
+ wibox.widget.textbox(""),
+ shape = function(cr, width, height) gears.shape.circle(cr, width, height, height / 2) end,
+ shape_border_width = 4,
+ shape_border_color = beautiful.xcolor8,
+ bg = "alpha",
+ widget = wibox.container.background
+ },
+ minute_pointer_img,
+ hour_pointer_img,
+ layout = wibox.layout.stack
+}
+
+local minute = 0
+local hour = 0
+
+gears.timer {
+ timeout = 30,
+ call_now = true,
+ autostart = true,
+ callback = function()
+ minute = os.date("%M")
+ hour = os.date("%H")
+ minute_pointer = create_minute_pointer(minute)
+ hour_pointer = create_hour_pointer(hour + (minute / 60))
+ minute_pointer_img.image = minute_pointer
+ hour_pointer_img.image = hour_pointer
+ end
+}
+
+return analog_clock
diff --git a/config/awesome/ui/widgets/pacman_taglist.lua b/config/awesome/ui/widgets/pacman_taglist.lua
index acb6331..005e878 100644
--- a/config/awesome/ui/widgets/pacman_taglist.lua
+++ b/config/awesome/ui/widgets/pacman_taglist.lua
@@ -5,6 +5,7 @@ local wibox = require("wibox")
local beautiful = require("beautiful")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
+local helpers = require("helpers")
local get_taglist = function(s)
-- Taglist buttons
@@ -25,15 +26,13 @@ local get_taglist = function(s)
-- The actual png icons
-- I do have the svgs, but inkscape does a better job of scaling
local ghost = gears.surface.load_uncached(
- gfs.get_configuration_dir() .. "theme/assets/icons/taglist/ghost.png")
+ gfs.get_configuration_dir() .. "theme/assets/icons/taglist/ghost.png")
local ghost_icon = gears.color.recolor_image(ghost, beautiful.xcolor6)
-
local dot = gears.surface.load_uncached(
- gfs.get_configuration_dir() .. "theme/assets/icons/taglist/dot.png")
+ gfs.get_configuration_dir() .. "theme/assets/icons/taglist/dot.png")
local dot_icon = gears.color.recolor_image(dot, beautiful.xcolor8)
-
local pacman = gears.surface.load_uncached(
- gfs.get_configuration_dir() .. "theme/assets/icons/taglist/pacman.png")
+ gfs.get_configuration_dir() .. "theme/assets/icons/taglist/pacman.png")
local pacman_icon = gears.color.recolor_image(pacman, beautiful.xcolor3)
-- Function to update the tags
@@ -51,13 +50,15 @@ local get_taglist = function(s)
local pac_taglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
- style = {shape = gears.shape.rectangle},
+ style = {
+ shape = helpers.rrect(dpi(10))
+ },
layout = {spacing = 0, layout = wibox.layout.fixed.vertical},
widget_template = {
{
{id = 'icon_role', widget = wibox.widget.imagebox},
id = 'margin_role',
- margins = dpi(8),
+ margins = dpi(10),
widget = wibox.container.margin
},
id = 'background_role',
@@ -70,18 +71,10 @@ local get_taglist = function(s)
awesome.emit_signal("bling::tag_preview::visibility", s,
true)
end
- if self.bg ~= beautiful.lighter_bg then
- self.backup = self.bg
- self.has_backup = true
- end
- self.bg = beautiful.lighter_bg
end)
self:connect_signal('mouse::leave', function()
awesome.emit_signal("bling::tag_preview::visibility", s,
false)
- if self.has_backup then
- self.bg = self.backup
- end
end)
end,
update_callback = function(self, c3, index, objects)