Add revelation
Update and add bling task_preview, tag_preview and window_switcher Add catppuccin-macchiato Use my weather key Update keybindings Update autorun Fix sliders
This commit is contained in:
parent
4f850f7173
commit
2401cfcee2
56 changed files with 2040 additions and 858 deletions
|
@ -25,6 +25,8 @@ mylauncher = wibox.container.margin(mylauncher, dpi(0), dpi(0), dpi(6), dpi(6))
|
|||
-- ~~~~~~~~~~~
|
||||
-- # Sidebar button :
|
||||
local sidebar_button = require('ui.widgets.sidebar_button')
|
||||
-- # notifications_list button :
|
||||
local notifications_list_button = require('ui.widgets.notifications_list_button')
|
||||
-- # Systray :
|
||||
local systray = require('ui.widgets.systray')
|
||||
-- # Clock :
|
||||
|
@ -109,6 +111,7 @@ local function get_bar(s)
|
|||
systray,
|
||||
sidebar_button,
|
||||
layoutbox(s),
|
||||
notifications_list_button,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
spacing = dpi(10)
|
||||
},
|
||||
|
@ -140,8 +143,8 @@ local function get_bar(s)
|
|||
c.screen.mywibar.visible = true
|
||||
end
|
||||
end
|
||||
client.connect_signal("property::fullscreen", remove_wibar)
|
||||
client.connect_signal("request::unmanage", add_wibar)
|
||||
--client.connect_signal("property::fullscreen", remove_wibar)
|
||||
--client.connect_signal("request::unmanage", add_wibar)
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -9,15 +9,16 @@ local wibox = require("wibox")
|
|||
local beautiful = require("beautiful")
|
||||
local xresources = require("beautiful.xresources")
|
||||
local dpi = xresources.apply_dpi
|
||||
local naughty = require("naughty")
|
||||
|
||||
-- # Libs :
|
||||
-- ~~~~~~~~
|
||||
local helpers = require("libs.helpers")
|
||||
|
||||
-- Tags :
|
||||
--awful.util.tagnames = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
|
||||
awful.util.tagnames = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }
|
||||
--awful.util.tagnames = { "", "", "", "", "", "", "", "", ""} -- font size : 14
|
||||
awful.util.tagnames = {"", "", "", "", "", "", "", "", ""}
|
||||
--awful.util.tagnames = { "", "", "", "", "", "", "", "", "" }
|
||||
|
||||
-- Each screen has its own tag table.
|
||||
screen.connect_signal("request::desktop_decoration", function(s)
|
||||
|
@ -25,68 +26,88 @@ screen.connect_signal("request::desktop_decoration", function(s)
|
|||
end)
|
||||
|
||||
local function update_tag(item, tag, index)
|
||||
if tag.selected then
|
||||
item.markup = helpers.colorize_text(" ", colors.main_scheme)
|
||||
elseif tag.urgent then
|
||||
item.markup = helpers.colorize_text(" ", colors.red)
|
||||
elseif #tag:clients() > 0 then
|
||||
item.markup = helpers.colorize_text(" ", colors.white)
|
||||
else
|
||||
item.markup = helpers.colorize_text(" ", colors.white)
|
||||
end
|
||||
if tag.selected then
|
||||
item.markup = helpers.colorize_text(" ", colors.main_scheme)
|
||||
elseif tag.urgent then
|
||||
item.markup = helpers.colorize_text(" ", colors.red)
|
||||
elseif #tag:clients() > 0 then
|
||||
item.markup = helpers.colorize_text(" ", colors.white)
|
||||
else
|
||||
item.markup = helpers.colorize_text(" ", colors.white)
|
||||
end
|
||||
end
|
||||
|
||||
local modkey = "Mod4"
|
||||
return function(s)
|
||||
|
||||
-- Taglist buttons
|
||||
local taglist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
-- Taglist buttons
|
||||
local taglist_buttons = gears.table.join(
|
||||
awful.button({}, 1, function(t) t:view_only() end),
|
||||
awful.button({ modkey }, 1, function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end),
|
||||
|
||||
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||
awful.button({}, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end)
|
||||
|
||||
--awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
|
||||
--awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end),
|
||||
--awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
|
||||
--awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end),
|
||||
)
|
||||
|
||||
-- Create a taglist widget
|
||||
local taglist = awful.widget.taglist {
|
||||
screen = s,
|
||||
screen = s,
|
||||
--filter = awful.widget.taglist.filter.all,
|
||||
filter = function (t) return t.selected or #t:clients() > 0 end, -- Show only used Tags
|
||||
buttons = taglist_buttons,
|
||||
layout = {
|
||||
filter = function(t) return t.selected or #t:clients() > 0 end, -- Show only used Tags
|
||||
buttons = taglist_buttons,
|
||||
layout = {
|
||||
spacing = dpi(8),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
style = {
|
||||
style = {
|
||||
spacing = dpi(-4),
|
||||
},
|
||||
widget_template = {
|
||||
id = "tag",
|
||||
font = theme.ui_font,
|
||||
widget = wibox.widget.textbox,
|
||||
|
||||
create_callback = function(self, c3, index, object)
|
||||
update_tag(self, c3, index)
|
||||
end,
|
||||
|
||||
update_callback = function(self, c3, index, object)
|
||||
self:connect_signal('mouse::enter', function()
|
||||
-- BLING: Only show widget when there are clients in the tag
|
||||
if #c3:clients() > 0 then
|
||||
-- BLING: Update the widget with the new tag
|
||||
awesome.emit_signal("bling::tag_preview::update", c3)
|
||||
-- BLING: Show the widget
|
||||
awesome.emit_signal("bling::tag_preview::visibility", s, true)
|
||||
end
|
||||
|
||||
if self.bg ~= '#ff0000' then
|
||||
self.backup = self.bg
|
||||
self.has_backup = true
|
||||
end
|
||||
self.bg = '#ff0000'
|
||||
end)
|
||||
self:connect_signal('mouse::leave', function()
|
||||
-- BLING: Turn the widget off
|
||||
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, object)
|
||||
update_tag(self, c3, index)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
tags = wibox.widget{
|
||||
|
||||
tags = wibox.widget {
|
||||
{
|
||||
{
|
||||
taglist,
|
||||
|
@ -99,7 +120,7 @@ return function(s)
|
|||
bg = colors.container,
|
||||
shape = helpers.rrect(theme.rounded - 4),
|
||||
widget = wibox.container.background
|
||||
},
|
||||
},
|
||||
top = dpi(4),
|
||||
bottom = dpi(4),
|
||||
left = dpi(0),
|
||||
|
@ -108,6 +129,5 @@ return function(s)
|
|||
}
|
||||
|
||||
--return taglist
|
||||
return tags
|
||||
return tags
|
||||
end
|
||||
|
||||
|
|
|
@ -14,78 +14,93 @@ local dpi = xresources.apply_dpi
|
|||
-- ~~~~~~~~
|
||||
local helpers = require("libs.helpers")
|
||||
|
||||
return function(s)
|
||||
|
||||
-- Tasklist buttons
|
||||
local tasklist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function (c) c:activate { context = "tasklist", action = "toggle_minimization" } end),
|
||||
awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
|
||||
awful.button({ }, 4, function() awful.client.focus.byidx(-1) end),
|
||||
awful.button({ }, 5, function() awful.client.focus.byidx( 1) end)
|
||||
)
|
||||
return function(s)
|
||||
-- Tasklist buttons
|
||||
local tasklist_buttons = gears.table.join(
|
||||
awful.button({}, 1, function(c) c:activate { context = "tasklist", action = "toggle_minimization" } end),
|
||||
awful.button({}, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
|
||||
awful.button({}, 4, function() awful.client.focus.byidx(-1) end),
|
||||
awful.button({}, 5, function() awful.client.focus.byidx(1) end)
|
||||
)
|
||||
|
||||
-- Create a tasklist widget
|
||||
local tasklist = awful.widget.tasklist
|
||||
{
|
||||
screen = s,
|
||||
filter = awful.widget.tasklist.filter.currenttags,
|
||||
buttons = tasklist_buttons,
|
||||
style = {
|
||||
font = theme.font,
|
||||
bg_normal = colors.container,
|
||||
bg_focus = colors.container,
|
||||
bg_minimize = colors.black ,
|
||||
shape = helpers.rrect(dpi(4)),
|
||||
},
|
||||
layout = {
|
||||
spacing = dpi(8),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
widget_template = {
|
||||
local tasklist = awful.widget.tasklist
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.widget.clienticon,
|
||||
forced_height = dpi(15),
|
||||
forced_width = dpi(15),
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
margins = dpi(2),
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
{
|
||||
nil,
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
widget = wibox.container.background,
|
||||
id = "pointer",
|
||||
bg = colors.main_scheme,
|
||||
shape = gears.shape.rounded_bar,
|
||||
forced_height = dpi(2),
|
||||
forced_width = dpi(20)
|
||||
},
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
layout = wibox.layout.stack,
|
||||
screen = s,
|
||||
filter = awful.widget.tasklist.filter.currenttags,
|
||||
buttons = tasklist_buttons,
|
||||
style = {
|
||||
font = theme.font,
|
||||
bg_normal = colors.container,
|
||||
bg_focus = colors.container,
|
||||
bg_minimize = colors.black,
|
||||
shape = helpers.rrect(dpi(4)),
|
||||
},
|
||||
forced_width = dpi(40),
|
||||
id = "background_role",
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
top = dpi(4),
|
||||
bottom = dpi(4),
|
||||
left = dpi(2),
|
||||
right = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
}
|
||||
layout = {
|
||||
spacing = dpi(8),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
widget_template = {
|
||||
create_callback = function(self, c, index, objects) --luacheck: no unused args
|
||||
--self:get_children_by_id('clienticon')[1].client = c
|
||||
|
||||
-- BLING: Toggle the popup on hover and disable it off hover
|
||||
self:connect_signal('mouse::enter', function()
|
||||
awesome.emit_signal("bling::task_preview::visibility", s,
|
||||
true, c)
|
||||
end)
|
||||
self:connect_signal('mouse::leave', function()
|
||||
awesome.emit_signal("bling::task_preview::visibility", s,
|
||||
false, c)
|
||||
end)
|
||||
end,
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = 'clienticon',
|
||||
awful.widget.clienticon,
|
||||
forced_height = dpi(15),
|
||||
forced_width = dpi(15),
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
margins = dpi(2),
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
{
|
||||
nil,
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
widget = wibox.container.background,
|
||||
id = "pointer",
|
||||
bg = colors.main_scheme,
|
||||
shape = gears.shape.rounded_bar,
|
||||
forced_height = dpi(2),
|
||||
forced_width = dpi(20)
|
||||
},
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.stack,
|
||||
},
|
||||
forced_width = dpi(40),
|
||||
id = "background_role",
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
top = dpi(4),
|
||||
bottom = dpi(4),
|
||||
left = dpi(2),
|
||||
right = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
}
|
||||
return tasklist
|
||||
end
|
||||
|
|
108
home/.config/awesome/ui/notifications-list/init.lua
Normal file
108
home/.config/awesome/ui/notifications-list/init.lua
Normal file
|
@ -0,0 +1,108 @@
|
|||
-- ## Sidebar ##
|
||||
-- ~~~~~~~~~~~~~
|
||||
|
||||
-- Requirements :
|
||||
-- ~~~~~~~~~~~~~~
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require ("beautiful")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
|
||||
-- # Libs :
|
||||
-- ~~~~~~~~
|
||||
local helpers = require("libs.helpers")
|
||||
local rubato = require("libs.rubato")
|
||||
|
||||
local function box_widget(widgets, width, height)
|
||||
return wibox.widget {
|
||||
{
|
||||
{
|
||||
widgets,
|
||||
margins = dpi(16),
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
forced_width = dpi(width),
|
||||
forced_height = dpi(height),
|
||||
shape = helpers.rrect(theme.rounded),
|
||||
bg = colors.container,
|
||||
widget = wibox.container.background,
|
||||
},
|
||||
margins = {left = dpi(20), right = dpi(20)},
|
||||
widget = wibox.container.margin,
|
||||
}
|
||||
end
|
||||
|
||||
-- Get widgets
|
||||
local notifications_list_core = require("ui.notifications-list.list")
|
||||
local notifications_widget = notifications_list_core.widget
|
||||
|
||||
-- Combine some widgets
|
||||
local notifications = box_widget(notifications_widget, 380, 150)
|
||||
|
||||
-- Sidebar
|
||||
local notifications_list = wibox {
|
||||
type = "dock",
|
||||
visible = false,
|
||||
ontop = true,
|
||||
width = dpi(420),
|
||||
height = dpi(836),
|
||||
y = dpi(8),
|
||||
bg = theme.bg,
|
||||
shape = helpers.rrect(18),
|
||||
|
||||
}
|
||||
|
||||
-- Sidebar widget setup
|
||||
notifications_list : setup {
|
||||
{
|
||||
notifications,
|
||||
spacing = dpi(20),
|
||||
layout = wibox.layout.flex.vertical,
|
||||
},
|
||||
margins = { top = dpi(20), bottom = dpi(20)},
|
||||
widget = wibox.container.margin,
|
||||
}
|
||||
|
||||
-- Slide animation
|
||||
local slide = rubato.timed {
|
||||
pos = helpers.screen.geometry.height,
|
||||
rate = 60,
|
||||
intro = 0.05,
|
||||
duration = 0.2,
|
||||
easing = rubato.quadratic,
|
||||
subscribed = function(pos)
|
||||
notifications_list.y = helpers.screen.geometry.y + pos
|
||||
end
|
||||
}
|
||||
|
||||
-- Timer of sidebar's death
|
||||
notifications_list.timer = gears.timer {
|
||||
timeout = 0.5,
|
||||
single_shot = true,
|
||||
callback = function()
|
||||
notifications_list.visible = not notifications_list.visible
|
||||
end
|
||||
}
|
||||
|
||||
-- Toggle function
|
||||
notifications_list.toggle = function()
|
||||
if notifications_list.visible then
|
||||
slide.target = helpers.screen.geometry.y - notifications_list.height
|
||||
notifications_list.timer:start()
|
||||
else
|
||||
slide.target = helpers.screen.geometry.y + dpi(10)
|
||||
notifications_list.visible = not notifications_list.visible
|
||||
end
|
||||
|
||||
end
|
||||
awful.placement.top_right(notifications_list, {honor_workarea = true, margins = beautiful.useless_gap * 3})
|
||||
|
||||
notifications_list.core = notifications_list_core
|
||||
|
||||
-- Get signal to execute the function (if that makes sense)
|
||||
awesome.connect_signal("notifications_list::toggle", function()
|
||||
notifications_list.toggle()
|
||||
end)
|
||||
|
||||
return notifications_list
|
147
home/.config/awesome/ui/notifications-list/list.lua
Normal file
147
home/.config/awesome/ui/notifications-list/list.lua
Normal file
|
@ -0,0 +1,147 @@
|
|||
-- ## Clock ##
|
||||
-- ~~~~~~~~~~~
|
||||
|
||||
-- Requirements :
|
||||
-- ~~~~~~~~~~~~~~
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local naughty = require("naughty")
|
||||
local beautiful = require("beautiful")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
|
||||
local notifbox_layout = wibox.widget {
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
spacing = dpi(7)
|
||||
}
|
||||
|
||||
local function create_notifcation(n)
|
||||
local icon_visibility
|
||||
|
||||
if n.icon == nil then
|
||||
icon_visibility = false
|
||||
else
|
||||
icon_visibility = true
|
||||
end
|
||||
|
||||
-- Action widget
|
||||
local action_widget = {
|
||||
{
|
||||
{
|
||||
id = "text_role",
|
||||
align = "center",
|
||||
font = "Roboto Mono 10",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
margins = { left = dpi(6), right = dpi(6) },
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
}
|
||||
|
||||
-- Apply action widget ^
|
||||
local actions = wibox.widget {
|
||||
notification = n,
|
||||
base_layout = wibox.widget {
|
||||
spacing = dpi(8),
|
||||
layout = wibox.layout.flex.horizontal,
|
||||
},
|
||||
widget_template = action_widget,
|
||||
widget = naughty.list.actions,
|
||||
}
|
||||
|
||||
local function space_h(length, circumstances)
|
||||
return wibox.widget {
|
||||
forced_width = length,
|
||||
visible = circumstances,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
}
|
||||
end
|
||||
|
||||
-- Make other widgets
|
||||
local title = wibox.widget.textbox()
|
||||
title.font = "Roboto bold 14"
|
||||
title.align = 'left'
|
||||
title.markup = n.title
|
||||
|
||||
local message = wibox.widget.textbox()
|
||||
message.font = "Roboto Medium 11"
|
||||
message.align = 'left'
|
||||
message.markup = n.message
|
||||
|
||||
local icon = wibox.widget {
|
||||
nil,
|
||||
{
|
||||
{
|
||||
image = n.icon or n.app_icon,
|
||||
visible = icon_visibility,
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
strategy = "max",
|
||||
width = dpi(30),
|
||||
height = dpi(30),
|
||||
widget = wibox.container.constraint,
|
||||
},
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.vertical,
|
||||
}
|
||||
|
||||
local container = wibox.widget {
|
||||
{
|
||||
title,
|
||||
{
|
||||
icon,
|
||||
space_h(dpi(10), icon_visibility),
|
||||
message,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
actions,
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
},
|
||||
margins = dpi(20),
|
||||
widget = wibox.container.margin,
|
||||
}
|
||||
|
||||
notifbox_layout:insert(
|
||||
1,
|
||||
container
|
||||
)
|
||||
end
|
||||
|
||||
naughty.connect_signal("request::display", function(n)
|
||||
create_notifcation(n)
|
||||
end)
|
||||
|
||||
local notif_core = {}
|
||||
|
||||
notif_core.is_read = true
|
||||
|
||||
notif_core.widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
text = "Dismiss all",
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
buttons = gears.table.join(
|
||||
awful.button({}, 1, function()
|
||||
notifbox_layout:reset()
|
||||
end)
|
||||
),
|
||||
forced_width = 75,
|
||||
shape = gears.shape.rounded_bar,
|
||||
shape_border_width = 1,
|
||||
shape_border_color = beautiful.bg_highlight,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
{
|
||||
notifbox_layout,
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
}
|
||||
|
||||
return notif_core
|
|
@ -22,11 +22,11 @@ naughty.config.defaults.title = "Notification"
|
|||
naughty.config.defaults.position = "top_right"
|
||||
naughty.config.defaults.border_width = 0
|
||||
|
||||
local function create_notifcation(n)
|
||||
local function create_notifcation(n)
|
||||
local time = os.date "%H:%M"
|
||||
local icon_visibility
|
||||
|
||||
if n.icon == nil then
|
||||
if n.icon == nil then
|
||||
icon_visibility = false
|
||||
else
|
||||
icon_visibility = true
|
||||
|
@ -41,7 +41,7 @@ local function create_notifcation(n)
|
|||
font = "Roboto Mono 10",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
margins = {left = dpi(6), right = dpi(6)},
|
||||
margins = { left = dpi(6), right = dpi(6) },
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
|
@ -81,7 +81,7 @@ local function create_notifcation(n)
|
|||
nil,
|
||||
{
|
||||
{
|
||||
image = n.icon,
|
||||
image = n.icon or n.app_icon,
|
||||
visible = icon_visibility,
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
|
@ -133,22 +133,20 @@ local function create_notifcation(n)
|
|||
widget = wibox.container.constraint,
|
||||
},
|
||||
bg = colors.container,
|
||||
widget = wibox.container.background,
|
||||
widget = wibox.container.background,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
-- # Error handling :
|
||||
naughty.connect_signal("request::display_error", function(message, startup)
|
||||
naughty.notification {
|
||||
urgency = "critical",
|
||||
title = "Oops, an error happened"..(startup and " during startup!" or "!"),
|
||||
message = message
|
||||
}
|
||||
naughty.notification {
|
||||
urgency = "critical",
|
||||
title = "Oops, an error happened" .. (startup and " during startup!" or "!"),
|
||||
message = message
|
||||
}
|
||||
end)
|
||||
|
||||
naughty.connect_signal("request::display", function(n)
|
||||
naughty.connect_signal("request::display", function(n)
|
||||
create_notifcation(n)
|
||||
end)
|
||||
|
||||
|
||||
|
|
|
@ -109,8 +109,9 @@ sidebar : setup {
|
|||
local slide = rubato.timed {
|
||||
pos = helpers.screen.geometry.height,
|
||||
rate = 60,
|
||||
intro = 0.2,
|
||||
duration = 0.4,
|
||||
intro = 0.05,
|
||||
duration = 0.2,
|
||||
easing = rubato.quadratic,
|
||||
subscribed = function(pos)
|
||||
sidebar.y = helpers.screen.geometry.y + pos
|
||||
end
|
||||
|
@ -146,8 +147,8 @@ awful.placement.top_right(sidebar, {honor_workarea = true, margins = beautiful.u
|
|||
--})
|
||||
|
||||
-- Get signal to execute the function (if that makes sense)
|
||||
awesome.connect_signal("sidebar::toggle", function(s)
|
||||
sidebar.toggle(s)
|
||||
awesome.connect_signal("sidebar::toggle", function()
|
||||
sidebar.toggle()
|
||||
end)
|
||||
|
||||
return sidebar
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require ("beautiful")
|
||||
local beautiful = require("beautiful")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
|
||||
|
||||
|
@ -20,18 +20,18 @@ local playerctl = require("libs.bling").signal.playerctl.lib()
|
|||
-- widgets
|
||||
----------
|
||||
-- gradientee music album art
|
||||
-- - - - - - - - - - - - - -
|
||||
-- - - - - - - - - - - - - -
|
||||
local music_art_filter = wibox.widget({
|
||||
{
|
||||
bg = {
|
||||
type = "linear",
|
||||
from = { 0, 30 },
|
||||
to = { 0, 200},
|
||||
stops = {
|
||||
{ 0, colors.transparent},
|
||||
{ 1, colors.container }
|
||||
},
|
||||
type = "linear",
|
||||
from = { 0, 30 },
|
||||
to = { 0, 200 },
|
||||
stops = {
|
||||
{ 0, colors.transparent },
|
||||
{ 1, colors.container }
|
||||
},
|
||||
},
|
||||
forced_height = dpi(85),
|
||||
forced_width = dpi(85),
|
||||
widget = wibox.container.background,
|
||||
|
@ -43,42 +43,42 @@ local music_art_filter = wibox.widget({
|
|||
|
||||
|
||||
-- the different music elements
|
||||
-- - - - - - - - - - - - - - -
|
||||
-- - - - - - - - - - - - - - -
|
||||
|
||||
-- album art
|
||||
local album_art = wibox.widget{
|
||||
widget = wibox.widget.imagebox,
|
||||
clip_shape = helpers.rrect(theme.rounded),
|
||||
forced_height = dpi(85),
|
||||
forced_width = dpi(85),
|
||||
image = theme.album_art
|
||||
local album_art = wibox.widget {
|
||||
widget = wibox.widget.imagebox,
|
||||
clip_shape = helpers.rrect(theme.rounded),
|
||||
forced_height = dpi(85),
|
||||
forced_width = dpi(85),
|
||||
image = theme.album_art
|
||||
}
|
||||
|
||||
-- playing yeah?
|
||||
local playing_or = wibox.widget{
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("Now playing", colors.white),
|
||||
font = theme.font,
|
||||
align = "left",
|
||||
valign = "center"
|
||||
local playing_or = wibox.widget {
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("Now playing", colors.white),
|
||||
font = theme.font,
|
||||
align = "left",
|
||||
valign = "center"
|
||||
}
|
||||
|
||||
-- song artist
|
||||
local song_artist = wibox.widget{
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("Unknown", colors.white),
|
||||
font = theme.font,
|
||||
align = "left",
|
||||
valign = "center"
|
||||
local song_artist = wibox.widget {
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("Unknown", colors.white),
|
||||
font = theme.font,
|
||||
align = "left",
|
||||
valign = "center"
|
||||
}
|
||||
|
||||
-- song name
|
||||
local song_name = wibox.widget{
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("None", colors.white),
|
||||
font = theme.font,
|
||||
align = "left",
|
||||
valign = "center"
|
||||
local song_name = wibox.widget {
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("None", colors.white),
|
||||
font = theme.font,
|
||||
align = "left",
|
||||
valign = "center"
|
||||
}
|
||||
|
||||
---------------------------------------- eo.Widgets
|
||||
|
@ -87,30 +87,30 @@ local song_name = wibox.widget{
|
|||
----------
|
||||
|
||||
-- toggle button
|
||||
local toggle_button = wibox.widget{
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("", colors.white),
|
||||
font = theme.sidebar_font,
|
||||
align = "right",
|
||||
valign = "center"
|
||||
local toggle_button = wibox.widget {
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("", colors.white),
|
||||
font = theme.sidebar_font,
|
||||
align = "right",
|
||||
valign = "center"
|
||||
}
|
||||
|
||||
-- next button
|
||||
local next_button = wibox.widget{
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("", colors.white),
|
||||
font = theme.sidebar_font,
|
||||
align = "right",
|
||||
valign = "center"
|
||||
local next_button = wibox.widget {
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("", colors.white),
|
||||
font = theme.sidebar_font,
|
||||
align = "right",
|
||||
valign = "center"
|
||||
}
|
||||
|
||||
-- prev button
|
||||
local prev_button = wibox.widget{
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("", colors.white),
|
||||
font = theme.sidebar_font,
|
||||
align = "right",
|
||||
valign = "center"
|
||||
local prev_button = wibox.widget {
|
||||
widget = wibox.widget.textbox,
|
||||
markup = helpers.colorize_text("", colors.white),
|
||||
font = theme.sidebar_font,
|
||||
align = "right",
|
||||
valign = "center"
|
||||
}
|
||||
|
||||
local music_bar = wibox.widget({
|
||||
|
@ -139,13 +139,13 @@ local next_command = function() playerctl:next() end
|
|||
|
||||
-- make it functional!
|
||||
toggle_button:buttons(gears.table.join(
|
||||
awful.button({}, 1, function() toggle_command() end)))
|
||||
awful.button({}, 1, function() toggle_command() end)))
|
||||
|
||||
next_button:buttons(gears.table.join(
|
||||
awful.button({}, 1, function() next_command() end)))
|
||||
awful.button({}, 1, function() next_command() end)))
|
||||
|
||||
prev_button:buttons(gears.table.join(
|
||||
awful.button({}, 1, function() prev_command() end)))
|
||||
awful.button({}, 1, function() prev_command() end)))
|
||||
|
||||
|
||||
|
||||
|
@ -165,77 +165,75 @@ playerctl:connect_signal("metadata", function(_, title, artist, album_path, __,
|
|||
end
|
||||
|
||||
album_art:set_image(gears.surface.load_uncached(album_path))
|
||||
song_name:set_markup_silently(helpers.colorize_text(title, colors.white))
|
||||
song_name:set_markup_silently(helpers.colorize_text(title, colors.white))
|
||||
song_artist:set_markup_silently(helpers.colorize_text(artist, colors.white))
|
||||
|
||||
|
||||
end)
|
||||
|
||||
-- playing/paused/{N/A}
|
||||
playerctl:connect_signal("playback_status", function(_, playing, __)
|
||||
if playing then
|
||||
toggle_button.markup = helpers.colorize_text("", colors.white)
|
||||
toggle_button.markup = helpers.colorize_text("", colors.white)
|
||||
else
|
||||
toggle_button.markup = helpers.colorize_text("", colors.white)
|
||||
toggle_button.markup = helpers.colorize_text("", colors.white)
|
||||
end
|
||||
end)
|
||||
|
||||
-- time elapsed
|
||||
playerctl:connect_signal("position", function(_, interval_sec, length_sec)
|
||||
music_bar.value = (interval_sec / length_sec) * 100
|
||||
music_length = length_sec
|
||||
music_bar.value = (interval_sec / length_sec) * 100
|
||||
music_length = length_sec
|
||||
end)
|
||||
|
||||
|
||||
-- mainbox
|
||||
-- too messy
|
||||
------------
|
||||
local music_box = wibox.widget {
|
||||
local music_box = wibox.widget {
|
||||
{
|
||||
{
|
||||
album_art,
|
||||
music_art_filter,
|
||||
layout = wibox.layout.stack,
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
album_art,
|
||||
music_art_filter,
|
||||
layout = wibox.layout.stack,
|
||||
},
|
||||
{
|
||||
playing_or,
|
||||
nil,
|
||||
{
|
||||
{
|
||||
playing_or,
|
||||
nil,
|
||||
{
|
||||
{
|
||||
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
|
||||
widget = wibox.container.scroll.horizontal,
|
||||
forced_width = dpi(250),
|
||||
speed = 30,
|
||||
song_name,
|
||||
},
|
||||
{
|
||||
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
|
||||
widget = wibox.container.scroll.horizontal,
|
||||
forced_width = dpi(250),
|
||||
speed = 30,
|
||||
song_artist,
|
||||
},
|
||||
spacing = dpi(2),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
spacing = dpi(10)
|
||||
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
|
||||
widget = wibox.container.scroll.horizontal,
|
||||
forced_width = dpi(250),
|
||||
speed = 30,
|
||||
song_name,
|
||||
},
|
||||
{
|
||||
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
|
||||
widget = wibox.container.scroll.horizontal,
|
||||
forced_width = dpi(250),
|
||||
speed = 30,
|
||||
song_artist,
|
||||
},
|
||||
spacing = dpi(2),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = {top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20)},
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
layout = wibox.layout.stack,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
forced_height = dpi(150),
|
||||
bg = colors.container,
|
||||
border_color = colors.container,
|
||||
shape = helpers.rrect(theme.rounded)
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
spacing = dpi(10)
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = { top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20) },
|
||||
},
|
||||
layout = wibox.layout.stack,
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
forced_height = dpi(150),
|
||||
bg = colors.container,
|
||||
border_color = colors.container,
|
||||
shape = helpers.rrect(theme.rounded)
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,26 +243,26 @@ return wibox.widget {
|
|||
{
|
||||
music_box,
|
||||
{
|
||||
{
|
||||
music_bar,
|
||||
direction = "east",
|
||||
widget = wibox.container.rotate,
|
||||
forced_width = dpi(2)
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
spacing = dpi(20),
|
||||
{
|
||||
music_bar,
|
||||
direction = "east",
|
||||
widget = wibox.container.rotate,
|
||||
forced_width = dpi(2)
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
spacing = dpi(20),
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
prev_button,
|
||||
toggle_button,
|
||||
next_button,
|
||||
{
|
||||
prev_button,
|
||||
toggle_button,
|
||||
next_button,
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
spacing = dpi(22)
|
||||
},
|
||||
spacing = dpi(22)
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
|
@ -285,5 +283,3 @@ return wibox.widget {
|
|||
|
||||
-- eof
|
||||
------
|
||||
|
||||
|
||||
|
|
|
@ -113,13 +113,13 @@ local mic = wibox.widget {
|
|||
}
|
||||
|
||||
local update_mic = function()
|
||||
awful.spawn.easy_async_with_shell("pamixer --source 5891 --get-volume", function(stdout)
|
||||
awful.spawn.easy_async_with_shell("pactl get-source-volume 0 | awk '{print $5}' | cut -d '%' -f 1", function(stdout)
|
||||
mic_slider.value = tonumber(stdout:match("%d+"))
|
||||
end)
|
||||
end
|
||||
|
||||
mic_slider:connect_signal("property::value", function(_, mic_vol)
|
||||
awful.spawn("pamixer --source 5891 --set-volume ".. mic_vol, false)
|
||||
awful.spawn("pactl set-source-volume 0 ".. mic_vol .. "%", false)
|
||||
-- Update textbox widget text
|
||||
mic_osd_value.text = mic_vol .. "%"
|
||||
awesome.emit_signal("module::mic_osd_value", mic_vol)
|
||||
|
|
|
@ -6,48 +6,49 @@
|
|||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require ("beautiful")
|
||||
local beautiful = require("beautiful")
|
||||
local naughty = require("naughty")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
|
||||
-- Helper
|
||||
-----------
|
||||
local function round_widget(radius)
|
||||
return function(cr,w,h)
|
||||
gears.shape.rounded_rect(cr,w,h,radius)
|
||||
end
|
||||
return function(cr, w, h)
|
||||
gears.shape.rounded_rect(cr, w, h, radius)
|
||||
end
|
||||
end
|
||||
|
||||
local function grouping_widget(w1,w2)
|
||||
local container = wibox.widget {
|
||||
w1,
|
||||
{
|
||||
nil,
|
||||
w2,
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.vertical,
|
||||
},
|
||||
spacing = dpi(18),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
}
|
||||
local function grouping_widget(w1, w2)
|
||||
local container = wibox.widget {
|
||||
w1,
|
||||
{
|
||||
nil,
|
||||
w2,
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.vertical,
|
||||
},
|
||||
spacing = dpi(18),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
}
|
||||
|
||||
return container
|
||||
return container
|
||||
end
|
||||
|
||||
local function center_widget(widget)
|
||||
return wibox.widget {
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
widget,
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.vertical,
|
||||
}
|
||||
return wibox.widget {
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
widget,
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
expand = 'none',
|
||||
layout = wibox.layout.align.vertical,
|
||||
}
|
||||
end
|
||||
|
||||
-- Create_widgets
|
||||
-- Create_widgets
|
||||
-------------------
|
||||
|
||||
-- Disk
|
||||
|
@ -57,15 +58,15 @@ d_icon.align = "left"
|
|||
d_icon.markup = " "
|
||||
|
||||
local d_slider = wibox.widget {
|
||||
forced_width = dpi(220),
|
||||
forced_height = dpi(10),
|
||||
color = beautiful.red,
|
||||
background_color = "#663D3D",
|
||||
shape = round_widget(12),
|
||||
bar_shape = round_widget(12),
|
||||
max_value = 100,
|
||||
value = 20,
|
||||
widget = wibox.widget.progressbar,
|
||||
forced_width = dpi(220),
|
||||
forced_height = dpi(10),
|
||||
color = beautiful.red,
|
||||
background_color = "#663D3D",
|
||||
shape = round_widget(12),
|
||||
bar_shape = round_widget(12),
|
||||
max_value = 100,
|
||||
value = 20,
|
||||
widget = wibox.widget.progressbar,
|
||||
}
|
||||
|
||||
local disk = grouping_widget(d_icon, d_slider)
|
||||
|
@ -77,14 +78,14 @@ v_icon.align = "left"
|
|||
v_icon.markup = ""
|
||||
|
||||
local v_slider = wibox.widget {
|
||||
forced_width = dpi(220),
|
||||
forced_height = dpi(10),
|
||||
color = beautiful.blue,
|
||||
background_color = "#3D4B66",
|
||||
shape = round_widget(12),
|
||||
bar_shape = round_widget(12),
|
||||
max_value = 100,
|
||||
widget = wibox.widget.progressbar,
|
||||
forced_width = dpi(220),
|
||||
forced_height = dpi(10),
|
||||
color = beautiful.blue,
|
||||
background_color = "#3D4B66",
|
||||
shape = round_widget(12),
|
||||
bar_shape = round_widget(12),
|
||||
max_value = 100,
|
||||
widget = wibox.widget.progressbar,
|
||||
}
|
||||
|
||||
local volume = grouping_widget(v_icon, v_slider)
|
||||
|
@ -96,14 +97,14 @@ b_icon.align = "left"
|
|||
b_icon.markup = " "
|
||||
|
||||
local b_slider = wibox.widget {
|
||||
forced_width = dpi(220),
|
||||
forced_height = dpi(10),
|
||||
color = beautiful.yellow,
|
||||
background_color = "#66523D",
|
||||
shape = round_widget(12),
|
||||
bar_shape = round_widget(12),
|
||||
max_value = 100,
|
||||
widget = wibox.widget.progressbar,
|
||||
forced_width = dpi(220),
|
||||
forced_height = dpi(10),
|
||||
color = beautiful.yellow,
|
||||
background_color = "#66523D",
|
||||
shape = round_widget(12),
|
||||
bar_shape = round_widget(12),
|
||||
max_value = 100,
|
||||
widget = wibox.widget.progressbar,
|
||||
}
|
||||
|
||||
local brightness = grouping_widget(b_icon, b_slider)
|
||||
|
@ -112,28 +113,30 @@ local brightness = grouping_widget(b_icon, b_slider)
|
|||
------------------------------------
|
||||
|
||||
local function get_val()
|
||||
awesome.connect_signal("signal::volume", function(vol, muted)
|
||||
if muted then v_slider.value = 0 else
|
||||
v_slider.color = beautiful.blue
|
||||
v_slider.value = tonumber(vol)
|
||||
end
|
||||
end)
|
||||
awesome.connect_signal("signal::volume", function(vol, muted)
|
||||
if muted then
|
||||
v_slider.value = 0
|
||||
else
|
||||
v_slider.color = beautiful.blue
|
||||
v_slider.value = tonumber(vol)
|
||||
end
|
||||
end)
|
||||
|
||||
awesome.connect_signal("signal::brightness", function(bri)
|
||||
b_slider.value = tonumber(bri)
|
||||
end)
|
||||
awesome.connect_signal("signal::brightness", function(bri)
|
||||
b_slider.value = tonumber(bri)
|
||||
end)
|
||||
|
||||
awesome.connect_signal("signal::disk", function(disk_perc)
|
||||
d_slider.value = tonumber(disk_perc)
|
||||
end)
|
||||
awesome.connect_signal("signal::disk", function(disk_perc)
|
||||
d_slider.value = tonumber(disk_perc)
|
||||
end)
|
||||
end
|
||||
|
||||
get_val()
|
||||
|
||||
return center_widget(wibox.widget {
|
||||
disk,
|
||||
volume,
|
||||
brightness,
|
||||
spacing = dpi(18),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
disk,
|
||||
volume,
|
||||
brightness,
|
||||
spacing = dpi(18),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
})
|
||||
|
|
|
@ -7,6 +7,7 @@ local beautiful = require("beautiful")
|
|||
local dpi = beautiful.xresources.apply_dpi
|
||||
local filesystem = gears.filesystem
|
||||
local icon_dir = filesystem.get_configuration_dir() .. "themes/icons/weather/"
|
||||
local naughty = require("naughty")
|
||||
|
||||
-- # Libs :
|
||||
-- ~~~~~~~~
|
||||
|
@ -85,7 +86,7 @@ local current_weather_widget = wibox.widget({
|
|||
font = "Roboto Medium 10",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
spacing = dpi(-6),
|
||||
spacing = dpi( -6),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
},
|
||||
widget = wibox.container.place,
|
||||
|
@ -132,8 +133,9 @@ local hourly_widget = function()
|
|||
local time = widget:get_children_by_id("time")[1]
|
||||
local icon = widget:get_children_by_id("icon")[1]
|
||||
local temp = widget:get_children_by_id("tempareture")[1]
|
||||
temp:set_markup(math.floor(result.temp) .. "<sup><span>°</span></sup>")
|
||||
time:set_text(os.date("%I%p", tonumber(result.dt)))
|
||||
|
||||
temp:set_markup(math.floor(result.main.temp) .. "<sup><span>°</span></sup>")
|
||||
time:set_text(os.date("%H", tonumber(result.dt)))
|
||||
icon.image = icon_dir .. icon_map[result.weather[1].icon] .. ".svg"
|
||||
icon:emit_signal("widget::redraw_needed")
|
||||
end
|
||||
|
@ -169,27 +171,19 @@ local weather_widget = wibox.widget({
|
|||
layout = wibox.layout.fixed.vertical,
|
||||
})
|
||||
|
||||
local api_key = ""
|
||||
local coordinates = {"", ""}
|
||||
|
||||
local show_hourly_forecast = true
|
||||
local show_daily_forecast = true
|
||||
local api_key = "7641c17cda8ed75684ed55704226c565"
|
||||
local city_id = "2972315"
|
||||
local units = "metric"
|
||||
|
||||
local url = (
|
||||
"https://api.openweathermap.org/data/2.5/onecall"
|
||||
.. "?lat="
|
||||
.. coordinates[1]
|
||||
.. "&lon="
|
||||
.. coordinates[2]
|
||||
.. "&appid="
|
||||
.. api_key
|
||||
.. "&units="
|
||||
.. units
|
||||
.. "&exclude=minutely"
|
||||
.. (show_hourly_forecast == false and ",hourly" or "")
|
||||
.. (show_daily_forecast == false and ",daily" or "")
|
||||
)
|
||||
"https://api.openweathermap.org/data/2.5/forecast"
|
||||
.. "?appid="
|
||||
.. api_key
|
||||
.. "&id="
|
||||
.. city_id
|
||||
.. "&units="
|
||||
.. units
|
||||
)
|
||||
|
||||
awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout, stderr)
|
||||
if stderr == "" then
|
||||
|
@ -200,19 +194,27 @@ awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout
|
|||
local humidity = current_weather_widget:get_children_by_id("humidity")[1]
|
||||
local temp_current = current_weather_widget:get_children_by_id("tempareture_current")[1]
|
||||
local feels_like = current_weather_widget:get_children_by_id("feels_like")[1]
|
||||
icon.image = icon_dir .. icon_map[result.current.weather[1].icon] .. ".svg"
|
||||
|
||||
local current = result.list[1]
|
||||
icon.image = icon_dir .. icon_map[current.weather[1].icon] .. ".svg"
|
||||
icon:emit_signal("widget::redraw_needed")
|
||||
description:set_text(result.current.weather[1].description:gsub("^%l", string.upper))
|
||||
humidity:set_text("Humidity: " .. result.current.humidity .. "%")
|
||||
temp_current:set_markup(math.floor(result.current.temp) .. "<sup><span>°</span></sup>")
|
||||
feels_like:set_markup("Feels like: " .. math.floor(result.current.feels_like) .. "<sup><span>°</span></sup>")
|
||||
description:set_text(current.weather[1].description:gsub("^%l", string.upper))
|
||||
humidity:set_text("Humidity: " .. current.main.humidity .. "%")
|
||||
temp_current:set_markup(math.floor(current.main.temp) .. "<sup><span>°</span></sup>")
|
||||
feels_like:set_markup("Feels like: " .. math.floor(current.main.feels_like) .. "<sup><span>°</span></sup>")
|
||||
|
||||
-- Hourly widget setup
|
||||
hourly_widget_1.update(result.hourly[1])
|
||||
hourly_widget_2.update(result.hourly[2])
|
||||
hourly_widget_3.update(result.hourly[3])
|
||||
hourly_widget_4.update(result.hourly[4])
|
||||
hourly_widget_5.update(result.hourly[5])
|
||||
hourly_widget_6.update(result.hourly[6])
|
||||
hourly_widget_1.update(result.list[1])
|
||||
hourly_widget_2.update(result.list[2])
|
||||
hourly_widget_3.update(result.list[3])
|
||||
hourly_widget_4.update(result.list[4])
|
||||
hourly_widget_5.update(result.list[5])
|
||||
hourly_widget_6.update(result.list[6])
|
||||
else
|
||||
naughty.notify({
|
||||
title = "Weather error",
|
||||
text = stderr
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
-- ## Sidebar button ##
|
||||
-- ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
-- Requirements :
|
||||
-- ~~~~~~~~~~~~~~
|
||||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local notifications_list = require("ui.notifications-list")
|
||||
|
||||
|
||||
local notifications_list_icon = wibox.widget{
|
||||
markup = "",
|
||||
font = theme.taglist_font,
|
||||
valign = "center",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
notifications_list_icon:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
notifications_list_icon.opacity = 0.6
|
||||
notifications_list.toggle()
|
||||
end)
|
||||
|
||||
notifications_list_icon:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
notifications_list_icon.opacity = 1
|
||||
end)
|
||||
|
||||
--return sidebar_icon
|
||||
return awful.widget.only_on_screen(notifications_list_icon, 'primary')
|
|
@ -29,7 +29,7 @@ sidebar_icon:connect_signal(
|
|||
"button::press",
|
||||
function()
|
||||
sidebar_icon.opacity = 0.6
|
||||
sidebar.toggle(s)
|
||||
sidebar.toggle()
|
||||
end)
|
||||
sidebar_icon:connect_signal(
|
||||
"button::release",
|
||||
|
|
28
home/.config/awesome/ui/widgets/tag-preview.lua
Normal file
28
home/.config/awesome/ui/widgets/tag-preview.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
local awful = require "awful"
|
||||
local wibox = require "wibox"
|
||||
local beautiful = require "beautiful"
|
||||
local bling = require "libs.bling"
|
||||
|
||||
bling.widget.tag_preview.enable {
|
||||
show_client_content = true, -- Whether or not to show the client content
|
||||
x = 10, -- The x-coord of the popup
|
||||
y = 10, -- The y-coord of the popup
|
||||
scale = 0.25, -- The scale of the previews compared to the screen
|
||||
honor_padding = true, -- Honor padding when creating widget size
|
||||
honor_workarea = true, -- Honor work area when creating widget size
|
||||
placement_fn = function(c) -- Place the widget using awful.placement (this overrides x & y)
|
||||
awful.placement.bottom_left(c, {
|
||||
margins = {
|
||||
bottom = 45,
|
||||
left = 5
|
||||
},
|
||||
parent = awful.screen.focused()
|
||||
})
|
||||
end,
|
||||
background_widget = wibox.widget { -- Set a background image (like a wallpaper) for the widget
|
||||
image = beautiful.wallpaper,
|
||||
horizontal_fit_policy = "fit",
|
||||
vertical_fit_policy = "fit",
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
}
|
17
home/.config/awesome/ui/widgets/task-preview.lua
Normal file
17
home/.config/awesome/ui/widgets/task-preview.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
local awful = require "awful"
|
||||
local bling = require "libs.bling"
|
||||
|
||||
bling.widget.task_preview.enable {
|
||||
x = 20, -- The x-coord of the popup
|
||||
y = 20, -- The y-coord of the popup
|
||||
height = 200, -- The height of the popup
|
||||
width = 200, -- The width of the popup
|
||||
placement_fn = function(c) -- Place the widget using awful.placement (this overrides x & y)
|
||||
awful.placement.bottom(c, {
|
||||
margins = {
|
||||
bottom = 45
|
||||
},
|
||||
parent = awful.screen.focused()
|
||||
})
|
||||
end
|
||||
}
|
|
@ -15,25 +15,29 @@ local helpers = require("libs.helpers")
|
|||
local temprature = wibox.widget.textbox()
|
||||
temprature.font = theme.font
|
||||
|
||||
watch('bash -c "sensors | awk \'/Core 0/ {print substr($3, 2) }\'"', 30, function(_, stdout)
|
||||
temprature.text = stdout
|
||||
watch([[ bash -c "sensors | grep 'Tctl:' | awk '{print $2}'" ]], 30, function(_, stdout)
|
||||
local temp_num = tonumber(stdout:match("%d+"))
|
||||
if temp_num == nil then
|
||||
temp_num = -1
|
||||
end
|
||||
temprature.text = math.floor(temp_num) .. "°C"
|
||||
end)
|
||||
|
||||
|
||||
-- Icon :
|
||||
local widget_icon = " "
|
||||
local icon = wibox.widget{
|
||||
font = theme.icon_font,
|
||||
markup = helpers.colorize_text(widget_icon, colors.main_scheme),
|
||||
widget = wibox.widget.textbox,
|
||||
valign = "center",
|
||||
align = "center"
|
||||
local icon = wibox.widget {
|
||||
font = theme.icon_font,
|
||||
markup = helpers.colorize_text(widget_icon, colors.main_scheme),
|
||||
widget = wibox.widget.textbox,
|
||||
valign = "center",
|
||||
align = "center"
|
||||
}
|
||||
|
||||
return wibox.widget {
|
||||
icon,
|
||||
wibox.widget{
|
||||
temprature,
|
||||
icon,
|
||||
wibox.widget {
|
||||
temprature,
|
||||
fg = colors.brightwhite,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
|
|
20
home/.config/awesome/ui/widgets/window-switcher.lua
Normal file
20
home/.config/awesome/ui/widgets/window-switcher.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local awful = require "awful"
|
||||
local bling = require "libs.bling"
|
||||
|
||||
bling.widget.window_switcher.enable {
|
||||
type = "thumbnail", -- set to anything other than "thumbnail" to disable client previews
|
||||
|
||||
-- keybindings (the examples provided are also the default if kept unset)
|
||||
hide_window_switcher_key = "Escape", -- The key on which to close the popup
|
||||
minimize_key = "n", -- The key on which to minimize the selected client
|
||||
unminimize_key = "N", -- The key on which to unminimize all clients
|
||||
kill_client_key = "q", -- The key on which to close the selected client
|
||||
cycle_key = "Tab", -- The key on which to cycle through all clients
|
||||
previous_key = "Left", -- The key on which to select the previous client
|
||||
next_key = "Right", -- The key on which to select the next client
|
||||
vim_previous_key = "h", -- Alternative key on which to select the previous client
|
||||
vim_next_key = "l", -- Alternative key on which to select the next client
|
||||
|
||||
cycleClientsByIdx = awful.client.focus.byidx, -- The function to cycle the clients
|
||||
filterClients = awful.widget.tasklist.filter.currenttags, -- The function to filter the viewed clients
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue