update: dotfiles
This commit is contained in:
parent
eac679adf8
commit
a03dd3ad40
|
@ -5,4 +5,5 @@ require("signal.cpu")
|
|||
require("signal.ram")
|
||||
require("signal.todo")
|
||||
require("signal.weather")
|
||||
require("signal.playerctl")
|
||||
require("signal.playerctl")
|
||||
require("signal.network")
|
27
config/awesome/signal/network.lua
Normal file
27
config/awesome/signal/network.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- Provides:
|
||||
-- signal::network
|
||||
-- status (boolean)
|
||||
-- ssid (string)
|
||||
local awful = require("awful")
|
||||
local naughty = require("naughty")
|
||||
|
||||
local update_interval = 5
|
||||
local network_script = [[
|
||||
bash -c "
|
||||
iwgetid -r
|
||||
"]]
|
||||
|
||||
-- Periodically get cpu info
|
||||
awful.widget.watch(network_script, update_interval, function(_, stdout)
|
||||
-- local network = stdout:match('+(.*)%.%d...(.*)%(')
|
||||
local net_ssid = stdout
|
||||
local net_status = true
|
||||
|
||||
if net_ssid == "" then
|
||||
net_status = false
|
||||
end
|
||||
|
||||
net_ssid = string.gsub(net_ssid, '^%s*(.-)%s*$', '%1')
|
||||
awesome.emit_signal("signal::network", net_status, net_ssid)
|
||||
end)
|
||||
|
|
@ -37,6 +37,7 @@ theme.xcolor15 = xrdb.color15
|
|||
theme.darker_bg = "#0a1419"
|
||||
theme.lighter_bg = "#162026"
|
||||
theme.dash_fg = "#666c79"
|
||||
theme.transparent = "#00000000"
|
||||
|
||||
-- Titlebar
|
||||
local icon_path = gfs.get_configuration_dir() .. "theme/assets/icons/"
|
||||
|
@ -153,6 +154,21 @@ theme.pop_brightness_color = theme.xcolor3
|
|||
theme.pop_fg = theme.xforeground
|
||||
theme.pop_border_radius = dpi(6)
|
||||
|
||||
-- Tooltip
|
||||
theme.tooltip_height = dpi(490)
|
||||
theme.tooltip_width = dpi(310)
|
||||
theme.tooltip_bg = theme.xbackground
|
||||
theme.tooltip_box_bg = theme.bg_secondary
|
||||
theme.tooltip_fg = theme.xforeground
|
||||
theme.tooltip_box_fg = theme.xcolor8
|
||||
theme.tooltip_margin = dpi(15)
|
||||
theme.tooltip_box_margin = dpi(10)
|
||||
theme.tooltip_gap = dpi(10)
|
||||
theme.tooltip_border_radius = dpi(6)
|
||||
theme.tooltip_box_border_radius = dpi(3)
|
||||
theme.tooltip_border_width = dpi(0)
|
||||
theme.tooltip_border_color = theme.xcolor0
|
||||
|
||||
-- Edge snap
|
||||
theme.snap_bg = theme.xcolor8
|
||||
theme.snap_shape = helpers.rrect(0)
|
||||
|
|
|
@ -91,6 +91,14 @@ screen.connect_signal("request::desktop_decoration", function(s)
|
|||
end)
|
||||
))
|
||||
|
||||
awesome_icon:connect_signal("mouse::enter", function()
|
||||
awesome_icon.bg = beautiful.lighter_bg
|
||||
end)
|
||||
|
||||
awesome_icon:connect_signal("mouse::leave", function()
|
||||
awesome_icon.bg = beautiful.transparent
|
||||
end)
|
||||
|
||||
-- Tasklist
|
||||
local tasklist_buttons = gears.table.join(
|
||||
awful.button({}, 1, function(c)
|
||||
|
@ -172,6 +180,21 @@ screen.connect_signal("request::desktop_decoration", function(s)
|
|||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
local stats_container = wibox.widget{
|
||||
wrap_widget2(batt),
|
||||
boxed_widget2(time),
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
stats_container:connect_signal("mouse::enter", function()
|
||||
cal_tooltip_show()
|
||||
end)
|
||||
|
||||
stats_container:connect_signal("mouse::leave", function()
|
||||
cal_tooltip_hide()
|
||||
end)
|
||||
|
||||
-- Notification center
|
||||
local notifs = wibox.widget{
|
||||
markup = "",
|
||||
|
@ -193,7 +216,7 @@ screen.connect_signal("request::desktop_decoration", function(s)
|
|||
|
||||
-- Create layoutbox widget
|
||||
s.mylayoutbox = awful.widget.layoutbox(s)
|
||||
|
||||
|
||||
local layoutbox = wibox.widget{
|
||||
s.mylayoutbox,
|
||||
right = dpi(9),
|
||||
|
@ -203,6 +226,12 @@ screen.connect_signal("request::desktop_decoration", function(s)
|
|||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
layoutbox:buttons(gears.table.join(
|
||||
awful.button({}, 1, function ()
|
||||
awful.layout.inc(1)
|
||||
end)
|
||||
))
|
||||
|
||||
-- Create the wibox
|
||||
s.mywibox = wibox({
|
||||
-- position = beautiful.wibar_position,
|
||||
|
@ -322,8 +351,7 @@ screen.connect_signal("request::desktop_decoration", function(s)
|
|||
{
|
||||
boxed_widget({
|
||||
wrap_widget({
|
||||
wrap_widget2(batt),
|
||||
boxed_widget2(time),
|
||||
stats_container,
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}),
|
||||
|
|
|
@ -2,6 +2,7 @@ local lock_screen = require("ui.lockscreen")
|
|||
lock_screen.init()
|
||||
|
||||
require("ui.notifs")
|
||||
require("ui.tooltip")
|
||||
require("ui.bar")
|
||||
require("ui.dash")
|
||||
require("ui.decorations")
|
||||
|
|
|
@ -91,8 +91,8 @@ reset_notif_container = function()
|
|||
remove_notif_empty = true
|
||||
end
|
||||
|
||||
remove_notif = function(box)
|
||||
notif_container:remove_widgets(box)
|
||||
remove_notifbox = function(box)
|
||||
notif_container:remove_widgets(box)
|
||||
|
||||
if #notif_container.children == 0 then
|
||||
notif_container:insert(1, empty)
|
||||
|
@ -114,7 +114,7 @@ local create_notif = function(icon, n, width)
|
|||
|
||||
dismiss:buttons(gears.table.join(
|
||||
awful.button({}, 1, function()
|
||||
_G.remove_notif(box)
|
||||
_G.remove_notifbox(box)
|
||||
end)
|
||||
))
|
||||
|
||||
|
@ -297,16 +297,15 @@ awful.placement.bottom_left(
|
|||
{
|
||||
honor_workarea = true,
|
||||
margins = {
|
||||
bottom = 50,
|
||||
left = beautiful.wibar_width + 11
|
||||
}
|
||||
})
|
||||
|
||||
local slide = rubato.timed{
|
||||
pos = dpi(10),
|
||||
pos = dpi(896),
|
||||
rate = 60,
|
||||
intro = 0.025,
|
||||
duration = 0.3,
|
||||
duration = 0.5,
|
||||
easing = rubato.quadratic,
|
||||
awestore_compat = true,
|
||||
subscribed = function(pos) notifs.y = pos end
|
||||
|
@ -327,7 +326,7 @@ notifs_show = function()
|
|||
end
|
||||
|
||||
notifs_hide = function()
|
||||
slide:set(dpi(10))
|
||||
slide:set(dpi(896))
|
||||
notifs_status = true
|
||||
end
|
||||
|
||||
|
|
|
@ -83,10 +83,11 @@ local function toggle_pop()
|
|||
end
|
||||
|
||||
awesome.connect_signal("signal::volume", function(value, muted)
|
||||
pop_icon.markup = ""
|
||||
pop_icon.markup = ""
|
||||
pop_bar.value = value
|
||||
|
||||
if muted then
|
||||
pop_icon.markup = ""
|
||||
pop_bar.color = beautiful.xcolor8
|
||||
else
|
||||
pop_bar.color = beautiful.pop_vol_color
|
||||
|
|
341
config/awesome/ui/tooltip/init.lua
Normal file
341
config/awesome/ui/tooltip/init.lua
Normal file
|
@ -0,0 +1,341 @@
|
|||
-- Standard awesome library
|
||||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
|
||||
-- Theme handling library
|
||||
local beautiful = require("beautiful")
|
||||
local xresources = require("beautiful.xresources")
|
||||
local dpi = xresources.apply_dpi
|
||||
|
||||
-- Widget library
|
||||
local wibox = require("wibox")
|
||||
|
||||
-- rubato
|
||||
local rubato = require("module.rubato")
|
||||
|
||||
-- Helpers
|
||||
local helpers = require("helpers")
|
||||
|
||||
-- Get screen geometry
|
||||
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
|
||||
box_container.forced_height = height
|
||||
box_container.forced_width = width
|
||||
box_container.shape = helpers.rrect(beautiful.tooltip_box_border_radius)
|
||||
|
||||
local inner = dpi(0)
|
||||
|
||||
if inner_pad then inner = beautiful.tooltip_box_margin end
|
||||
|
||||
local boxed_widget = wibox.widget {
|
||||
-- Add margins
|
||||
{
|
||||
-- Add background color
|
||||
{
|
||||
-- The actual widget goes here
|
||||
widget_to_be_boxed,
|
||||
margins = inner,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
widget = box_container,
|
||||
},
|
||||
margins = beautiful.tooltip_gap / 2,
|
||||
color = "#FF000000",
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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,
|
||||
batt_icon,
|
||||
expand = "none",
|
||||
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_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::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
|
||||
|
||||
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_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)
|
||||
|
||||
---- Calendar
|
||||
|
||||
-- Date
|
||||
local date_day = wibox.widget{
|
||||
font = beautiful.font_name .. "medium 9",
|
||||
format = helpers.colorize_text("%A", beautiful.xcolor4),
|
||||
valign = "center",
|
||||
widget = wibox.widget.textclock
|
||||
}
|
||||
|
||||
local date_month = wibox.widget{
|
||||
font = beautiful.font_name .. "bold 14",
|
||||
format = "%d %B",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textclock
|
||||
}
|
||||
|
||||
local date = wibox.widget{
|
||||
date_day,
|
||||
nil,
|
||||
date_month,
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
|
||||
-- Separator
|
||||
local separator = wibox.widget{
|
||||
{
|
||||
bg = beautiful.xcolor5,
|
||||
shape = helpers.rrect(dpi(3)),
|
||||
forced_width = dpi(3),
|
||||
widget = wibox.container.background
|
||||
},
|
||||
right = dpi(5),
|
||||
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
|
||||
}
|
||||
|
||||
-- Wifi
|
||||
local wifi_status_icon = wibox.widget{
|
||||
markup = "Offline",
|
||||
font = beautiful.icon_font_name .. "Round 15",
|
||||
valign = "center",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
local wifi = wibox.widget{
|
||||
wifi_status_icon,
|
||||
forced_width = dpi(40),
|
||||
forced_height = dpi(40),
|
||||
bg = beautiful.xcolor0,
|
||||
shape = helpers.rrect(beautiful.tooltip_box_border_radius),
|
||||
shape_border_width = dpi(2.25),
|
||||
shape_border_color = beautiful.xcolor1,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local wifi_status = false
|
||||
|
||||
awesome.connect_signal("signal::network", function(status, ssid)
|
||||
wifi_status = status
|
||||
awesome.emit_signal("widget::network")
|
||||
end)
|
||||
|
||||
awesome.connect_signal("widget::network", function ()
|
||||
local w, fill_color
|
||||
if wifi_status == true then
|
||||
w = ""
|
||||
fill_color = beautiful.xcolor2
|
||||
else
|
||||
w = ""
|
||||
fill_color = beautiful.xcolor1
|
||||
end
|
||||
|
||||
wifi.shape_border_color = fill_color
|
||||
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),
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
local uptime_value = wibox.widget.textbox()
|
||||
awful.widget.watch("sh -c 'uptime -p | sed 's/^...//' | sed 's/.d..../d/' | sed 's/.h...../h/' | sed 's/.m....../m/''", 60, function(_, stdout)
|
||||
local out = stdout:gsub("^%s*(.-)%s*$", "%1")
|
||||
uptime_value.text = out
|
||||
end)
|
||||
|
||||
local uptime_text = wibox.widget {
|
||||
font = beautiful.font_name .. "bold 13",
|
||||
valign = "center",
|
||||
widget = uptime_value
|
||||
}
|
||||
|
||||
local uptime_container = wibox.widget{
|
||||
separator,
|
||||
{
|
||||
uptime_label,
|
||||
nil,
|
||||
uptime_text,
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
{
|
||||
wifi,
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
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)
|
||||
|
||||
-- Tooltip
|
||||
cal_tooltip = wibox({
|
||||
type = "dock",
|
||||
screen = screen.primary,
|
||||
height = dpi(200),
|
||||
width = dpi(200),
|
||||
shape = helpers.rrect(beautiful.tooltip_border_radius - 1),
|
||||
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)}})
|
||||
|
||||
cal_tooltip_show = function()
|
||||
cal_tooltip.visible = true
|
||||
end
|
||||
|
||||
cal_tooltip_hide = function()
|
||||
cal_tooltip.visible = false
|
||||
end
|
||||
|
||||
cal_tooltip:setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
date_boxed,
|
||||
{
|
||||
hour_boxed,
|
||||
min_boxed,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
{
|
||||
batt_boxed,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
{
|
||||
uptime_boxed,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
margins = beautiful.tooltip_gap,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = helpers.rrect(beautiful.tooltip_border_radius),
|
||||
bg = beautiful.xbackground,
|
||||
widget = wibox.container.background
|
||||
}
|
Loading…
Reference in a new issue