diff options
Diffstat (limited to '.config/awesome/ui/fresnel/init.lua')
-rw-r--r-- | .config/awesome/ui/fresnel/init.lua | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/.config/awesome/ui/fresnel/init.lua b/.config/awesome/ui/fresnel/init.lua index cf1357a..242603f 100644 --- a/.config/awesome/ui/fresnel/init.lua +++ b/.config/awesome/ui/fresnel/init.lua @@ -1,19 +1,16 @@ local awful = require "awful" local gtable = require "gears.table" -local gdebug = require "gears.debug" -local gfs = require "gears.filesystem" -local h = require "misc.helpers" +local qui = require "quarrel.ui" +local qtable = require "quarrel.table" +local qnative = require "quarrel.native" local cfg = require "misc.cfg" -local vars = require "misc.vars" +local qvars = require "quarrel.vars" local wibox = require "wibox" local beautiful = require "beautiful" local rubato = require "lib.rubato" local al_prompt = require "lib.bling.widget.app_launcher.prompt" local btn = awful.button.names -package.cpath = package.cpath .. ";" .. gfs.get_configuration_dir() .. "ui/fresnel/lenses/target/debug/lib?.so" - -local lenses = require "lenses" local max_entries = 10 local fresnel = {} @@ -27,7 +24,7 @@ fresnel._selected_index = 1 function fresnel:_exec_entry(entry_index) local exec = self._entries_exec[entry_index] - if type(exec) ~= "userdata" then + if type(exec) ~= "userdata" and type(exec) ~= "nil" then awful.spawn((exec[2] and cfg.terminal .. " -e " or "") .. exec[1]) end end @@ -49,7 +46,7 @@ function fresnel:_update(query, scrolled) self._entries_exec = {} layout:reset() - for _, provider in h.opairs(lenses) do + for _, provider in qtable.opairs(qnative.lenses) do local entries = provider(query) table.sort(entries, function(a, b) @@ -70,18 +67,18 @@ function fresnel:_update(query, scrolled) local entry_widget = wibox.widget { widget = wibox.container.background, - shape = vars.shape, + shape = qvars.shape, { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { widget = wibox.container.constraint, strategy = "max", - height = vars.char_height, + height = qvars.char_height, { { widget = wibox.container.background, - fg = vars.colors.dim.fg, + fg = qvars.colors.dim.fg, { widget = wibox.widget.textbox, text = entry.provider .. " | " @@ -91,7 +88,7 @@ function fresnel:_update(query, scrolled) widget = wibox.widget.textbox, text = entry.message }, - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.horizontal } } @@ -110,17 +107,17 @@ function fresnel:_update(query, scrolled) if self._selected_index + self._entries_offset == i then entry_widget._selected = true - entry_widget.bg = vars.colors.black + entry_widget.bg = qvars.colors.black end entry_widget:connect_signal("mouse::enter", function() if entry_widget._selected == true then return end - entry_widget.bg = vars.colors.black + entry_widget.bg = qvars.colors.black end) entry_widget:connect_signal("mouse::leave", function() if entry_widget._selected == true then return end - entry_widget.bg = vars.colors.bg + entry_widget.bg = qvars.colors.bg end) layout:add(entry_widget) @@ -138,7 +135,7 @@ fresnel._prompt = al_prompt { prompt = "", reset_on_stop = true, ul_cursor = "low", - bg_cursor = vars.colors.black, + bg_cursor = qvars.colors.black, changed_callback = function(text) if fresnel._text == text then return end if fresnel._toggled == false then return end @@ -177,7 +174,7 @@ fresnel._prompt = al_prompt { end } -fresnel._widget = h.popup { +fresnel._widget = qui.popup { visible = false, ontop = true, placement = function(d) @@ -192,12 +189,12 @@ fresnel._widget = h.popup { widget = { { widget = wibox.container.background, - bg = vars.colors.black, - fg = vars.colors.dim.fg, - shape = vars.shape, + bg = qvars.colors.black, + fg = qvars.colors.dim.fg, + shape = qvars.shape, { widget = wibox.container.margin, - margins = vars.padding, + margins = qvars.padding, { { widget = wibox.widget.textbox, @@ -206,16 +203,16 @@ fresnel._widget = h.popup { { widget = wibox.container.margin, margins = { - left = vars.padding, - right = vars.padding + left = qvars.padding, + right = qvars.padding }, { widget = wibox.container.constraint, strategy = "max", - height = vars.char_height, + height = qvars.char_height, { widget = wibox.container.background, - fg = vars.colors.fg, + fg = qvars.colors.fg, fresnel._prompt.textbox } } @@ -232,10 +229,10 @@ fresnel._widget = h.popup { { widget = wibox.container.margin, margins = { - top = vars.padding + top = qvars.padding }, { - spacing = vars.padding, + spacing = qvars.padding, layout = wibox.layout.fixed.vertical, id = "entry_layout" } @@ -243,7 +240,7 @@ fresnel._widget = h.popup { layout = wibox.layout.align.vertical } } -fresnel._widget.maximum_height = vars.big_padding * 2 + (vars.padding * 2 + vars.char_height) * (1 + 10) + vars.padding + vars.padding * 9 +fresnel._widget.maximum_height = qvars.big_padding * 2 + (qvars.padding * 2 + qvars.char_height) * (1 + 10) + qvars.padding + qvars.padding * 9 function fresnel:show() self._toggled = true @@ -259,8 +256,8 @@ function fresnel:hide() end fresnel._timed = rubato.timed { - duration = vars.anim_duration, - intro = vars.anim_intro, + duration = qvars.anim_duration, + intro = qvars.anim_intro, pos = 0, subscribed = function(pos) fresnel._widget.opacity = pos |