aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/quarrel/vars.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/quarrel/vars.lua')
-rw-r--r--.config/awesome/quarrel/vars.lua254
1 files changed, 172 insertions, 82 deletions
diff --git a/.config/awesome/quarrel/vars.lua b/.config/awesome/quarrel/vars.lua
index 1983343..5c3b178 100644
--- a/.config/awesome/quarrel/vars.lua
+++ b/.config/awesome/quarrel/vars.lua
@@ -1,37 +1,38 @@
local awful = require "awful"
local btns = awful.button.names
-local gears = require "gears"
-local xresources = require "beautiful.xresources"
-local x_col = xresources.get_current_theme()
-local dpi = xresources.apply_dpi
+local gshape = require "gears.shape"
local wibox = require "wibox"
+-- local qconts = require "quarrel.consts"
+local qbezier = require "quarrel.animation.bezier"
----@class QuarrelVars
local qvars = {}
-qvars.anim_duration = 0.20
-qvars.anim_intro = qvars.anim_duration / 4
-
-qvars.notif_timeout = 3
+-- ---@param protected (fun(): table) | table
+-- function qconsts.protect(protected)
+-- ---@type table
+-- local tbl
+-- if type(protected) == "table" then
+-- tbl = protected
+-- elseif type(protected) == "function" then
+-- tbl = protected()
+-- else
+-- error("expected a table or a function that returns a table, got " .. type(protected), 2)
+-- end
+-- return setmetatable({}, {
+-- __index = tbl,
+-- __newindex = function(t, k, v)
+-- error("attempted to change constant " .. tostring(k) .. " to " .. tostring(v), 2)
+-- end
+-- })
+-- end
+
+-- qui.BORDER_WIDTH = 1
+-- qui.BORDER_RADIUS = 4
+
+-- qui.PADDING = 4
+-- qui.BIG_PADDING = 8
---- Clip Cairo context
----@param cr cairo_surface Cairo surface
----@param w integer Widget width
----@param h integer Widget height
----@return nil
-function qvars.shape(cr, w, h)
- gears.shape.rounded_rect(cr, w, h, dpi(4))
-end
-
-qvars.border_width = dpi(1.5)
-
-qvars.padding = dpi(4)
-qvars.big_padding = dpi(8)
-
--- qvars.text_font = "Fira Code Nerd Font Mono Medium"
--- qvars.text_font = "Iosevka Comfy SemiBold"
qvars.text_font = "Iosevka Comfy Regular"
--- qvars.font_size = 8
qvars.font_size = 9
qvars.font = qvars.text_font .. " " .. qvars.font_size
@@ -42,63 +43,152 @@ local char_width, char_height = wibox
})
:get_preferred_size_at_dpi(awful.screen.focused().dpi)
-qvars.char_height = char_height
-qvars.char_width = char_width
-
-qvars.bar_size = dpi(24) + qvars.big_padding * 2
-qvars.element_size = dpi(12)
-qvars.expanded_bar_size = qvars.big_padding + (qvars.big_padding * 2 + qvars.element_size * 4) * 3 + qvars.padding * 2
-
-qvars.colors = {
- fg = x_col.foreground,
- bg = x_col.background,
-
- black = x_col.color0,
- red = x_col.color1,
- green = x_col.color2,
- yellow = x_col.color3,
- blue = x_col.color4,
- pink = x_col.color5,
- cyan = x_col.color6,
- white = x_col.color7,
-
- bright = {
- black = x_col.color8,
- red = x_col.color9,
- green = x_col.color10,
- yellow = x_col.color11,
- blue = x_col.color12,
- pink = x_col.color13,
- cyan = x_col.color14,
- white = x_col.color15,
- },
-
- dim = {
- fg = "#77828c",
- bg = "#161b22",
- },
-
- transparent = "#00000000",
-}
+-- qui.CHAR_HEIGHT = char_height
+-- qui.CHAR_WIDTH = char_width
+
+--- Clip Cairo context
+---@param cr cairo_surface Cairo surface
+---@param w integer Widget width
+---@param h integer Widget height
+---@return nil
+-- function qui.shape(cr, w, h)
+-- -- gears.shape.rounded_rect(cr, w, h, dpi(4))
+-- gshape.rounded_rect(cr, w, h, qui.BORDER_RADIUS)
+-- end
+
+qvars.anim_duration = 0.30
+qvars.anim_intro = qvars.anim_duration / 4
+
+local easing_bezier = qbezier(0.2, 0, 0, 1)
+function qvars.easing(t, b, c, d)
+ local epsilon = 1000 / d
+ return c * easing_bezier:solve(t / d, epsilon) + b
+end
+
+qvars.notif_timeout = 3
+
+-- qvars.bar_size = dpi(24) + qui.BIG_PADDING * 2
+-- qvars.element_size = dpi(12)
+-- qvars.bar_size = 24 + qui.BIG_PADDING * 2
+-- qvars.element_size = 12
+-- qvars.expanded_bar_size = qui.BIG_PADDING + (qui.BIG_PADDING * 2 + qvars.element_size * 4) * 4 + qui.PADDING * 2
+
+-- local function palette(colors)
+-- return setmetatable(colors, {
+-- __call = function(self)
+-- return self[1]
+-- end,
+-- })
+-- end
+
+-- local colors = require "quarrel.color"
+-- qcolor.palette = colors.palette
+-- qcolor.palette = {
+-- fg = palette {
+-- low = "#a8afb7",
+-- "#c8ced7",
+-- high = "#e8eff8",
+-- },
+--
+-- bg = palette {
+-- lowest = "#070c11",
+-- low = "#0c1116",
+-- "#12161c",
+-- high = "#171c22",
+-- highest = "#1d2228",
+-- },
+--
+-- border = palette {
+-- "#323b46",
+-- variant = "#262f39",
+-- },
+--
+-- red = palette {
+-- "#ff928a",
+-- bright = "#ffb2a9",
+-- },
+-- orange = palette {
+-- "#ff9f6f",
+-- bright = "#ffc08e",
+-- },
+-- yellow = palette {
+-- "#ecb256",
+-- bright = "#ffd278",
+-- },
+-- green = palette {
+-- "#8bd294",
+-- bright = "#abf3b3",
+-- },
+-- cyan = palette {
+-- "#6dd3c2",
+-- bright = "#8ef4e2",
+-- },
+-- blue = palette {
+-- "#8bc3fc",
+-- bright = "#abe4ff",
+-- },
+-- purple = palette {
+-- "#c4b1f6",
+-- bright = "#e4d1ff",
+-- },
+-- pink = palette {
+-- "#e5acb4",
+-- bright = "#ffccd4",
+-- },
+--
+-- transparent = "#00000000",
+-- }
+
+-- qcolor.palette = {
+-- fg = x_col.foreground,
+-- bg = x_col.background,
+--
+-- black = x_col.color0,
+-- red = x_col.color1,
+-- green = x_col.color2,
+-- yellow = x_col.color3,
+-- blue = x_col.color4,
+-- pink = x_col.color5,
+-- cyan = x_col.color6,
+-- white = x_col.color7,
+--
+-- bright = {
+-- black = x_col.color8,
+-- red = x_col.color9,
+-- green = x_col.color10,
+-- yellow = x_col.color11,
+-- blue = x_col.color12,
+-- pink = x_col.color13,
+-- cyan = x_col.color14,
+-- white = x_col.color15,
+-- },
+--
+-- dim = {
+-- fg = "#77828c",
+-- bg = "#161b22",
+-- },
+--
+-- transparent = "#00000000",
+-- }
-- taken from https://github.com/bew/dotfiles/blob/ab9bb1935783f7a31ef777b1d7e26d53f35df864/gui/wezterm/cfg_utils.lua
-qvars.mods = setmetatable({ _SHORT_MAP = { C = "Control", S = "Shift", A = "Mod1", M = "Mod4" } }, {
- __index = function(self, key)
- local resolved_mods = {}
- for i = 1, #key do
- resolved_mods[i] = self._SHORT_MAP[key:sub(i, i)]
- end
- return resolved_mods
- end,
-})
-
----@enum buttons
-qvars.btns = {
- left = btns.LEFT,
- right = btns.RIGHT,
- middle = btns.MIDDLE,
- up = btns.SCROLL_UP,
- down = btns.SCROLL_DOWN,
-}
+-- qbind.mods = setmetatable({ _SHORT_MAP = { C = "Control", S = "Shift", A = "Mod1", M = "Mod4" } }, {
+-- __index = function(self, key)
+-- local resolved_mods = {}
+-- for i = 1, #key do
+-- resolved_mods[i] = self._SHORT_MAP[key:sub(i, i)]
+-- end
+-- return resolved_mods
+-- end,
+-- })
+--
+-- ---@enum buttons
+-- qbind.btns = {
+-- left = btns.LEFT,
+-- right = btns.RIGHT,
+-- middle = btns.MIDDLE,
+-- up = btns.SCROLL_UP,
+-- down = btns.SCROLL_DOWN,
+-- }
return qvars