♻️ refactor(awesome): Individual module refactoring

This commit is contained in:
punkfairie 2024-02-24 14:01:36 -08:00
parent 5f36cb1146
commit 3f0adf7ad6
48 changed files with 673 additions and 551 deletions

View file

@ -22,6 +22,7 @@ M.theme = {
flavor = "macchiato",
accent = "pink",
wallpaper = config_dir .. "themes/catppuccin/buttons.png",
pfp = config_dir .. "themes/catppuccin/assets/pfp.jpg",
icons = {},
}
@ -34,11 +35,49 @@ M.theme.icons.tags = {
misc = "󰍹 ",
}
M.icons = {
menu = "󰜬",
power = "",
tags = {
general = "",
files = "",
media = "",
terminal = "",
coding = "",
misc = "󰍹 ",
},
cal = "",
clock = "",
arr = {
r = "»",
l = "«",
},
vol = {
on = "󰕾",
off = "󰖁",
low = "󰕿",
med = "󰖀",
high = "󰕾",
},
mem = "󰍛",
cpu = "",
disk = "",
}
M.widget = {}
M.widget.clock = {
format = "%I:%M %p",
}
M.widget.date = {
format = "%a %b %d",
}
M.widget.weather = {
api_key = "e894c3e6c1a9d2217eee94791e845c96",
coordinates = { lat = "47.773140", lon = "-122.303660" },
units = "imperial",
}
M.widget.github = {

View file

@ -1,3 +1,3 @@
return {
ui = require(... .. ".ui"),
ui = require("helpers.ui"),
}

View file

@ -2,20 +2,53 @@ local awful = require("awful")
local wibox = require("wibox")
local gshape = require("gears.shape")
local gmatrix = require("gears.matrix")
local ipairs = ipairs
local capi = { mouse = mouse }
local beautiful = require("beautiful")
local _ui = {}
local capi = { mouse = mouse }
local theme = beautiful.get()
local ui = {}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.colorize_text(text, color)
---Set text color
---@param text string
---@param color string
---@return string
function ui.colorize_text(text, color)
return "<span foreground='" .. color .. "'>" .. text .. "</span>"
end
---Change a font attribute
---@param attr string attribute(s) to add, e.g. "Bold 16"
---@return string
function ui.set_font(attr)
return beautiful.get_merged_font(theme.font, attr):to_string()
end
---Create an icon widget
---@param i string the icon
---@param c string the icon's color
---@return table widget the widget
function ui.create_icon(i, c)
local widget = {
{
font = ui.set_font("12.5"),
text = " " .. i,
widget = wibox.widget.textbox,
},
fg = c,
widget = wibox.container.background,
}
return widget
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.add_hover_cursor(w, hover_cursor)
---Change cursor on hovering
---@param w any widget to change cursor on
---@param hover_cursor string cursor to change to
function ui.add_hover_cursor(w, hover_cursor)
local original_cursor = "left_ptr"
w:connect_signal("mouse::enter", function()
@ -35,7 +68,7 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.vertical_pad(height)
function ui.vertical_pad(height)
return wibox.widget({
forced_height = height,
layout = wibox.layout.fixed.vertical,
@ -44,7 +77,7 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.horizontal_pad(width)
function ui.horizontal_pad(width)
return wibox.widget({
forced_width = width,
layout = wibox.layout.fixed.horizontal,
@ -53,13 +86,13 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.rrect(radius)
function ui.rrect(radius)
return function(cr, width, height)
gshape.rounded_rect(cr, width, height, radius)
end
end
function _ui.pie(width, height, start_angle, end_angle, radius)
function ui.pie(width, height, start_angle, end_angle, radius)
return function(cr)
gshape.pie(cr, width, height, start_angle, end_angle, radius)
end
@ -67,7 +100,7 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.prgram(height, base)
function ui.prgram(height, base)
return function(cr, width)
gshape.parallelogram(cr, width, height, base)
end
@ -75,7 +108,7 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.prrect(radius, tl, tr, br, bl)
function ui.prrect(radius, tl, tr, br, bl)
return function(cr, width, height)
gshape.partially_rounded_rect(cr, width, height, tl, tr, br, bl, radius)
end
@ -83,7 +116,7 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.custom_shape(cr, width, height)
function ui.custom_shape(cr, width, height)
cr:move_to(0, height / 25)
cr:line_to(height / 25, 0)
cr:line_to(width, 0)
@ -111,13 +144,13 @@ local function _get_widget_geometry(_hierarchy, widget)
end
end
function _ui.get_widget_geometry(_wibox, widget)
function ui.get_widget_geometry(_wibox, widget)
return _get_widget_geometry(_wibox._drawable._widget_hierarchy, widget)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.screen_mask(s, bg)
function ui.screen_mask(s, bg)
local mask = wibox({
visible = false,
ontop = true,
@ -131,7 +164,7 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function _ui.grouping_widget(w1, w2, dpi1)
function ui.grouping_widget(w1, w2, dpi1)
local container = wibox.widget({
w1,
{
@ -149,4 +182,4 @@ end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return _ui
return ui

View file

@ -1,4 +1,9 @@
require(... .. ".better-resize")
require(... .. ".savefloats")
require(... .. ".exit-screen")
local req = {
"better-resize",
"savefloats",
"exit-screen",
}
for _, x in pairs(req) do
require(... .. "." .. x)
end

View file

@ -1,8 +1,14 @@
-- require("main.error_handling")
require(... .. ".layout")
require(... .. ".menu")
require(... .. ".wallpaper")
require(... .. ".bindings")
require(... .. ".custom_bindings")
require(... .. ".rules")
require(... .. ".tags")
local req = {
"error_handling",
"layout",
"menu",
"wallpaper",
"bindings",
"custom_bindings",
"rules",
"tags",
}
for _, x in pairs(req) do
require(... .. "." .. x)
end

View file

@ -19,3 +19,6 @@ require("signals")
-- Ui/Panels --
require("ui")
-- local f = beautiful.get().font
-- beautiful.get_merged_font(f, "50"):to_string()

View file

@ -2,9 +2,7 @@ local awful = require("awful")
local gears = require("gears")
local function get_cpu()
local script = [[
echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}')]
]]
local script = "echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}')]"
awful.spawn.easy_async_with_shell(script, function(cpu_perc)
cpu_perc = cpu_perc:match("%d+")
@ -20,4 +18,3 @@ gears.timer({
get_cpu()
end,
})

View file

@ -2,12 +2,10 @@ local awful = require("awful")
local gears = require("gears")
local config = require("config")
local which_disk = config.widget.disk.name
local disk = config.widget.disk.name
local function get_disk()
local script = [[
df -kH -B 1MB ]] .. which_disk .. [[ | tail -1 | awk '{printf $5}'
]]
local script = "df -kH -B 1MB" .. disk .. "| tail -1 | awk '{printf $5}'"
awful.spawn.easy_async_with_shell(script, function(disk_perc)
disk_perc = disk_perc:match("%d+")

View file

@ -20,4 +20,3 @@ gears.timer({
get_mem()
end,
})

View file

@ -21,7 +21,9 @@ local function get_vol()
end)
end)
end
awesome.connect_signal("widget::update_mic", function() -- Needs to be Updated if muted! For Mute in Sidebar Widget
get_vol()
end)
get_vol()

View file

@ -16,13 +16,16 @@ local function get_player()
artist = string.gsub(artist, "\n", "")
length = string.gsub(length, "\n", "")
status = string.gsub(status, "\n", "")
awesome.emit_signal("signal::player", title, artist, length, status)
end)
end)
end)
end)
end
awesome.connect_signal("widget::update_player", function()
get_player()
end)
get_player()

View file

@ -13,4 +13,5 @@ end
if not instance then
instance = new()
end
return instance

View file

@ -2,7 +2,7 @@ local awful = require("awful")
local function get_uptime()
local script = [[
uptime -p | sed 's/up\s*//g' | sed 's/\s*days/d/g' | sed 's/\s*day/d/g' | sed 's/\s*hours/h/g' | sed 's/\s*hour/h/g' | sed 's/\s*minutes/m/g' | sed 's/\s*minute/m/g'
uptime -p | sed 's/up\s*//g' | sed 's/\s*days*/d/g' | sed 's/\s*hours*/h/g' | sed 's/\s*minutes*/m/g'
]]
awful.spawn.easy_async_with_shell(script, function(uptime)
@ -14,4 +14,3 @@ awesome.connect_signal("widget::update_uptime", function()
get_uptime()
end)
get_uptime()

View file

@ -1,6 +1,9 @@
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi
local theme = beautiful.get()
-- Creating Calendar
----------------------
@ -8,29 +11,30 @@ local dpi = require("beautiful.xresources").apply_dpi
-- copied from awesome doc and adjusted a bit
local styles = {}
styles.month = { bg_color = beautiful.xcolorS0 }
styles.month = { bg_color = theme.xcolorS0 }
styles.normal = {
bg_color = beautiful.xcolorS0,
bg_color = theme.xcolorS0,
padding = dpi(6),
fg_color = beautiful.xcolorT2,
fg_color = theme.xcolorT2,
}
styles.focus = {
fg_color = beautiful.xcolor7,
fg_color = theme.xcolor7,
padding = dpi(6),
markup = function(t)
return "<b>" .. t .. "</b>"
end,
}
styles.header = {
fg_color = beautiful.xcolor2,
fg_color = theme.xcolor2,
markup = function(t)
return "<b>" .. t .. "</b>"
end,
}
styles.weekday = {
fg_color = beautiful.xcolorT2,
fg_color = theme.xcolorT2,
markup = function(t)
return '<span font_desc="FiraCode Nerd Font Medium 16">' .. t .. "</span>"
local f = helpers.ui.set_font("16")
return '<span font_desc="' .. f .. '">' .. t .. "</span>"
end,
}
@ -45,6 +49,7 @@ local function decorate_cell(widget, flag)
if props.markup and widget.get_text and widget.set_markup then
widget:set_markup(props.markup(widget:get_text()))
end
-- Change bg color for weekends
local ret = wibox.widget({
{
@ -62,7 +67,7 @@ end
local calendar = wibox.widget({
date = os.date("*t"),
font = beautiful.font_name .. "14",
font = helpers.ui.set_font("14"),
fn_embed = decorate_cell,
widget = wibox.widget.calendar.month,
})

View file

@ -1,11 +1,12 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local rubato = require("lib.rubato")
local dpi = beautiful.xresources.apply_dpi
local theme = beautiful.get()
-- Var
local width = dpi(410)
local height = awful.screen.focused().geometry.height - dpi(100)
@ -19,23 +20,7 @@ local function round_widget(radius)
end
end
local function center_widget(widgets)
return wibox.widget({
nil,
{
nil,
widgets,
expand = "none",
layout = wibox.layout.align.horizontal,
},
expand = "none",
layout = wibox.layout.align.vertical,
})
end
local function box_widget(widgets, _width, _height)
--local centered_widget = center_widget(widgets)
return wibox.widget({
{
{
@ -46,7 +31,7 @@ local function box_widget(widgets, _width, _height)
forced_width = dpi(_width),
forced_height = dpi(_height),
shape = round_widget(8),
bg = beautiful.bg_focus, --for widget Rounded and Border
bg = theme.bg_focus, --for widget Rounded and Border
widget = wibox.container.background,
},
margins = { left = dpi(20), right = dpi(20) },
@ -57,7 +42,6 @@ end
-- Get widgets
local weather_widget = require("ui.info-panel.weather")
local profile_widget = require("ui.info-panel.profile")
--local player_widget = require "ui.info-panel.player" -- Old MPD widget
local calendar_widget = require("ui.info-panel.calendar")
local music_widget = require("ui.info-panel.music-player")
@ -65,15 +49,7 @@ local music_widget = require("ui.info-panel.music-player")
-- Combine some widgets
local weather = box_widget(weather_widget, 380, 180)
local profile = box_widget(profile_widget, 380, 210)
--local player = box_widget(player_widget, 380, 150) -- Box MPD widget
local calendar = box_widget(calendar_widget, 380, 340)
-- Spacing
local space = function(_height)
return wibox.widget({
forced_height = dpi(_height),
layout = wibox.layout.align.horizontal,
})
end
-- Sidebar
local sidebar = wibox({
@ -82,17 +58,15 @@ local sidebar = wibox({
width = width,
height = height,
y = dpi(60),
bg = beautiful.bg_normal,
bg = theme.bg_normal,
border_width = dpi(3),
border_color = beautiful.xcolorS0,
border_color = theme.xcolorS0,
})
-- Sidebar widget setup
sidebar:setup({
{
profile,
--player,
--stats,
music_widget,
weather,
calendar,
@ -122,26 +96,18 @@ sidebar.timer = gears.timer({
sidebar.visible = not sidebar.visible
end,
})
--aa.timer = gears.timer { -- Updates the Player every second
-- timeout = 1,
-- autostart = false,
-- callback = function()
-- awesome.emit_signal("widget::update_player")
-- end
--}
sidebar.shape = function(cr, w, h) --Rounded Corners
gears.shape.rounded_rect(cr, w, h, 14)
end
-- Toggle function
sidebar.toggle = function()
if sidebar.visible then
-- aa.timer:stop() -- Stops to Update the Player Signal
slide.target = awful.screen.focused().geometry.x - sidebar.width
sidebar.timer:start()
else
-- awesome.emit_signal("widget::update_player") -- Updates it before the Timer so it doesn't Jump the Length
awesome.emit_signal("widget::update_uptime")
-- aa.timer:start()
slide.target = awful.screen.focused().geometry.x + dpi(20)
sidebar.visible = not sidebar.visible
end

View file

@ -1,23 +1,24 @@
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful").get()
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local beautiful = require("beautiful")
local wibox = require("wibox")
local helpers = require("helpers")
local playerctl_daemon = require("signals.playerctl")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
---- Music Player
---- ~~~~~~~~~~~~
local music_text = wibox.widget({
font = beautiful.font_name .. "Medium 10",
font = helpers.ui.set_font("Medium 10"),
valign = "center",
widget = wibox.widget.textbox,
})
local music_art = wibox.widget({
image = beautiful.music,
image = theme.music,
resize = true,
widget = wibox.widget.imagebox,
})
@ -33,7 +34,7 @@ local filter_color = {
type = "linear",
from = { 0, 0 },
to = { 0, 160 },
stops = { { 0, beautiful.xcolorS0 .. "cc" }, { 1, beautiful.xcolorS0 } },
stops = { { 0, theme.xcolorS0 .. "cc" }, { 1, theme.xcolorS0 } },
}
local music_art_filter = wibox.widget({
@ -48,13 +49,13 @@ local music_art_filter = wibox.widget({
})
local music_title = wibox.widget({
font = beautiful.font_name .. "Regular 13",
font = helpers.ui.set_font("Regular 13"),
valign = "center",
widget = wibox.widget.textbox,
})
local music_artist = wibox.widget({
font = beautiful.font_name .. "Bold 16",
font = helpers.ui.set_font("Bold 16"),
valign = "center",
widget = wibox.widget.textbox,
})
@ -68,8 +69,8 @@ local function volume_control()
bar_width = dpi(4),
shape = helpers.ui.rrect(6),
bar_shape = helpers.ui.rrect(6),
color = beautiful.xcolor2,
background_color = beautiful.xcolorS0,
color = theme.xcolor2,
background_color = theme.xcolorS0,
border_width = 0,
widget = wibox.widget.progressbar,
})
@ -100,6 +101,7 @@ local function volume_control()
awful.button({}, 4, function()
awful.spawn.with_shell("playerctl volume 0.05+")
end),
awful.button({}, 5, function()
awful.spawn.with_shell("playerctl volume 0.05-")
end)
@ -107,25 +109,26 @@ local function volume_control()
return volume
end
-- Player's Button
local toggle = wibox.widget.textbox()
toggle.font = beautiful.font_name .. "26"
toggle.font = helpers.ui.set_font("26")
toggle:buttons(gears.table.join(awful.button({}, 1, function()
playerctl_daemon:play_pause()
end)))
local next = wibox.widget.textbox()
next.font = beautiful.font_name .. "26"
next.markup = ""
next.font = helpers.ui.set_font("26")
next.markup = "󰒭"
next:buttons(gears.table.join(awful.button({}, 1, function()
playerctl_daemon:next()
end)))
local back = wibox.widget.textbox()
back.font = beautiful.font_name .. "26"
back.markup = ""
back.font = helpers.ui.set_font("26")
back.markup = "󰒮"
back:buttons(gears.table.join(awful.button({}, 1, function()
playerctl_daemon:previous()
@ -194,7 +197,7 @@ local function music()
},
forced_width = dpi(350),
shape = helpers.ui.prrect(8, false, true, true, false),
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
widget = wibox.container.background,
})
end
@ -211,7 +214,7 @@ local music_widget = wibox.widget({
layout = wibox.layout.align.horizontal,
},
forced_height = dpi(150),
bg = beautiful.xcolorbase,
bg = theme.xcolorbase,
shape = helpers.ui.rrect(8),
widget = wibox.container.background,
},
@ -231,21 +234,21 @@ playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_pat
artist = "Nothing Playing"
end
if album_path == "" then
album_path = beautiful.music
album_path = theme.music
end
music_art:set_image(gears.surface.load_uncached(album_path))
music_title:set_markup_silently(helpers.ui.colorize_text(title, beautiful.xcolorT2))
music_artist:set_markup_silently(helpers.ui.colorize_text(artist, beautiful.xcolor2))
music_title:set_markup_silently(helpers.ui.colorize_text(title, theme.xcolorT2))
music_artist:set_markup_silently(helpers.ui.colorize_text(artist, theme.xcolor2))
end)
playerctl_daemon:connect_signal("playback_status", function(_, playing, _)
if playing then
music_text:set_markup_silently(helpers.ui.colorize_text("Now Playing", beautiful.xcolorO0)) --"#666c79"
toggle.markup = helpers.ui.colorize_text("󰏤", beautiful.xcolor2)
music_text:set_markup_silently(helpers.ui.colorize_text("Now Playing", theme.xcolorO0))
toggle.markup = helpers.ui.colorize_text("󰏤", theme.xcolor2)
else
music_text:set_markup_silently(helpers.ui.colorize_text("Music", beautiful.xcolorO0))
toggle.markup = helpers.ui.colorize_text("󰐊", beautiful.xcolor2)
music_text:set_markup_silently(helpers.ui.colorize_text("Music", theme.xcolorO0))
toggle.markup = helpers.ui.colorize_text("󰐊", theme.xcolor2)
end
end)

View file

@ -1,36 +1,39 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local helpers = require("helpers")
local dpi = beautiful.xresources.apply_dpi
-- Make Widgets
-----------------
-- Song's Title
local title = wibox.widget.textbox()
title.font = beautiful.font_name .. "Medium 16"
title.font = helpers.ui.set_font("Medium 16")
title.align = "left"
title.valign = "bottom"
-- Song's Artist
local artist = wibox.widget.textbox()
artist.font = beautiful.font_name .. "Regular 16"
artist.font = helpers.ui.set_font("Regular 16")
artist.align = "left"
artist.valign = "bottom"
-- Song's Length
local length = wibox.widget.textbox()
length.font = beautiful.font_name .. "Regular 14"
length.font = helpers.ui.set_font("Regular 14")
length.align = "center"
length.valign = "center"
-- Player's Button
local toggle = wibox.widget.textbox()
toggle.font = beautiful.font_name .. "26"
toggle.font = helpers.ui.set_font("26")
toggle:buttons(gears.table.join(awful.button({}, 1, function()
awful.spawn("mpc toggle", false)
if toggle.markup:match("󰏤") then
toggle.markup = "󰐊"
else
@ -39,7 +42,7 @@ toggle:buttons(gears.table.join(awful.button({}, 1, function()
end)))
local next = wibox.widget.textbox()
next.font = beautiful.font_name .. "26"
next.font = helpers.ui.set_font("26")
next.markup = "󰒭"
next:buttons(gears.table.join(awful.button({}, 1, function()
@ -47,7 +50,7 @@ next:buttons(gears.table.join(awful.button({}, 1, function()
end)))
local back = wibox.widget.textbox()
back.font = beautiful.font_name .. "26"
back.font = helpers.ui.set_font("26")
back.markup = "󰒮"
back:buttons(gears.table.join(awful.button({}, 1, function()
@ -104,7 +107,7 @@ return wibox.widget({
spacing = dpi(6),
layout = wibox.layout.fixed.vertical,
},
top = 30,
top = dpi(30),
bottom = 0,
layout = wibox.container.margin,
},

View file

@ -1,57 +1,55 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local helpers = require("helpers")
local dpi = require("beautiful.xresources").apply_dpi
local user1 = os.getenv("USER")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local os_user = os.getenv("USER")
-- Create Widgets
-------------------
-- Pfp
local pfp = wibox.widget.imagebox()
pfp.image = beautiful.pfp
pfp.image = require("config").theme.pfp
pfp.clip_shape = gears.shape.circle
pfp.forced_width = dpi(130)
pfp.forced_height = dpi(130)
-- User
local user = wibox.widget.textbox()
user.font = beautiful.font_name .. "SemiBold 18"
user.font = helpers.ui.set_font("SemiBold 18")
user.align = "left"
user.markup = "<span foreground='" .. beautiful.fg_normal .. "'>" .. user1 .. "</span>"
user.markup = helpers.ui.colorize_text(os_user, theme.fg_normal)
-- Hostname
local hostname = wibox.widget.textbox()
hostname.font = beautiful.font_name .. "Regular 14"
hostname.font = helpers.ui.set_font("Regular 14")
hostname.align = "left"
awful.spawn.easy_async_with_shell("echo $HOST", function(stdout)
hostname.markup = "<span foreground='" .. beautiful.xcolor1 .. "'>" .. "@" .. tostring(stdout) .. "</span>"
awful.spawn.easy_async_with_shell("hostnamectl --static", function(stdout)
hostname.markup = helpers.ui.colorize_text("@" .. tostring(stdout), theme.xcolor1)
end)
-- Battery
local uptimeosd = wibox.widget.textbox()
uptimeosd.font = beautiful.font_name .. "12"
uptimeosd.font = helpers.ui.set_font("12")
uptimeosd.align = "center"
-- Get data 4 widgets!
awesome.connect_signal("signal::uptime", function(uptime)
uptimeosd.markup = "<span foreground='" .. beautiful.fg_normal .. "'>" .. "up " .. uptime .. "</span>"
uptimeosd.markup = helpers.ui.colorize_text("up " .. uptime, theme.fg_normal)
end)
-- Spacing horizontally
local space = wibox.widget({
forced_height = dpi(6),
layout = wibox.layout.align.horizontal,
})
local shutdown = wibox.widget({
{
{
font = beautiful.font_name .. "30",
markup = "<span foreground='" .. beautiful.xcolor10 .. "'>" .. "" .. "</span>",
font = helpers.ui.set_font("30"),
markup = helpers.ui.colorize_text("", theme.xcolor10),
align = "center",
valign = "center",
widget = wibox.widget.textbox,
@ -62,7 +60,7 @@ local shutdown = wibox.widget({
right = dpi(11),
widget = wibox.container.margin,
},
bg = beautiful.xcolorS1,
bg = theme.xcolorS1,
shape = helpers.ui.rrect(8),
widget = wibox.container.background,
})
@ -70,8 +68,8 @@ local shutdown = wibox.widget({
local reboot = wibox.widget({
{
{
font = beautiful.font_name .. "30",
markup = "<span foreground='" .. beautiful.xcolor2 .. "'>" .. "" .. "</span>",
font = helpers.ui.set_font("30"),
markup = helpers.ui.colorize_text("", theme.xcolor2),
align = "center",
valign = "center",
widget = wibox.widget.textbox,
@ -82,24 +80,24 @@ local reboot = wibox.widget({
right = dpi(11),
widget = wibox.container.margin,
},
bg = beautiful.xcolorS1,
bg = theme.xcolorS1,
shape = helpers.ui.rrect(8),
widget = wibox.container.background,
})
shutdown:connect_signal("mouse::enter", function()
shutdown.bg = beautiful.xcolorS2
shutdown.bg = theme.xcolorS2
end)
shutdown:connect_signal("mouse::leave", function()
shutdown.bg = beautiful.xcolorS1
shutdown.bg = theme.xcolorS1
end)
reboot:connect_signal("mouse::enter", function()
reboot.bg = beautiful.xcolorS2
reboot.bg = theme.xcolorS2
end)
reboot:connect_signal("mouse::leave", function()
reboot.bg = beautiful.xcolorS1
reboot.bg = theme.xcolorS1
end)
shutdown:buttons(gears.table.join(awful.button({}, 1, function()
@ -119,8 +117,8 @@ local buttons = wibox.widget({
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
top = 10,
left = 57,
top = dpi(10),
left = dpi(57),
widget = wibox.container.margin,
})
@ -134,6 +132,7 @@ local name = wibox.widget({
left = 0,
widget = wibox.container.margin,
})
local uptimebox = wibox.widget({
{
{
@ -141,11 +140,11 @@ local uptimebox = wibox.widget({
spacing = dpi(2),
layout = wibox.layout.fixed.vertical,
},
top = 3,
bottom = 3,
top = dpi(3),
bottom = dpi(3),
widget = wibox.container.margin,
},
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
shape = helpers.ui.rrect(7),
widget = wibox.container.background,
})
@ -167,7 +166,7 @@ return wibox.widget({
buttons,
layout = wibox.layout.fixed.vertical,
},
top = 30,
top = dpi(30),
layout = wibox.container.margin,
},
spacing = dpi(30),

View file

@ -1,12 +1,14 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local filesystem = gears.filesystem
local beautiful = require("beautiful")
local json = require("lib.json")
local config = require("config")
local icon_dir = filesystem.get_configuration_dir() .. "ui/info-panel/weather/icons/"
local helpers = require("helpers")
local config = require("config").widget.weather
local dpi = beautiful.xresources.apply_dpi
local icon_dir = gears.filesystem.get_configuration_dir() .. "ui/info-panel/weather/icons/"
--- Weather Widget
--- ~~~~~~~~~~~~~~
@ -49,13 +51,13 @@ local current_weather_widget = wibox.widget({
{
id = "description",
text = "Mostly cloudy",
font = beautiful.font_name .. "Bold 10",
font = helpers.ui.set_font("Bold 10"),
widget = wibox.widget.textbox,
},
{
id = "humidity",
text = "Humidity: 80%",
font = beautiful.font_name .. " 9",
font = helpers.ui.set_font("9"),
widget = wibox.widget.textbox,
},
layout = wibox.layout.fixed.vertical,
@ -69,16 +71,16 @@ local current_weather_widget = wibox.widget({
{
{
{
id = "tempareture_current",
id = "temp_current",
markup = "20<sup><span>°</span></sup>",
align = "right",
font = beautiful.font_name .. "Bold 16",
font = helpers.ui.set_font("Bold 16"),
widget = wibox.widget.textbox,
},
{
id = "feels_like",
markup = "Feels like: 19<sup><span>°</span></sup>",
font = beautiful.font_name .. " 8",
font = helpers.ui.set_font("8"),
widget = wibox.widget.textbox,
},
spacing = dpi(-6),
@ -95,7 +97,7 @@ local hourly_widget = function()
{
id = "time",
text = "12PM",
font = beautiful.font_name .. " 9",
font = helpers.ui.set_font("9"),
widget = wibox.widget.textbox,
},
widget = wibox.container.place,
@ -113,9 +115,9 @@ local hourly_widget = function()
},
{
{
id = "tempareture",
id = "temp",
markup = "1<sup><span>°</span></sup>",
font = beautiful.font_name .. " 9",
font = helpers.ui.set_font("9"),
widget = wibox.widget.textbox,
},
widget = wibox.container.place,
@ -127,12 +129,17 @@ local hourly_widget = function()
widget.update = function(result)
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]
local temp = widget:get_children_by_id("temp")[1]
temp:set_markup(math.floor(result.temp) .. "<sup><span>°</span></sup>")
time:set_text(os.date("%I%p", tonumber(result.dt)))
icon.image = icon_dir .. icon_map[result.weather[1].icon] .. ".svg"
icon:emit_signal("widget::redraw_needed")
end
return widget
end
@ -146,7 +153,7 @@ local hourly_widget_6 = hourly_widget()
local weather_widget = wibox.widget({
{
text = "Weather",
font = beautiful.font_name .. "Bold 16",
font = helpers.ui.set_font("Bold 16"),
align = "center",
widget = wibox.widget.textbox,
},
@ -165,23 +172,19 @@ local weather_widget = wibox.widget({
layout = wibox.layout.fixed.vertical,
})
local api_key = config.widget.weather.api_key
local coordinates = config.widget.weather.coordinates
local show_hourly_forecast = true
local show_daily_forecast = true
local units = "imperial"
local url = (
"https://api.openweathermap.org/data/2.5/onecall"
.. "?lat="
.. coordinates.lat
.. config.coordinates.lat
.. "&lon="
.. coordinates.lon
.. config.coordinates.lon
.. "&appid="
.. api_key
.. config.api_key
.. "&units="
.. units
.. config.units
.. "&exclude=minutely"
.. (show_hourly_forecast == false and ",hourly" or "")
.. (show_daily_forecast == false and ",daily" or "")
@ -199,14 +202,20 @@ awful.widget.watch(string.format(GET_FORECAST_CMD, url), 600, function(_, stdout
local icon = current_weather_widget:get_children_by_id("icon")[1]
local description = current_weather_widget:get_children_by_id("description")[1]
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 temp_current = current_weather_widget:get_children_by_id("temp_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"
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>")
-- Hourly widget setup
hourly_widget_1.update(result.hourly[1])
hourly_widget_2.update(result.hourly[2])

View file

@ -1,22 +1,24 @@
local gears = require("gears")
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local helpers = require("helpers")
local naughty = require("naughty")
local rubato = require("lib.rubato")
local dpi = require("beautiful.xresources").apply_dpi
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local notifs_text = wibox.widget({
font = beautiful.font .. " Bold 20",
font = helpers.ui.set_font("Bold 20"),
markup = "Notifications",
halign = "center",
widget = wibox.widget.textbox,
})
local notifs_clear = wibox.widget({
markup = "<span foreground='" .. beautiful.xcolor10 .. "'> </span>",
font = beautiful.font_name .. " Bold 21",
markup = helpers.ui.colorize_text("", theme.xcolor10),
font = helpers.ui.set_font("Bold 21"),
align = "center",
valign = "center",
widget = wibox.widget.textbox,
@ -25,6 +27,7 @@ local notifs_clear = wibox.widget({
notifs_clear:buttons(gears.table.join(awful.button({}, 1, function()
_G.Notif_center_reset_notifs_container()
end)))
helpers.ui.add_hover_cursor(notifs_clear, "hand2")
local notifs_empty = wibox.widget({
@ -33,8 +36,8 @@ local notifs_empty = wibox.widget({
{
nil,
{
markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>Nothing Here!</span>",
font = beautiful.font .. " Bold 17",
markup = helpers.ui.colorize_text("Nothing Here!", theme.xcolorT2),
font = helpers.ui.set_font("Bold 17"),
align = "center",
valign = "center",
widget = wibox.widget.textbox,
@ -43,27 +46,27 @@ local notifs_empty = wibox.widget({
},
layout = wibox.layout.align.horizontal,
},
forced_height = 730,
forced_height = dpi(730),
widget = wibox.container.background,
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
shape = helpers.ui.rrect(8),
})
local notifs_container = wibox.widget({
spacing = 10,
spacing = dpi(10),
spacing_widget = {
{
shape = helpers.ui.rrect(8),
widget = wibox.container.background,
},
top = 2,
bottom = 2,
left = 6,
right = 6,
top = dpi(2),
bottom = dpi(2),
left = dpi(6),
right = dpi(6),
widget = wibox.container.margin,
},
forced_width = 320,
forced_height = 730, --Use it like in notifs_empty else it will look weird
forced_width = dpi(320),
forced_height = dpi(730), --Use it like in notifs_empty else it will look weird
layout = wibox.layout.fixed.vertical,
})
@ -101,8 +104,8 @@ local create_notif = function(icon, n)
widget = wibox.widget.imagebox,
},
strategy = "exact",
height = 50,
width = 50,
height = dpi(50),
width = dpi(50),
widget = wibox.container.constraint,
},
{
@ -112,22 +115,22 @@ local create_notif = function(icon, n)
{
{
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
speed = 50,
speed = dpi(50),
{
markup = n.title,
font = beautiful.font .. " Bold 9",
font = helpers.ui.set_font("Bold 9"),
align = "left",
widget = wibox.widget.textbox,
},
forced_width = 140,
forced_width = dpi(140),
widget = wibox.container.scroll.horizontal,
},
nil,
{
markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>" .. time .. "</span>",
markup = helpers.ui.colorize_text(time, theme.xcolorT2),
align = "right",
valign = "bottom",
font = beautiful.font .. " Bold 10",
font = helpers.ui.set_font("Bold 10"),
widget = wibox.widget.textbox,
},
expand = "none",
@ -135,32 +138,32 @@ local create_notif = function(icon, n)
},
{
step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth,
speed = 50,
speed = dpi(50),
{
markup = n.message,
align = "left",
widget = wibox.widget.textbox,
},
forced_width = 165,
forced_width = dpi(165),
widget = wibox.container.scroll.horizontal,
},
spacing = 3,
spacing = dpi(3),
layout = wibox.layout.fixed.vertical,
},
expand = "none",
layout = wibox.layout.align.vertical,
},
left = 17,
left = dpi(17),
widget = wibox.container.margin,
},
layout = wibox.layout.align.horizontal,
},
margins = 15,
margins = dpi(15),
widget = wibox.container.margin,
},
forced_height = 85,
forced_height = dpi(85),
widget = wibox.container.background,
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
shape = helpers.ui.rrect(8),
})
@ -199,7 +202,7 @@ naughty.connect_signal("request::display", function(n)
local appicon = n.icon or n.app_icon
if not appicon then
appicon = beautiful.pfp --notification_icon
appicon = theme.pfp --notification_icon
end
notifs_container:insert(1, create_notif(appicon, n))
@ -215,18 +218,18 @@ local notifs = wibox.widget({
expand = "none",
layout = wibox.layout.align.horizontal,
},
left = 5,
right = 5,
top = 7,
bottom = 7,
left = dpi(5),
right = dpi(5),
top = dpi(7),
bottom = dpi(7),
layout = wibox.container.margin,
},
widget = wibox.container.background,
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
shape = helpers.ui.rrect(8),
},
notifs_container,
spacing = 20,
spacing = dpi(20),
layout = wibox.layout.fixed.vertical,
})
@ -240,20 +243,20 @@ local actions = wibox.widget({
widget = require("ui.notif-panel.widgets.mic_slider"),
},
layout = wibox.layout.flex.vertical,
spacing = 1,
spacing = dpi(1),
},
widget = wibox.container.margin,
top = 20,
bottom = 20,
left = 35,
right = 35,
top = dpi(20),
bottom = dpi(20),
left = dpi(35),
right = dpi(35),
},
forced_height = 120,
forced_height = dpi(120),
widget = wibox.container.background,
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
shape = helpers.ui.rrect(8),
})
--
-- Sidebar
local action = wibox({
visible = false,
@ -261,20 +264,26 @@ local action = wibox({
width = dpi(410),
height = awful.screen.focused().geometry.height - dpi(100),
y = dpi(60),
bg = beautiful.bg_normal,
bg = theme.bg_normal,
border_width = dpi(3),
border_color = beautiful.xcolorS0,
border_color = theme.xcolorS0,
})
-- Sidebar widget setup
action:setup({
{
notifs,
nil,
actions,
spacing = dpi(20),
layout = wibox.layout.fixed.vertical,
layout = wibox.layout.align.vertical,
},
margins = {
top = dpi(20),
bottom = dpi(20),
left = dpi(20),
right = dpi(20),
},
margins = { top = dpi(20), bottom = dpi(20), left = dpi(20), right = dpi(20) },
widget = wibox.container.margin,
})
@ -300,6 +309,7 @@ action.timer = gears.timer({
action.shape = function(cr, w, h) --Rounded Corners
gears.shape.rounded_rect(cr, w, h, 14)
end
-- Toggle function
action.toggle = function()
if action.visible then

View file

@ -1,18 +1,21 @@
local gears = require("gears")
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local helpers = require("helpers")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local slider = wibox.widget({
bar_shape = helpers.ui.rrect(9),
bar_height = 6,
bar_color = beautiful.bg_focus,
bar_active_color = beautiful.xcolor7,
bar_color = theme.bg_focus,
bar_active_color = theme.xcolor7,
handle_shape = gears.shape.circle,
handle_color = beautiful.xcolor7,
handle_width = 12,
value = 25,
handle_color = theme.xcolor7,
handle_width = dpi(12),
value = dpi(25),
widget = wibox.widget.slider,
})
@ -20,8 +23,8 @@ helpers.ui.add_hover_cursor(slider, "hand1")
local bri_slider = wibox.widget({
{
markup = helpers.ui.colorize_text("", beautiful.xcolor7),
font = beautiful.font .. " 14",
markup = helpers.ui.colorize_text("󰃞 ", theme.xcolor7),
font = helpers.ui.set_font("14"),
align = "center",
valign = "center",
widget = wibox.widget.textbox(),

View file

@ -1,34 +1,36 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local helpers = require("helpers")
local dpi = require("beautiful.xresources").apply_dpi
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local config = require("config")
local microphone = config.widget.mic.name
local slider = wibox.widget({
bar_shape = helpers.ui.rrect(9),
bar_height = 6,
bar_color = beautiful.xcolorbase,
bar_active_color = beautiful.xcolor2,
bar_height = dpi(6),
bar_color = theme.xcolorbase,
bar_active_color = theme.xcolor2,
handle_shape = gears.shape.circle,
handle_color = beautiful.xcolor2,
handle_width = 12,
value = 75,
handle_color = theme.xcolor2,
handle_width = dpi(12),
value = dpi(75),
forced_width = dpi(239),
widget = wibox.widget.slider,
})
local osd_value = wibox.widget({
text = "0%",
font = beautiful.font_name .. "10",
font = helpers.ui.set_font("10"),
widget = wibox.widget.textbox(),
})
local icon = wibox.widget({
markup = helpers.ui.colorize_text("󰍬", beautiful.xcolor2),
font = beautiful.font_name .. "14",
markup = helpers.ui.colorize_text("󰍬", theme.xcolor2),
font = helpers.ui.set_font("14"),
align = "center",
valign = "center",
widget = wibox.widget.textbox(),
@ -37,11 +39,11 @@ local icon = wibox.widget({
local function get_val()
awesome.connect_signal("signal::mic", function(_, muted)
if muted then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰍭</span>"
icon.font = beautiful.font_name .. "14"
icon.markup = helpers.ui.colorize_text("󰍭", theme.xcolor2)
icon.font = helpers.ui.set_font("14")
else
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰍬</span>"
icon.font = beautiful.font_name .. "17"
icon.markup = helpers.ui.colorize_text("󰍬", theme.xcolor2)
icon.font = helpers.ui.set_font("17")
end
end)
end
@ -49,9 +51,7 @@ end
get_val()
icon:buttons(gears.table.join(awful.button({}, 1, function()
local script = [[
pamixer --source ]] .. microphone .. [[ -t
]]
local script = "pamixer --source" .. microphone .. "-t"
awful.spawn(script, false)
awesome.emit_signal("widget::update_mic")
@ -65,6 +65,7 @@ slider:buttons(gears.table.join(
end
slider:set_value(slider:get_value() + 5)
end),
awful.button({}, 5, nil, function()
if slider:get_value() < 0 then
slider:set_value(0)
@ -85,8 +86,8 @@ local mic_slider = wibox.widget({
},
left = 0,
right = dpi(14),
top = 5,
bottom = 5,
top = dpi(5),
bottom = dpi(5),
layout = wibox.container.margin,
},
slider,
@ -119,4 +120,5 @@ slider:connect_signal("property::value", function(_, new_value)
local volume_level = slider:get_value()
osd_value.text = volume_level .. "%"
end)
return mic_slider

View file

@ -1,31 +1,33 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local helpers = require("helpers")
local dpi = require("beautiful.xresources").apply_dpi
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local slider = wibox.widget({
bar_shape = helpers.ui.rrect(9),
bar_height = 6,
bar_color = beautiful.xcolorbase,
bar_active_color = beautiful.xcolor2,
bar_height = dpi(6),
bar_color = theme.xcolorbase,
bar_active_color = theme.xcolor2,
handle_shape = gears.shape.circle,
handle_color = beautiful.xcolor2,
handle_width = 12,
value = 75,
handle_color = theme.xcolor2,
handle_width = dpi(12),
value = dpi(75),
forced_width = dpi(239),
widget = wibox.widget.slider,
})
local osd_value = wibox.widget({
text = "0%",
font = beautiful.font_name .. "10",
font = helpers.ui.set_font("10"),
widget = wibox.widget.textbox(),
})
local icon = wibox.widget({
markup = helpers.ui.colorize_text("󰕾 ", beautiful.xcolor2),
font = beautiful.font_name .. "14",
markup = helpers.ui.colorize_text("󰕾 ", theme.xcolor2),
font = helpers.ui.set_font("14"),
align = "center",
valign = "center",
widget = wibox.widget.textbox(),
@ -34,9 +36,9 @@ local icon = wibox.widget({
local function get_val()
awesome.connect_signal("signal::volume", function(_, muted)
if muted then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖁</span>"
icon.markup = helpers.ui.colorize_text("󰖁", theme.xcolor2)
else
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
icon.markup = helpers.ui.colorize_text("󰕾", theme.xcolor2)
end
end)
end
@ -44,9 +46,7 @@ end
get_val()
icon:buttons(gears.table.join(awful.button({}, 1, function()
local script = [[
pamixer -t
]]
local script = "pamixer -t"
awful.spawn(script, false)
awesome.emit_signal("widget::update_vol")
@ -60,6 +60,7 @@ slider:buttons(gears.table.join(
end
slider:set_value(slider:get_value() + 5)
end),
awful.button({}, 5, nil, function()
if slider:get_value() < 0 then
slider:set_value(0)
@ -80,8 +81,8 @@ local vol_slider = wibox.widget({
},
left = 0,
right = dpi(14),
top = 5,
bottom = 5,
top = dpi(5),
bottom = dpi(5),
layout = wibox.container.margin,
},
slider,
@ -119,4 +120,5 @@ slider:connect_signal("property::value", function(_, new_value)
local volume_level = slider:get_value()
osd_value.text = volume_level .. "%"
end)
return vol_slider

View file

@ -1,4 +1,10 @@
require(... .. ".layout")
require(... .. ".notifications")
require(... .. ".scratchpad")
require(... .. ".volume")
local req = {
"layout",
"notifications",
"scratchpad",
"volume",
}
for _, x in pairs(req) do
require(... .. "." .. x)
end

View file

@ -1,30 +1,33 @@
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local wibox = require("wibox")
local keys = require("config").keys
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local ll = awful.widget.layoutlist({
base_layout = wibox.widget({
spacing = 5,
forced_num_cols = 4,
spacing = dpi(5),
forced_num_cols = dpi(4),
layout = wibox.layout.grid.vertical,
}),
widget_template = {
{
{
id = "icon_role",
forced_height = 1,
forced_width = 1,
forced_height = dpi(1),
forced_width = dpi(1),
widget = wibox.widget.imagebox,
},
margins = 15,
margins = dpi(15),
widget = wibox.container.margin,
},
id = "background_role",
forced_width = 70,
forced_height = 70,
forced_width = dpi(70),
forced_height = dpi(70),
shape = gears.shape.rounded_rect,
widget = wibox.container.background,
},
@ -36,14 +39,16 @@ local layout_popup = awful.popup({
margins = 4, --border margins (padding)
widget = wibox.container.margin,
}),
border_color = beautiful.border_normal,
bg = beautiful.bg_normal,
border_width = beautiful.border_width,
border_color = theme.border_normal,
bg = theme.bg_normal,
border_width = theme.border_width,
placement = awful.placement.centered,
ontop = true,
visible = false,
shape = gears.shape.rounded_rect,
})
function gears.table.iterate_value(t, value, step_size, filter, _)
local k = gears.table.hasitem(t, value)
if not k then
@ -60,6 +65,7 @@ function gears.table.iterate_value(t, value, step_size, filter, _)
return t[k2], k2
end
end
return
end
@ -69,7 +75,6 @@ end
-- Timer for Death of PopUp
layout_popup.timer = gears.timer({
timeout = 0.8,
--autostart = true,
single_shot = true,
callback = function()
layout_popup.visible = false
@ -84,37 +89,34 @@ function layout_popup.changed()
layout_popup.timer:again()
end
end
-- Mouse Support -- Disable if not Wanted --
-- Mouse Support
layout_popup:connect_signal("mouse::enter", function()
layout_popup.timer:stop()
end)
layout_popup:connect_signal("mouse::leave", function()
layout_popup.timer:start()
end)
-- Make sure you remove the default Mod4+Space and Mod4+Shift+Space
-- keybindings before adding this.
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" },
keybindings = {
{
{ keys.mod },
" ",
function()
--layout_popup.timer:again()
awful.layout.set(
gears.table.iterate_value(ll.layouts, ll.current_layout, 1),
--layout_popup.timer:start()
layout_popup.changed()
)
awful.layout.set(gears.table.iterate_value(ll.layouts, ll.current_layout, 1), layout_popup.changed())
end,
},
@ -122,12 +124,7 @@ awful.keygrabber({
{ keys.mod, "Shift" },
" ",
function()
--layout_popup.timer:again()
awful.layout.set(
gears.table.iterate_value(ll.layouts, ll.current_layout, -1),
--layout_popup.timer:start()
layout_popup.changed()
)
awful.layout.set(gears.table.iterate_value(ll.layouts, ll.current_layout, -1), layout_popup.changed())
end,
},
},

View file

@ -1,13 +1,15 @@
local gears = require("gears")
local wibox = require("wibox")
local awful = require("awful")
local beautiful = require("beautiful").get()
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local beautiful = require("beautiful")
local naughty = require("naughty")
local helpers = require("helpers")
local menubar = require("menubar")
local animation = require("lib.animation")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
--- Naughty Notifications with animation
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -44,13 +46,13 @@ naughty.connect_signal("request::icon", function(n, context, hints)
end)
--- Use XDG icon
naughty.connect_signal("request::action_icon", function(a, context, hints)
naughty.connect_signal("request::action_icon", function(a, _, hints)
a.icon = menubar.utils.lookup_icon(hints.id)
end)
naughty.connect_signal("request::display", function(n)
--- random accent color
local accent_colors = beautiful.xcolor2
local accent_colors = theme.xcolor2
--- table of icons
local app_icons = {
@ -71,8 +73,8 @@ naughty.connect_signal("request::display", function(n)
local app_icon_n = wibox.widget({
{
font = beautiful.font_name .. "Round 13",
markup = "<span foreground='" .. beautiful.xcolorbase .. "'>" .. app_icon .. "</span>",
font = helpers.ui.set_font("Round 13"),
markup = helpers.ui.colorize_text(app_icon, theme.xcolorbase),
align = "center",
valign = "center",
widget = wibox.widget.textbox,
@ -122,15 +124,15 @@ naughty.connect_signal("request::display", function(n)
})
local app_name = wibox.widget({
font = beautiful.font_name .. "Bold 12",
font = helpers.ui.set_font("Bold 12"),
text = n.app_name:gsub("^%l", string.upper),
widget = wibox.widget.textbox,
})
local dismiss = wibox.widget({
{
font = beautiful.font_name .. "Bold 10",
markup = helpers.ui.colorize_text("", beautiful.xcolor2),
font = helpers.ui.set_font("Bold 10"),
markup = helpers.ui.colorize_text("", theme.xcolor2),
widget = wibox.widget.textbox,
valign = "center",
align = "center",
@ -152,7 +154,7 @@ naughty.connect_signal("request::display", function(n)
value = 0,
thickness = dpi(4),
rounded_edge = true,
bg = beautiful.xcolorbase,
bg = theme.xcolorbase,
colors = {
{
type = "linear",
@ -169,8 +171,9 @@ naughty.connect_signal("request::display", function(n)
},
dismiss,
})
local title2 = wibox.widget.textbox()
title2.font = beautiful.font_name .. "Bold 11"
title2.font = helpers.ui.set_font("Bold 11")
title2.text = n.title
local title = wibox.widget({
@ -182,7 +185,7 @@ naughty.connect_signal("request::display", function(n)
})
local message2 = wibox.widget.textbox()
message2.font = beautiful.font_name .. "11"
message2.font = helpers.ui.set_font("11")
message2.text = n.message
local message = wibox.widget({
@ -195,16 +198,18 @@ naughty.connect_signal("request::display", function(n)
local actions = wibox.widget({
notification = n,
base_layout = wibox.widget({
spacing = dpi(3),
layout = wibox.layout.flex.horizontal,
}),
widget_template = {
{
{
{
id = "text_role",
font = beautiful.font_name .. "10",
font = helpers.ui.set_font("10"),
widget = wibox.widget.textbox,
},
left = dpi(6),
@ -213,7 +218,7 @@ naughty.connect_signal("request::display", function(n)
},
widget = wibox.container.place,
},
bg = beautiful.xcolorbase,
bg = theme.xcolorbase,
forced_height = dpi(25),
forced_width = dpi(70),
widget = wibox.container.background,
@ -230,11 +235,12 @@ naughty.connect_signal("request::display", function(n)
type = "notification",
cursor = "hand2",
shape = helpers.ui.rrect(12),
border_color = beautiful.xcolorS0,
border_color = theme.xcolorS0,
border_width = dpi(3),
maximum_width = dpi(350),
maximum_height = dpi(180),
bg = "#00000000",
widget_template = {
{
layout = wibox.layout.fixed.vertical,
@ -249,7 +255,7 @@ naughty.connect_signal("request::display", function(n)
margins = { top = dpi(3), bottom = dpi(3), left = dpi(15), right = dpi(15) },
widget = wibox.container.margin,
},
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
widget = wibox.container.background,
},
{
@ -288,7 +294,7 @@ naughty.connect_signal("request::display", function(n)
},
--- Anti-aliasing container
shape = helpers.ui.rrect(0),
bg = beautiful.xcolorbase,
bg = theme.xcolorbase,
widget = wibox.container.background,
},
})
@ -326,7 +332,7 @@ naughty.connect_signal("request::display", function(n)
anim:start()
end)
local notification_height = widget.height + beautiful.notification_spacing
local notification_height = widget.height + theme.notification_spacing
local total_notifications_height = #naughty.active * notification_height
if total_notifications_height > n.screen.workarea.height then

View file

@ -1,10 +1,12 @@
local naughty = require("naughty")
local playerctl_daemon = require("signals.playerctl")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local theme = beautiful.get()
playerctl_daemon:connect_signal("metadata", function(_, title, artist, album_path, _, new, _)
if album_path == "" then -- Sets Image for Notification --
album_path = beautiful.music
album_path = theme.music
end
if new == true then

View file

@ -1,26 +1,16 @@
local bling = require("lib.bling")
local rubato = require("lib.rubato") -- Totally optional, only required if you are using animations.
local rubato = require("lib.rubato")
-- These are example rubato tables. You can use one for just y, just x, or both.
-- The duration and easing is up to you. Please check out the rubato docs to learn more.
local anim_y = rubato.timed({
pos = -1000,
rate = 60,
--easing = rubato.quadratic,
intro = 0.2,
duration = 0.4,
awestore_compat = true, -- This option must be set to true.
})
local anim_x = rubato.timed({
pos = 1720,
rate = 60,
easing = rubato.quadratic,
intro = 0.1,
duration = 0.3,
awestore_compat = true, -- This option must be set to true.
})
local term_scratch = bling.module.scratchpad({
command = "alacritty --class spad", -- How to spawn the scratchpad
rule = { instance = "spad" }, -- The rule that the scratchpad will be searched by

View file

@ -1,17 +1,18 @@
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful").get()
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local beautiful = require("beautiful")
local wibox = require("wibox")
local helpers = require("helpers")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
--- Volume OSD
--- ~~~~~~~~~~
local icon = wibox.widget({
{
id = "icon2",
image = beautiful.volume_on,
image = theme.volume_on,
resize = true,
widget = wibox.widget.imagebox,
},
@ -20,11 +21,12 @@ local icon = wibox.widget({
bottom = dpi(12),
widget = wibox.container.margin,
})
local icon3 = icon.icon2
local osd_header = wibox.widget({
text = "Volume",
font = beautiful.font_name .. "Bold 12",
font = helpers.ui.set_font("Bold 12"),
align = "left",
valign = "center",
widget = wibox.widget.textbox,
@ -32,7 +34,7 @@ local osd_header = wibox.widget({
local osd_value = wibox.widget({
text = "0%",
font = beautiful.font_name .. "Bold 12",
font = helpers.ui.set_font("Bold 12"),
align = "center",
valign = "center",
widget = wibox.widget.textbox,
@ -44,9 +46,9 @@ local slider_osd = wibox.widget({
id = "vol_osd_slider",
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(12),
bar_color = beautiful.xcolorS0,
bar_active_color = beautiful.xcolor2,
handle_color = beautiful.xcolor2,
bar_color = theme.xcolorS0,
bar_active_color = theme.xcolor2,
handle_color = theme.xcolor2,
handle_shape = gears.shape.circle,
handle_width = dpi(24),
handle_border_color = "#00000012",
@ -60,6 +62,7 @@ local slider_osd = wibox.widget({
})
local vol_osd_slider = slider_osd.vol_osd_slider
vol_osd_slider:buttons(gears.table.join(
awful.button({}, 4, nil, function()
if vol_osd_slider:get_value() > 100 then
@ -68,6 +71,7 @@ vol_osd_slider:buttons(gears.table.join(
end
vol_osd_slider:set_value(vol_osd_slider:get_value() + 5)
end),
awful.button({}, 5, nil, function()
if vol_osd_slider:get_value() < 0 then
vol_osd_slider:set_value(0)
@ -84,11 +88,13 @@ local update_volume = function() -- Sets the Volume Correct
vol_osd_slider.value = tonumber(stdout:match("%d+"))
end)
end
awesome.connect_signal("widget::update_vol", function()
update_volume()
end)
update_volume()
vol_osd_slider:connect_signal("property::value", function(_, new_value)
local volume_level = vol_osd_slider:get_value()
awful.spawn("pamixer --set-volume " .. new_value, false)
@ -99,6 +105,7 @@ vol_osd_slider:connect_signal("property::value", function(_, new_value)
-- Update the volume slider if values here change
awesome.emit_signal("widget::update_vol_pulse")
awesome.emit_signal("widget::update_vol_slider", volume_level)
if awful.screen.focused().show_vol_osd then
awesome.emit_signal("module::volume_osd:show", true)
end
@ -132,10 +139,10 @@ screen.connect_signal("request::desktop_decoration", function(s)
width = volume_osd_width,
maximum_height = volume_osd_height,
maximum_width = volume_osd_width,
bg = beautiful.transparent,
bg = theme.transparent,
offset = dpi(5),
border_width = dpi(3),
border_color = beautiful.xcolorS0,
border_color = theme.xcolorS0,
ontop = true,
visible = false,
preferred_anchors = "middle",
@ -172,7 +179,7 @@ screen.connect_signal("request::desktop_decoration", function(s)
right = dpi(24),
widget = wibox.container.margin,
},
bg = beautiful.xcolorbase,
bg = theme.xcolorbase,
widget = wibox.container.background,
},
})
@ -212,6 +219,7 @@ end
local function get_vol()
local script = "pamixer --get-volume"
local script2 = "pamixer --get-mute"
awful.spawn.easy_async_with_shell(script, function()
awful.spawn.easy_async_with_shell(script2, function(is_mute)
local muted
@ -223,13 +231,13 @@ local function get_vol()
end
if muted then
vol_osd_slider.bar_active_color = beautiful.xcolor10
vol_osd_slider.handle_color = beautiful.xcolor10
icon3.image = beautiful.volume_off
vol_osd_slider.bar_active_color = theme.xcolor10
vol_osd_slider.handle_color = theme.xcolor10
icon3.image = theme.volume_off
else
vol_osd_slider.bar_active_color = beautiful.xcolor2
vol_osd_slider.handle_color = beautiful.xcolor2
icon3.image = beautiful.volume_on
vol_osd_slider.bar_active_color = theme.xcolor2
vol_osd_slider.handle_color = theme.xcolor2
icon3.image = theme.volume_on
end
end)
end)
@ -237,7 +245,9 @@ end
awesome.connect_signal("module::volume_osd:show", function(bool)
placement_placer()
awful.screen.focused().volume_osd_overlay.visible = bool
if bool then
awesome.emit_signal("module::volume_osd:rerun")
awesome.emit_signal("module::brightness_osd:show", false)
@ -247,29 +257,25 @@ awesome.connect_signal("module::volume_osd:show", function(bool)
end
end
end)
local volume = {}
volume.increase = function()
local script = [[
pamixer -i 5
]]
local script = "pamixer -i 5"
awful.spawn(script, false)
get_vol()
end
volume.decrease = function()
local script = [[
pamixer -d 5
]]
local script = "pamixer -d 5"
awful.spawn(script, false)
get_vol()
end
volume.mute = function()
local script = [[
pamixer -t
]]
local script = "pamixer -t"
awful.spawn(script, false)
get_vol()

View file

@ -1,6 +1,9 @@
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
--- Rounded Corners Client Side ---
-- Use Picom If you Can --
@ -25,6 +28,7 @@ client.connect_signal("request::titlebars", function(c)
awful.button({}, 1, function()
c:activate({ context = "titlebar", action = "mouse_move" })
end),
awful.button({}, 3, function()
c:activate({ context = "titlebar", action = "mouse_resize" })
end)
@ -34,19 +38,22 @@ client.connect_signal("request::titlebars", function(c)
size = 30,
expand = "none",
})
local left = {
buttons = buttons,
layout = wibox.layout.fixed.horizontal(),
}
local middle = {
buttons = buttons,
layout = wibox.layout.fixed.horizontal(),
}
local right = {
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.minimizebutton(c),
awful.titlebar.widget.closebutton(c),
spacing = 11.5,
spacing = dpi(11.5),
layout = wibox.layout.fixed.horizontal(),
}
@ -57,10 +64,10 @@ client.connect_signal("request::titlebars", function(c)
right,
layout = wibox.layout.align.horizontal(),
},
left = 13.5,
right = 13.5,
top = 7.4,
bottom = 7.4,
left = dpi(13.5),
right = dpi(13.5),
top = dpi(7.4),
bottom = dpi(7.4),
layout = wibox.container.margin,
})
end)

View file

@ -1,49 +1,16 @@
-- Standard awesome library --
local awful = require("awful")
local wibox = require("wibox")
local widgets = require("ui.top-panel.widgets")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local dpi = require("beautiful.xresources").apply_dpi
local clock = widgets.clock
local date = widgets.date
local cpu = widgets.cpu
local disk = widgets.disk
local keyboard = widgets.keyboard
local mem = widgets.mem
local menu = widgets.menu
local systray = widgets.systray
local audio = widgets.audio
local seperator = widgets.seperator
local layoutbox = widgets.layoutbox
local function create_icon(i, c) --Icon Creation
local widget = {
{
font = beautiful.font_name .. "12.5",
text = " " .. i,
widget = wibox.widget.textbox,
},
fg = c,
widget = wibox.container.background,
}
return widget
end
-- Create Icons with Color --
local calendar_icon = create_icon("", beautiful.xcolor5)
local clock_icon = create_icon("", beautiful.xcolor12)
local keyboard_icon = create_icon("", beautiful.xcolor4)
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
screen.connect_signal("request::desktop_decoration", function(s)
-- Create Clock with Colerfull Widget --
local clockdate = wibox.widget({
layout = wibox.layout.fixed.horizontal,
calendar_icon,
date,
clock_icon,
clock, -- Middle widget
widgets.date,
widgets.clock,
})
local tasklist = wibox.widget({
@ -51,7 +18,7 @@ screen.connect_signal("request::desktop_decoration", function(s)
layout = wibox.layout.fixed.horizontal,
s.tasklist, -- needs to be here (under the screen.connect_signal) bc of the s
},
forced_width = 300,
forced_width = dpi(300),
layout = wibox.layout.fixed.horizontal,
})
@ -66,16 +33,16 @@ screen.connect_signal("request::desktop_decoration", function(s)
{
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
menu,
seperator,
widgets.menu,
widgets.seperator,
s.taglist,
seperator,
widgets.seperator,
tasklist,
},
left = 5, --Padding
left = dpi(5),
right = 0,
top = 2,
bottom = 2,
top = dpi(2),
bottom = dpi(2),
layout = wibox.container.margin,
},
{
@ -85,35 +52,34 @@ screen.connect_signal("request::desktop_decoration", function(s)
},
left = 0,
right = 0,
top = 1,
bottom = 1,
top = dpi(1),
bottom = dpi(1),
layout = wibox.container.margin,
},
{ -- Right widgets
{
layout = wibox.layout.fixed.horizontal,
systray,
seperator,
audio,
mem,
cpu,
disk,
keyboard_icon,
keyboard,
layoutbox,
widgets.systray,
widgets.seperator,
widgets.audio,
widgets.mem,
widgets.cpu,
widgets.disk,
widgets.layoutbox,
},
left = 0,
right = 2,
top = 1,
bottom = 1,
right = dpi(2),
top = dpi(1),
bottom = dpi(1),
layout = wibox.container.margin,
},
},
})
s.border2 = awful.wibar({
position = "top",
screen = s,
bg = beautiful.xcolorS0,
bg = theme.xcolorS0,
height = dpi(2),
})
end)

View file

@ -1,19 +1,34 @@
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
require("awful.hotkeys_popup.keys")
local helpers = require("helpers")
local config = require("config")
local beautiful = require("beautiful")
-- Clock
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local clock_icon = helpers.ui.create_icon(config.icons.clock, theme.xcolor12)
local clock = wibox.widget.textbox()
clock.font = beautiful.font_name .. "11"
clock.font = helpers.ui.set_font("11")
gears.timer({
timeout = 60,
autostart = true,
call_now = true,
callback = function()
clock.markup = os.date(" %I:%M %p")
clock.markup = os.date(config.widget.clock.format)
end,
})
return clock
return wibox.widget({
{
clock_icon,
clock,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = dpi(1),
right = dpi(1),
layout = wibox.container.margin,
})

View file

@ -1,16 +1,17 @@
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local helpers = require("helpers.ui")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
-- Icon
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.xcolor9 .. "'></span>"
local icon = helpers.create_icon(config.icons.cpu, theme.xcolor9)
-- Uptime
local cpu = wibox.widget.textbox()
cpu.font = beautiful.font_name .. "10"
cpu.font = helpers.set_font("10")
cpu.align = "center"
local function get_val()
@ -35,11 +36,11 @@ local full = wibox.widget({
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
left = dpi(1),
right = 0,
layout = wibox.container.margin,
},
forced_width = 73, -- Makes it fixed and not Moves Whole Bar
forced_width = dpi(73), -- Makes it fixed and not Moves Whole Bar
layout = wibox.layout.fixed.horizontal,
})

View file

@ -1,19 +1,34 @@
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
require("awful.hotkeys_popup.keys")
local helpers = require("helpers")
local beautiful = require("beautiful")
local config = require("config")
-- Clock
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local icon = helpers.ui.create_icon(config.icons.cal, theme.xcolor5)
local date = wibox.widget.textbox()
date.font = beautiful.font_name .. "11"
date.font = helpers.ui.set_font("11")
gears.timer({
timeout = 60,
autostart = true,
call_now = true,
callback = function()
date.markup = os.date(" %a %b %d")
date.markup = os.date(config.widget.date.format)
end,
})
return date
return wibox.widget({
{
icon,
date,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = dpi(1),
right = dpi(1),
layout = wibox.container.margin,
})

View file

@ -1,21 +1,24 @@
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local helpers = require("helpers.ui")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
-- Icon
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.xcolor7 .. "'></span>"
local icon = helpers.create_icon(config.icons.disk, theme.xcolor7)
-- Uptime
local disk = wibox.widget.textbox()
disk.font = beautiful.font_name .. "10"
disk.font = helpers.set_font("10")
disk.align = "center"
local function get_val()
awesome.connect_signal("signal::disk", function(disk_perc)
disk.markup = tonumber(disk_perc) .. "%"
if disk_perc then
disk.markup = tonumber(disk_perc) .. "%"
end
end)
end
@ -28,8 +31,8 @@ local full = wibox.widget({
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
right = 8,
left = dpi(1),
right = dpi(8),
layout = wibox.container.margin,
})

View file

@ -3,15 +3,13 @@ return {
cpu = require(... .. ".cpu"),
date = require(... .. ".date"),
disk = require(... .. ".disk"),
keyboard = require(... .. ".keyboard"),
layoutbox = require(... .. ".layoutbox"),
mem = require(... .. ".mem"),
menu = require(... .. ".menu"),
systray = require(... .. ".systray"),
promptbox = require(... .. ".promptbox"),
audio = require(... .. ".pulseaudio"),
seperator = require(... .. ".seperator"),
systray = require(... .. ".systray"),
taglist = require(... .. ".taglist"),
tasklist = require(... .. ".tasklist"),
power = require(... .. ".power"),
}

View file

@ -1,7 +0,0 @@
local awful = require("awful")
-- Keyboard map indicator and switcher
local keyboardlayout = awful.widget.keyboardlayout()
return keyboardlayout

View file

@ -1,7 +1,7 @@
local awful = require("awful")
local beautiful = require("beautiful").get()
local theme = require("beautiful").get()
local menu = require("main.menu")
local launcher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = menu })
local launcher = awful.widget.launcher({ image = theme.awesome_icon, menu = menu })
return launcher

View file

@ -5,16 +5,19 @@ local layoutbox = awful.widget.layoutbox({
awful.button({}, 1, function()
awful.layout.inc(1)
end),
awful.button({}, 3, function()
awful.layout.inc(-1)
end),
awful.button({}, 4, function()
awful.layout.inc(-1)
end),
awful.button({}, 5, function()
awful.layout.inc(1)
end),
},
})
return layoutbox
return layoutbox

View file

@ -1,16 +1,17 @@
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local helpers = require("helpers.ui")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
-- Icon
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.xcolor6 .. "'>󰍛</span>"
local icon = helpers.create_icon(config.icons.mem, theme.xcolor6)
-- Uptime
local mem = wibox.widget.textbox()
mem.font = beautiful.font_name .. "10"
mem.font = helpers.set_font("10")
mem.align = "center"
local function get_val()
@ -29,11 +30,11 @@ local full = wibox.widget({
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
left = dpi(1),
right = 0,
layout = wibox.container.margin,
},
forced_width = 73,
forced_width = dpi(73),
layout = wibox.layout.fixed.horizontal,
})

View file

@ -1,24 +1,26 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful").get()
local helpers = require("helpers")
local beautiful = require("beautiful")
local helpers = require("helpers.ui")
local config = require("config")
local dpi = beautiful.xresources.apply_dpi
-- Menu
local menu = wibox.widget({
{
font = beautiful.font_name .. "16",
markup = "󰜬",
font = helpers.set_font("16"),
markup = config.icons.menu,
widget = wibox.widget.textbox(),
},
bottom = 2,
bottom = dpi(2),
widget = wibox.container.margin,
})
helpers.ui.add_hover_cursor(menu, "hand2")
helpers.add_hover_cursor(menu, "hand2")
menu:buttons(gears.table.join(awful.button({}, 1, function()
menu:add_button(awful.button({}, 1, function()
awesome.emit_signal("sidebar::toggle")
end)))
end))
return menu

View file

@ -1,15 +1,18 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local config = require("config")
local helpers = require("helpers")
local theme = beautiful.get()
-- Menu
local menu = wibox.widget.textbox()
menu.font = beautiful.font_name .. "16"
menu.markup = "<span foreground='" .. beautiful.xcolor10 .. "'></span>"
menu.font = helpers.ui.set_font("16")
menu.markup = helpers.ui.colorize_text(config.icons.power, theme.xcolor10)
menu:buttons(gears.table.join(awful.button({}, 1, function()
menu:add_button(awful.button({}, 1, function()
awesome.emit_signal("module::exit_screen:show")
end)))
end))
return menu

View file

@ -1,5 +1,5 @@
local awful = require("awful")
local promptbox = awful.widget.prompt()
return promptbox
return promptbox

View file

@ -1,29 +1,28 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
local beautiful = require("beautiful")
local helpers = require("helpers")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
-- Icon
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
local icon = helpers.ui.create_icon(config.icons.vol.on, theme.xcolor2)
-- Uptime
local pulseaudio = wibox.widget.textbox()
pulseaudio.font = beautiful.font_name .. "10"
pulseaudio.font = helpers.ui.set_font("10")
pulseaudio.align = "center"
local function get_val()
awesome.connect_signal("signal::volume", function(vol, muted)
if muted then
pulseaudio.markup = "muted"
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖁</span>"
icon.markup = helpers.ui.colorize_text(config.icons.vol.off, theme.xcolor2)
else
pulseaudio.markup = tonumber(vol) .. "%"
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
icon.markup = helpers.ui.colorize_text(config.icons.vol.on, theme.xcolor2)
end
end)
end
@ -39,39 +38,43 @@ local full = wibox.widget({
layout = wibox.layout.fixed.horizontal,
},
left = dpi(5),
right = 8,
right = dpi(8),
layout = wibox.container.margin,
},
forced_width = 73,
forced_width = dpi(73),
layout = wibox.layout.fixed.horizontal,
})
full:buttons(gears.table.join(awful.button({}, 1, function()
full:add_button(awful.button({}, 1, function()
awesome.emit_signal("action::toggle")
end)))
end))
-- Update Function
local update_volume = function() -- Sets the Volume Correct
local update_volume = function()
awful.spawn.easy_async_with_shell("pamixer --get-volume", function(stdout)
pulseaudio.markup = tonumber(stdout:match("%d+")) .. "%"
if tonumber(stdout:match("%d+")) < 10 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕿</span>"
icon.markup = helpers.ui.colorize_text(config.icons.vol.low, theme.xcolor2)
elseif tonumber(stdout:match("%d+")) < 50 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰖀</span>"
icon.markup = helpers.ui.colorize_text(config.icons.vol.med, theme.xcolor2)
elseif tonumber(stdout:match("%d+")) < 100 then
icon.markup = "<span foreground='" .. beautiful.xcolor2 .. "'>󰕾</span>"
icon.markup = helpers.ui.colorize_text(config.icons.vol.high, theme.xcolor2)
else
end
end)
end
update_volume()
awesome.connect_signal("widget::update_vol", function()
update_volume()
end)
awesome.connect_signal("widget::update_vol_pulse", function()
update_volume()
end)
helpers.ui.add_hover_cursor(full, "hand2")
return full

View file

@ -1,9 +1,12 @@
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local wibox = require("wibox")
local helpers = require("helpers")
local theme = beautiful.get()
local seperator = wibox.widget.textbox()
seperator.font = beautiful.font_name .. "14"
seperator.markup = "<span foreground='" .. beautiful.xcolorT2 .. "'>|</span>"
seperator.font = helpers.ui.set_font("14")
seperator.markup = helpers.ui.colorize_text("|", theme.xcolorT2)
return seperator

View file

@ -1,35 +1,38 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local rubato = require("lib.rubato")
local dpi = require("beautiful.xresources").apply_dpi
local helpers = require("helpers")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
local arrow = wibox.widget.textbox()
arrow.font = beautiful.font_name .. "13"
arrow.markup = "»"
arrow.font = helpers.ui.set_font("13")
arrow.markup = config.icons.arr.r
local mysystray = wibox.widget.systray()
mysystray.visible = true
beautiful.systray_icon_spacing = dpi(4)
local systray = wibox.widget.systray()
systray.visible = true
theme.systray_icon_spacing = dpi(4)
local widget = wibox.widget({
local sys = wibox.widget({
widget = wibox.container.constraint,
strategy = "max",
width = dpi(0),
visible = true,
width = 0,
{
widget = wibox.container.margin,
margins = dpi(2),
mysystray,
systray,
},
})
widget.visible = true
local slide = rubato.timed({
duration = 0.9,
awestore_compat = true,
subscribed = function(pos)
widget.width = pos
sys.width = pos
end,
})
@ -37,29 +40,25 @@ local value = true
arrow.toggle = function()
if value == false then
arrow.markup = "»"
arrow.markup = config.icons.arr.r
value = true
slide:set(2)
else
arrow.markup = "«"
arrow.markup = config.icons.arr.l
slide:set(500)
value = false
end
end
awesome.connect_signal("arrow::toggle", function()
arrow:add_button(awful.button({}, 1, function()
arrow.toggle()
end)
end))
arrow:buttons(gears.table.join(awful.button({}, 1, function()
awesome.emit_signal("arrow::toggle")
end)))
local sys = wibox.widget({
local full = wibox.widget({
layout = wibox.layout.fixed.horizontal,
arrow,
widget,
sys,
spacing = dpi(2),
})
return sys
return full

View file

@ -1,14 +1,17 @@
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful").get()
local beautiful = require("beautiful")
local bling = require("lib.bling")
local keys = require("config").keys
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
awful.screen.connect_for_each_screen(function(s)
s.taglist = awful.widget.taglist({
screen = s,
filter = awful.widget.taglist.filter.all,
widget_template = {
{
{
@ -18,15 +21,17 @@ awful.screen.connect_for_each_screen(function(s)
},
layout = wibox.layout.fixed.horizontal,
},
left = 4,
right = 4,
left = dpi(4),
right = dpi(4),
widget = wibox.container.margin,
},
id = "background_role",
widget = wibox.container.background,
-- Add support for hover colors and an index label
create_callback = function(self, c3, index, _) --luacheck: no unused args
create_callback = function(self, c3, index, _)
self:get_children_by_id("text_role")[1].markup = "<b> " .. index .. " </b>"
self:connect_signal("mouse::enter", function()
-- BLING: Only show widget when there are clients in the tag
if #c3:clients() > 0 then
@ -36,6 +41,7 @@ awful.screen.connect_for_each_screen(function(s)
awesome.emit_signal("bling::tag_preview::visibility", s, true)
end
end)
self:connect_signal("mouse::leave", function()
-- BLING: Turn the widget off
awesome.emit_signal("bling::tag_preview::visibility", s, false)
@ -45,28 +51,35 @@ awful.screen.connect_for_each_screen(function(s)
end
end)
end,
update_callback = function(self, _, index, _)
self:get_children_by_id("text_role")[1].markup = "<b> " .. index .. " </b>"
end,
},
buttons = {
awful.button({}, 1, function(t)
t:view_only()
end),
awful.button({ keys.mod }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({}, 3, awful.tag.viewtoggle),
awful.button({ keys.mod }, 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),
@ -80,16 +93,18 @@ awful.screen.connect_for_each_screen(function(s)
scale = 0.2, -- 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.top_left(c, {
margins = {
top = 31,
top = dpi(31),
left = 0,
},
})
end,
background_widget = wibox.widget({ -- Set a background image (like a wallpaper) for the widget
image = beautiful.wallpaper,
image = theme.wallpaper,
horizontal_fit_policy = "fit",
vertical_fit_policy = "fit",
widget = wibox.widget.imagebox,

1
.gitignore vendored
View file

@ -70,3 +70,4 @@ data/
.config/pulse/cookie
.gnupg/
.config/nvim/lazy-lock.json
.config/browsh/