New Setup 📦
This commit is contained in:
parent
d16174b447
commit
415dbd08a1
10194 changed files with 1368647 additions and 4 deletions
67
home/.config/awesome/libs/helpers/init.lua
Normal file
67
home/.config/awesome/libs/helpers/init.lua
Normal file
|
@ -0,0 +1,67 @@
|
|||
-- ## Helpers ##
|
||||
-- ~~~~~~~~~~~~~
|
||||
|
||||
-- Requirements :
|
||||
-- ~~~~~~~~~~~~~~
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local naughty = require("naughty")
|
||||
local beautiful = require("beautiful")
|
||||
local xresources = require("beautiful.xresources")
|
||||
local dpi = xresources.apply_dpi
|
||||
|
||||
|
||||
local helpers = {}
|
||||
|
||||
-- # Better focused screen :
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
helpers.screen = awful.screen.focused({ client = true, mouse = false })
|
||||
|
||||
-- # Markup :
|
||||
-- ~~~~~~~~~~
|
||||
function helpers.colorize_text(txt, fg)
|
||||
if fg == "" then
|
||||
fg = "#ffffff"
|
||||
end
|
||||
return "<span foreground='" .. fg .. "'>" .. txt .. "</span>"
|
||||
end
|
||||
|
||||
-- # Shapes :
|
||||
-- ~~~~~~~~~~
|
||||
-- Create rounded rectangle shape (in one line)
|
||||
helpers.rrect = function(radius)
|
||||
return function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, radius)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create pi
|
||||
helpers.pie = function(width, height, start_angle, end_angle, radius)
|
||||
return function(cr)
|
||||
gears.shape.pie(cr, width, height, start_angle, end_angle, radius)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create parallelogram
|
||||
helpers.prgram = function(height, base)
|
||||
return function(cr, width)
|
||||
gears.shape.parallelogram(cr, width, height, base)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create partially rounded rect
|
||||
helpers.prrect = function(radius, tl, tr, br, bl)
|
||||
return function(cr, width, height)
|
||||
gears.shape.partially_rounded_rect(cr, width, height, tl, tr, br, bl,radius)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create rounded bar
|
||||
helpers.rbar = function(width, height)
|
||||
return function(cr)
|
||||
gears.shape.rounded_bar(cr, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
return helpers
|
79
home/.config/awesome/libs/helpers/widgets/create_button.lua
Normal file
79
home/.config/awesome/libs/helpers/widgets/create_button.lua
Normal file
|
@ -0,0 +1,79 @@
|
|||
-- ## Creat Button ##
|
||||
-- ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
-- Requirements :
|
||||
-- ~~~~~~~~~~~~~~
|
||||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
|
||||
-- # Libs :
|
||||
-- ~~~~~~~~
|
||||
local rubato = require("libs.rubato")
|
||||
|
||||
return function (widget, normal_bg, press_color, margins, border_width, border_color, shape_spe)
|
||||
|
||||
|
||||
-- containers
|
||||
local circle_animate = wibox.widget{
|
||||
widget = wibox.container.background,
|
||||
shape = shape_spe or gears.shape.rounded_bar,
|
||||
bg = press_color or colors.main_shceme,
|
||||
}
|
||||
|
||||
local mainbox = wibox.widget {
|
||||
{
|
||||
circle_animate,
|
||||
{
|
||||
widget,
|
||||
margins = margins or dpi(15),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.stack
|
||||
},
|
||||
bg = (normal_bg) or colors.container,
|
||||
shape = shape_spe or gears.shape.rounded_bar,
|
||||
border_width = border_width or dpi(0),
|
||||
border_color = border_color or press_color or "#00000000",
|
||||
widget = wibox.container.background,
|
||||
}
|
||||
|
||||
local animation_button_opacity = rubato.timed{
|
||||
pos = 0,
|
||||
rate = 60,
|
||||
intro = 0.06,
|
||||
duration = 0.2,
|
||||
awestore_compat = true,
|
||||
subscribed = function(pos)
|
||||
circle_animate.opacity = pos
|
||||
end
|
||||
}
|
||||
|
||||
mainbox:connect_signal("mouse::enter", function()
|
||||
animation_button_opacity:set(0.4)
|
||||
end)
|
||||
|
||||
mainbox:connect_signal("mouse::leave", function()
|
||||
animation_button_opacity:set(0.0)
|
||||
end)
|
||||
|
||||
-- add buttons and commands
|
||||
mainbox:connect_signal("button::press", function()
|
||||
animation_button_opacity:set(1)
|
||||
end)
|
||||
|
||||
mainbox:connect_signal("button::release", function()
|
||||
gears.timer {
|
||||
timeout = 0.1,
|
||||
autostart = true,
|
||||
single_shot = true,
|
||||
callback = function()
|
||||
animation_button_opacity:set(0.4)
|
||||
end
|
||||
}
|
||||
end)
|
||||
return mainbox
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue