From fab3b36dec2fe91c88ace6db85ab3b1040867fdd Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 22 Sep 2021 09:58:13 -0500 Subject: [PATCH] I got a little crazy here. a lot of laptop poop --- awesome/fennel.lua | 3011 +++++++++++++++++ awesome/init.fnl | 1 + awesome/keybindings.fnl | 8 +- awesome/rules.fnl | 6 +- eww/eww.scss | 0 eww/eww.yuck | 12 + .../navbar_tabs_oneliner_tabs_on_left.css | 19 +- kanshi/config | 2 +- kmonad/config.kbd | 9 +- kmonad/config.org | 10 +- libinput-gestures.conf | 8 +- mako/config | 2 +- nyxt/glyphs.lisp | 24 + nyxt/init.lisp | 3 +- picom.conf | 5 +- qutebrowser/autoconfig.yml | 7 + qutebrowser/config.py | 2 +- qutebrowser/qsettings/QtProject.conf | 4 +- qutebrowser/quickmarks | 1 + river/init | 51 +- rofi/config.rasi | 41 +- rofi/launchers-git/blurry.rasi | 3 +- rofi/launchers-git/desktop-rbw.rasi | 8 + rofi/launchers-git/desktop.rasi | 11 +- rofi/launchers-git/laptop-rbw.rasi | 8 + rofi/launchers-git/laptop.rasi | 13 +- rofi/launchers-git/launcher.sh | 2 +- rofi/rofi.rasi | 192 ++ scripts/emacslof | 32 + scripts/fflof | 30 + scripts/filesearch | 9 +- scripts/plasma-startup.sh | 12 + scripts/qblof | 30 + scripts/rofi-rbw | 14 +- scripts/wintitle | 3 + scripts/wlrofi-rbw | 29 +- scripts/wofi-window | 20 +- scripts/ww | 120 + sway/autostart.sh | 3 + sway/config | 30 +- sway/rounded_and_shadows_custom.png | Bin 9791 -> 9890 bytes sway/rounded_and_shadows_custom.xcf | Bin 5165 -> 5731 bytes tridactyl/tridactylrc | 9 +- waybar/config | 28 +- waybar/style.css | 4 +- wayfire/wayfire.ini | 78 +- wofi/style.css | 1 - 47 files changed, 3726 insertions(+), 189 deletions(-) create mode 100644 awesome/fennel.lua create mode 100644 eww/eww.scss create mode 100644 eww/eww.yuck create mode 100644 nyxt/glyphs.lisp create mode 100644 rofi/launchers-git/desktop-rbw.rasi create mode 100644 rofi/launchers-git/laptop-rbw.rasi create mode 100644 rofi/rofi.rasi create mode 100755 scripts/emacslof create mode 100755 scripts/fflof create mode 100755 scripts/plasma-startup.sh create mode 100755 scripts/qblof create mode 100755 scripts/wintitle mode change 100644 => 100755 scripts/wofi-window create mode 100755 scripts/ww create mode 100644 sway/autostart.sh diff --git a/awesome/fennel.lua b/awesome/fennel.lua new file mode 100644 index 0000000..30c9a4c --- /dev/null +++ b/awesome/fennel.lua @@ -0,0 +1,3011 @@ +package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) + local utils = require("fennel.utils") + local parser = require("fennel.parser") + local compiler = require("fennel.compiler") + local specials = require("fennel.specials") + local function default_read_chunk(parser_state) + local function _0_() + if (0 < parser_state["stack-size"]) then + return ".." + else + return ">> " + end + end + io.write(_0_()) + io.flush() + local input = io.read() + return (input and (input .. "\n")) + end + local function default_on_values(xs) + io.write(table.concat(xs, "\9")) + return io.write("\n") + end + local function default_on_error(errtype, err, lua_source) + local function _1_() + local _0_0 = errtype + if (_0_0 == "Lua Compile") then + return ("Bad code generated - likely a bug with the compiler:\n" .. "--- Generated Lua Start ---\n" .. lua_source .. "--- Generated Lua End ---\n") + elseif (_0_0 == "Runtime") then + return (compiler.traceback(err, 4) .. "\n") + else + local _ = _0_0 + return ("%s error: %s\n"):format(errtype, tostring(err)) + end + end + return io.write(_1_()) + end + local save_source = table.concat({"local ___i___ = 1", "while true do", " local name, value = debug.getlocal(1, ___i___)", " if(name and name ~= \"___i___\") then", " ___replLocals___[name] = value", " ___i___ = ___i___ + 1", " else break end end"}, "\n") + local function splice_save_locals(env, lua_source) + env.___replLocals___ = (env.___replLocals___ or {}) + local spliced_source = {} + local bind = "local %s = ___replLocals___['%s']" + for line in lua_source:gmatch("([^\n]+)\n?") do + table.insert(spliced_source, line) + end + for name in pairs(env.___replLocals___) do + table.insert(spliced_source, 1, bind:format(name, name)) + end + if ((1 < #spliced_source) and (spliced_source[#spliced_source]):match("^ *return .*$")) then + table.insert(spliced_source, #spliced_source, save_source) + end + return table.concat(spliced_source, "\n") + end + local function completer(env, scope, text) + local matches = {} + local input_fragment = text:gsub(".*[%s)(]+", "") + local function add_partials(input, tbl, prefix) + for k in utils.allpairs(tbl) do + local k0 = nil + if ((tbl == env) or (tbl == env.___replLocals___)) then + k0 = scope.unmanglings[k] + else + k0 = k + end + if ((#matches < 2000) and (type(k0) == "string") and (input == k0:sub(0, #input))) then + table.insert(matches, (prefix .. k0)) + end + end + return nil + end + local function add_matches(input, tbl, prefix) + local prefix0 = nil + if prefix then + prefix0 = (prefix .. ".") + else + prefix0 = "" + end + if not input:find("%.") then + return add_partials(input, tbl, prefix0) + else + local head, tail = input:match("^([^.]+)%.(.*)") + local raw_head = nil + if ((tbl == env) or (tbl == env.___replLocals___)) then + raw_head = scope.manglings[head] + else + raw_head = head + end + if (type(tbl[raw_head]) == "table") then + return add_matches(tail, tbl[raw_head], (prefix0 .. head)) + end + end + end + add_matches(input_fragment, (scope.specials or {})) + add_matches(input_fragment, (scope.macros or {})) + add_matches(input_fragment, (env.___replLocals___ or {})) + add_matches(input_fragment, env) + add_matches(input_fragment, (env._ENV or env._G or {})) + return matches + end + local function repl(options) + local old_root_options = utils.root.options + local env = nil + if options.env then + env = utils["wrap-env"](options.env) + else + env = setmetatable({}, {__index = (_G._ENV or _G)}) + end + local save_locals_3f = ((options.saveLocals ~= false) and env.debug and env.debug.getlocal) + local opts = {} + local _ = nil + for k, v in pairs(options) do + opts[k] = v + end + _ = nil + local read_chunk = (opts.readChunk or default_read_chunk) + local on_values = (opts.onValues or default_on_values) + local on_error = (opts.onError or default_on_error) + local pp = (opts.pp or tostring) + local byte_stream, clear_stream = parser.granulate(read_chunk) + local chars = {} + local read, reset = nil, nil + local function _1_(parser_state) + local c = byte_stream(parser_state) + chars[(#chars + 1)] = c + return c + end + read, reset = parser.parser(_1_) + local scope = compiler["make-scope"]() + opts.useMetadata = (options.useMetadata ~= false) + if (opts.allowedGlobals == nil) then + opts.allowedGlobals = specials["current-global-names"](opts.env) + end + if opts.registerCompleter then + local function _3_(...) + return completer(env, scope, ...) + end + opts.registerCompleter(_3_) + end + local function loop() + for k in pairs(chars) do + chars[k] = nil + end + local ok, parse_ok_3f, x = pcall(read) + local src_string = string.char((_G.unpack or table.unpack)(chars)) + utils.root.options = opts + if not ok then + on_error("Parse", parse_ok_3f) + clear_stream() + reset() + return loop() + else + if parse_ok_3f then + do + local _4_0, _5_0 = pcall(compiler.compile, x, {["assert-compile"] = opts["assert-compile"], ["parse-error"] = opts["parse-error"], correlate = opts.correlate, moduleName = opts.moduleName, scope = scope, source = src_string, useMetadata = opts.useMetadata}) + if ((_4_0 == false) and (nil ~= _5_0)) then + local msg = _5_0 + clear_stream() + on_error("Compile", msg) + elseif ((_4_0 == true) and (nil ~= _5_0)) then + local source = _5_0 + local source0 = nil + if save_locals_3f then + source0 = splice_save_locals(env, source) + else + source0 = source + end + local lua_ok_3f, loader = pcall(specials["load-code"], source0, env) + if not lua_ok_3f then + clear_stream() + on_error("Lua Compile", loader, source0) + else + local _7_0, _8_0 = nil, nil + local function _9_() + return {loader()} + end + local function _10_(...) + return on_error("Runtime", ...) + end + _7_0, _8_0 = xpcall(_9_, _10_) + if ((_7_0 == true) and (nil ~= _8_0)) then + local ret = _8_0 + env._ = ret[1] + env.__ = ret + on_values(utils.map(ret, pp)) + end + end + end + end + utils.root.options = old_root_options + return loop() + end + end + end + return loop() + end + return repl +end +package.preload["fennel.specials"] = package.preload["fennel.specials"] or function(...) + local utils = require("fennel.utils") + local parser = require("fennel.parser") + local compiler = require("fennel.compiler") + local unpack = (_G.unpack or table.unpack) + local SPECIALS = compiler.scopes.global.specials + local function wrap_env(env) + local function _0_(_, key) + if (type(key) == "string") then + return env[compiler["global-unmangling"](key)] + else + return env[key] + end + end + local function _1_(_, key, value) + if (type(key) == "string") then + env[compiler["global-unmangling"](key)] = value + return nil + else + env[key] = value + return nil + end + end + local function _2_() + local function putenv(k, v) + local _3_ + if (type(k) == "string") then + _3_ = compiler["global-unmangling"](k) + else + _3_ = k + end + return _3_, v + end + return next, utils.kvmap(env, putenv), nil + end + return setmetatable({}, {__index = _0_, __newindex = _1_, __pairs = _2_}) + end + local function current_global_names(env) + return utils.kvmap((env or _G), compiler["global-unmangling"]) + end + local function load_code(code, environment, filename) + local environment0 = ((environment or _ENV) or _G) + if (_G.setfenv and _G.loadstring) then + local f = assert(_G.loadstring(code, filename)) + _G.setfenv(f, environment0) + return f + else + return assert(load(code, filename, "t", environment0)) + end + end + local function doc_2a(tgt, name) + if not tgt then + return (name .. " not found") + else + local docstring = (((compiler.metadata):get(tgt, "fnl/docstring") or "#")):gsub("\n$", ""):gsub("\n", "\n ") + if (type(tgt) == "function") then + local arglist = table.concat(((compiler.metadata):get(tgt, "fnl/arglist") or {"#"}), " ") + local _0_ + if (#arglist > 0) then + _0_ = " " + else + _0_ = "" + end + return string.format("(%s%s%s)\n %s", name, _0_, arglist, docstring) + else + return string.format("%s\n %s", name, docstring) + end + end + end + local function doc_special(name, arglist, docstring) + compiler.metadata[SPECIALS[name]] = {["fnl/arglist"] = arglist, ["fnl/docstring"] = docstring} + return nil + end + local function compile_do(ast, scope, parent, start) + local start0 = (start or 2) + local len = #ast + local sub_scope = compiler["make-scope"](scope) + for i = start0, len do + compiler.compile1(ast[i], sub_scope, parent, {nval = 0}) + end + return nil + end + SPECIALS["do"] = function(ast, scope, parent, opts, start, chunk, sub_scope, pre_syms) + local start0 = (start or 2) + local sub_scope0 = (sub_scope or compiler["make-scope"](scope)) + local chunk0 = (chunk or {}) + local len = #ast + local outer_target = opts.target + local outer_tail = opts.tail + local retexprs = {returned = true} + if (not outer_target and (opts.nval ~= 0) and not outer_tail) then + if opts.nval then + local syms = {} + for i = 1, opts.nval, 1 do + local s = ((pre_syms and pre_syms[i]) or compiler.gensym(scope)) + syms[i] = s + retexprs[i] = utils.expr(s, "sym") + end + outer_target = table.concat(syms, ", ") + compiler.emit(parent, ("local %s"):format(outer_target), ast) + compiler.emit(parent, "do", ast) + else + local fname = compiler.gensym(scope) + local fargs = ((scope.vararg and "...") or "") + compiler.emit(parent, ("local function %s(%s)"):format(fname, fargs), ast) + retexprs = utils.expr((fname .. "(" .. fargs .. ")"), "statement") + outer_tail = true + outer_target = nil + end + else + compiler.emit(parent, "do", ast) + end + if (len < start0) then + compiler.compile1(nil, sub_scope0, chunk0, {tail = outer_tail, target = outer_target}) + else + for i = start0, len do + local subopts = {nval = (((i ~= len) and 0) or opts.nval), tail = (((i == len) and outer_tail) or nil), target = (((i == len) and outer_target) or nil)} + utils["propagate-options"](opts, subopts) + local subexprs = compiler.compile1(ast[i], sub_scope0, chunk0, subopts) + if (i ~= len) then + compiler["keep-side-effects"](subexprs, parent, nil, ast[i]) + end + end + end + compiler.emit(parent, chunk0, ast) + compiler.emit(parent, "end", ast) + return retexprs + end + doc_special("do", {"..."}, "Evaluate multiple forms; return last value.") + SPECIALS.values = function(ast, scope, parent) + local len = #ast + local exprs = {} + for i = 2, len do + local subexprs = compiler.compile1(ast[i], scope, parent, {nval = ((i ~= len) and 1)}) + exprs[(#exprs + 1)] = subexprs[1] + if (i == len) then + for j = 2, #subexprs, 1 do + exprs[(#exprs + 1)] = subexprs[j] + end + end + end + return exprs + end + doc_special("values", {"..."}, "Return multiple values from a function. Must be in tail position.") + SPECIALS.fn = function(ast, scope, parent) + local index, fn_name, is_local_fn, docstring = 2, utils["is-sym"](ast[2]) + local f_scope = nil + do + local _0_0 = compiler["make-scope"](scope) + _0_0["vararg"] = false + f_scope = _0_0 + end + local f_chunk = {} + local multi = (fn_name and utils["is-multi-sym"](fn_name[1])) + compiler.assert((not multi or not multi["multi-sym-method-call"]), ("unexpected multi symbol " .. tostring(fn_name)), ast[index]) + if (fn_name and (fn_name[1] ~= "nil")) then + is_local_fn = not multi + if is_local_fn then + fn_name = compiler["declare-local"](fn_name, {}, scope, ast) + else + fn_name = compiler["symbol-to-expression"](fn_name, scope)[1] + end + index = (index + 1) + else + is_local_fn = true + fn_name = compiler.gensym(scope) + end + do + local arg_list = nil + local function _2_() + if (type(ast[index]) == "table") then + return ast[index] + else + return ast + end + end + arg_list = compiler.assert(utils["is-table"](ast[index]), "expected parameters", _2_()) + local function get_arg_name(i, name) + if utils["is-varg"](name) then + compiler.assert((i == #arg_list), "expected vararg as last parameter", ast[2]) + f_scope.vararg = true + return "..." + elseif (utils["is-sym"](name) and (utils.deref(name) ~= "nil") and not utils["is-multi-sym"](utils.deref(name))) then + return compiler["declare-local"](name, {}, f_scope, ast) + elseif utils["is-table"](name) then + local raw = utils.sym(compiler.gensym(scope)) + local declared = compiler["declare-local"](raw, {}, f_scope, ast) + compiler.destructure(name, raw, ast, f_scope, f_chunk, {declaration = true, nomulti = true}) + return declared + else + return compiler.assert(false, ("expected symbol for function parameter: %s"):format(tostring(name)), ast[2]) + end + end + local arg_name_list = utils.kvmap(arg_list, get_arg_name) + if ((type(ast[(index + 1)]) == "string") and ((index + 1) < #ast)) then + index = (index + 1) + docstring = ast[index] + end + for i = (index + 1), #ast, 1 do + compiler.compile1(ast[i], f_scope, f_chunk, {nval = (((i ~= #ast) and 0) or nil), tail = (i == #ast)}) + end + if is_local_fn then + compiler.emit(parent, ("local function %s(%s)"):format(fn_name, table.concat(arg_name_list, ", ")), ast) + else + compiler.emit(parent, ("%s = function(%s)"):format(fn_name, table.concat(arg_name_list, ", ")), ast) + end + compiler.emit(parent, f_chunk, ast) + compiler.emit(parent, "end", ast) + if utils.root.options.useMetadata then + local args = nil + local function _5_(v) + if utils["is-table"](v) then + return "\"#\"" + else + return ("\"%s\""):format(tostring(v)) + end + end + args = utils.map(arg_list, _5_) + local meta_fields = {"\"fnl/arglist\"", ("{" .. table.concat(args, ", ") .. "}")} + if docstring then + table.insert(meta_fields, "\"fnl/docstring\"") + table.insert(meta_fields, ("\"" .. docstring:gsub("%s+$", ""):gsub("\\", "\\\\"):gsub("\n", "\\n"):gsub("\"", "\\\"") .. "\"")) + end + local meta_str = ("require(\"%s\").metadata"):format((utils.root.options.moduleName or "fennel")) + compiler.emit(parent, ("pcall(function() %s:setall(%s, %s) end)"):format(meta_str, fn_name, table.concat(meta_fields, ", "))) + end + end + return utils.expr(fn_name, "sym") + end + doc_special("fn", {"name?", "args", "docstring?", "..."}, "Function syntax. May optionally include a name and docstring.\nIf a name is provided, the function will be bound in the current scope.\nWhen called with the wrong number of args, excess args will be discarded\nand lacking args will be nil, use lambda for arity-checked functions.") + SPECIALS.lua = function(ast, _, parent) + compiler.assert(((#ast == 2) or (#ast == 3)), "expected 1 or 2 arguments", ast) + if (ast[2] ~= nil) then + table.insert(parent, {ast = ast, leaf = tostring(ast[2])}) + end + if (#ast == 3) then + return tostring(ast[3]) + end + end + SPECIALS.doc = function(ast, scope, parent) + assert(utils.root.options.useMetadata, "can't look up doc with metadata disabled.") + compiler.assert((#ast == 2), "expected one argument", ast) + local target = utils.deref(ast[2]) + local special_or_macro = (scope.specials[target] or scope.macros[target]) + if special_or_macro then + return ("print([[%s]])"):format(doc_2a(special_or_macro, target)) + else + local value = tostring(compiler.compile1(ast[2], scope, parent, {nval = 1})[1]) + return ("print(require('%s').doc(%s, '%s'))"):format((utils.root.options.moduleName or "fennel"), value, tostring(ast[2])) + end + end + doc_special("doc", {"x"}, "Print the docstring and arglist for a function, macro, or special form.") + local function dot(ast, scope, parent) + compiler.assert((1 < #ast), "expected table argument", ast) + local len = #ast + local lhs = compiler.compile1(ast[2], scope, parent, {nval = 1}) + if (len == 2) then + return tostring(lhs[1]) + else + local indices = {} + for i = 3, len, 1 do + local index = ast[i] + if ((type(index) == "string") and utils["is-valid-lua-identifier"](index)) then + table.insert(indices, ("." .. index)) + else + index = compiler.compile1(index, scope, parent, {nval = 1})[1] + table.insert(indices, ("[" .. tostring(index) .. "]")) + end + end + if utils["is-table"](ast[2]) then + return ("(" .. tostring(lhs[1]) .. ")" .. table.concat(indices)) + else + return (tostring(lhs[1]) .. table.concat(indices)) + end + end + end + SPECIALS["."] = dot + doc_special(".", {"tbl", "key1", "..."}, "Look up key1 in tbl table. If more args are provided, do a nested lookup.") + SPECIALS.global = function(ast, scope, parent) + compiler.assert((#ast == 3), "expected name and value", ast) + compiler.destructure(ast[2], ast[3], ast, scope, parent, {forceglobal = true, nomulti = true}) + return nil + end + doc_special("global", {"name", "val"}, "Set name as a global with val.") + SPECIALS.set = function(ast, scope, parent) + compiler.assert((#ast == 3), "expected name and value", ast) + compiler.destructure(ast[2], ast[3], ast, scope, parent, {noundef = true}) + return nil + end + doc_special("set", {"name", "val"}, "Set a local variable to a new value. Only works on locals using var.") + local function set_forcibly_21_2a(ast, scope, parent) + compiler.assert((#ast == 3), "expected name and value", ast) + compiler.destructure(ast[2], ast[3], ast, scope, parent, {forceset = true}) + return nil + end + SPECIALS["set-forcibly!"] = set_forcibly_21_2a + local function local_2a(ast, scope, parent) + compiler.assert((#ast == 3), "expected name and value", ast) + compiler.destructure(ast[2], ast[3], ast, scope, parent, {declaration = true, nomulti = true}) + return nil + end + SPECIALS["local"] = local_2a + doc_special("local", {"name", "val"}, "Introduce new top-level immutable local.") + SPECIALS.var = function(ast, scope, parent) + compiler.assert((#ast == 3), "expected name and value", ast) + compiler.destructure(ast[2], ast[3], ast, scope, parent, {declaration = true, isvar = true, nomulti = true}) + return nil + end + doc_special("var", {"name", "val"}, "Introduce new mutable local.") + SPECIALS.let = function(ast, scope, parent, opts) + local bindings = ast[2] + local pre_syms = {} + compiler.assert((utils["is-list"](bindings) or utils["is-table"](bindings)), "expected binding table", ast) + compiler.assert(((#bindings % 2) == 0), "expected even number of name/value bindings", ast[2]) + compiler.assert((#ast >= 3), "expected body expression", ast[1]) + for _ = 1, (opts.nval or 0), 1 do + table.insert(pre_syms, compiler.gensym(scope)) + end + local sub_scope = compiler["make-scope"](scope) + local sub_chunk = {} + for i = 1, #bindings, 2 do + compiler.destructure(bindings[i], bindings[(i + 1)], ast, sub_scope, sub_chunk, {declaration = true, nomulti = true}) + end + return SPECIALS["do"](ast, scope, parent, opts, 3, sub_chunk, sub_scope, pre_syms) + end + doc_special("let", {"[name1 val1 ... nameN valN]", "..."}, "Introduces a new scope in which a given set of local bindings are used.") + SPECIALS.tset = function(ast, scope, parent) + compiler.assert((#ast > 3), "expected table, key, and value arguments", ast) + local root = compiler.compile1(ast[2], scope, parent, {nval = 1})[1] + local keys = {} + for i = 3, (#ast - 1), 1 do + local key = compiler.compile1(ast[i], scope, parent, {nval = 1})[1] + keys[(#keys + 1)] = tostring(key) + end + local value = compiler.compile1(ast[#ast], scope, parent, {nval = 1})[1] + local rootstr = tostring(root) + local fmtstr = nil + if rootstr:match("^{") then + fmtstr = "do end (%s)[%s] = %s" + else + fmtstr = "%s[%s] = %s" + end + return compiler.emit(parent, fmtstr:format(tostring(root), table.concat(keys, "]["), tostring(value)), ast) + end + doc_special("tset", {"tbl", "key1", "...", "keyN", "val"}, "Set the value of a table field. Can take additional keys to set\nnested values, but all parents must contain an existing table.") + local function if_2a(ast, scope, parent, opts) + local do_scope = compiler["make-scope"](scope) + local branches = {} + local has_else = ((#ast > 3) and ((#ast % 2) == 0)) + local else_branch = nil + local wrapper, inner_tail, inner_target, target_exprs = nil + if (opts.tail or opts.target or opts.nval) then + if (opts.nval and (opts.nval ~= 0) and not opts.target) then + local accum = {} + target_exprs = {} + for i = 1, opts.nval, 1 do + local s = compiler.gensym(scope) + accum[i] = s + target_exprs[i] = utils.expr(s, "sym") + end + wrapper, inner_tail, inner_target = "target", opts.tail, table.concat(accum, ", ") + else + wrapper, inner_tail, inner_target = "none", opts.tail, opts.target + end + else + wrapper, inner_tail, inner_target = "iife", true, nil + end + local body_opts = {nval = opts.nval, tail = inner_tail, target = inner_target} + local function compile_body(i) + local chunk = {} + local cscope = compiler["make-scope"](do_scope) + compiler["keep-side-effects"](compiler.compile1(ast[i], cscope, chunk, body_opts), chunk, nil, ast[i]) + return {chunk = chunk, scope = cscope} + end + for i = 2, (#ast - 1), 2 do + local condchunk = {} + local res = compiler.compile1(ast[i], do_scope, condchunk, {nval = 1}) + local cond = res[1] + local branch = compile_body((i + 1)) + branch.cond = cond + branch.condchunk = condchunk + branch.nested = ((i ~= 2) and (next(condchunk, nil) == nil)) + table.insert(branches, branch) + end + if has_else then + else_branch = compile_body(#ast) + end + local s = compiler.gensym(scope) + local buffer = {} + local last_buffer = buffer + for i = 1, #branches do + local branch = branches[i] + local fstr = nil + if not branch.nested then + fstr = "if %s then" + else + fstr = "elseif %s then" + end + local cond = tostring(branch.cond) + local cond_line = nil + if ((cond == "true") and branch.nested and (i == #branches)) then + cond_line = "else" + else + cond_line = fstr:format(cond) + end + if branch.nested then + compiler.emit(last_buffer, branch.condchunk, ast) + else + for _, v in ipairs(branch.condchunk) do + compiler.emit(last_buffer, v, ast) + end + end + compiler.emit(last_buffer, cond_line, ast) + compiler.emit(last_buffer, branch.chunk, ast) + if (i == #branches) then + if has_else then + compiler.emit(last_buffer, "else", ast) + compiler.emit(last_buffer, else_branch.chunk, ast) + elseif (inner_target and (cond_line ~= "else")) then + compiler.emit(last_buffer, "else", ast) + compiler.emit(last_buffer, ("%s = nil"):format(inner_target), ast) + end + compiler.emit(last_buffer, "end", ast) + elseif not branches[(i + 1)].nested then + local next_buffer = {} + compiler.emit(last_buffer, "else", ast) + compiler.emit(last_buffer, next_buffer, ast) + compiler.emit(last_buffer, "end", ast) + last_buffer = next_buffer + end + end + if (wrapper == "iife") then + local iifeargs = ((scope.vararg and "...") or "") + compiler.emit(parent, ("local function %s(%s)"):format(tostring(s), iifeargs), ast) + compiler.emit(parent, buffer, ast) + compiler.emit(parent, "end", ast) + return utils.expr(("%s(%s)"):format(tostring(s), iifeargs), "statement") + elseif (wrapper == "none") then + for i = 1, #buffer, 1 do + compiler.emit(parent, buffer[i], ast) + end + return {returned = true} + else + compiler.emit(parent, ("local %s"):format(inner_target), ast) + for i = 1, #buffer, 1 do + compiler.emit(parent, buffer[i], ast) + end + return target_exprs + end + end + SPECIALS["if"] = if_2a + doc_special("if", {"cond1", "body1", "...", "condN", "bodyN"}, "Conditional form.\nTakes any number of condition/body pairs and evaluates the first body where\nthe condition evaluates to truthy. Similar to cond in other lisps.") + SPECIALS.each = function(ast, scope, parent) + compiler.assert((#ast >= 3), "expected body expression", ast[1]) + local binding = compiler.assert(utils["is-table"](ast[2]), "expected binding table", ast) + local iter = table.remove(binding, #binding) + local destructures = {} + local new_manglings = {} + local sub_scope = compiler["make-scope"](scope) + local function destructure_binding(v) + if utils["is-sym"](v) then + return compiler["declare-local"](v, {}, sub_scope, ast, new_manglings) + else + local raw = utils.sym(compiler.gensym(sub_scope)) + destructures[raw] = v + return compiler["declare-local"](raw, {}, sub_scope, ast) + end + end + local bind_vars = utils.map(binding, destructure_binding) + local vals = compiler.compile1(iter, sub_scope, parent) + local val_names = utils.map(vals, tostring) + local chunk = {} + compiler.emit(parent, ("for %s in %s do"):format(table.concat(bind_vars, ", "), table.concat(val_names, ", ")), ast) + for raw, args in utils.stablepairs(destructures) do + compiler.destructure(args, raw, ast, sub_scope, chunk, {declaration = true, nomulti = true}) + end + compiler["apply-manglings"](sub_scope, new_manglings, ast) + compile_do(ast, sub_scope, chunk, 3) + compiler.emit(parent, chunk, ast) + return compiler.emit(parent, "end", ast) + end + doc_special("each", {"[key value (iterator)]", "..."}, "Runs the body once for each set of values provided by the given iterator.\nMost commonly used with ipairs for sequential tables or pairs for undefined\norder, but can be used with any iterator.") + local function while_2a(ast, scope, parent) + local len1 = #parent + local condition = compiler.compile1(ast[2], scope, parent, {nval = 1})[1] + local len2 = #parent + local sub_chunk = {} + if (len1 ~= len2) then + for i = (len1 + 1), len2, 1 do + sub_chunk[(#sub_chunk + 1)] = parent[i] + parent[i] = nil + end + compiler.emit(parent, "while true do", ast) + compiler.emit(sub_chunk, ("if not %s then break end"):format(condition[1]), ast) + else + compiler.emit(parent, ("while " .. tostring(condition) .. " do"), ast) + end + compile_do(ast, compiler["make-scope"](scope), sub_chunk, 3) + compiler.emit(parent, sub_chunk, ast) + return compiler.emit(parent, "end", ast) + end + SPECIALS["while"] = while_2a + doc_special("while", {"condition", "..."}, "The classic while loop. Evaluates body until a condition is non-truthy.") + local function for_2a(ast, scope, parent) + local ranges = compiler.assert(utils["is-table"](ast[2]), "expected binding table", ast) + local binding_sym = table.remove(ast[2], 1) + local sub_scope = compiler["make-scope"](scope) + local range_args = {} + local chunk = {} + compiler.assert(utils["is-sym"](binding_sym), ("unable to bind %s %s"):format(type(binding_sym), tostring(binding_sym)), ast[2]) + compiler.assert((#ast >= 3), "expected body expression", ast[1]) + for i = 1, math.min(#ranges, 3), 1 do + range_args[i] = tostring(compiler.compile1(ranges[i], sub_scope, parent, {nval = 1})[1]) + end + compiler.emit(parent, ("for %s = %s do"):format(compiler["declare-local"](binding_sym, {}, sub_scope, ast), table.concat(range_args, ", ")), ast) + compile_do(ast, sub_scope, chunk, 3) + compiler.emit(parent, chunk, ast) + return compiler.emit(parent, "end", ast) + end + SPECIALS["for"] = for_2a + doc_special("for", {"[index start stop step?]", "..."}, "Numeric loop construct.\nEvaluates body once for each value between start and stop (inclusive).") + local function once(val, ast, scope, parent) + if ((val.type == "statement") or (val.type == "expression")) then + local s = compiler.gensym(scope) + compiler.emit(parent, ("local %s = %s"):format(s, tostring(val)), ast) + return utils.expr(s, "sym") + else + return val + end + end + local function method_call(ast, scope, parent) + compiler.assert((#ast >= 3), "expected at least 2 arguments", ast) + local objectexpr = compiler.compile1(ast[2], scope, parent, {nval = 1})[1] + local methodident, methodstring = false + if ((type(ast[3]) == "string") and utils["is-valid-lua-identifier"](ast[3])) then + methodident = true + methodstring = ast[3] + else + methodstring = tostring(compiler.compile1(ast[3], scope, parent, {nval = 1})[1]) + objectexpr = once(objectexpr, ast[2], scope, parent) + end + local args = {} + for i = 4, #ast, 1 do + local subexprs = nil + local _1_ + if (i ~= #ast) then + _1_ = 1 + else + _1_ = nil + end + subexprs = compiler.compile1(ast[i], scope, parent, {nval = _1_}) + utils.map(subexprs, tostring, args) + end + local fstring = nil + if not methodident then + table.insert(args, 1, tostring(objectexpr)) + if (objectexpr.type == "sym") then + fstring = "%s[%s](%s)" + else + fstring = "(%s)[%s](%s)" + end + elseif ((objectexpr.type == "literal") or (objectexpr.type == "expression")) then + fstring = "(%s):%s(%s)" + else + fstring = "%s:%s(%s)" + end + return utils.expr(fstring:format(tostring(objectexpr), methodstring, table.concat(args, ", ")), "statement") + end + SPECIALS[":"] = method_call + doc_special(":", {"tbl", "method-name", "..."}, "Call the named method on tbl with the provided args.\nMethod name doesn't have to be known at compile-time; if it is, use\n(tbl:method-name ...) instead.") + SPECIALS.comment = function(ast, _, parent) + local els = {} + for i = 2, #ast, 1 do + els[(#els + 1)] = tostring(ast[i]):gsub("\n", " ") + end + return compiler.emit(parent, ("-- " .. table.concat(els, " ")), ast) + end + doc_special("comment", {"..."}, "Comment which will be emitted in Lua output.") + SPECIALS.hashfn = function(ast, scope, parent) + compiler.assert((#ast == 2), "expected one argument", ast) + local f_scope = nil + do + local _0_0 = compiler["make-scope"](scope) + _0_0["vararg"] = false + _0_0["hashfn"] = true + f_scope = _0_0 + end + local f_chunk = {} + local name = compiler.gensym(scope) + local symbol = utils.sym(name) + compiler["declare-local"](symbol, {}, scope, ast) + local args = {} + for i = 1, 9 do + args[i] = compiler["declare-local"](utils.sym(("$" .. i)), {}, f_scope, ast) + end + local function walker(idx, node, parent_node) + if (utils["is-sym"](node) and (utils.deref(node) == "$...")) then + parent_node[idx] = utils.varg() + f_scope.vararg = true + return nil + else + return (utils["is-list"](node) or utils["is-table"](node)) + end + end + utils["walk-tree"](ast[2], walker) + compiler.compile1(ast[2], f_scope, f_chunk, {tail = true}) + local max_used = 0 + for i = 1, 9, 1 do + if f_scope.symmeta[("$" .. i)].used then + max_used = i + end + end + if f_scope.vararg then + compiler.assert((max_used == 0), "$ and $... in hashfn are mutually exclusive", ast) + args = {utils.deref(utils.varg())} + max_used = 1 + end + local arg_str = table.concat(args, ", ", 1, max_used) + compiler.emit(parent, ("local function %s(%s)"):format(name, arg_str), ast) + compiler.emit(parent, f_chunk, ast) + compiler.emit(parent, "end", ast) + return utils.expr(name, "sym") + end + doc_special("hashfn", {"..."}, "Function literal shorthand; args are either $... OR $1, $2, etc.") + local function define_arithmetic_special(name, zero_arity, unary_prefix, lua_name) + do + local padded_op = (" " .. (lua_name or name) .. " ") + local function _0_(ast, scope, parent) + local len = #ast + if (len == 1) then + compiler.assert((zero_arity ~= nil), "Expected more than 0 arguments", ast) + return utils.expr(zero_arity, "literal") + else + local operands = {} + for i = 2, len, 1 do + local subexprs = nil + local _1_ + if (i == 1) then + _1_ = 1 + else + _1_ = nil + end + subexprs = compiler.compile1(ast[i], scope, parent, {nval = _1_}) + utils.map(subexprs, tostring, operands) + end + if (#operands == 1) then + if unary_prefix then + return ("(" .. unary_prefix .. padded_op .. operands[1] .. ")") + else + return operands[1] + end + else + return ("(" .. table.concat(operands, padded_op) .. ")") + end + end + end + SPECIALS[name] = _0_ + end + return doc_special(name, {"a", "b", "..."}, "Arithmetic operator; works the same as Lua but accepts more arguments.") + end + define_arithmetic_special("+", "0") + define_arithmetic_special("..", "''") + define_arithmetic_special("^") + define_arithmetic_special("-", nil, "") + define_arithmetic_special("*", "1") + define_arithmetic_special("%") + define_arithmetic_special("/", nil, "1") + define_arithmetic_special("//", nil, "1") + define_arithmetic_special("lshift", nil, "1", "<<") + define_arithmetic_special("rshift", nil, "1", ">>") + define_arithmetic_special("band", "0", "0", "&") + define_arithmetic_special("bor", "0", "0", "|") + define_arithmetic_special("bxor", "0", "0", "~") + doc_special("lshift", {"x", "n"}, "Bitwise logical left shift of x by n bits; only works in Lua 5.3+.") + doc_special("rshift", {"x", "n"}, "Bitwise logical right shift of x by n bits; only works in Lua 5.3+.") + doc_special("band", {"x1", "x2"}, "Bitwise AND of arguments; only works in Lua 5.3+.") + doc_special("bor", {"x1", "x2"}, "Bitwise OR of arguments; only works in Lua 5.3+.") + doc_special("bxor", {"x1", "x2"}, "Bitwise XOR of arguments; only works in Lua 5.3+.") + define_arithmetic_special("or", "false") + define_arithmetic_special("and", "true") + doc_special("and", {"a", "b", "..."}, "Boolean operator; works the same as Lua but accepts more arguments.") + doc_special("or", {"a", "b", "..."}, "Boolean operator; works the same as Lua but accepts more arguments.") + doc_special("..", {"a", "b", "..."}, "String concatenation operator; works the same as Lua but accepts more arguments.") + local function define_comparator_special(name, realop, chain_op) + do + local op = (realop or name) + local function opfn(ast, scope, parent) + local len = #ast + compiler.assert((len > 2), "expected at least two arguments", ast) + local lhs = compiler.compile1(ast[2], scope, parent, {nval = 1})[1] + local lastval = compiler.compile1(ast[3], scope, parent, {nval = 1})[1] + if (len > 3) then + lastval = once(lastval, ast[3], scope, parent) + end + local out = ("(%s %s %s)"):format(tostring(lhs), op, tostring(lastval)) + if (len > 3) then + for i = 4, len do + local nextval = once(compiler.compile1(ast[i], scope, parent, {nval = 1})[1], ast[i], scope, parent) + out = ((out .. " %s (%s %s %s)")):format((chain_op or "and"), tostring(lastval), op, tostring(nextval)) + lastval = nextval + end + out = ("(" .. out .. ")") + end + return out + end + SPECIALS[name] = opfn + end + return doc_special(name, {"a", "b", "..."}, "Comparison operator; works the same as Lua but accepts more arguments.") + end + define_comparator_special(">") + define_comparator_special("<") + define_comparator_special(">=") + define_comparator_special("<=") + define_comparator_special("=", "==") + define_comparator_special("not=", "~=", "or") + SPECIALS["~="] = SPECIALS["not="] + local function define_unary_special(op, realop) + local function opfn(ast, scope, parent) + compiler.assert((#ast == 2), "expected one argument", ast) + local tail = compiler.compile1(ast[2], scope, parent, {nval = 1}) + return ((realop or op) .. tostring(tail[1])) + end + SPECIALS[op] = opfn + return nil + end + define_unary_special("not", "not ") + doc_special("not", {"x"}, "Logical operator; works the same as Lua.") + define_unary_special("bnot", "~") + doc_special("bnot", {"x"}, "Bitwise negation; only works in Lua 5.3+.") + define_unary_special("length", "#") + doc_special("length", {"x"}, "Returns the length of a table or string.") + SPECIALS["#"] = SPECIALS.length + SPECIALS.quote = function(ast, scope, parent) + compiler.assert((#ast == 2), "expected one argument") + local runtime, this_scope = true, scope + while this_scope do + this_scope = this_scope.parent + if (this_scope == compiler.scopes.compiler) then + runtime = false + end + end + return compiler["do-quote"](ast[2], scope, parent, runtime) + end + doc_special("quote", {"x"}, "Quasiquote the following form. Only works in macro/compiler scope.") + local function make_compiler_env(ast, scope, parent) + local function _0_() + return compiler.scopes.macro + end + local function _1_(symbol) + compiler.assert(compiler.scopes.macro, "must call from macro", ast) + return compiler.scopes.macro.manglings[tostring(symbol)] + end + local function _2_() + return utils.sym(compiler.gensym((compiler.scopes.macro or scope))) + end + local function _3_(form) + compiler.assert(compiler.scopes.macro, "must call from macro", ast) + return compiler.macroexpand(form, compiler.scopes.macro) + end + return setmetatable({["get-scope"] = _0_, ["in-scope?"] = _1_, ["list?"] = utils["is-list"], ["multi-sym?"] = utils["is-multi-sym"], ["sequence?"] = utils["is-sequence"], ["sym?"] = utils["is-sym"], ["table?"] = utils["is-table"], ["varg?"] = utils["is-varg"], _AST = ast, _CHUNK = parent, _IS_COMPILER = true, _SCOPE = scope, _SPECIALS = compiler.scopes.global.specials, _VARARG = utils.varg(), fennel = utils["fennel-module"], gensym = _2_, list = utils.list, macroexpand = _3_, sequence = utils.sequence, sym = utils.sym, unpack = unpack}, {__index = (_ENV or _G)}) + end + local cfg = string.gmatch(package.config, "([^\n]+)") + local dirsep, pathsep, pathmark = (cfg() or "/"), (cfg() or ";"), (cfg() or "?") + local pkg_config = {dirsep = dirsep, pathmark = pathmark, pathsep = pathsep} + local function escapepat(str) + return string.gsub(str, "[^%w]", "%%%1") + end + local function search_module(modulename, pathstring) + local pathsepesc = escapepat(pkg_config.pathsep) + local pattern = ("([^%s]*)%s"):format(pathsepesc, pathsepesc) + local no_dot_module = modulename:gsub("%.", pkg_config.dirsep) + local fullpath = ((pathstring or utils["fennel-module"].path) .. pkg_config.pathsep) + local function try_path(path) + local filename = path:gsub(escapepat(pkg_config.pathmark), no_dot_module) + local filename2 = path:gsub(escapepat(pkg_config.pathmark), modulename) + local _0_0 = (io.open(filename) or io.open(filename2)) + if (nil ~= _0_0) then + local file = _0_0 + file:close() + return filename + end + end + local function find_in_path(start) + local _0_0 = fullpath:match(pattern, start) + if (nil ~= _0_0) then + local path = _0_0 + return (try_path(path) or find_in_path((start + #path + 1))) + end + end + return find_in_path(1) + end + local function make_searcher(options) + local opts = utils.copy(utils.root.options) + for k, v in pairs((options or {})) do + opts[k] = v + end + local function _0_(module_name) + local filename = search_module(module_name) + if filename then + local function _1_(mod_name) + return utils["fennel-module"].dofile(filename, opts, mod_name) + end + return _1_ + end + end + return _0_ + end + local function macro_globals(env, globals) + local allowed = current_global_names(env) + for _, k in pairs((globals or {})) do + table.insert(allowed, k) + end + return allowed + end + local function add_macros(macros_2a, ast, scope) + compiler.assert(utils["is-table"](macros_2a), "expected macros to be table", ast) + for k, v in pairs(macros_2a) do + compiler.assert((type(v) == "function"), "expected each macro to be function", ast) + scope.macros[k] = v + end + return nil + end + local function load_macros(modname, ast, scope, parent) + local filename = compiler.assert(search_module(modname), (modname .. " module not found."), ast) + local env = make_compiler_env(ast, scope, parent) + local globals = macro_globals(env, current_global_names()) + return utils["fennel-module"].dofile(filename, {allowedGlobals = globals, env = env, scope = compiler.scopes.compiler, useMetadata = utils.root.options.useMetadata}) + end + local macro_loaded = {} + SPECIALS["require-macros"] = function(ast, scope, parent) + compiler.assert((#ast == 2), "Expected one module name argument", ast) + local modname = ast[2] + if not macro_loaded[modname] then + macro_loaded[modname] = load_macros(modname, ast, scope, parent) + end + return add_macros(macro_loaded[modname], ast, scope, parent) + end + doc_special("require-macros", {"macro-module-name"}, "Load given module and use its contents as macro definitions in current scope.\nMacro module should return a table of macro functions with string keys.\nConsider using import-macros instead as it is more flexible.") + local function emit_fennel(src, path, opts, sub_chunk) + local subscope = compiler["make-scope"](utils.root.scope.parent) + local forms = {} + if utils.root.options.requireAsInclude then + subscope.specials.require = compiler["require-include"] + end + for _, val in parser.parser(parser["string-stream"](src), path) do + table.insert(forms, val) + end + for i = 1, #forms do + local subopts = nil + if (i == #forms) then + subopts = {nval = 1, tail = true} + else + subopts = {nval = 0} + end + utils["propagate-options"](opts, subopts) + compiler.compile1(forms[i], subscope, sub_chunk, subopts) + end + return nil + end + local function include_path(ast, opts, path, mod, fennel_3f) + utils.root.scope.includes[mod] = "fnl/loading" + local src = nil + do + local f = assert(io.open(path)) + local function close_handlers_0_(ok_0_, ...) + f:close() + if ok_0_ then + return ... + else + return error(..., 0) + end + end + local function _0_() + return f:read("*all"):gsub("[\13\n]*$", "") + end + src = close_handlers_0_(xpcall(_0_, (package.loaded.fennel or debug).traceback)) + end + local ret = utils.expr(("require(\"" .. mod .. "\")"), "statement") + local target = ("package.preload[%q]"):format(mod) + local preload_str = (target .. " = " .. target .. " or function(...)") + local temp_chunk, sub_chunk = {}, {} + compiler.emit(temp_chunk, preload_str, ast) + compiler.emit(temp_chunk, sub_chunk) + compiler.emit(temp_chunk, "end", ast) + for i, v in ipairs(temp_chunk) do + table.insert(utils.root.chunk, i, v) + end + if fennel_3f then + emit_fennel(src, path, opts, sub_chunk) + else + compiler.emit(sub_chunk, src, ast) + end + utils.root.scope.includes[mod] = ret + return ret + end + local function include_circular_fallback(mod, modexpr, fallback, ast) + if (utils.root.scope.includes[mod] == "fnl/loading") then + compiler.assert(fallback, "circular include detected", ast) + return fallback(modexpr) + end + end + SPECIALS.include = function(ast, scope, parent, opts) + compiler.assert((#ast == 2), "expected one argument", ast) + local modexpr = compiler.compile1(ast[2], scope, parent, {nval = 1})[1] + if ((modexpr.type ~= "literal") or ((modexpr[1]):byte() ~= 34)) then + if opts.fallback then + return opts.fallback(modexpr) + else + return compiler.assert(false, "module name must be string literal", ast) + end + else + local mod = load_code(("return " .. modexpr[1]))() + local function _1_() + local _0_0 = search_module(mod) + if (nil ~= _0_0) then + local fennel_path = _0_0 + return include_path(ast, opts, fennel_path, mod, true) + else + local _ = _0_0 + local lua_path = search_module(mod, package.path) + if lua_path then + return include_path(ast, opts, lua_path, mod, false) + elseif opts.fallback then + return opts.fallback(modexpr) + else + return compiler.assert(false, ("module not found " .. mod), ast) + end + end + end + return (include_circular_fallback(mod, modexpr, opts.fallback, ast) or utils.root.scope.includes[mod] or _1_()) + end + end + doc_special("include", {"module-name-literal"}, "Like require but load the target module during compilation and embed it in the\nLua output. The module must be a string literal and resolvable at compile time.") + local function eval_compiler_2a(ast, scope, parent) + local scope0 = compiler["make-scope"](compiler.scopes.compiler) + local luasrc = compiler.compile(ast, {scope = scope0, useMetadata = utils.root.options.useMetadata}) + local loader = load_code(luasrc, wrap_env(make_compiler_env(ast, scope0, parent))) + return loader() + end + SPECIALS.macros = function(ast, scope, parent) + compiler.assert((#ast == 2), "Expected one table argument", ast) + return add_macros(eval_compiler_2a(ast[2], scope, parent), ast, scope, parent) + end + doc_special("macros", {"{:macro-name-1 (fn [...] ...) ... :macro-name-N macro-body-N}"}, "Define all functions in the given table as macros local to the current scope.") + SPECIALS["eval-compiler"] = function(ast, scope, parent) + local old_first = ast[1] + ast[1] = utils.sym("do") + local val = eval_compiler_2a(ast, scope, parent) + ast[1] = old_first + return val + end + doc_special("eval-compiler", {"..."}, "Evaluate the body at compile-time. Use the macro system instead if possible.") + return {["current-global-names"] = current_global_names, ["load-code"] = load_code, ["macro-loaded"] = macro_loaded, ["make-compiler-env"] = make_compiler_env, ["make-searcher"] = make_searcher, ["search-module"] = search_module, ["wrap-env"] = wrap_env, doc = doc_2a} +end +package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or function(...) + local utils = require("fennel.utils") + local parser = require("fennel.parser") + local friend = require("fennel.friend") + local unpack = (_G.unpack or table.unpack) + local scopes = {} + local function make_scope(parent) + local parent0 = (parent or scopes.global) + local _0_ + if parent0 then + _0_ = ((parent0.depth or 0) + 1) + else + _0_ = 0 + end + return {autogensyms = {}, depth = _0_, hashfn = (parent0 and parent0.hashfn), includes = setmetatable({}, {__index = (parent0 and parent0.includes)}), macros = setmetatable({}, {__index = (parent0 and parent0.macros)}), manglings = setmetatable({}, {__index = (parent0 and parent0.manglings)}), parent = parent0, refedglobals = setmetatable({}, {__index = (parent0 and parent0.refedglobals)}), specials = setmetatable({}, {__index = (parent0 and parent0.specials)}), symmeta = setmetatable({}, {__index = (parent0 and parent0.symmeta)}), unmanglings = setmetatable({}, {__index = (parent0 and parent0.unmanglings)}), vararg = (parent0 and parent0.vararg)} + end + local function assert_compile(condition, msg, ast) + if not condition then + local _0_ = (utils.root.options or {}) + local source = _0_["source"] + local unfriendly = _0_["unfriendly"] + utils.root.reset() + if unfriendly then + local m = getmetatable(ast) + local filename = ((m and m.filename) or ast.filename or "unknown") + local line = ((m and m.line) or ast.line or "?") + local target = nil + local function _1_() + if utils["is-sym"](ast[1]) then + return utils.deref(ast[1]) + else + return (ast[1] or "()") + end + end + target = tostring(_1_()) + error(string.format("Compile error in '%s' %s:%s: %s", target, filename, line, msg), 0) + else + friend["assert-compile"](condition, msg, ast, source) + end + end + return condition + end + scopes.global = make_scope() + scopes.global.vararg = true + scopes.compiler = make_scope(scopes.global) + scopes.macro = scopes.global + local serialize_subst = {["\11"] = "\\v", ["\12"] = "\\f", ["\7"] = "\\a", ["\8"] = "\\b", ["\9"] = "\\t", ["\n"] = "n"} + local function serialize_string(str) + local function _0_(_241) + return ("\\" .. _241:byte()) + end + return ("%q"):format(str):gsub(".", serialize_subst):gsub("[\128-\255]", _0_) + end + local function global_mangling(str) + if utils["is-valid-lua-identifier"](str) then + return str + else + local function _0_(_241) + return ("_%02x"):format(_241:byte()) + end + return ("__fnl_global__" .. str:gsub("[^%w]", _0_)) + end + end + local function global_unmangling(identifier) + local _0_0 = identifier:match("^__fnl_global__(.*)$") + if (nil ~= _0_0) then + local rest = _0_0 + local _1_0 = nil + local function _2_(_241) + return string.char(tonumber(_241:sub(2), 16)) + end + _1_0 = rest:gsub("_[%da-f][%da-f]", _2_) + return _1_0 + else + local _ = _0_0 + return identifier + end + end + local allowed_globals = nil + local function global_allowed(name) + local found_3f = not allowed_globals + if not allowed_globals then + return true + else + for _, g in ipairs(allowed_globals) do + if (g == name) then + found_3f = true + end + end + return found_3f + end + end + local function local_mangling(str, scope, ast, temp_manglings) + local append = 0 + local mangling = str + assert_compile(not utils["is-multi-sym"](str), ("unexpected multi symbol " .. str), ast) + if (utils["lua-keywords"][mangling] or mangling:match("^%d")) then + mangling = ("_" .. mangling) + end + local function _1_(_241) + return ("_%02x"):format(_241:byte()) + end + mangling = mangling:gsub("-", "_"):gsub("[^%w_]", _1_) + local raw = mangling + while scope.unmanglings[mangling] do + mangling = (raw .. append) + append = (append + 1) + end + scope.unmanglings[mangling] = str + do + local manglings = (temp_manglings or scope.manglings) + manglings[str] = mangling + end + return mangling + end + local function apply_manglings(scope, new_manglings, ast) + for raw, mangled in pairs(new_manglings) do + assert_compile(not scope.refedglobals[mangled], ("use of global " .. raw .. " is aliased by a local"), ast) + scope.manglings[raw] = mangled + end + return nil + end + local function combine_parts(parts, scope) + local ret = (scope.manglings[parts[1]] or global_mangling(parts[1])) + for i = 2, #parts, 1 do + if utils["is-valid-lua-identifier"](parts[i]) then + if (parts["multi-sym-method-call"] and (i == #parts)) then + ret = (ret .. ":" .. parts[i]) + else + ret = (ret .. "." .. parts[i]) + end + else + ret = (ret .. "[" .. serialize_string(parts[i]) .. "]") + end + end + return ret + end + local function gensym(scope, base) + local append, mangling = 0, ((base or "") .. "_0_") + while scope.unmanglings[mangling] do + mangling = ((base or "") .. "_" .. append .. "_") + append = (append + 1) + end + scope.unmanglings[mangling] = true + return mangling + end + local function autogensym(base, scope) + local _0_0 = utils["is-multi-sym"](base) + if (nil ~= _0_0) then + local parts = _0_0 + parts[1] = autogensym(parts[1], scope) + return table.concat(parts, ((parts["multi-sym-method-call"] and ":") or ".")) + else + local _ = _0_0 + local function _1_() + local mangling = gensym(scope, base:sub(1, ( - 2))) + scope.autogensyms[base] = mangling + return mangling + end + return (scope.autogensyms[base] or _1_()) + end + end + local function check_binding_valid(symbol, scope, ast) + local name = utils.deref(symbol) + assert_compile(not (scope.specials[name] or scope.macros[name]), ("local %s was overshadowed by a special form or macro"):format(name), ast) + return assert_compile(not utils["is-quoted"](symbol), ("macro tried to bind %s without gensym"):format(name), symbol) + end + local function declare_local(symbol, meta, scope, ast, temp_manglings) + check_binding_valid(symbol, scope, ast) + local name = utils.deref(symbol) + assert_compile(not utils["is-multi-sym"](name), ("unexpected multi symbol " .. name), ast) + scope.symmeta[name] = meta + return local_mangling(name, scope, ast, temp_manglings) + end + local function symbol_to_expression(symbol, scope, is_reference) + local name = symbol[1] + local multi_sym_parts = utils["is-multi-sym"](name) + if scope.hashfn then + if (name == "$") then + name = "$1" + end + if multi_sym_parts then + if (multi_sym_parts[1] == "$") then + multi_sym_parts[1] = "$1" + name = table.concat(multi_sym_parts, ".") + end + end + end + local parts = (multi_sym_parts or {name}) + local etype = (((#parts > 1) and "expression") or "sym") + local is_local = scope.manglings[parts[1]] + if (is_local and scope.symmeta[parts[1]]) then + scope.symmeta[parts[1]]["used"] = true + end + assert_compile((not is_reference or is_local or global_allowed(parts[1])), ("unknown global in strict mode: " .. parts[1]), symbol) + if (allowed_globals and not is_local) then + utils.root.scope.refedglobals[parts[1]] = true + end + return utils.expr(combine_parts(parts, scope), etype) + end + local function emit(chunk, out, ast) + if (type(out) == "table") then + return table.insert(chunk, out) + else + return table.insert(chunk, {ast = ast, leaf = out}) + end + end + local function peephole(chunk) + if chunk.leaf then + return chunk + elseif ((#chunk >= 3) and (chunk[(#chunk - 2)].leaf == "do") and not chunk[(#chunk - 1)].leaf and (chunk[#chunk].leaf == "end")) then + local kid = peephole(chunk[(#chunk - 1)]) + local new_chunk = {ast = chunk.ast} + for i = 1, (#chunk - 3), 1 do + table.insert(new_chunk, peephole(chunk[i])) + end + for i = 1, #kid, 1 do + table.insert(new_chunk, kid[i]) + end + return new_chunk + else + return utils.map(chunk, peephole) + end + end + local function flatten_chunk_correlated(main_chunk) + local function flatten(chunk, out, last_line, file) + local last_line0 = last_line + if chunk.leaf then + out[last_line0] = ((out[last_line0] or "") .. " " .. chunk.leaf) + else + for _, subchunk in ipairs(chunk) do + if (subchunk.leaf or (#subchunk > 0)) then + if (subchunk.ast and (file == subchunk.ast.file)) then + last_line0 = math.max(last_line0, (subchunk.ast.line or 0)) + end + last_line0 = flatten(subchunk, out, last_line0, file) + end + end + end + return last_line0 + end + local out = {} + local last = flatten(main_chunk, out, 1, main_chunk.file) + for i = 1, last do + if (out[i] == nil) then + out[i] = "" + end + end + return table.concat(out, "\n") + end + local function flatten_chunk(sm, chunk, tab, depth) + if chunk.leaf then + local code = chunk.leaf + local info = chunk.ast + if sm then + sm[(#sm + 1)] = ((info and info.line) or ( - 1)) + end + return code + else + local tab0 = nil + do + local _0_0 = tab + if (_0_0 == true) then + tab0 = " " + elseif (_0_0 == false) then + tab0 = "" + elseif (_0_0 == tab) then + tab0 = tab + elseif (_0_0 == nil) then + tab0 = "" + else + tab0 = nil + end + end + local function parter(c) + if (c.leaf or (#c > 0)) then + local sub = flatten_chunk(sm, c, tab0, (depth + 1)) + if (depth > 0) then + sub = (tab0 .. sub:gsub("\n", ("\n" .. tab0))) + end + return sub + end + end + return table.concat(utils.map(chunk, parter), "\n") + end + end + local fennel_sourcemap = {} + local function make_short_src(source) + local source0 = source:gsub("\n", " ") + if (#source0 <= 49) then + return ("[fennel \"" .. source0 .. "\"]") + else + return ("[fennel \"" .. source0:sub(1, 46) .. "...\"]") + end + end + local function flatten(chunk, options) + local chunk0 = peephole(chunk) + if options.correlate then + return flatten_chunk_correlated(chunk0), {} + else + local sm = {} + local ret = flatten_chunk(sm, chunk0, options.indent, 0) + if sm then + local key, short_src = nil + if options.filename then + short_src = options.filename + key = ("@" .. short_src) + else + key = ret + short_src = make_short_src((options.source or ret)) + end + sm.short_src = short_src + sm.key = key + fennel_sourcemap[key] = sm + end + return ret, sm + end + end + local function make_metadata() + local function _0_(self, tgt, key) + if self[tgt] then + return self[tgt][key] + end + end + local function _1_(self, tgt, key, value) + self[tgt] = (self[tgt] or {}) + self[tgt][key] = value + return tgt + end + local function _2_(self, tgt, ...) + local kv_len = select("#", ...) + local kvs = {...} + if ((kv_len % 2) ~= 0) then + error("metadata:setall() expected even number of k/v pairs") + end + self[tgt] = (self[tgt] or {}) + for i = 1, kv_len, 2 do + self[tgt][kvs[i]] = kvs[(i + 1)] + end + return tgt + end + return setmetatable({}, {__index = {get = _0_, set = _1_, setall = _2_}, __mode = "k"}) + end + local function exprs1(exprs) + return table.concat(utils.map(exprs, 1), ", ") + end + local function keep_side_effects(exprs, chunk, start, ast) + local start0 = (start or 1) + for j = start0, #exprs, 1 do + local se = exprs[j] + if ((se.type == "expression") and (se[1] ~= "nil")) then + emit(chunk, ("do local _ = %s end"):format(tostring(se)), ast) + elseif (se.type == "statement") then + local code = tostring(se) + emit(chunk, (((code:byte() == 40) and ("do end " .. code)) or code), ast) + end + end + return nil + end + local function handle_compile_opts(exprs, parent, opts, ast) + if opts.nval then + local n = opts.nval + local len = #exprs + if (n ~= len) then + if (len > n) then + keep_side_effects(exprs, parent, (n + 1), ast) + for i = (n + 1), len, 1 do + exprs[i] = nil + end + else + for i = (#exprs + 1), n, 1 do + exprs[i] = utils.expr("nil", "literal") + end + end + end + end + if opts.tail then + emit(parent, ("return %s"):format(exprs1(exprs)), ast) + end + if opts.target then + local result = exprs1(exprs) + if (result == "") then + result = "nil" + end + emit(parent, ("%s = %s"):format(opts.target, result), ast) + end + if (opts.tail or opts.target) then + return {} + else + return exprs + end + end + local function macroexpand_2a(ast, scope, once) + if not utils["is-list"](ast) then + return ast + else + local multi_sym_parts = utils["is-multi-sym"](ast[1]) + local macro_2a = (utils["is-sym"](ast[1]) and scope.macros[utils.deref(ast[1])]) + if (not macro_2a and multi_sym_parts) then + local in_macro_module = nil + macro_2a = scope.macros + for i = 1, #multi_sym_parts, 1 do + macro_2a = (utils["is-table"](macro_2a) and macro_2a[multi_sym_parts[i]]) + if macro_2a then + in_macro_module = true + end + end + assert_compile((not in_macro_module or (type(macro_2a) == "function")), "macro not found in imported macro module", ast) + end + if not macro_2a then + return ast + else + local old_scope = scopes.macro + local _ = nil + scopes.macro = scope + _ = nil + local ok, transformed = pcall(macro_2a, unpack(ast, 2)) + scopes.macro = old_scope + assert_compile(ok, transformed, ast) + if (once or not transformed) then + return transformed + else + return macroexpand_2a(transformed, scope) + end + end + end + end + local function compile1(ast, scope, parent, opts) + local opts0 = (opts or {}) + local ast0 = macroexpand_2a(ast, scope) + local exprs = {} + if utils["is-list"](ast0) then + local len = #ast0 + local first = ast0[1] + local multi_sym_parts = utils["is-multi-sym"](first) + local special = (utils["is-sym"](first) and scope.specials[utils.deref(first)]) + assert_compile((#ast0 > 0), "expected a function, macro, or special to call", ast0) + if special then + exprs = (special(ast0, scope, parent, opts0) or utils.expr("nil", "literal")) + if (type(exprs) == "string") then + exprs = utils.expr(exprs, "expression") + end + if utils["is-expr"](exprs) then + exprs = {exprs} + end + if not exprs.returned then + exprs = handle_compile_opts(exprs, parent, opts0, ast0) + elseif (opts0.tail or opts0.target) then + exprs = {} + end + elseif (multi_sym_parts and multi_sym_parts["multi-sym-method-call"]) then + local table_with_method = table.concat({unpack(multi_sym_parts, 1, (#multi_sym_parts - 1))}, ".") + local method_to_call = multi_sym_parts[#multi_sym_parts] + local new_ast = utils.list(utils.sym(":", scope), utils.sym(table_with_method, scope), method_to_call) + for i = 2, len, 1 do + new_ast[(#new_ast + 1)] = ast0[i] + end + exprs = compile1(new_ast, scope, parent, opts0) + else + local fargs = {} + local fcallee = compile1(ast0[1], scope, parent, {nval = 1})[1] + assert_compile((fcallee.type ~= "literal"), ("cannot call literal value " .. tostring(ast0[1])), ast0) + fcallee = tostring(fcallee) + for i = 2, len, 1 do + local subexprs = compile1(ast0[i], scope, parent, {nval = (((i ~= len) and 1) or nil)}) + fargs[(#fargs + 1)] = (subexprs[1] or utils.expr("nil", "literal")) + if (i == len) then + for j = 2, #subexprs, 1 do + fargs[(#fargs + 1)] = subexprs[j] + end + else + keep_side_effects(subexprs, parent, 2, ast0[i]) + end + end + local call = ("%s(%s)"):format(tostring(fcallee), exprs1(fargs)) + exprs = handle_compile_opts({utils.expr(call, "statement")}, parent, opts0, ast0) + end + elseif utils["is-varg"](ast0) then + assert_compile(scope.vararg, "unexpected vararg", ast0) + exprs = handle_compile_opts({utils.expr("...", "varg")}, parent, opts0, ast0) + elseif utils["is-sym"](ast0) then + local multi_sym_parts = utils["is-multi-sym"](ast0) + local e = nil + assert_compile(not (multi_sym_parts and multi_sym_parts["multi-sym-method-call"]), "multisym method calls may only be in call position", ast0) + if (ast0[1] == "nil") then + e = utils.expr("nil", "literal") + else + e = symbol_to_expression(ast0, scope, true) + end + exprs = handle_compile_opts({e}, parent, opts0, ast0) + elseif ((type(ast0) == "nil") or (type(ast0) == "boolean")) then + exprs = handle_compile_opts({utils.expr(tostring(ast0), "literal")}, parent, opts0) + elseif (type(ast0) == "number") then + local n = ("%.17g"):format(ast0) + exprs = handle_compile_opts({utils.expr(n, "literal")}, parent, opts0) + elseif (type(ast0) == "string") then + local s = serialize_string(ast0) + exprs = handle_compile_opts({utils.expr(s, "literal")}, parent, opts0) + elseif (type(ast0) == "table") then + local buffer = {} + for i = 1, #ast0, 1 do + local nval = ((i ~= #ast0) and 1) + buffer[(#buffer + 1)] = exprs1(compile1(ast0[i], scope, parent, {nval = nval})) + end + local function write_other_values(k) + if ((type(k) ~= "number") or (math.floor(k) ~= k) or (k < 1) or (k > #ast0)) then + if ((type(k) == "string") and utils["is-valid-lua-identifier"](k)) then + return {k, k} + else + local _0_ = compile1(k, scope, parent, {nval = 1}) + local compiled = _0_[1] + local kstr = ("[" .. tostring(compiled) .. "]") + return {kstr, k} + end + end + end + do + local keys = nil + do + local _0_0 = utils.kvmap(ast0, write_other_values) + local function _1_(a, b) + return (a[1] < b[1]) + end + table.sort(_0_0, _1_) + keys = _0_0 + end + local function _1_(k) + local v = tostring(compile1(ast0[k[2]], scope, parent, {nval = 1})[1]) + return ("%s = %s"):format(k[1], v) + end + utils.map(keys, _1_, buffer) + end + exprs = handle_compile_opts({utils.expr(("{" .. table.concat(buffer, ", ") .. "}"), "expression")}, parent, opts0, ast0) + else + assert_compile(false, ("could not compile value of type " .. type(ast0)), ast0) + end + exprs.returned = true + return exprs + end + local function destructure(to, from, ast, scope, parent, opts) + local opts0 = (opts or {}) + local _0_ = opts0 + local declaration = _0_["declaration"] + local forceglobal = _0_["forceglobal"] + local forceset = _0_["forceset"] + local isvar = _0_["isvar"] + local nomulti = _0_["nomulti"] + local noundef = _0_["noundef"] + local setter = nil + if declaration then + setter = "local %s = %s" + else + setter = "%s = %s" + end + local new_manglings = {} + local function getname(symbol, up1) + local raw = symbol[1] + assert_compile(not (nomulti and utils["is-multi-sym"](raw)), ("unexpected multi symbol " .. raw), up1) + if declaration then + return declare_local(symbol, {var = isvar}, scope, symbol, new_manglings) + else + local parts = (utils["is-multi-sym"](raw) or {raw}) + local meta = scope.symmeta[parts[1]] + if ((#parts == 1) and not forceset) then + assert_compile(not (forceglobal and meta), ("global %s conflicts with local"):format(tostring(symbol)), symbol) + assert_compile(not (meta and not meta.var), ("expected var " .. raw), symbol) + assert_compile((meta or not noundef), ("expected local " .. parts[1]), symbol) + end + if forceglobal then + assert_compile(not scope.symmeta[scope.unmanglings[raw]], ("global " .. raw .. " conflicts with local"), symbol) + scope.manglings[raw] = global_mangling(raw) + scope.unmanglings[global_mangling(raw)] = raw + if allowed_globals then + table.insert(allowed_globals, raw) + end + end + return symbol_to_expression(symbol, scope)[1] + end + end + local function compile_top_target(lvalues) + local inits = nil + local function _2_(_241) + if scope.manglings[_241] then + return _241 + else + return "nil" + end + end + inits = utils.map(lvalues, _2_) + local init = table.concat(inits, ", ") + local lvalue = table.concat(lvalues, ", ") + local plen, plast = #parent, parent[#parent] + local ret = compile1(from, scope, parent, {target = lvalue}) + if declaration then + for pi = plen, #parent do + if (parent[pi] == plast) then + plen = pi + end + end + if ((#parent == (plen + 1)) and parent[#parent].leaf) then + parent[#parent]["leaf"] = ("local " .. parent[#parent].leaf) + else + table.insert(parent, (plen + 1), {ast = ast, leaf = ("local " .. lvalue .. " = " .. init)}) + end + end + return ret + end + local function destructure1(left, rightexprs, up1, top) + if (utils["is-sym"](left) and (left[1] ~= "nil")) then + local lname = getname(left, up1) + check_binding_valid(left, scope, left) + if top then + compile_top_target({lname}) + else + emit(parent, setter:format(lname, exprs1(rightexprs)), left) + end + elseif utils["is-table"](left) then + local s = gensym(scope) + local right = nil + if top then + right = exprs1(compile1(from, scope, parent)) + else + right = exprs1(rightexprs) + end + if (right == "") then + right = "nil" + end + emit(parent, ("local %s = %s"):format(s, right), left) + for k, v in utils.stablepairs(left) do + if (utils["is-sym"](left[k]) and (left[k][1] == "&")) then + assert_compile(((type(k) == "number") and not left[(k + 2)]), "expected rest argument before last parameter", left) + local formatted = ("{(table.unpack or unpack)(%s, %s)}"):format(s, k) + local subexpr = utils.expr(formatted, "expression") + destructure1(left[(k + 1)], {subexpr}, left) + return + else + if (utils["is-sym"](k) and (tostring(k) == ":") and utils["is-sym"](v)) then + k = tostring(v) + end + if (type(k) ~= "number") then + k = serialize_string(k) + end + local subexpr = utils.expr(("%s[%s]"):format(s, k), "expression") + destructure1(v, {subexpr}, left) + end + end + elseif utils["is-list"](left) then + local left_names, tables = {}, {} + for i, name in ipairs(left) do + local symname = nil + if utils["is-sym"](name) then + symname = getname(name, up1) + else + symname = gensym(scope) + tables[i] = {name, utils.expr(symname, "sym")} + end + table.insert(left_names, symname) + end + if top then + compile_top_target(left_names) + else + local lvalue = table.concat(left_names, ", ") + local setting = setter:format(lvalue, exprs1(rightexprs)) + emit(parent, setting, left) + end + for _, pair in utils.stablepairs(tables) do + destructure1(pair[1], {pair[2]}, left) + end + else + assert_compile(false, ("unable to bind %s %s"):format(type(left), tostring(left)), (((type(up1[2]) == "table") and up1[2]) or up1)) + end + if top then + return {returned = true} + end + end + local ret = destructure1(to, nil, ast, true) + apply_manglings(scope, new_manglings, ast) + return ret + end + local function require_include(ast, scope, parent, opts) + opts.fallback = function(e) + return utils.expr(("require(%s)"):format(tostring(e)), "statement") + end + return scopes.global.specials.include(ast, scope, parent, opts) + end + local function compile_stream(strm, options) + local opts = utils.copy(options) + local old_globals = allowed_globals + local scope = (opts.scope or make_scope(scopes.global)) + local vals = {} + local chunk = {} + local _0_ = utils.root + _0_["set-reset"](_0_) + allowed_globals = opts.allowedGlobals + if (opts.indent == nil) then + opts.indent = " " + end + if opts.requireAsInclude then + scope.specials.require = require_include + end + utils.root.chunk, utils.root.scope, utils.root.options = chunk, scope, opts + for ok, val in parser.parser(strm, opts.filename, opts) do + vals[(#vals + 1)] = val + end + for i = 1, #vals, 1 do + local exprs = compile1(vals[i], scope, chunk, {nval = (((i < #vals) and 0) or nil), tail = (i == #vals)}) + keep_side_effects(exprs, chunk, nil, vals[i]) + end + allowed_globals = old_globals + utils.root.reset() + return flatten(chunk, opts) + end + local function compile_string(str, opts) + return compile_stream(parser["string-stream"](str), (opts or {})) + end + local function compile(ast, opts) + local opts0 = utils.copy(opts) + local old_globals = allowed_globals + local chunk = {} + local scope = (opts0.scope or make_scope(scopes.global)) + local _0_ = utils.root + _0_["set-reset"](_0_) + allowed_globals = opts0.allowedGlobals + if (opts0.indent == nil) then + opts0.indent = " " + end + if opts0.requireAsInclude then + scope.specials.require = require_include + end + utils.root.chunk, utils.root.scope, utils.root.options = chunk, scope, opts0 + local exprs = compile1(ast, scope, chunk, {tail = true}) + keep_side_effects(exprs, chunk, nil, ast) + allowed_globals = old_globals + utils.root.reset() + return flatten(chunk, opts0) + end + local function traceback_frame(info) + if ((info.what == "C") and info.name) then + return (" [C]: in function '%s'"):format(info.name) + elseif (info.what == "C") then + return " [C]: in ?" + else + local remap = fennel_sourcemap[info.source] + if (remap and remap[info.currentline]) then + info["short-src"] = remap["short-src"] + info.currentline = remap[info.currentline] + end + if (info.what == "Lua") then + local function _1_() + if info.name then + return ("'" .. info.name .. "'") + else + return "?" + end + end + return string.format(" %s:%d: in function %s", info.short_src, info.currentline, _1_()) + elseif (info["short-src"] == "(tail call)") then + return " (tail call)" + else + return string.format(" %s:%d: in main chunk", info.short_src, info.currentline) + end + end + end + local function traceback(msg, start) + local msg0 = (msg or "") + if ((msg0:find("^Compile error") or msg0:find("^Parse error")) and not utils["debug-on"]("trace")) then + return msg0 + else + local lines = {} + if (msg0:find("^Compile error") or msg0:find("^Parse error")) then + table.insert(lines, msg0) + else + local newmsg = msg0:gsub("^[^:]*:%d+:%s+", "runtime error: ") + table.insert(lines, newmsg) + end + table.insert(lines, "stack traceback:") + local done_3f, level = false, (start or 2) + while not done_3f do + do + local _1_0 = debug.getinfo(level, "Sln") + if (_1_0 == nil) then + done_3f = true + elseif (nil ~= _1_0) then + local info = _1_0 + table.insert(lines, traceback_frame(info)) + end + end + level = (level + 1) + end + return table.concat(lines, "\n") + end + end + local function entry_transform(fk, fv) + local function _0_(k, v) + if (type(k) == "number") then + return k, fv(v) + else + return fk(k), fv(v) + end + end + return _0_ + end + local function no() + return nil + end + local function mixed_concat(t, joiner) + local seen = {} + local ret, s = "", "" + for k, v in ipairs(t) do + table.insert(seen, k) + ret = (ret .. s .. v) + s = joiner + end + for k, v in utils.stablepairs(t) do + if not seen[k] then + ret = (ret .. s .. "[" .. k .. "]" .. "=" .. v) + s = joiner + end + end + return ret + end + local function do_quote(form, scope, parent, runtime) + local function q(x) + return do_quote(x, scope, parent, runtime) + end + if utils["is-varg"](form) then + assert_compile(not runtime, "quoted ... may only be used at compile time", form) + return "_VARARG" + elseif utils["is-sym"](form) then + local filename = nil + if form.filename then + filename = ("%q"):format(form.filename) + else + filename = "nil" + end + local symstr = utils.deref(form) + assert_compile(not runtime, "symbols may only be used at compile time", form) + if (symstr:find("#$") or symstr:find("#[:.]")) then + return ("sym('%s', nil, {filename=%s, line=%s})"):format(autogensym(symstr, scope), filename, (form.line or "nil")) + else + return ("sym('%s', nil, {quoted=true, filename=%s, line=%s})"):format(symstr, filename, (form.line or "nil")) + end + elseif (utils["is-list"](form) and utils["is-sym"](form[1]) and (utils.deref(form[1]) == "unquote")) then + local payload = form[2] + local res = unpack(compile1(payload, scope, parent)) + return res[1] + elseif utils["is-list"](form) then + local mapped = utils.kvmap(form, entry_transform(no, q)) + local filename = nil + if form.filename then + filename = ("%q"):format(form.filename) + else + filename = "nil" + end + assert_compile(not runtime, "lists may only be used at compile time", form) + return (("setmetatable({filename=%s, line=%s, bytestart=%s, %s}" .. ", getmetatable(list()))")):format(filename, (form.line or "nil"), (form.bytestart or "nil"), mixed_concat(mapped, ", ")) + elseif (type(form) == "table") then + local mapped = utils.kvmap(form, entry_transform(q, q)) + local source = getmetatable(form) + local filename = nil + if source.filename then + filename = ("%q"):format(source.filename) + else + filename = "nil" + end + local function _1_() + if source then + return source.line + else + return "nil" + end + end + return ("setmetatable({%s}, {filename=%s, line=%s})"):format(mixed_concat(mapped, ", "), filename, _1_()) + elseif (type(form) == "string") then + return serialize_string(form) + else + return tostring(form) + end + end + return {["apply-manglings"] = apply_manglings, ["compile-stream"] = compile_stream, ["compile-string"] = compile_string, ["declare-local"] = declare_local, ["do-quote"] = do_quote, ["global-mangling"] = global_mangling, ["global-unmangling"] = global_unmangling, ["keep-side-effects"] = keep_side_effects, ["make-scope"] = make_scope, ["require-include"] = require_include, ["symbol-to-expression"] = symbol_to_expression, assert = assert_compile, autogensym = autogensym, compile = compile, compile1 = compile1, destructure = destructure, emit = emit, gensym = gensym, macroexpand = macroexpand_2a, metadata = make_metadata(), scopes = scopes, traceback = traceback} +end +package.preload["fennel.friend"] = package.preload["fennel.friend"] or function(...) + local function ast_source(ast) + local m = getmetatable(ast) + if (m and m.line and m) then + return m + else + return ast + end + end + local suggestions = {["$ and $... in hashfn are mutually exclusive"] = {"modifying the hashfn so it only contains $... or $, $1, $2, $3, etc"}, ["can't start multisym segment with a digit"] = {"removing the digit", "adding a non-digit before the digit"}, ["cannot call literal value"] = {"checking for typos", "checking for a missing function name"}, ["could not compile value of type "] = {"debugging the macro you're calling not to return a coroutine or userdata"}, ["could not read number (.*)"] = {"removing the non-digit character", "beginning the identifier with a non-digit if it is not meant to be a number"}, ["expected a function.* to call"] = {"removing the empty parentheses", "using square brackets if you want an empty table"}, ["expected binding table"] = {"placing a table here in square brackets containing identifiers to bind"}, ["expected body expression"] = {"putting some code in the body of this form after the bindings"}, ["expected each macro to be function"] = {"ensuring that the value for each key in your macros table contains a function", "avoid defining nested macro tables"}, ["expected even number of name/value bindings"] = {"finding where the identifier or value is missing"}, ["expected even number of values in table literal"] = {"removing a key", "adding a value"}, ["expected local"] = {"looking for a typo", "looking for a local which is used out of its scope"}, ["expected macros to be table"] = {"ensuring your macro definitions return a table"}, ["expected parameters"] = {"adding function parameters as a list of identifiers in brackets"}, ["expected rest argument before last parameter"] = {"moving & to right before the final identifier when destructuring"}, ["expected symbol for function parameter: (.*)"] = {"changing %s to an identifier instead of a literal value"}, ["expected var (.*)"] = {"declaring %s using var instead of let/local", "introducing a new local instead of changing the value of %s"}, ["expected vararg as last parameter"] = {"moving the \"...\" to the end of the parameter list"}, ["expected whitespace before opening delimiter"] = {"adding whitespace"}, ["global (.*) conflicts with local"] = {"renaming local %s"}, ["illegal character: (.)"] = {"deleting or replacing %s", "avoiding reserved characters like \", \\, ', ~, ;, @, `, and comma"}, ["local (.*) was overshadowed by a special form or macro"] = {"renaming local %s"}, ["macro not found in macro module"] = {"checking the keys of the imported macro module's returned table"}, ["macro tried to bind (.*) without gensym"] = {"changing to %s# when introducing identifiers inside macros"}, ["malformed multisym"] = {"ensuring each period or colon is not followed by another period or colon"}, ["may only be used at compile time"] = {"moving this to inside a macro if you need to manipulate symbols/lists", "using square brackets instead of parens to construct a table"}, ["method must be last component"] = {"using a period instead of a colon for field access", "removing segments after the colon", "making the method call, then looking up the field on the result"}, ["mismatched closing delimiter (.), expected (.)"] = {"replacing %s with %s", "deleting %s", "adding matching opening delimiter earlier"}, ["multisym method calls may only be in call position"] = {"using a period instead of a colon to reference a table's fields", "putting parens around this"}, ["unable to bind (.*)"] = {"replacing the %s with an identifier"}, ["unexpected closing delimiter (.)"] = {"deleting %s", "adding matching opening delimiter earlier"}, ["unexpected multi symbol (.*)"] = {"removing periods or colons from %s"}, ["unexpected vararg"] = {"putting \"...\" at the end of the fn parameters if the vararg was intended"}, ["unknown global in strict mode: (.*)"] = {"looking to see if there's a typo", "using the _G table instead, eg. _G.%s if you really want a global", "moving this code to somewhere that %s is in scope", "binding %s as a local in the scope of this code"}, ["unused local (.*)"] = {"fixing a typo so %s is used", "renaming the local to _%s"}, ["use of global (.*) is aliased by a local"] = {"renaming local %s", "refer to the global using _G.%s instead of directly"}} + local unpack = (_G.unpack or table.unpack) + local function suggest(msg) + local suggestion = nil + for pat, sug in pairs(suggestions) do + local matches = {msg:match(pat)} + if (0 < #matches) then + if ("table" == type(sug)) then + local out = {} + for _, s in ipairs(sug) do + table.insert(out, s:format(unpack(matches))) + end + suggestion = out + else + suggestion = sug(matches) + end + end + end + return suggestion + end + local function read_line_from_file(filename, line) + local bytes = 0 + local f = assert(io.open(filename)) + local _ = nil + for _0 = 1, (line - 1) do + bytes = (bytes + 1 + #f:read()) + end + _ = nil + local codeline = f:read() + f:close() + return codeline, bytes + end + local function read_line_from_source(source, line) + local lines, bytes, codeline = 0, 0 + for this_line, newline in string.gmatch((source .. "\n"), "(.-)(\13?\n)") do + lines = (lines + 1) + if (lines == line) then + codeline = this_line + break + end + bytes = (bytes + #newline + #this_line) + end + return codeline, bytes + end + local function read_line(filename, line, source) + if source then + return read_line_from_source(source, line) + else + return read_line_from_file(filename, line) + end + end + local function friendly_msg(msg, _0_0, source) + local _1_ = _0_0 + local byteend = _1_["byteend"] + local bytestart = _1_["bytestart"] + local filename = _1_["filename"] + local line = _1_["line"] + local ok, codeline, bol, eol = pcall(read_line, filename, line, source) + local suggestions0 = suggest(msg) + local out = {msg, ""} + if (ok and codeline) then + table.insert(out, codeline) + end + if (ok and codeline and bytestart and byteend) then + table.insert(out, (string.rep(" ", (bytestart - bol - 1)) .. "^" .. string.rep("^", math.min((byteend - bytestart), ((bol + #codeline) - bytestart))))) + end + if (ok and codeline and bytestart and not byteend) then + table.insert(out, (string.rep("-", (bytestart - bol - 1)) .. "^")) + table.insert(out, "") + end + if suggestions0 then + for _, suggestion in ipairs(suggestions0) do + table.insert(out, ("* Try %s."):format(suggestion)) + end + end + return table.concat(out, "\n") + end + local function assert_compile(condition, msg, ast, source) + if not condition then + local _1_ = ast_source(ast) + local filename = _1_["filename"] + local line = _1_["line"] + error(friendly_msg(("Compile error in %s:%s\n %s"):format((filename or "unknown"), (line or "?"), msg), ast_source(ast), source), 0) + end + return condition + end + local function parse_error(msg, filename, line, bytestart, source) + return error(friendly_msg(("Parse error in %s:%s\n %s"):format(filename, line, msg), {bytestart = bytestart, filename = filename, line = line}, source), 0) + end + return {["assert-compile"] = assert_compile, ["parse-error"] = parse_error} +end +package.preload["fennel.parser"] = package.preload["fennel.parser"] or function(...) + local utils = require("fennel.utils") + local friend = require("fennel.friend") + local unpack = (_G.unpack or table.unpack) + local function granulate(getchunk) + local c = "" + local index = 1 + local done = false + local function _0_(parser_state) + if not done then + if (index <= #c) then + local b = c:byte(index) + index = (index + 1) + return b + else + c = getchunk(parser_state) + if (not c or (c == "")) then + done = true + return nil + end + index = 2 + return c:byte(1) + end + end + end + local function _1_() + c = "" + return nil + end + return _0_, _1_ + end + local function string_stream(str) + local str0 = str:gsub("^#![^\n]*\n", "") + local index = 1 + local function _0_() + local r = str0:byte(index) + index = (index + 1) + return r + end + return _0_ + end + local delims = {[123] = 125, [125] = true, [40] = 41, [41] = true, [91] = 93, [93] = true} + local function iswhitespace(b) + return ((b == 32) or ((b >= 9) and (b <= 13))) + end + local function issymbolchar(b) + return ((b > 32) and not delims[b] and (b ~= 127) and (b ~= 34) and (b ~= 39) and (b ~= 126) and (b ~= 59) and (b ~= 44) and (b ~= 64) and (b ~= 96)) + end + local prefixes = {[35] = "hashfn", [39] = "quote", [44] = "unquote", [96] = "quote"} + local function parser(getbyte, filename, options) + local stack = {} + local line = 1 + local byteindex = 0 + local lastb = nil + local function ungetb(ub) + if (ub == 10) then + line = (line - 1) + end + byteindex = (byteindex - 1) + lastb = ub + return nil + end + local function getb() + local r = nil + if lastb then + r, lastb = lastb, nil + else + r = getbyte({["stack-size"] = #stack}) + end + byteindex = (byteindex + 1) + if (r == 10) then + line = (line + 1) + end + return r + end + local function parse_error(msg) + local _0_ = (utils.root.options or {}) + local source = _0_["source"] + local unfriendly = _0_["unfriendly"] + utils.root.reset() + if unfriendly then + return error(("Parse error in %s:%s: %s"):format((filename or "unknown"), (line or "?"), msg), 0) + else + return friend["parse-error"](msg, (filename or "unknown"), (line or "?"), byteindex, source) + end + end + local function parse_stream() + local whitespace_since_dispatch, done, retval = true + local function dispatch(v) + if (#stack == 0) then + retval = v + done = true + whitespace_since_dispatch = false + return nil + elseif stack[#stack].prefix then + local stacktop = stack[#stack] + stack[#stack] = nil + return dispatch(utils.list(utils.sym(stacktop.prefix), v)) + else + whitespace_since_dispatch = false + return table.insert(stack[#stack], v) + end + end + local function badend() + local accum = utils.map(stack, "closer") + return parse_error(("expected closing delimiter%s %s"):format((((#stack == 1) and "") or "s"), string.char(unpack(accum)))) + end + while true do + local b = nil + while true do + b = getb() + if (b and iswhitespace(b)) then + whitespace_since_dispatch = true + end + if (not b or not iswhitespace(b)) then + break + end + end + if not b then + if (#stack > 0) then + badend() + end + return nil + end + if (b == 59) then + while true do + b = getb() + if (not b or (b == 10)) then + break + end + end + elseif (type(delims[b]) == "number") then + if not whitespace_since_dispatch then + parse_error(("expected whitespace before opening delimiter " .. string.char(b))) + end + table.insert(stack, setmetatable({bytestart = byteindex, closer = delims[b], filename = filename, line = line}, getmetatable(utils.list()))) + elseif delims[b] then + if (#stack == 0) then + parse_error(("unexpected closing delimiter " .. string.char(b))) + end + local last = stack[#stack] + local val = nil + if (last.closer ~= b) then + parse_error(("mismatched closing delimiter " .. string.char(b) .. ", expected " .. string.char(last.closer))) + end + last.byteend = byteindex + if (b == 41) then + val = last + elseif (b == 93) then + val = utils.sequence(unpack(last)) + for k, v in pairs(last) do + getmetatable(val)[k] = v + end + else + if ((#last % 2) ~= 0) then + byteindex = (byteindex - 1) + parse_error("expected even number of values in table literal") + end + val = {} + setmetatable(val, last) + for i = 1, #last, 2 do + if ((tostring(last[i]) == ":") and utils["is-sym"](last[(i + 1)]) and utils["is-sym"](last[i])) then + last[i] = tostring(last[(i + 1)]) + end + val[last[i]] = last[(i + 1)] + end + end + stack[#stack] = nil + dispatch(val) + elseif (b == 34) then + local state = "base" + local chars = {34} + stack[(#stack + 1)] = {closer = 34} + while true do + b = getb() + chars[(#chars + 1)] = b + if (state == "base") then + if (b == 92) then + state = "backslash" + elseif (b == 34) then + state = "done" + end + else + state = "base" + end + if (not b or (state == "done")) then + break + end + end + if not b then + badend() + end + stack[#stack] = nil + local raw = string.char(unpack(chars)) + local formatted = nil + local function _2_(c) + return ("\\" .. c:byte()) + end + formatted = raw:gsub("[\1-\31]", _2_) + local load_fn = (_G.loadstring or load)(("return %s"):format(formatted)) + dispatch(load_fn()) + elseif prefixes[b] then + table.insert(stack, {prefix = prefixes[b]}) + local nextb = getb() + if iswhitespace(nextb) then + if (b ~= 35) then + parse_error("invalid whitespace after quoting prefix") + end + stack[#stack] = nil + dispatch(utils.sym("#")) + end + ungetb(nextb) + elseif (issymbolchar(b) or (b == string.byte("~"))) then + local chars = {} + local bytestart = byteindex + while true do + chars[(#chars + 1)] = b + b = getb() + if (not b or not issymbolchar(b)) then + break + end + end + if b then + ungetb(b) + end + local rawstr = string.char(unpack(chars)) + if (rawstr == "true") then + dispatch(true) + elseif (rawstr == "false") then + dispatch(false) + elseif (rawstr == "...") then + dispatch(utils.varg()) + elseif rawstr:match("^:.+$") then + dispatch(rawstr:sub(2)) + elseif (rawstr:match("^~") and (rawstr ~= "~=")) then + parse_error("illegal character: ~") + else + local force_number = rawstr:match("^%d") + local number_with_stripped_underscores = rawstr:gsub("_", "") + local x = nil + if force_number then + x = (tonumber(number_with_stripped_underscores) or parse_error(("could not read number \"" .. rawstr .. "\""))) + else + x = tonumber(number_with_stripped_underscores) + if not x then + if rawstr:match("%.[0-9]") then + byteindex = (((byteindex - #rawstr) + rawstr:find("%.[0-9]")) + 1) + parse_error(("can't start multisym segment " .. "with a digit: " .. rawstr)) + elseif (rawstr:match("[%.:][%.:]") and (rawstr ~= "..") and (rawstr ~= "$...")) then + byteindex = ((byteindex - #rawstr) + 1 + rawstr:find("[%.:][%.:]")) + parse_error(("malformed multisym: " .. rawstr)) + elseif rawstr:match(":.+[%.:]") then + byteindex = ((byteindex - #rawstr) + rawstr:find(":.+[%.:]")) + parse_error(("method must be last component " .. "of multisym: " .. rawstr)) + else + x = utils.sym(rawstr, nil, {byteend = byteindex, bytestart = bytestart, filename = filename, line = line}) + end + end + end + dispatch(x) + end + else + parse_error(("illegal character: " .. string.char(b))) + end + if done then + break + end + end + return true, retval + end + local function _0_() + stack = {} + return nil + end + return parse_stream, _0_ + end + return {["string-stream"] = string_stream, granulate = granulate, parser = parser} +end +local utils = nil +package.preload["fennel.utils"] = package.preload["fennel.utils"] or function(...) + local function stablepairs(t) + local keys = {} + local succ = {} + for k in pairs(t) do + table.insert(keys, k) + end + local function _0_(a, b) + return (tostring(a) < tostring(b)) + end + table.sort(keys, _0_) + for i, k in ipairs(keys) do + succ[k] = keys[(i + 1)] + end + local function stablenext(tbl, idx) + if (idx == nil) then + return keys[1], tbl[keys[1]] + else + return succ[idx], tbl[succ[idx]] + end + end + return stablenext, t, nil + end + local function map(t, f, out) + local out0 = (out or {}) + local f0 = nil + if (type(f) == "function") then + f0 = f + else + local s = f + local function _0_(x) + return x[s] + end + f0 = _0_ + end + for _, x in ipairs(t) do + local _1_0 = f0(x) + if (nil ~= _1_0) then + local v = _1_0 + table.insert(out0, v) + end + end + return out0 + end + local function kvmap(t, f, out) + local out0 = (out or {}) + local f0 = nil + if (type(f) == "function") then + f0 = f + else + local s = f + local function _0_(x) + return x[s] + end + f0 = _0_ + end + for k, x in stablepairs(t) do + local korv, v = f0(k, x) + if (korv and not v) then + table.insert(out0, korv) + end + if (korv and v) then + out0[korv] = v + end + end + return out0 + end + local function copy(from) + local to = {} + for k, v in pairs((from or {})) do + to[k] = v + end + return to + end + local function allpairs(tbl) + assert((type(tbl) == "table"), "allpairs expects a table") + local t = tbl + local seen = {} + local function allpairs_next(_, state) + local next_state, value = next(t, state) + if seen[next_state] then + return allpairs_next(nil, next_state) + elseif next_state then + seen[next_state] = true + return next_state, value + else + local meta = getmetatable(t) + if (meta and meta.__index) then + t = meta.__index + return allpairs_next(t) + end + end + end + return allpairs_next + end + local function deref(self) + return self[1] + end + local nil_sym = nil + local function list_to_string(self, tostring2) + local safe, max = {}, 0 + for k in pairs(self) do + if ((type(k) == "number") and (k > max)) then + max = k + end + end + for i = 1, max, 1 do + safe[i] = (((self[i] == nil) and nil_sym) or self[i]) + end + return ("(" .. table.concat(map(safe, (tostring2 or tostring)), " ", 1, max) .. ")") + end + local SYMBOL_MT = {"SYMBOL", __fennelview = deref, __tostring = deref} + local EXPR_MT = {"EXPR", __tostring = deref} + local LIST_MT = {"LIST", __fennelview = list_to_string, __tostring = list_to_string} + local SEQUENCE_MARKER = {"SEQUENCE"} + local VARARG = setmetatable({"..."}, {"VARARG", __fennelview = deref, __tostring = deref}) + local getenv = nil + local function _0_() + return nil + end + getenv = ((os and os.getenv) or _0_) + local function debug_on(flag) + local level = (getenv("FENNEL_DEBUG") or "") + return ((level == "all") or level:find(flag)) + end + local function list(...) + return setmetatable({...}, LIST_MT) + end + local function sym(str, scope, source) + local s = {str, scope = scope} + for k, v in pairs((source or {})) do + if (type(k) == "string") then + s[k] = v + end + end + return setmetatable(s, SYMBOL_MT) + end + nil_sym = sym("nil") + local function sequence(...) + return setmetatable({...}, {sequence = SEQUENCE_MARKER}) + end + local function expr(strcode, etype) + return setmetatable({strcode, type = etype}, EXPR_MT) + end + local function varg() + return VARARG + end + local function is_expr(x) + return ((type(x) == "table") and (getmetatable(x) == EXPR_MT) and x) + end + local function is_varg(x) + return ((x == VARARG) and x) + end + local function is_list(x) + return ((type(x) == "table") and (getmetatable(x) == LIST_MT) and x) + end + local function is_sym(x) + return ((type(x) == "table") and (getmetatable(x) == SYMBOL_MT) and x) + end + local function is_table(x) + return ((type(x) == "table") and (x ~= VARARG) and (getmetatable(x) ~= LIST_MT) and (getmetatable(x) ~= SYMBOL_MT) and x) + end + local function is_sequence(x) + local mt = ((type(x) == "table") and getmetatable(x)) + return (mt and (mt.sequence == SEQUENCE_MARKER) and x) + end + local function is_multi_sym(str) + if is_sym(str) then + return is_multi_sym(tostring(str)) + elseif (type(str) ~= "string") then + return false + else + local parts = {} + for part in str:gmatch("[^%.%:]+[%.%:]?") do + local last_char = part:sub(( - 1)) + if (last_char == ":") then + parts["multi-sym-method-call"] = true + end + if ((last_char == ":") or (last_char == ".")) then + parts[(#parts + 1)] = part:sub(1, ( - 2)) + else + parts[(#parts + 1)] = part + end + end + return ((#parts > 0) and (str:match("%.") or str:match(":")) and not str:match("%.%.") and (str:byte() ~= string.byte(".")) and (str:byte(( - 1)) ~= string.byte(".")) and parts) + end + end + local function is_quoted(symbol) + return symbol.quoted + end + local function walk_tree(root, f, custom_iterator) + local function walk(iterfn, parent, idx, node) + if f(idx, node, parent) then + for k, v in iterfn(node) do + walk(iterfn, node, k, v) + end + return nil + end + end + walk((custom_iterator or pairs), nil, nil, root) + return root + end + local lua_keywords = {"and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"} + for i, v in ipairs(lua_keywords) do + lua_keywords[v] = i + end + local function is_valid_lua_identifier(str) + return (str:match("^[%a_][%w_]*$") and not lua_keywords[str]) + end + local propagated_options = {"allowedGlobals", "indent", "correlate", "useMetadata", "env"} + local function propagate_options(options, subopts) + for _, name in ipairs(propagated_options) do + subopts[name] = options[name] + end + return subopts + end + local root = nil + local function _1_() + end + root = {chunk = nil, options = nil, reset = _1_, scope = nil} + root["set-reset"] = function(new_root) + root.reset = function() + root.chunk, root.scope, root.options, root.reset = new_root.chunk, new_root.scope, new_root.options, new_root.reset + return nil + end + return root.reset + end + local _3_ + do + local _2_0 = {"./?.fnl", "./?/init.fnl"} + table.insert(_2_0, getenv("FENNEL_PATH")) + _3_ = _2_0 + end + return {["debug-on"] = debug_on, ["is-expr"] = is_expr, ["is-list"] = is_list, ["is-multi-sym"] = is_multi_sym, ["is-quoted"] = is_quoted, ["is-sequence"] = is_sequence, ["is-sym"] = is_sym, ["is-table"] = is_table, ["is-valid-lua-identifier"] = is_valid_lua_identifier, ["is-varg"] = is_varg, ["lua-keywords"] = lua_keywords, ["propagate-options"] = propagate_options, ["walk-tree"] = walk_tree, allpairs = allpairs, copy = copy, deref = deref, expr = expr, kvmap = kvmap, list = list, map = map, path = table.concat(_3_, ";"), root = root, sequence = sequence, stablepairs = stablepairs, sym = sym, varg = varg} +end +utils = require("fennel.utils") +local parser = require("fennel.parser") +local compiler = require("fennel.compiler") +local specials = require("fennel.specials") +local repl = require("fennel.repl") +local function eval(str, options, ...) + local opts = utils.copy(options) + local _ = nil + if ((opts.allowedGlobals == nil) and not getmetatable(opts.env)) then + opts.allowedGlobals = specials["current-global-names"](opts.env) + _ = nil + else + _ = nil + end + local env = (opts.env and specials["wrap-env"](opts.env)) + local lua_source = compiler["compile-string"](str, opts) + local loader = nil + local function _1_(...) + if opts.filename then + return ("@" .. opts.filename) + else + return str + end + end + loader = specials["load-code"](lua_source, env, _1_(...)) + opts.filename = nil + return loader(...) +end +local function dofile_2a(filename, options, ...) + local opts = utils.copy(options) + local f = assert(io.open(filename, "rb")) + local source = f:read("*all") + f:close() + opts.filename = filename + return eval(source, opts, ...) +end +local mod = {["compile-stream"] = compiler["compile-stream"], ["compile-string"] = compiler["compile-string"], ["load-code"] = specials["load-code"], ["macro-loaded"] = specials["macro-loaded"], ["make-searcher"] = specials["make-searcher"], ["search-module"] = specials["search-module"], ["string-stream"] = parser["string-stream"], compile = compiler.compile, compile1 = compiler.compile1, compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], doc = specials.doc, dofile = dofile_2a, eval = eval, gensym = compiler.gensym, granulate = parser.granulate, list = utils.list, loadCode = specials["load-code"], macroLoaded = specials["macro-loaded"], makeSearcher = specials["make-searcher"], make_searcher = specials["make-searcher"], mangle = compiler["global-mangling"], metadata = compiler.metadata, parser = parser.parser, path = utils.path, repl = repl, scope = compiler["make-scope"], searchModule = specials["search-module"], searcher = specials["make-searcher"](), stringStream = parser["string-stream"], sym = utils.sym, traceback = compiler.traceback, unmangle = compiler["global-unmangling"], varg = utils.varg, version = "0.5.0"} +utils["fennel-module"] = mod +do + local builtin_macros = [===[;; The code for these macros is somewhat idiosyncratic because it cannot use any + ;; macros which have not yet been defined. + + (fn -> [val ...] + "Thread-first macro. + Take the first value and splice it into the second form as its first argument. + The value of the second form is spliced into the first arg of the third, etc." + (var x val) + (each [_ e (ipairs [...])] + (let [elt (if (list? e) e (list e))] + (table.insert elt 2 x) + (set x elt))) + x) + + (fn ->> [val ...] + "Thread-last macro. + Same as ->, except splices the value into the last position of each form + rather than the first." + (var x val) + (each [_ e (pairs [...])] + (let [elt (if (list? e) e (list e))] + (table.insert elt x) + (set x elt))) + x) + + (fn -?> [val ...] + "Nil-safe thread-first macro. + Same as -> except will short-circuit with nil when it encounters a nil value." + (if (= 0 (select "#" ...)) + val + (let [els [...] + e (table.remove els 1) + el (if (list? e) e (list e)) + tmp (gensym)] + (table.insert el 2 tmp) + `(let [,tmp ,val] + (if ,tmp + (-?> ,el ,(unpack els)) + ,tmp))))) + + (fn -?>> [val ...] + "Nil-safe thread-last macro. + Same as ->> except will short-circuit with nil when it encounters a nil value." + (if (= 0 (select "#" ...)) + val + (let [els [...] + e (table.remove els 1) + el (if (list? e) e (list e)) + tmp (gensym)] + (table.insert el tmp) + `(let [,tmp ,val] + (if ,tmp + (-?>> ,el ,(unpack els)) + ,tmp))))) + + (fn doto [val ...] + "Evaluates val and splices it into the first argument of subsequent forms." + (let [name (gensym) + form `(let [,name ,val])] + (each [_ elt (pairs [...])] + (table.insert elt 2 name) + (table.insert form elt)) + (table.insert form name) + form)) + + (fn when [condition body1 ...] + "Evaluate body for side-effects only when condition is truthy." + (assert body1 "expected body") + `(if ,condition + (do ,body1 ,...))) + + (fn with-open [closable-bindings ...] + "Like `let`, but invokes (v:close) on each binding after evaluating the body. + The body is evaluated inside `xpcall` so that bound values will be closed upon + encountering an error before propagating it." + (let [bodyfn `(fn [] ,...) + closer `(fn close-handlers# [ok# ...] (if ok# ... + (error ... 0))) + traceback `(. (or package.loaded.fennel debug) :traceback)] + (for [i 1 (# closable-bindings) 2] + (assert (sym? (. closable-bindings i)) + "with-open only allows symbols in bindings") + (table.insert closer 4 `(: ,(. closable-bindings i) :close))) + `(let ,closable-bindings ,closer + (close-handlers# (xpcall ,bodyfn ,traceback))))) + + (fn partial [f ...] + "Returns a function with all arguments partially applied to f." + (let [body (list f ...)] + (table.insert body _VARARG) + `(fn [,_VARARG] ,body))) + + (fn pick-args [n f] + "Creates a function of arity n that applies its arguments to f. + + For example, + (pick-args 2 func) + expands to + (fn [_0_ _1_] (func _0_ _1_))" + (assert (and (= (type n) :number) (= n (math.floor n)) (>= n 0)) + "Expected n to be an integer literal >= 0.") + (let [bindings []] + (for [i 1 n] (tset bindings i (gensym))) + `(fn ,bindings (,f ,(unpack bindings))))) + + (fn pick-values [n ...] + "Like the `values` special, but emits exactly n values. + + For example, + (pick-values 2 ...) + expands to + (let [(_0_ _1_) ...] + (values _0_ _1_))" + (assert (and (= :number (type n)) (>= n 0) (= n (math.floor n))) + "Expected n to be an integer >= 0") + (let [let-syms (list) + let-values (if (= 1 (select :# ...)) ... `(values ,...))] + (for [i 1 n] (table.insert let-syms (gensym))) + (if (= n 0) `(values) + `(let [,let-syms ,let-values] (values ,(unpack let-syms)))))) + + (fn lambda [...] + "Function literal with arity checking. + Will throw an exception if a declared argument is passed in as nil, unless + that argument name begins with ?." + (let [args [...] + has-internal-name? (sym? (. args 1)) + arglist (if has-internal-name? (. args 2) (. args 1)) + docstring-position (if has-internal-name? 3 2) + has-docstring? (and (> (# args) docstring-position) + (= :string (type (. args docstring-position)))) + arity-check-position (- 4 (if has-internal-name? 0 1) + (if has-docstring? 0 1)) + empty-body? (< (# args) arity-check-position)] + (fn check! [a] + (if (table? a) + (each [_ a (pairs a)] + (check! a)) + (and (not (: (tostring a) :match "^?")) + (not= (tostring a) "&") + (not= (tostring a) "...")) + (table.insert args arity-check-position + `(assert (not= nil ,a) + (: "Missing argument %s on %s:%s" + :format ,(tostring a) + ,(or a.filename "unknown") + ,(or a.line "?")))))) + (assert (= :table (type arglist)) "expected arg list") + (each [_ a (ipairs arglist)] + (check! a)) + (if empty-body? + (table.insert args (sym :nil))) + `(fn ,(unpack args)))) + + (fn macro [name ...] + "Define a single macro." + (assert (sym? name) "expected symbol for macro name") + (local args [...]) + `(macros { ,(tostring name) (fn ,name ,(unpack args))})) + + (fn macrodebug [form return?] + "Print the resulting form after performing macroexpansion. + With a second argument, returns expanded form as a string instead of printing." + (let [(ok view) (pcall require :fennelview) + handle (if return? `do `print)] + `(,handle ,((if ok view tostring) (macroexpand form _SCOPE))))) + + (fn import-macros [binding1 module-name1 ...] + "Binds a table of macros from each macro module according to a binding form. + Each binding form can be either a symbol or a k/v destructuring table. + Example: + (import-macros mymacros :my-macros ; bind to symbol + {:macro1 alias : macro2} :proj.macros) ; import by name" + (assert (and binding1 module-name1 (= 0 (% (select :# ...) 2))) + "expected even number of binding/modulename pairs") + (for [i 1 (select :# binding1 module-name1 ...) 2] + (local (binding modname) (select i binding1 module-name1 ...)) + ;; generate a subscope of current scope, use require-macros + ;; to bring in macro module. after that, we just copy the + ;; macros from subscope to scope. + (local scope (get-scope)) + (local subscope (fennel.scope scope)) + (fennel.compile-string (string.format "(require-macros %q)" + modname) + {:scope subscope}) + (if (sym? binding) + ;; bind whole table of macros to table bound to symbol + (do (tset scope.macros (. binding 1) {}) + (each [k v (pairs subscope.macros)] + (tset (. scope.macros (. binding 1)) k v))) + + ;; 1-level table destructuring for importing individual macros + (table? binding) + (each [macro-name [import-key] (pairs binding)] + (assert (= :function (type (. subscope.macros macro-name))) + (.. "macro " macro-name " not found in module " modname)) + (tset scope.macros import-key (. subscope.macros macro-name))))) + nil) + + ;;; Pattern matching + + (fn match-pattern [vals pattern unifications] + "Takes the AST of values and a single pattern and returns a condition + to determine if it matches as well as a list of bindings to + introduce for the duration of the body if it does match." + ;; we have to assume we're matching against multiple values here until we + ;; know we're either in a multi-valued clause (in which case we know the # + ;; of vals) or we're not, in which case we only care about the first one. + (let [[val] vals] + (if (or (and (sym? pattern) ; unification with outer locals (or nil) + (not= :_ (tostring pattern)) ; never unify _ + (or (in-scope? pattern) + (= :nil (tostring pattern)))) + (and (multi-sym? pattern) + (in-scope? (. (multi-sym? pattern) 1)))) + (values `(= ,val ,pattern) []) + ;; unify a local we've seen already + (and (sym? pattern) + (. unifications (tostring pattern))) + (values `(= ,(. unifications (tostring pattern)) ,val) []) + ;; bind a fresh local + (sym? pattern) + (let [wildcard? (= (tostring pattern) "_")] + (if (not wildcard?) (tset unifications (tostring pattern) val)) + (values (if (or wildcard? (: (tostring pattern) :find "^?")) + true `(not= ,(sym :nil) ,val)) + [pattern val])) + ;; guard clause + (and (list? pattern) (sym? (. pattern 2)) (= :? (tostring (. pattern 2)))) + (let [(pcondition bindings) (match-pattern vals (. pattern 1) + unifications) + condition `(and ,pcondition)] + (for [i 3 (# pattern)] ; splice in guard clauses + (table.insert condition (. pattern i))) + (values `(let ,bindings ,condition) bindings)) + + ;; multi-valued patterns (represented as lists) + (list? pattern) + (let [condition `(and) + bindings []] + (each [i pat (ipairs pattern)] + (let [(subcondition subbindings) (match-pattern [(. vals i)] pat + unifications)] + (table.insert condition subcondition) + (each [_ b (ipairs subbindings)] + (table.insert bindings b)))) + (values condition bindings)) + ;; table patterns + (= (type pattern) :table) + (let [condition `(and (= (type ,val) :table)) + bindings []] + (each [k pat (pairs pattern)] + (if (and (sym? pat) (= "&" (tostring pat))) + (do (assert (not (. pattern (+ k 2))) + "expected rest argument before last parameter") + (table.insert bindings (. pattern (+ k 1))) + (table.insert bindings [`(select ,k ((or _G.unpack + table.unpack) + ,val))])) + (and (= :number (type k)) + (= "&" (tostring (. pattern (- k 1))))) + nil ; don't process the pattern right after &; already got it + (let [subval `(. ,val ,k) + (subcondition subbindings) (match-pattern [subval] pat + unifications)] + (table.insert condition subcondition) + (each [_ b (ipairs subbindings)] + (table.insert bindings b))))) + (values condition bindings)) + ;; literal value + (values `(= ,val ,pattern) [])))) + + (fn match-condition [vals clauses] + "Construct the actual `if` AST for the given match values and clauses." + (if (not= 0 (% (length clauses) 2)) ; treat odd final clause as default + (table.insert clauses (length clauses) (sym :_))) + (let [out `(if)] + (for [i 1 (length clauses) 2] + (let [pattern (. clauses i) + body (. clauses (+ i 1)) + (condition bindings) (match-pattern vals pattern {})] + (table.insert out condition) + (table.insert out `(let ,bindings ,body)))) + out)) + + (fn match-val-syms [clauses] + "How many multi-valued clauses are there? return a list of that many gensyms." + (let [syms (list (gensym))] + (for [i 1 (length clauses) 2] + (if (list? (. clauses i)) + (each [valnum (ipairs (. clauses i))] + (if (not (. syms valnum)) + (tset syms valnum (gensym)))))) + syms)) + + (fn match [val ...] + "Perform pattern matching on val. See reference for details." + (let [clauses [...] + vals (match-val-syms clauses)] + ;; protect against multiple evaluation of the value, bind against as + ;; many values as we ever match against in the clauses. + (list `let [vals val] + (match-condition vals clauses)))) + + {: -> : ->> : -?> : -?>> + : doto : when : with-open + : partial : lambda + : pick-args : pick-values + : macro : macrodebug : import-macros + : match} + ]===] + local module_name = "fennel.macros" + local _ = nil + local function _0_() + return mod + end + package.preload[module_name] = _0_ + _ = nil + local env = specials["make-compiler-env"](nil, compiler.scopes.compiler, {}) + local built_ins = eval(builtin_macros, {allowedGlobals = false, env = env, filename = "src/fennel/macros.fnl", moduleName = module_name, scope = compiler.scopes.compiler, useMetadata = true}) + for k, v in pairs(built_ins) do + compiler.scopes.global.macros[k] = v + end + compiler.scopes.global.macros["\206\187"] = compiler.scopes.global.macros.lambda + package.preload[module_name] = nil +end +return mod diff --git a/awesome/init.fnl b/awesome/init.fnl index 335262e..36bd220 100644 --- a/awesome/init.fnl +++ b/awesome/init.fnl @@ -645,6 +645,7 @@ ;; MPV wasn't centering right (when (= c.class "mpv") (awful.placement.centered c)) + (when (= c.class "imv") (awful.placement.centered c)) (awful.client.focus.byidx 1) ;; Rounded windows done right diff --git a/awesome/keybindings.fnl b/awesome/keybindings.fnl index 387156e..a28d5cf 100644 --- a/awesome/keybindings.fnl +++ b/awesome/keybindings.fnl @@ -104,7 +104,7 @@ ;; {:description "increase the number of columns" :group "layout"}) ||# ;; (awful.key [ modkey alt ] "l" (fn [] (awful.tag.incncol -1 nil true)) ||# ;; {:description "decrease the number of columns" :group "layout"}) ||# - (awful.key [ modkey ] "space" (fn [] (awful.layout.inc 1)) + (awful.key [ modkey alt ] "space" (fn [] (awful.layout.inc 1)) {:description "select next" :group "layout"}) (awful.key [ modkey shift ] "space" (fn [] (awful.layout.inc -1)) {:description "select previous" :group "layout"}) @@ -163,18 +163,18 @@ {:description "launch mu4e in new emacs frame" :group "apps" }) (awful.key [ modkey shift ] "Return" (fn [] (awful.spawn "emacsclient -c -e '(+eshell/frame)'")) {:description "launch eshell in new emacs frame" :group "apps" }) - (awful.key [ modkey ] "e" (fn [] (awful.spawn "emacsclient -c -a 'emacs'")) + (awful.key [ modkey ] "e" (fn [] (awful.spawn "emacslof")) {:description "launch new emacs frame" :group "apps" }) (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-rbw")) {:description "select pass" :group "apps" }) (awful.key [ modkey shift ] "w" (fn [] (awful.spawn "libreoffice --writer")) {:description "Open Writer" :group "apps" }) - (awful.key [modkey] "b" (fn [] (awful.spawn "qutebrowser")) + (awful.key [modkey] "b" (fn [] (awful.spawn "qblof")) {:description "launch browser" :group "apps"}) ;; rofi (awful.key [] "Menu" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh")) {:description "launch rofi" :group "launcher"}) - (awful.key [modkey alt] "space" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh")) + (awful.key [modkey] "space" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/launcher.sh")) {:description "launch rofi" :group "launcher"}) (awful.key [modkey] "w" (fn [] (awful.spawn "/home/chris/.config/rofi/launchers-git/windows.sh")) {:description "launch rofi window switcher" :group "launcher"}) diff --git a/awesome/rules.fnl b/awesome/rules.fnl index 66614a4..d8374d4 100644 --- a/awesome/rules.fnl +++ b/awesome/rules.fnl @@ -84,9 +84,9 @@ :properties { :floating true :raise true - :height (dpi 600) - :width (dpi 900) - :placement (+ awful.placement.no_offscreen awful.placement.centered) + :height (dpi 800) + :width (dpi 1200) + :placement awful.placement.centered } } ;; Emacs diff --git a/eww/eww.scss b/eww/eww.scss new file mode 100644 index 0000000..e69de29 diff --git a/eww/eww.yuck b/eww/eww.yuck new file mode 100644 index 0000000..9fa69e8 --- /dev/null +++ b/eww/eww.yuck @@ -0,0 +1,12 @@ +(defwindow example + :monitor 0 + :geometry (geometry :x "0%" + :y "20px" + :width "90%" + :height "30px" + :anchor "top center") + :stacking "fg" + :reserve (struts :distance "40px" :side "top") + :windowtype "dock" + :wm-ignore false + "example content") diff --git a/firefox/chrome/chrome/navbar_tabs_oneliner_tabs_on_left.css b/firefox/chrome/chrome/navbar_tabs_oneliner_tabs_on_left.css index 383a0f4..d446889 100644 --- a/firefox/chrome/chrome/navbar_tabs_oneliner_tabs_on_left.css +++ b/firefox/chrome/chrome/navbar_tabs_oneliner_tabs_on_left.css @@ -95,7 +95,7 @@ the close button is positioned to the far right */ margin-right: calc(0px + var(--uc-navigationbar-width)); /* Remove empty space above tabs so that tabs are clickable at very top of screen */ margin-left: 10px; - margin-top: -20px !important; + margin-top: -30px !important; max-height: 20px !important; font-size: 13px !important; z-index: 10; @@ -152,6 +152,7 @@ the close button is positioned to the far right */ margin-left: calc(100vw - var(--uc-navigationbar-width)); margin-top: calc(0px - var(--uc-toolbar-height)); padding-right: calc(3 * 46px + var(--window-drag-space-width)); + } /* Hide dropdown placeholder */ @@ -164,10 +165,10 @@ the close button is positioned to the far right */ /*visibility: collapse !important;*/ min-height: 0px !important; max-height: 0px !important; - margin-top: -15px !important; + margin-top: -6px !important; margin-bottom: 14px !important; - margin-right: 200px !important; - margin-left: 200px !important; + margin-right: 70px !important; + margin-left: 70px !important; transition: all 300ms ease .5s !important; z-index: -5 !important; border-radius: 50px; @@ -180,7 +181,7 @@ the close button is positioned to the far right */ /*visibility: visible !important;*/ min-height: 32px !important; max-height: 32px !important; - margin-top: 5px !important; + margin-top: 14px !important; margin-bottom: -38px !important; transition: all 200ms ease 0s !important; z-index: 5 !important; @@ -190,7 +191,7 @@ the close button is positioned to the far right */ /* make urlbar rounded */ #urlbar{ - margin-top: 30px !important; + margin-top: 35px !important; padding-right: 10px !important; padding-left: 10px !important; } @@ -216,11 +217,11 @@ the close button is positioned to the far right */ } #nav-bar-customization-target{ - margin-top: -15px; + margin-top: -20px; } #nav-bar-overflow-button{ - margin-top: -15px !important; + margin-top: -20px !important; } #PanelUI-button{ - margin-top: -15px !important; + margin-top: -20px !important; } diff --git a/kanshi/config b/kanshi/config index 4c825e5..a2565ae 100644 --- a/kanshi/config +++ b/kanshi/config @@ -4,6 +4,6 @@ profile laptop { profile office { output eDP-1 mode 2256x1504 position 0,0 scale 1.5 - output DP-2 mode 1366x768 position 1500,0 scale 1 + output DP-4 mode 1366x768 position 1500,0 scale 1 exec notify-send 'office monitors setup' } \ No newline at end of file diff --git a/kmonad/config.kbd b/kmonad/config.kbd index 4bd7691..4e164b3 100644 --- a/kmonad/config.kbd +++ b/kmonad/config.kbd @@ -1,6 +1,6 @@ (defcfg ;; For Linux - input (device-file "/dev/input/by-id/usb-Razer_Razer_BlackWidow_Chroma-if01-event-kbd") + input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") output (uinput-sink "My KMonad output" ;; To understand the importance of the following line, see the section on ;; Compose-key sequences at the near-bottom of this file. @@ -23,11 +23,12 @@ ) (defsrc + esc mute vold volu prev pp next f7 f8 f9 f10 f11 f12 del grv 1 2 3 4 5 6 7 8 9 0 - = bspc tab q w e r t y u i o p [ ] \ - lctl a s d f g h j k l ; ' ret - lsft z x c v b n m , . / rsft - caps lmet lalt spc ralt rmet cmp rctl + caps a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft up + lctl fn lmet lalt spc ralt rctl left down rght ) (deflayer qwerty diff --git a/kmonad/config.org b/kmonad/config.org index 733111e..f88c5b2 100644 --- a/kmonad/config.org +++ b/kmonad/config.org @@ -136,7 +136,7 @@ #+begin_src common-lisp :tangle config.kbd (defcfg ;; For Linux - input (device-file "/dev/input/by-id/usb-Razer_Razer_BlackWidow_Chroma-if01-event-kbd") + input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") output (uinput-sink "My KMonad output" ;; To understand the importance of the following line, see the section on ;; Compose-key sequences at the near-bottom of this file. @@ -206,11 +206,13 @@ #+begin_src common-lisp :tangle config.kbd (defsrc + esc mute vold volu prev pp next f7 f8 f9 f10 sys f12 del grv 1 2 3 4 5 6 7 8 9 0 - = bspc tab q w e r t y u i o p [ ] \ - lctl a s d f g h j k l ; ' ret - lsft z x c v b n m , . / rsft - caps lmet lalt spc ralt rmet cmp rctl + caps a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft + lctl fn lmet lalt spc ralt rctl left up rght + down ) #+end_src diff --git a/libinput-gestures.conf b/libinput-gestures.conf index 2fa07ab..99affce 100644 --- a/libinput-gestures.conf +++ b/libinput-gestures.conf @@ -13,10 +13,10 @@ swipe_threshold 0 # Gestures gesture swipe up 3 ydotool key ctrl+F10 gesture swipe down 3 ydotool key ctrl+F10 -gesture swipe up 4 _internal ws_up -gesture swipe down 4 _internal ws_down -gesture swipe left 4 _internal ws_left -gesture swipe right 4 _internal ws_right +gesture swipe up 4 ydotool key alt+meta+k +gesture swipe down 4 ydotool key alt+meta+j +gesture swipe left 4 ydotool key alt+meta+h +gesture swipe right 4 ydotool key alt+meta+l gesture swipe left 3 ydotool key alt+Right gesture swipe right 3 ydotool key alt+Left gesture pinch clockwise 4 xdotool key XF86AudioRaiseVolume diff --git a/mako/config b/mako/config index 72ec838..bcc24f2 100644 --- a/mako/config +++ b/mako/config @@ -1,6 +1,6 @@ max-visible=3 anchor=bottom-center -font=VictorMono Nerd Font 14 +font=VictorMono Nerd Font 8 background-color=#282a36 border-size=0 text-color=#5af78e diff --git a/nyxt/glyphs.lisp b/nyxt/glyphs.lisp new file mode 100644 index 0000000..b974208 --- /dev/null +++ b/nyxt/glyphs.lisp @@ -0,0 +1,24 @@ +(in-package #:nyxt-user) + +;;allow setting glyphs +(define-configuration status-buffer + ((glyph-mode-presentation-p t))) + +;;various glyph settings with no additional configs +(define-configuration nyxt/force-https-mode:force-https-mode ((glyph "ϕ"))) +(define-configuration nyxt/blocker-mode:blocker-mode ((glyph "β"))) +(define-configuration nyxt/proxy-mode:proxy-mode ((glyph "π"))) +(define-configuration nyxt/reduce-tracking-mode:reduce-tracking-mode ((glyph "∅"))) +(define-configuration nyxt/certificate-exception-mode:certificate-exception-mode ((glyph "ɛ"))) +(define-configuration nyxt/style-mode:style-mode ((glyph "s"))) +(define-configuration nyxt/help-mode:help-mode ((glyph "?"))) + +;;configure web mode hints to home row and set glyph +(define-configuration nyxt/web-mode:web-mode + ((nyxt/web-mode:hints-alphabet "ASDFGHJKL") + (glyph "ω"))) + +;;auto-mode config and set glyph +(define-configuration nyxt/auto-mode:auto-mode + ((nyxt/auto-mode:prompt-on-mode-toggle t) + (glyph "α"))) diff --git a/nyxt/init.lisp b/nyxt/init.lisp index c1301a2..6063db7 100644 --- a/nyxt/init.lisp +++ b/nyxt/init.lisp @@ -1,6 +1,7 @@ (in-package #:nyxt-user) ; While implicit, this allows SLY to know which package we are in. (dolist (file (list (nyxt-init-file "slynk.lisp")))) +(dolist (file (list (nyxt-init-file "glyphs.lisp")))) (load-after-system :slynk (nyxt-init-file "slynk.lisp")) ;; (defvar *chris-prompt-keymap (make-keymap "chris-prompt-map")) @@ -105,7 +106,7 @@ :color "#e2e4e5" :line-height "1fr") ("#container" - :grid-template-columns "0px 4fr 0px 2fr 0px 0px") + :grid-template-columns "2fr 0px 0px") ("#controls" :background-color "#282a36" :color "#f3f99d" diff --git a/picom.conf b/picom.conf index 08bd010..9d42089 100644 --- a/picom.conf +++ b/picom.conf @@ -174,10 +174,10 @@ opacity-rule = [ "100:class_g = 'scribus'", "100:class_g = 'kdenlive'", "100:class_g = 'resolve'", - "100:class_g = 'OpenLP'", + # "100:class_g = 'OpenLP'", "100:class_g = 'firefox'", "100:class_g = 'Gimp-2.10'", - "100:class_g = 'dolphin'", + # "100:class_g = 'dolphin'", "100:class_g = 'mpv'", "100:class_g = 'libreoffice'", "100:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_FULLSCREEN'", @@ -251,6 +251,7 @@ blur-background-exclude = [ "class_g = 'slop'", "_GTK_FRAME_EXTENTS@:c", "class_g = 'soffice'", + "name = 'Display Window'", # "window_type = '_NET_WM_WINDOW_TYPE_NOTIFICATION'" "window_type = 'notification'" ]; diff --git a/qutebrowser/autoconfig.yml b/qutebrowser/autoconfig.yml index 391ae7f..5603814 100644 --- a/qutebrowser/autoconfig.yml +++ b/qutebrowser/autoconfig.yml @@ -12,12 +12,19 @@ settings: https://openweathermap.org: false content.media.audio_capture: https://jitsi.tfcconnection.org: true + https://staff.tfcconnection.org: true + content.media.audio_video_capture: + global: ask + https://jitsi.tfcconnection.org: true + https://staff.tfcconnection.org: true content.media.video_capture: https://jitsi.tfcconnection.org: true + https://staff.tfcconnection.org: true content.notifications.enabled: https://jelly.cochrun.xyz: true https://nc.cochrun.xyz: false https://staff.tfcconnection.org: true + https://teams.microsoft.com: true https://toolbox.iskysoft.com: false https://www.facebook.com: false https://www.g2a.com: false diff --git a/qutebrowser/config.py b/qutebrowser/config.py index 8bc3a27..5645e34 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -2482,7 +2482,7 @@ config.bind("o", "set-cmd-text -s :open") # config.bind('y', 'prompt-accept yes', mode='yesno') ## Bindings for MPV and YTDL -config.bind("v", "hint links spawn --detach mpv --profile=fast --force-window yes {hint-url}") +config.bind("v", 'hint links spawn --detach mpv --profile=fast --force-window yes "{hint-url}"') config.bind("gv", "spawn --detach mpv --profile=fast --force-window yes --ytdl=bestvideo[height<=?720][fps<=?30]+bestaudio/best \'{url}\'") config.bind("gc", 'spawn org-capture "{url}"') config.bind( diff --git a/qutebrowser/qsettings/QtProject.conf b/qutebrowser/qsettings/QtProject.conf index 63ddc4a..8bb9d75 100644 --- a/qutebrowser/qsettings/QtProject.conf +++ b/qutebrowser/qsettings/QtProject.conf @@ -1,6 +1,6 @@ [FileDialog] -history=file:///home/chris, file:///home/chris/nextcloud/tfc/Documents -lastVisited=file:///home/chris/nextcloud/tfc/Documents +history=file:///home/chris, file:///home/chris/nextcloud/tfc/Documents, file:///home/chris/Videos, file:///home/chris/Downloads +lastVisited=file:///home/chris/Downloads qtVersion=5.15.2 shortcuts=file:, file:///home/chris, file:///home/chris/storage/tfc sidebarWidth=116 diff --git a/qutebrowser/quickmarks b/qutebrowser/quickmarks index efc3db7..e1ff631 100644 --- a/qutebrowser/quickmarks +++ b/qutebrowser/quickmarks @@ -23,3 +23,4 @@ tnc https://staff.tfcconnection.org/apps/dashboard/ nc https://nc.cochrun.xyz/apps/files/ oml https://outlook.live.com/mail/0/inbox stb https://table.tfcconnection.org/ +tms https://teams.microsoft.com/_#/conversations/General diff --git a/river/init b/river/init index 140e5c1..460ef04 100755 --- a/river/init +++ b/river/init @@ -14,9 +14,10 @@ mod="Mod4" riverctl map normal $mod Return spawn alacritty riverctl map normal $mod E spawn "emacsclient -c -a 'emacs'" riverctl map normal $mod B spawn qutebrowser -riverctl map normal $mod+Mod1 space spawn "wofi --show drun" +riverctl map normal $mod space spawn "wofi --show drun" riverctl map normal $mod Menu spawn "wofi --show run" -riverctl map normal $mod P spawn rofi-rbw +riverctl map normal $mod P spawn "wlrofi-rbw" +riverctl map normal $mod W spawn "wofi-window" riverctl map normal $mod+Control M spawn "makoctl dismiss -a" @@ -105,7 +106,7 @@ riverctl map normal $mod 0 set-focused-tags $all_tags riverctl map normal $mod+Shift 0 set-view-tags $all_tags # Mod+Space to toggle float -riverctl map normal $mod Space toggle-float +riverctl map normal $mod+Mod1 Space toggle-float # Mod+F to toggle fullscreen riverctl map normal $mod F toggle-fullscreen @@ -148,8 +149,8 @@ do riverctl map $mode None XF86AudioNext spawn playerctl next # Control screen backlight brighness with light (https://github.com/haikarainen/light) - riverctl map $mode None XF86MonBrightnessUp spawn light -A 5 - riverctl map $mode None XF86MonBrightnessDown spawn light -U 5 + riverctl map $mode None XF86MonBrightnessUp spawn brightnessctl set +5% + riverctl map $mode None XF86MonBrightnessDown spawn brightnessctl set 5%- done # Set repeat rate @@ -166,7 +167,7 @@ riverctl csd-filter-add "gedit" # riverctl csd-filter-add "emacs" # apps to hide decorations -# riverctl csd-filter-remove "emacs" +riverctl csd-filter-remove "emacs" # Set opacity and fade effect # riverctl opacity 0.95 0.45 0.0 0.1 20 @@ -175,15 +176,16 @@ riverctl csd-filter-add "gedit" riverctl xcursor-theme breeze-snow #set the decos -riverctl border-width 1 +riverctl border-width 0 # set pointer speed -riverctl input 1118:1997:Microsoft_Surface_Keyboard_Touchpad tap enabled -riverctl input 1118:1997:Microsoft_Surface_Keyboard_Touchpad natural-scroll enabled -riverctl input 1118:1997:Microsoft_Surface_Keyboard_Touchpad pointer-accel 0.5 +riverctl input 2362:628:PIXA3854:00_093A:0274_Touchpad tap enabled +riverctl input 2362:628:PIXA3854:00_093A:0274_Touchpad natural-scroll enabled +riverctl input 2362:628:PIXA3854:00_093A:0274_Touchpad pointer-accel 0.5 # Set layout -wlr-randr --output eDP-1 --pos 0,0 --scale 2 +# wlr-randr --output eDP-1 --pos 0,0 --scale 2 +riverctl spawn kanshi riverctl spawn 'nextcloud --background' riverctl spawn 'emacs --daemon' @@ -192,26 +194,25 @@ riverctl spawn rbw-agent # Turn on Waybar riverctl spawn 'export XDG_CURRENT_DESKTOP="Unity"' -riverctl spawn 'waybar' +riverctl spawn waybar riverctl spawn 'swaybg -i /usr/share/wallpapers/Flow/contents/images/5120x2880.jpg -m fill' +#rivertile +riverctl spawn rivertile +riverctl output-layout rivertile + # Use kile as my layout generator allows me to create really unique layouts # with an s-expression syntax -riverctl spawn kile -riverctl default-layout kile +# riverctl spawn kile +# riverctl default-layout kile # riverctl output-layout kile -read -r -d '' DECK <({generic})] - {exec}"; - threads: 0; - scroll-method: 0; - disable-history: false; - fullscreen: false; - hide-scrollbar: true; - columns: 2; - font: "VictorMono Nerd Font 14.0"; + icon-theme: "Papirus"; + terminal: "alacritty"; + sidebar-mode: true; + run-command: "bash -c {cmd}"; + run-list-command: "fish -c functions"; + display-drun: " "; + drun-display-format: "{name} [({generic})] - {exec}"; + threads: 0; + scroll-method: 0; + disable-history: false; } * { @@ -44,7 +39,7 @@ configuration { base0D: #57c7ff; base0E: #ff6ac1; base0F: #b2643c; - base00t: #282a36AA; + base00t: #282a3655; background-alt: @base02; } @@ -52,7 +47,7 @@ window { background-color: @base00t; text-color: @base05; transparency: "real"; - border-radius: 0; + border-radius: 16px; border: 0px; width: 60%; location: center; @@ -81,11 +76,11 @@ inputbar { } prompt { - enabled: true; - padding: 0px 6px 0px 5px; - background-color: @transparent; - text-color: @base05; - border: 0px; + enabled: true; + padding: 0px 6px 0px 5px; + background-color: @transparent; + text-color: @base05; + border: 0px; } entry { @@ -108,7 +103,7 @@ case-indicator { } sidebar { - border: 2px 0 0; + border: 2px 0 0; } mainbox { diff --git a/rofi/launchers-git/blurry.rasi b/rofi/launchers-git/blurry.rasi index 5579ba4..b67c50c 100644 --- a/rofi/launchers-git/blurry.rasi +++ b/rofi/launchers-git/blurry.rasi @@ -44,13 +44,14 @@ configuration { base0D: #57c7ff; base0E: #ff6ac1; base0F: #b2643c; - base00t: #282a36AA; + base00t: #282a3644; background-alt: @base02; } window { background-color: @base00t; text-color: @base05; + transparency: "real"; border-radius: 0px; border: 0px; width: 60%; diff --git a/rofi/launchers-git/desktop-rbw.rasi b/rofi/launchers-git/desktop-rbw.rasi new file mode 100644 index 0000000..17aca75 --- /dev/null +++ b/rofi/launchers-git/desktop-rbw.rasi @@ -0,0 +1,8 @@ +/*-*- mode: css; -*-*/ + + +configuration { + font: "VictorMono Nerd Font 14.0"; + show-icons: false; +} +@import "/home/chris/.config/rofi/config.rasi" diff --git a/rofi/launchers-git/desktop.rasi b/rofi/launchers-git/desktop.rasi index 5d44dc3..0b639a5 100644 --- a/rofi/launchers-git/desktop.rasi +++ b/rofi/launchers-git/desktop.rasi @@ -1,15 +1,8 @@ /*-*- mode: css; -*-*/ -/* - * - * Author : Aditya Shakya (adi1090x) - * Mail : adi1090x@gmail.com - * Github : @adi1090x - * Reddit : @adi1090x - * - */ configuration { font: "VictorMono Nerd Font 14.0"; + show-icons: true; } -@import "/home/chris/.config/rofi/launchers-git/blurry.rasi" +@import "/home/chris/.config/rofi/config.rasi" diff --git a/rofi/launchers-git/laptop-rbw.rasi b/rofi/launchers-git/laptop-rbw.rasi new file mode 100644 index 0000000..9c29e82 --- /dev/null +++ b/rofi/launchers-git/laptop-rbw.rasi @@ -0,0 +1,8 @@ +/*-*- mode: css; -*-*/ + + +configuration { + font: "VictorMono Nerd Font 22.0"; + show-icons: false; +} +@import "/home/chris/.config/rofi/config.rasi" \ No newline at end of file diff --git a/rofi/launchers-git/laptop.rasi b/rofi/launchers-git/laptop.rasi index a825a12..6b67a33 100644 --- a/rofi/launchers-git/laptop.rasi +++ b/rofi/launchers-git/laptop.rasi @@ -1,15 +1,8 @@ /*-*- mode: css; -*-*/ -/* - * - * Author : Aditya Shakya (adi1090x) - * Mail : adi1090x@gmail.com - * Github : @adi1090x - * Reddit : @adi1090x - * - */ configuration { - font: "VictorMono Nerd Font 28.0"; + font: "VictorMono Nerd Font 22.0"; + show-icons: true; } -@import "/home/chris/.config/rofi/launchers-git/blurry.rasi" +@import "/home/chris/.config/rofi/config.rasi" diff --git a/rofi/launchers-git/launcher.sh b/rofi/launchers-git/launcher.sh index 65f0ba1..c0649bd 100755 --- a/rofi/launchers-git/launcher.sh +++ b/rofi/launchers-git/launcher.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ $(hostname) = "syl" ]; then - style="desktop" + style="laptop" #echo "this is hidpi" else style="desktop" diff --git a/rofi/rofi.rasi b/rofi/rofi.rasi new file mode 100644 index 0000000..763857a --- /dev/null +++ b/rofi/rofi.rasi @@ -0,0 +1,192 @@ +/*-*- mode: css; -*-*/ +/** Configured For Applets **/ + + +configuration { + show-icons: true; + icon-theme: "Papirus"; + terminal: "alacritty"; + sidebar-mode: true; + run-command: "bash -c {cmd}"; + run-list-command: "fish -c functions"; + display-drun: " "; + drun-display-format: "{name} [({generic})] - {exec}"; + threads: 0; + scroll-method: 0; + disable-history: false; + font: "VictorMono Nerd Font 14.0"; +} + +* { + backgrounkd: #12121222; + background-color: #00222b33; + background-entry: #000000; + foreground-selected: #ffffff; + urgent: #E91E63; + urgent-selected: #E91E63; + transparent: #00000000; + base00: #282a36; + base01: #34353e; + base02: #43454f; + base03: #78787e; + base04: #a5a5a9; + base05: #e2e4e5; + base06: #eff0eb; + base07: #f1f1f0; + base08: #ff5c57; + base09: #ff9f43; + base0A: #f3f99d; + base0B: #5af78e; + base0C: #9aedfe; + base0D: #57c7ff; + base0E: #ff6ac1; + base0F: #b2643c; + base00t: #282a3655; + background-alt: @base02; +} + +window { + background-color: @base00t; + text-color: @base05; + transparency: "real"; + border-radius: 16px; + border: 0px; + width: 60%; + location: center; + anchor: center; + x-offset: 0; + y-offset: 0; + margin: 0px; + padding: 0px; +} + +mainbox { + border-radius: 16; + background-color: @transparent; + text-color: @base05; + transparency: "real"; +} + +inputbar { + background-color: @transparent; + text-color: @base05; + expand: false; + border-radius: 36px; + margin: 0px 0px 0px 0px; + padding: 6px 6px 6px 6px; + position: north; +} + +prompt { + enabled: true; + padding: 0px 6px 0px 5px; + background-color: @transparent; + text-color: @base05; + border: 0px; +} + +entry { + background-color: @transparent; + placeholder-color: @base05; + text-color: @base05; + expand: true; + horizontal-align: 0; + placeholder: "Search"; + blink: true; + border: 0px; + padding: 0px 0px 0px 6px; +} + +case-indicator { + background-color: @transparent; + text-color: @base05; + spacing: 0; + border: 0px; +} + +sidebar { + border: 2px 0 0; +} + +mainbox { + background-color: @base00t; + text-color: @transparent; + children: [ inputbar, listview, message ]; + spacing: 5px; + padding: 10px 10px 10px 10px; +} + +message { + border: 0px 0 0; + padding: 0px; + background-color: @transparent; +} + +textbox { + highlight: @base0B; + text-color: @base0B; + background-color: @transparent; + padding: 10px 90px 10px 90px; +} + +listview { + background-color: @transparent; + columns: 2; + spacing: 4px; + cycle: false; + dynamic: true; + layout: vertical; + lines: 10; + scrollbar: false; + border: 0px; + fixed-height: false; +} + +element { + background-color: @transparent; + text-color: @base05; + orientation: horizontal; + border-radius: 55px; + padding: 5px 5px 5px 10px; +} + +element-icon { + size: 30px; + border: 0px; + padding: 0px 0px 0px; +} + +element-text { + expand: true; + background-color: @transparent; + text-color: @base05; + vertical-align: 0.5; +} + +element normal.urgent, +element alternate.urgent { + background-color: @urgent; + text-color: @base08; + border-radius: 9px; +} + +element normal.active, +element alternate.active { + background-color: @background-alt; + text-color: @base0B; +} + +element selected { + background-color: @background-alt; + text-color: @base0A; +} + +element selected.urgent { + background-color: @urgent-selected; + text-color: @base08; +} + +element selected.active { + background-color: @background-alt; + color: @base0A; +} diff --git a/scripts/emacslof b/scripts/emacslof new file mode 100755 index 0000000..a08f5e1 --- /dev/null +++ b/scripts/emacslof @@ -0,0 +1,32 @@ +#!/bin/sh + +# Check to see if an emacsclient is running +if [ $(pgrep -c emacsclient) -gt 0 ]; then + + if [ $XDG_SESSION_TYPE = "x11" ]; then + #X11 + emacsrg=$(wmctrl -lx | rg emacs | rg -v org-agenda | awk '{print $1}') + echo $emacsrg + + if [ -z $emacsrg ]; then + emacsclient -c + exit + else + wmctrl -ia $emacsrg + exit + fi + + else + # WAYLAND + emacsrg=$(wlrctl window list | rg -v 'emacs:\sorg-agenda' | rg 'emacs:') + + emacswin=$(echo $emacsrg | sed 's/.*\: //') + echo $emacswin + + wlrctl toplevel focus title:"$emacswin" + exit + fi + +else + emacsclient -c +fi diff --git a/scripts/fflof b/scripts/fflof new file mode 100755 index 0000000..f1f85af --- /dev/null +++ b/scripts/fflof @@ -0,0 +1,30 @@ +#!/bin/sh + +# Check to see if firefox is running +if [ $(pgrep -c firefox) -gt 0 ]; then + + if [ $XDG_SESSION_TYPE = "x11" ]; then + #X11 + ffrg=$(wmctrl -lx | rg firefox | awk '{print $1}') + # echo $emacsrg + + if [ -z $ffrg ]; then + firefox + exit + else + wmctrl -ia $ffrg + exit + fi + else + # WAYLAND + ffrg=$(wlrctl window list | rg firefox) + + ffwin=$(echo $ffrg | sed 's/.*\: //') + # echo $ffwin + + wlrctl toplevel focus title:"$ffwin" + exit + fi +else + firefox +fi diff --git a/scripts/filesearch b/scripts/filesearch index 523d255..6340454 100755 --- a/scripts/filesearch +++ b/scripts/filesearch @@ -1,15 +1,10 @@ #!/bin/sh if [ $(hostname) = "syl" ]; then - if [ $WAYLAND_DISPLAY = "wayland-0" ]; then - style="desktop" - else - style="desktop" - #echo "this is hidpi" - fi + style="laptop" else style="desktop" #echo "this is not hidpi" fi -lolcate | rofi -dmenu -p "File Search:" -i -matching regex | xargs -r0 xdg-open +lolcate | rofi -dmenu -p "File Search:" -i -matching regex -theme ~/.config/rofi/launchers-git/$style-rbw.rasi | xargs -r0 xdg-open diff --git a/scripts/plasma-startup.sh b/scripts/plasma-startup.sh new file mode 100755 index 0000000..d726797 --- /dev/null +++ b/scripts/plasma-startup.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +exec ydotoold & +exec libinput-gestures-setup start service & + +sleep 2 + +killall mako + +sleep 1 + +latte-restart diff --git a/scripts/qblof b/scripts/qblof new file mode 100755 index 0000000..d2369e0 --- /dev/null +++ b/scripts/qblof @@ -0,0 +1,30 @@ +#!/bin/sh + +# Check to see if firefox is running +if [ $(pgrep -c qutebrowser) -gt 0 ]; then + + if [ $XDG_SESSION_TYPE = "x11" ]; then + #X11 + qbrg=$(wmctrl -lx | rg qutebrowser | awk '{print $1}') + # echo $emacsrg + + if [ -z $qbrg ]; then + qutebrowser + exit + else + wmctrl -ia $qbrg + exit + fi + else + # WAYLAND + qbrg=$(wlrctl window list | rg qutebrowser) + + qbwin=$(echo $qbrg | sed 's/.*\: //') + # echo $ffwin + + wlrctl toplevel focus title:"$qbwin" + exit + fi +else + qutebrowser +fi diff --git a/scripts/rofi-rbw b/scripts/rofi-rbw index 142008c..922a83f 100755 --- a/scripts/rofi-rbw +++ b/scripts/rofi-rbw @@ -1,5 +1,13 @@ #!/usr/bin/env bash -# Very basic interface for pass using rofi +# Very basic interface for rbw using rofi + +if [ $(hostname) = "syl" ]; then + style="laptop-rbw" + #echo "this is hidpi" +else + style="desktop-rbw" + #echo "this is not hidpi" +fi # Get all password files and create an array root=~/.password-store @@ -16,7 +24,7 @@ list_passwords() { passwords=$(rbw list) prompt='search for passwords...' -SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu) +SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu -theme ~/.config/rofi/launchers-git/$style.rasi) # Ask whether pass, user or both are required @@ -26,7 +34,7 @@ options=("Password" \ "QR-Code" \ "OTP") -option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...") +option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="..." -theme ~/.config/rofi/launchers-git/$style.rasi) echo $option diff --git a/scripts/wintitle b/scripts/wintitle new file mode 100755 index 0000000..ec85244 --- /dev/null +++ b/scripts/wintitle @@ -0,0 +1,3 @@ +#!/bin/sh + +wlrctl window list state:active diff --git a/scripts/wlrofi-rbw b/scripts/wlrofi-rbw index 95beb9b..0d6e8ef 100755 --- a/scripts/wlrofi-rbw +++ b/scripts/wlrofi-rbw @@ -1,16 +1,29 @@ #!/usr/bin/env bash # Very basic interface for rbw using rofi +if [ $(hostname) = "syl" ]; then + style="laptop-rbw" + #echo "this is hidpi" +else + style="desktop-rbw" + #echo "this is not hidpi" +fi # Get all password files and create an array +root=~/.password-store CACHE=~/.local/tmp/pass_rofi seat=seat0 +rbw sync +rbw list + list_passwords() { rbw list } +passwords=$(rbw list) + prompt='search for passwords...' -SECRET=$(list_passwords | rofi -i -p="${prompt}" -dmenu) +SECRET=$(list_passwords | wofi -i -p"${prompt}" -d) # Ask whether pass, user or both are required options=("Password" \ @@ -19,22 +32,22 @@ options=("Password" \ "QR-Code" \ "OTP") -option=$(printf '%s\n' "${options[@]%}" | rofi -i -dmenu -width 400 -lines 4 -prompt="...") +option=$(printf '%s\n' "${options[@]%}" | wofi -id -W 400 -H 150 -p"...") # echo $option case ${option} in Password ) # echo "${SECRET}" - wtype $(rbw get "${SECRET}") + ydotool type $(rbw get "${SECRET}") ;; User ) - wtype $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') + ydotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') ;; "User and password" ) - wtype $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') - wtype -k TAB - wtype $(rbw get "${SECRET}") + ydotool type $(rbw get --full "${SECRET}" | rg Username: | awk '{$1 = ""; print $0}') + ydotool key TAB + ydotool type $(rbw get "${SECRET}") ;; "QR-Code" ) if [[ $SECRET =~ wifi$ ]]; then @@ -49,7 +62,7 @@ case ${option} in fi ;; "OTP" ) - wtype $(rbw code ${SECRET}) + ydotool type $(rbw code ${SECRET}) ;; esac diff --git a/scripts/wofi-window b/scripts/wofi-window old mode 100644 new mode 100755 index a829cfa..7b6b42f --- a/scripts/wofi-window +++ b/scripts/wofi-window @@ -1,9 +1,11 @@ -!#/bin/bash - swaymsg -t get_tree | - jq -r '.nodes[].nodes[] | if .nodes then [recurse(.nodes[])] else [] - end + .floating_nodes | .[] | select(.nodes==[]) | ((.id | tostring) + - "" + .name)' | - wofi --show dmenu | { - read -r id name - swaymsg "[con_id=$id]" focus - } +#!/bin/bash + +list_windows() ( + wlrctl window list +) + +window=$(list_windows | wofi -H 20% -id -p "select window..." | awk '{print $1}' | sed 's/://') + +echo $window + +wlrctl window focus $window diff --git a/scripts/ww b/scripts/ww new file mode 100755 index 0000000..26e1e28 --- /dev/null +++ b/scripts/ww @@ -0,0 +1,120 @@ +#!/bin/bash +# Usage: ww -f "window class filter" -c "run if not found" +# Usage: ww -fa "window title filter" -c "run if not found" + +POSITIONAL=() +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -c | --command) + COMMAND="$2" + shift # past argument + shift # past value + ;; + -f | --filter) + FILTERBY="$2" + shift # past argument + shift # past value + ;; + -fa | --filter-alternative) + FILTERALT="$2" + shift # past argument + shift # past value + ;; + -h | --help) + HELP="1" + shift # past argument + shift # past value + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; + esac +done + +set -- "${POSITIONAL[@]}" # restore positional parameters + +if [ -n "$HELP" ]; then + cat < 0 + for (var i=0; i"$SCRIPT_PATH" + fi +} + +if [ -z "$FILTERBY" ] && [ -z "$FILTERALT" ]; then + echo You need to specify a window filter. Either by class -f or by title -fa + exit 1 +fi + +IS_RUNNING=$(pgrep -o -a -f "$COMMAND" | grep -v "$CURRENT_SCRIPT_NAME") + +if [ -n "$IS_RUNNING" ] || [ -n "$FILTERALT" ]; then + SCRIPT_FOLDER="$HOME/.wwscripts/" + SCRIPT_NAME=$(echo "$FILTERBY$FILTERALT" | md5sum | head -c 32) + SCRIPT_PATH="$SCRIPT_FOLDER$SCRIPT_NAME" + ensure_script "$FILTERBY" "$FILTERALT" + + SCRIPT_NAME="ww$RANDOM" + #SCRIPT_NAME=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + + # install the script + ID=$(dbus-send --session --dest=org.kde.KWin --print-reply=literal /Scripting org.kde.kwin.Scripting.loadScript "string:$SCRIPT_PATH" "string:$SCRIPT_NAME" | awk '{print $2}') + # run it - some KDEs version use Script.run others Scripting.run + dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Scripting.run >/dev/null 2>&1 + dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Script.run >/dev/null 2>&1 + # stop it - some KDEs version use Script.run others Scripting.run + dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Scripting.stop >/dev/null 2>&1 + dbus-send --session --dest=org.kde.KWin --print-reply=literal "/$ID" org.kde.kwin.Script.stop >/dev/null 2>&1 + # uninstall it + dbus-send --session --dest=org.kde.KWin --print-reply=literal /Scripting org.kde.kwin.Scripting.unloadScript "string:$SCRIPT_NAME" >/dev/null 2>&1 +elif [ -n "$COMMAND" ]; then + $COMMAND & +fi diff --git a/sway/autostart.sh b/sway/autostart.sh new file mode 100644 index 0000000..ea95ecf --- /dev/null +++ b/sway/autostart.sh @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +export QT_QPA_PLATFORMTHEME="qt5ct" diff --git a/sway/config b/sway/config index 269b1ed..fc5505a 100644 --- a/sway/config +++ b/sway/config @@ -16,7 +16,8 @@ output * bg /usr/share/wallpapers/Flow/contents/images/5120x2880.jpg fill ###old ~/Pictures/wallpapers/RoyalKing.png -exec kanshi +exec_always kanshi +exec /home/chris/.config/sway/autostart.sh ### Idle configuration # @@ -53,10 +54,10 @@ gaps inner 10 default_border none -# border_images.focused /home/chris/.dotfiles/sway/rounded_and_shadows_custom.png -# border_images.focused_inactive /home/chris/.dotfiles/sway/rounded_and_shadows_custom.png -# border_images.unfocused /home/chris/.dotfiles/sway/rounded_and_shadows_custom.png -# border_images.urgent /home/chris/.dotfiles/sway/rounded_and_shadows_custom.png +# border_images.focused /home/chris/.config/sway/rounded_and_shadows_custom.png +# border_images.focused_inactive /home/chris/.config/sway/rounded_and_shadows_custom.png +# border_images.unfocused /home/chris/.config/sway/rounded_and_shadows_custom.png +# border_images.urgent /home/chris/.config/sway/rounded_and_shadows_custom.png font pango: VictorMono Nerd Font 10 show_marks yes @@ -77,10 +78,11 @@ client.focused '#282a36' '#57c7ff' '#34353e' '#34353e' bindsym $mod+c kill # Start your launcher - bindsym $mod+Mod1+Space exec $menu + bindsym $mod+Space exec $menu bindsym $mod+Shift+Menu exec wofi --show drun bindsym $mod+Menu exec wofi --show run | xargs swaymsg exec -- bindsym $mod+s exec filesearch + bindsym $mod+w exec wofi-window #Pass bindsym $mod+p exec wlrofi-rbw @@ -98,7 +100,7 @@ client.focused '#282a36' '#57c7ff' '#34353e' '#34353e' bindsym $mod+Ctrl+r reload # Exit sway (logs you out of your Wayland session) - bindsym $mod+Ctrl+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' + bindsym $mod+Shift+q exec swaymsg exit # # Moving around: # @@ -163,9 +165,9 @@ client.focused '#282a36' '#57c7ff' '#34353e' '#34353e' bindsym $mod+v splitv # Switch the current container between different layout styles - bindsym $mod+t layout stacking - bindsym $mod+w layout tabbed - bindsym $mod+q layout toggle split + bindsym $mod+y layout stacking + bindsym $mod+t layout tabbed + bindsym $mod+u layout toggle split # Make the current focus fullscreen bindsym $mod+f fullscreen @@ -174,7 +176,7 @@ client.focused '#282a36' '#57c7ff' '#34353e' '#34353e' bindsym $mod+Shift+space floating toggle # Swap focus between the tiling area and the floating area - bindsym $mod+space focus mode_toggle + bindsym $mod+Mod1+space focus mode_toggle # Move focus to the parent container bindsym $mod+Shift+p focus parent @@ -237,7 +239,7 @@ bindsym $mod+o mode "$mode_launcher" bindsym $mod+Ctrl+m exec makoctl dismiss -a bindsym $mod+e exec emacsclient -c -a emacs -bindsym $mod+b exec qutebrowser +bindsym $mod+b exec nyxt bindsym $mod+i exec emacsclient -e '(chris/org-agenda)' bindsym $mod+m exec emacsclient -c -e '(mu4e)' bindsym $mod+Shift+d exec dolphin @@ -252,14 +254,14 @@ bar { } -for_window [title="org-agenda"] floating enable +for_window [title="org-agenda"] floating enable, move scratchpad for_window [app_id="mpv"] floating enable for_window [app_id="imv"] floating enable for_window [app_id="dolphin"] floating enable for_window [app_id="pulsemixer"] floating enable -for_window [class="\*Org Agenda(a)\*"] floating enable; move scratchpad for_window [app_id="__focused__"] opacity set 1 for_window [app_id="qutebrowser"] move container to workspace number 2, opacity set 1 +for_window [title="Display Window"] move container to workspace number 9, fullscreen enable, move workspace to output right # for_window [app_id="emacs"] opacity set 0.90 ### Locking screen diff --git a/sway/rounded_and_shadows_custom.png b/sway/rounded_and_shadows_custom.png index e8ae6fc88da72d97558d06bf258ba7f4b35a9f7f..c6ca76ab9eec62a6c38b1b7c5cd960e7ad1f2ba9 100644 GIT binary patch delta 6807 zcmV;I8ffLeOrlMYB!2{YR9JLUVRs;Ka&Km7Y-J#Hd2nSQWq4_3004N}rJ8AW+&Z#^ z|6>)s1Y!o3gYlf+!CQWR0kUMdB>UR;Nmj93BtamDh{!~l^?(1}=0E(z=q?jtE~%z; z@e^vOuJNW^_fI>o_6q0q{J8p@vp;`sK2A73@*MsB-;$o|Uw@z5j{)vO<6ZnTP#MpO z{_}|%p7G1uK<++x%}DR(Gf;g7^6oxip8?vvtSi-$KQE!L`}o{{n}I*0mr#D5_Lu)> ztT!Xi@y;!8{l%;E<(`1opEbVmrt)fi=EBP--h2M1*VkYe5qymN1#+uJ?ndb7U%_MT;*HM5Eq z5~fbiqCTvqH(b{lN{=pvsiiCP7a1a--^yr!&d8X*S5h<+w8XM9ETlD zF}P(MzH-hDJg5%~zN>EFJ?n#h?RFWjPG4~H!0nz--G9ei?0IaxhB;3wJb79!b(X;_ zxBT_5`P&=zRw`I~l@D7nFXv=zrXkPimCNvf-H%b@G4Sj6{YQTFcreP!N|B0T`#nUD z_6HL9<7m%?k>j0%HqU2(LyXwbs^nW@F^W-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Ge?9C(H_2i){`up}rxG_yS8o8^H*M7{0S>5x3B_{g zt&dT+Z`Z5&wghNLBcsIJ09XR}Rkeiytv|PS~k^3E&F!MTP$<(ZmmRhO~b9v$EXmX}Z#`ZUv z$mlJA-xNamDIneC9JF9c`j$Cfax#(4O9HfYH)Dq`QG7Gj5$m}U_vJB}5^O@_pxxrJ z`|b<2DU-D`7qK{Ly6-;KD;tcMDa~8G

i({)u-%t+m$L|7w2#YkMMZ;aKfN00000 LNkvXXu0mjf6pNIy diff --git a/sway/rounded_and_shadows_custom.xcf b/sway/rounded_and_shadows_custom.xcf index 0f5d2f44b2360a7379099380bc581a6226c16cd9..1b6339a57d21bd156970713bbda1d5d338dd5f38 100644 GIT binary patch delta 1845 zcmZ`(OK;*<6h7wK*cf9I4A{nC5(61vz|8|D$)JcgAxSlzR#mqhb=`l^N=WIVyJ#fO zs#1T#EUHmwQK`%9Ds|IcAJTL*>O*ZKC7EXo%(({Uv8W}(x#xcOobNmL_}nc%tlaJ} z+Be;cz|wE<))UXTL$c|9L4ILwxwlx;`23CS658~|hrM&}4*MzVenx(Be+d1_u`p$l z?zf_&8fXRKdAm0R*z2Zn#kv29m3M;_fiHo}Ru7<`gBR^Sz@WpU(|{KpT=Y9CE+V)y zz{8ytc;4*p(J*MWs5R_SfOPMJaFuZcG{bP&?(~NT0(ghRepf+P5EG#5kcaWG-wC6K z1qMlcEfv!Ahy)%3zy!c+cKbsDlVMMz$J`&K3ZOcabxWidk~+%AXi%v{<? zO1keSgJewH2vozaaKLC@xo{n%#g$W5J>~~(X8B#X=b_fA9Bkz8xd^Lh!Q3oM} zoe(AiXN2PgAtZ_+fe#W!hv$S7L@6Q@<%KMX0!NbY56g>^5>?fBBCe`2MGo^U6N4uV zD}dH6r(>&#$$>kaLf`sVFf9wCJi%V1+tH=w5e-qR1$-X0*^;@FQJ*%ik%A- z9_Q^9%QO;ENnmBTAbdC)H_WVED3$`{i&C**XES;{D)A%&7r~ICYUXmTSgtyOwR5Lh zF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YLNoH!^64i$_LW3W|MC6tVViy4cJZxWzp zLn2zI-NJC}o5jXaZ<%P;YWv-84+ZyJyHQtB5Gs!+g?j6TWg~9;cvKEDji`;MNJB|d zj*Ldrb{yArY|A7Fg)YMH=nF~FY6z{5n^wa#YKTzdhr~(5GFmNDzpfo=3NZ}3OI*hb zQdObV>qAAZiUQgWy@>wg1yQ7>xrhcuf9}D8MuT!Rzu*9$(a~FPqtDaI?hoaipYYnz zw}0yH3flRNTr-26`9C+(jDC50yF9#Iof&7!?c&S;<4nF?FAe-KjHSGNqipyg?j-yF E2JBxOhyVZp diff --git a/tridactyl/tridactylrc b/tridactyl/tridactylrc index e6a55f3..494c914 100644 --- a/tridactyl/tridactylrc +++ b/tridactyl/tridactylrc @@ -17,7 +17,7 @@ set searchurls.o https://www.office.com/search?auth=2&q= set searchurls.wiki https://en.wikipedia.org/wiki/Special:Search/ set searchurls.g https://www.google.com/search?q= set searchurls.d https://duckduckgo.com/?q= -set searchurls.s https://search.cochrun.xyz/?q= +set searchurls.s https://search.tfcconnection.org/?q= set searchurls.ama https://smile.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords= set searchurls.google https://www.google.com/search?q= set searchurls.googlelucky https://www.google.com/search?btnI=I'm+Feeling+Lucky&q= @@ -49,9 +49,12 @@ set quickmark od https://odysee.com/$/following "" Org Capture command org-capture composite get_current_url | js -p tri.excmds.exclaim_quiet('org-capture ' + JS_ARG); +" MPV +command mpv js -p tri.excmds.shellescape(JS_ARG).then(url => tri.excmds.exclaim_quiet('mpv --profile=fast ' + url)) + "" Adding my own bindings -bind v hint -W mpvsafe -bind gv current_url mpvsafe +bind v hint -W mpv +bind gv current_url mpv bind F hint -w bind gy hint -y bind gc org-capture diff --git a/waybar/config b/waybar/config index d9ebdd4..3fd7d78 100644 --- a/waybar/config +++ b/waybar/config @@ -1,16 +1,16 @@ { // "layer": "top", // Waybar at top layer "position": "bottom", // Waybar position (top|bottom|left|right) - "height": 25, // Waybar height (to be removed for auto height) + "height": 30, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width - // Choose the order of the modules - "modules-left": ["sway/workspaces", "wlr/taskbar", "river/tags", "sway/mode", "sway/window"], + // Choose the order of the modules "custom/wintitle", + "modules-left": ["sway/workspaces", "river/tags", "sway/mode", "sway/window"], "modules-center": ["clock"], "modules-right": ["pulseaudio", "network", "memory", "cpu", "battery", "battery#bat2", "tray"], "margin-top": 0, - "margin-bottom": 0, - "margin-left": 0, - "margin-right": 0, + "margin-bottom": 10, + "margin-left": 10, + "margin-right": 10, // Modules configuration "sway/workspaces": { "disable-scroll": true, @@ -112,7 +112,7 @@ "format": "{icon} {volume}% {format_source}", "format-bluetooth": "{icon} {volume}% {format_source}", "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": " {format_source}", + "format-muted": "ﱝ muted", "format-source": " {volume}%", "format-source-muted": "", "format-icons": { @@ -138,12 +138,22 @@ "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name }, + "custom/wintitle": { + "format": " {icon} {}", + "max-length": 80, + //"format-icons": { + // "spotify": "", + // "default": "🎜" + //}, + "interval": 1, + "exec": "wintitle" + }, "wlr/taskbar": { - "format": "{icon} {title}", + "format": "{icon}", "icon-size": 20, "icon-theme": "Papirus-Dark", "tooltip-format": "{title}", - "max-length": 20, + "max-length": 10, "on-click": "activate", "on-click-middle": "close" }, diff --git a/waybar/style.css b/waybar/style.css index 35f6b5c..0f11e7f 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -17,8 +17,8 @@ @define-color basetransparent rgba(40, 42, 54, 0.0); @define-color backtransparent rgba(40, 42, 54, 0.7); * { - border: none; - border-radius: 0; + border: 1px; + border-radius: 20; font-family: VictorMono Nerd Font; font-size: 15px; font-weight: normal; diff --git a/wayfire/wayfire.ini b/wayfire/wayfire.ini index 1d235ae..b0d2169 100644 --- a/wayfire/wayfire.ini +++ b/wayfire/wayfire.ini @@ -69,18 +69,28 @@ saturation = 1.000000 toggle = none [command] +binding_agenda = KEY_APOSTROPHE binding_browser = KEY_B +binding_dolphin = KEY_D binding_emacs = KEY_E -binding_launcher = KEY_COMPOSE +binding_kanshi = KEY_R +binding_killnotif = KEY_M +binding_launcher = KEY_SPACE binding_mute = KEY_MUTE -binding_run = KEY_COMPOSE +binding_quit = KEY_Q +binding_run = KEY_R binding_screenshot = KEY_PRINT -binding_screenshot_interactive = KEY_PRINT +binding_screenshot_interactive = KEY_PRINT binding_terminal = KEY_ENTER +command_agenda = emacsclient -e '(chris/org-agenda)' command_browser = qutebrowser & +command_dolphin = dolphin command_emacs = emacsclient -c -a emacs -command_launcher = rofi -show drun -modi drun +command_killnotif = makoctl dismiss --all +command_kanshi = kanshi +command_launcher = wofi -S drun command_mute = pactl set-sink-mute @DEFAULT_SINK@ toggle +command_quit = killall wayfire command_run = rofi -show run -modi run command_screenshot = grim $(date '+%F_%T').webp command_screenshot_interactive = slurp | grim -g - $(date '+%F_%T').webp @@ -97,7 +107,7 @@ focus_button_with_modifiers = false focus_buttons = BTN_LEFT | BTN_MIDDLE | BTN_RIGHT focus_buttons_passthrough = true max_render_time = -1 -plugins = alpha animate autostart command cube decoration expo fast-switcher grid idle invert move oswitch place resize switcher vswitch window-rules wobbly zoom simple-tile blur scale alpha vswipe wm-actions +plugins = alpha animate autostart command cube decoration expo fast-switcher window-shadows grid idle invert move oswitch place resize switcher vswitch window-rules wobbly zoom simple-tile blur scale alpha vswipe wm-actions workspace-names winshadows preferred_decoration_mode = server vheight = 2 vwidth = 2 @@ -146,7 +156,7 @@ select_workspace_6 = KEY_6 select_workspace_7 = KEY_7 select_workspace_8 = KEY_8 select_workspace_9 = KEY_9 -toggle = KEY_W | swipe up 0 +toggle = KEY_W | swipe up 3 | hotspot left-top 100x10 100 [extra-gestures] close_fingers = 20 @@ -162,6 +172,8 @@ radius = 450.000000 toggle = KEY_F zoom = 7.000000 +[follow-cursor-bindings] + [follow-focus] change_output = true change_view = true @@ -203,8 +215,8 @@ toggle = none [input] click_method = default -cursor_size = 24 -cursor_theme = Breeze-Snow +cursor_size = 48 +cursor_theme = breeze-snow disable_touchpad_while_mouse = false disable_touchpad_while_typing = true gesture_sensitivity = 1.000000 @@ -221,7 +233,7 @@ natural_scroll = true scroll_method = default tap_to_click = true touchpad_accel_profile = default -touchpad_cursor_speed = 1.000000 +touchpad_cursor_speed = 0.300000 touchpad_scroll_speed = 1.000000 xkb_layout = us xkb_model = @@ -274,23 +286,26 @@ mode = center [preserve-output] last_output_focus_timeout = 10000 +[primary-monitor-switch] +external-monitor = HDMI-A-2 + [resize] activate = BTN_RIGHT [scale] allow_zoom = true bg_color = \#1A1A1AE6 -duration = 200 +duration = 250 inactive_alpha = 0.350000 interact = false -middle_click_close = false +middle_click_close = true spacing = 50 text_color = \#CCCCCCFF -title_font_size = 16 +title_font_size = 24 title_overlay = all title_position = center -toggle = KEY_P -toggle_all = KEY_M +toggle = KEY_P +toggle_all = KEY_M [scale-title-filter] bg_color = \#282A3680 @@ -316,7 +331,7 @@ key_focus_right = KEY_L key_toggle = KEY_T outer_horiz_gap_size = 20 outer_vert_gap_size = 20 -tile_by_default = if app_id is "emacs" & app_id is "alacritty" +tile_by_default = all [switcher] next_view = KEY_TAB @@ -328,9 +343,9 @@ view_thumbnail_scale = 1.000000 background = \#1A1A1AFF delta_threshold = 24.000000 duration = 180 -enable_free_movement = false +enable_free_movement = true enable_horizontal = true -enable_smooth_transition = false +enable_smooth_transition = true enable_vertical = true fingers = 4 gap = 32.000000 @@ -340,14 +355,14 @@ threshold = 0.350000 [vswitch] background = \#1A1A1AFF -binding_down = KEY_DOWN -binding_left = KEY_LEFT -binding_right = KEY_RIGHT -binding_up = KEY_UP -binding_win_down = KEY_DOWN -binding_win_left = KEY_LEFT -binding_win_right = KEY_RIGHT -binding_win_up = KEY_UP +binding_down = KEY_J +binding_left = KEY_H +binding_right = KEY_L +binding_up = KEY_K +binding_win_down = KEY_J +binding_win_left = KEY_H +binding_win_right = KEY_L +binding_win_up = KEY_K duration = 300 gap = 20 wraparound = false @@ -360,6 +375,13 @@ rule_1 = on created if app_id is "emacs" then set alpha 0.8 rule_2 = on created if app_id is "dolphin" then float rule_3 = on created if app_id is "emacs" then tile +[winshadows] +clip_shadow_inside = true +enabled_views = type is "toplevel" +include_undecorated_views = true +shadow_color = \#FFFFFF +shadow_radius = 30 + [winzoom] dec_x_binding = KEY_LEFT dec_y_binding = KEY_UP @@ -376,7 +398,7 @@ toggle_always_on_top = KEY_T toggle_fullscreen = KEY_F toggle_maximize = KEY_M toggle_showdesktop = none -toggle_sticky = none +toggle_sticky = KEY_0 [wobbly] friction = 3.000000 @@ -390,8 +412,8 @@ dynamic_repaint_delay = false [workspace-names] background_color = \#333333B3 -display_duration = 500 -font = sans-serif +display_duration = 300 +font = VictorMono Nerd Font position = center show_option_names = false text_color = \#FFFFFFFF diff --git a/wofi/style.css b/wofi/style.css index 0924766..e3dd83a 100644 --- a/wofi/style.css +++ b/wofi/style.css @@ -56,7 +56,6 @@ window { margin-left: 10px; margin-top: 2px; margin-bottom: 2px; - -gtk-icon-transform: scale 0.5; } #entry:selected {