├── CHANGELOG.md ├── HACKING.md ├── LICENSE ├── README.md ├── distr └── durden ├── durden ├── .gitignore ├── atypes │ ├── application.lua │ ├── clipboard.lua │ ├── decode.lua │ ├── game.lua │ ├── lwa.lua │ ├── remoting.lua │ ├── terminal.lua │ ├── tui.lua │ ├── vm.lua │ ├── wayland-toplevel.lua │ ├── wayland-x11.lua │ ├── wayland.lua │ ├── x11-redirect.lua │ └── x11.lua ├── autorun.lua ├── builtin │ ├── mouse.lua │ └── osdkbd.lua ├── clipboard.lua ├── config.lua ├── cursor │ └── default │ │ ├── cell.png │ │ ├── context.png │ │ ├── crosshair.png │ │ ├── default.lua │ │ ├── default.png │ │ ├── drag-reject.png │ │ ├── drag.png │ │ ├── forbidden.png │ │ ├── grabhint.png │ │ ├── help.png │ │ ├── pointer.png │ │ ├── rz_all.png │ │ ├── rz_col.png │ │ ├── rz_diag_l.png │ │ ├── rz_diag_r.png │ │ ├── rz_down.png │ │ ├── rz_left.png │ │ ├── rz_leftright.png │ │ ├── rz_right.png │ │ ├── rz_up.png │ │ ├── rz_updown.png │ │ ├── typefield.png │ │ ├── wait.png │ │ ├── zoom-in.png │ │ └── zoom-out.png ├── devmaps │ ├── colorschemes │ │ ├── dracula.lua │ │ ├── gruvbox-light.lua │ │ ├── gruvbox.lua │ │ ├── solarized-light.lua │ │ ├── solarized.lua │ │ ├── srcery.lua │ │ └── twilight.lua │ ├── composition │ │ └── basic.lua │ ├── display │ │ ├── README.md │ │ ├── index.lua │ │ ├── lg100.lua │ │ ├── psvr.lua │ │ ├── rift.lua │ │ ├── vive.lua │ │ └── vivepro.lua │ ├── game │ │ ├── README.md │ │ ├── linux_ps3.lua │ │ ├── linux_ps4.lua │ │ ├── linux_rband.lua │ │ ├── linux_x360.lua │ │ └── sdl_darwin_ps3.lua │ ├── keyboard │ │ └── README.md │ ├── led │ │ └── README.md │ ├── menus │ │ ├── README.md │ │ ├── cli_icon.lua │ │ ├── floatbg.lua │ │ └── wsbtn.lua │ ├── osd │ │ └── default.lua │ ├── rotary │ │ └── rotary.lua │ ├── schemes │ │ └── README.md │ ├── touch │ │ ├── README.md │ │ ├── default.lua │ │ ├── elan9038_go.lua │ │ └── wacom_s2.lua │ └── tts │ │ ├── basic_eng.lua │ │ └── cursor_eng.lua ├── dispatch.lua ├── display.lua ├── durden.lua ├── extevh.lua ├── firstrun.lua ├── fonts │ ├── default.ttf │ ├── emoji.ttf │ ├── hack.ttf │ └── hyperlegible.otf ├── gconf.lua ├── icon.lua ├── icons │ ├── default.lua │ └── default │ │ └── cli_24px.png ├── input │ ├── classifiers │ │ ├── empty.lua │ │ ├── mouse.lua │ │ └── touch.lua │ ├── devstate.lua │ ├── rotary.lua │ └── touch.lua ├── ipc.lua ├── ipc │ └── .gitignore ├── keybindings.lua ├── ledm.lua ├── listen.lua ├── menu.lua ├── menus │ ├── browse.lua │ ├── global │ │ ├── animations.lua │ │ ├── audio.lua │ │ ├── bars.lua │ │ ├── border.lua │ │ ├── colors.lua │ │ ├── debug.lua │ │ ├── display.lua │ │ ├── global.lua │ │ ├── hud.lua │ │ ├── input.lua │ │ ├── led.lua │ │ ├── notification.lua │ │ ├── open.lua │ │ ├── record.lua │ │ ├── schemes.lua │ │ ├── settings.lua │ │ ├── shaders.lua │ │ ├── shadow.lua │ │ ├── statusbar.lua │ │ ├── system.lua │ │ ├── terminal.lua │ │ ├── timer.lua │ │ ├── titlebar.lua │ │ ├── visual.lua │ │ ├── windows.lua │ │ ├── workspace.lua │ │ ├── workspaces.lua │ │ └── x11.lua │ ├── menus.lua │ ├── target │ │ ├── audio.lua │ │ ├── clipboard.lua │ │ ├── coreopts.lua │ │ ├── debug.lua │ │ ├── input.lua │ │ ├── share.lua │ │ ├── state.lua │ │ ├── target.lua │ │ ├── triggers.lua │ │ ├── video.lua │ │ └── window.lua │ └── window.lua ├── meta_guard.lua ├── models │ └── README.models ├── notification.lua ├── output │ └── .gitignore ├── shaders │ ├── audio │ │ └── bars.lua │ ├── display │ │ ├── basic.lua │ │ ├── gamma.lua │ │ ├── hsv.lua │ │ ├── quilt.lua │ │ └── weight.lua │ ├── effect │ │ ├── crt_lottes.frag │ │ ├── crt_lottes.lua │ │ ├── gaussian.lua │ │ ├── gaussian_h.frag │ │ ├── gaussian_v.frag │ │ ├── rounded.frag │ │ └── rounded.lua │ ├── simple │ │ ├── crop.lua │ │ ├── edge_luma.lua │ │ ├── gray.lua │ │ ├── inv_light.lua │ │ ├── inv_light_color.lua │ │ ├── invert.lua │ │ ├── noalpha.lua │ │ ├── nocanvas.lua │ │ ├── sidecol.lua │ │ ├── stretchcrop.lua │ │ └── vignette.lua │ └── ui │ │ ├── border.lua │ │ ├── border_float.lua │ │ ├── dropshadow.frag │ │ ├── dropshadow.lua │ │ ├── lbar.lua │ │ ├── lbar_tile.lua │ │ ├── lbar_tiletext.lua │ │ ├── lbarbg.lua │ │ ├── miniature.lua │ │ ├── popup.frag │ │ ├── popup.lua │ │ ├── regmark.lua │ │ ├── regsel.lua │ │ ├── rounded.lua │ │ ├── rounded_border.frag │ │ ├── rounded_border.lua │ │ ├── sbar_item.lua │ │ ├── sbar_item_bg.lua │ │ ├── sbar_msg_bg.lua │ │ ├── sbar_msg_text.lua │ │ ├── statusbar.lua │ │ ├── titlebar.lua │ │ ├── titlebar_icon.lua │ │ ├── titlebar_iconbg.lua │ │ └── titlebar_text.lua ├── shdrmgmt.lua ├── suppl.lua ├── tiler.lua ├── tiler_mh.lua ├── timer.lua ├── tools │ ├── .gitignore │ ├── a12net.lua │ ├── advfloat.lua │ ├── advfloat │ │ ├── autolay.lua │ │ ├── bgicons.lua │ │ ├── bginput.lua │ │ ├── cactions.lua │ │ ├── cactions_cfg.lua │ │ ├── gridfit.lua │ │ ├── minimize.lua │ │ ├── rzctl.lua │ │ └── spawnctl.lua │ ├── autolayout.lua │ ├── autostart.lua │ ├── composition.lua │ ├── extbtn.lua │ ├── flair.lua │ ├── flair │ │ ├── background.lua │ │ ├── cloth.lua │ │ ├── create.lua │ │ ├── destroy.lua │ │ ├── display.lua │ │ ├── display │ │ │ ├── confetti.lua │ │ │ └── snow.lua │ │ ├── drag.lua │ │ ├── hide.lua │ │ ├── psys.lua │ │ ├── select.lua │ │ ├── shadow.lua │ │ └── verlet.lua │ ├── gesture.lua │ ├── gesture │ │ ├── LICENSE │ │ └── gestures.lua │ ├── modelviewer.lua │ ├── osdkbd.lua │ ├── overlay.lua │ ├── overview.lua │ ├── popup.lua │ ├── presets.lua │ ├── pulldown.lua │ ├── scroll.lua │ ├── streamdeck.lua │ ├── todo.lua │ ├── tracing.lua │ ├── tts.lua │ └── typer.lua ├── uimap.lua ├── uiprim │ ├── bar.lua │ ├── bbar.lua │ ├── buttongrid.lua │ ├── icons.lua │ ├── lbar.lua │ ├── popup.lua │ └── uiprim.lua ├── whitelist.lua └── widgets │ ├── ascii.lua │ ├── bindings.lua │ ├── cheatsheet.lua │ ├── cheatsheets │ ├── gdb.txt │ ├── lldb.txt │ └── lua-ptn.txt │ ├── colorpick.lua │ ├── dispdbg.lua │ ├── helper.lua │ ├── icons.lua │ ├── labels.lua │ ├── notification.lua │ ├── support │ ├── text.lua │ └── unicode_data.lua │ ├── sysdbg.lua │ └── wnddbg.lua └── util ├── color_conv.lua └── json.lua /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2017, Bjorn Stahl 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of durden nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /durden/.gitignore: -------------------------------------------------------------------------------- 1 | debug 2 | autorun.lua 3 | clipboard_data.lua 4 | keybindings.lua 5 | luac.out 6 | -------------------------------------------------------------------------------- /durden/atypes/application.lua: -------------------------------------------------------------------------------- 1 | return { 2 | atype = "application", 3 | props = { 4 | scalemode = "client", 5 | filtermode = FILTER_NONE, 6 | rate_unlimited = false, 7 | allowed_segments = {"popup", "handover", "icon", "cursor"} 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /durden/atypes/clipboard.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- External Clipboard Manager (CLIPBOARD segment as primary) 3 | -- artificially restricted to one active clipboard manager. 4 | -- 5 | 6 | local log, fmt = suppl_add_logfn("clipboard"); 7 | local cm = nil; 8 | 9 | local function clipboard_event(msg, source) 10 | if (not cm or source == cm) then 11 | return; 12 | end 13 | 14 | if (msg and string.len(msg) > 0 and valid_vid(cm.external, TYPE_FRAMESERVER)) then 15 | local mode = gconfig_get("clipboard_access"); 16 | if (mode == "passive" or mode == "full") then 17 | message_target(cm.external, msg); 18 | end 19 | end 20 | end 21 | 22 | CLIPBOARD:add_monitor(clipboard_event); 23 | 24 | local clipboard_dispatch = 25 | { 26 | segment_request = 27 | function(...) 28 | end, 29 | 30 | terminated = 31 | function(wnd, ...) 32 | CLIPBOARD:set_provider(wnd) 33 | if cm == wnd then 34 | cm = nil 35 | end 36 | return false 37 | end, 38 | 39 | message = 40 | function(wnd, source, stat) 41 | local mode = gconfig_get("clipboard_access"); 42 | if (mode == "active" or mode == "full") then 43 | CLIPBOARD:add(source, stat.message, stat.multipart); 44 | else 45 | log("rejected:reason=external_copy_blocked") 46 | end 47 | end, 48 | 49 | registered = 50 | function(wnd, source, stat) 51 | if cm then 52 | log("collision:message=got existing clipboard manager") 53 | wnd:destroy(); 54 | return; 55 | end 56 | 57 | if gconfig_get("clipboard_access") == "none" then 58 | log("rejected:reason=external_blocked") 59 | wnd:destroy() 60 | return 61 | end 62 | 63 | log("accepted:kind=external_manager") 64 | cm = wnd 65 | end 66 | } 67 | 68 | return { 69 | atype = "clipboard", 70 | default_shader = {"simple", "noalpha"}, 71 | actions = {}, 72 | props = 73 | { 74 | attach_block = true 75 | }, 76 | dispatch = clipboard_dispatch 77 | }; 78 | -------------------------------------------------------------------------------- /durden/atypes/decode.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Decode archetype, settings and menus specific for decode- frameserver 3 | -- session (e.g. stream selection, language, subtitle overlays) 4 | -- 5 | local rtbl = { 6 | atype = "multimedia", 7 | actions = { 8 | }, 9 | bindings = {}, 10 | dispatch = { 11 | -- special case, FFT packed in video stream and unpacked by shader, 12 | streaminfo = function(wnd, source, tbl) 13 | if (tbl.lang == "AUD") then 14 | wnd.shaderflt = {"audio"}; 15 | wnd.scalemode = "stretch"; 16 | local lst = shader_list(wnd.shaderflt); 17 | if (#lst > 0) then 18 | shader_setup(wnd.canvas, "audio", shader_getkey(lst[1])); 19 | end 20 | end 21 | end 22 | }, 23 | props = { 24 | kbd_period = 0, 25 | kbd_delay = 0, 26 | scalemode = "aspect", 27 | filtermode = FILTER_BILINEAR, 28 | clipboard_block = true, 29 | font_block = true 30 | }, 31 | }; 32 | 33 | rtbl.bindings["F1"] = function(wnd) 34 | dispatch_symbol_wnd(wnd, "/target/playlist/step/previous") 35 | end 36 | 37 | rtbl.bindings["F2"] = function(wnd) 38 | dispatch_symbol_wnd(wnd, "/target/playlist/step/next") 39 | end 40 | 41 | rtbl.bindings["F3"] = function(wnd) 42 | dispatch_symbol_wnd(wnd, "/target/playlist/step/random") 43 | end 44 | 45 | rtbl.bindings["LEFT"] = function(wnd) 46 | if (valid_vid(wnd.external, TYPE_FRAMESERVER)) then 47 | target_seek(wnd.external, -10); 48 | end 49 | end 50 | 51 | rtbl.bindings["UP"] = function(wnd) 52 | if (valid_vid(wnd.external, TYPE_FRAMESERVER)) then 53 | target_seek(wnd.external, 100); 54 | end 55 | end 56 | 57 | rtbl.bindings["RIGHT"] = function(wnd) 58 | if (valid_vid(wnd.external, TYPE_FRAMESERVER)) then 59 | target_seek(wnd.external, 10); 60 | end 61 | end 62 | 63 | rtbl.bindings["DOWN"] = function(wnd) 64 | if (valid_vid(wnd.external, TYPE_FRAMESERVER)) then 65 | target_seek(wnd.external, -100); 66 | end 67 | end 68 | 69 | return rtbl; 70 | -------------------------------------------------------------------------------- /durden/atypes/game.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Game archetype, settings and menus specific for game- frameserver 3 | -- session - primarily display hints and synchronization control 4 | -- 5 | 6 | local skiptbl = {}; 7 | 8 | skiptbl["Automatic"] = 0; 9 | skiptbl["None"] = -1; 10 | skiptbl["Skip 1"] = 1; 11 | skiptbl["Skip 2"] = 2; 12 | skiptbl["Skip 3"] = 3; 13 | skiptbl["Skip 4"] = 4; 14 | 15 | local skipset = {"Automatic", "None", "Skip 1", "Skip 2", "Skip 3", "Skip 4"}; 16 | for k,v in ipairs(skipset) do 17 | assert(skiptbl[v] ~= nil); 18 | end 19 | 20 | local function update_synch(ctx) 21 | local cs = ctx.synch; 22 | if (not cs) then 23 | warning("atype/game, update_synch fields missing"); 24 | return; 25 | end 26 | 27 | if (valid_vid(ctx.external, TYPE_FRAMESERVER)) then 28 | target_framemode(ctx.external, skiptbl[cs.skipmode], 29 | cs.framealign, cs.preaudio, cs.jitterstep, cs.jitterxfer); 30 | end 31 | end 32 | 33 | local synch_menu = { 34 | { 35 | name = "gamewnd_synchmode", 36 | label = "Mode", 37 | kind = "value", 38 | set = skipset, 39 | initial = function(ctx) return active_display().selected.synch.skipmode; end, 40 | handler = function(ctx, val) 41 | local wnd = active_display().selected; 42 | wnd.synch.skipmode = val; 43 | update_synch(wnd); 44 | end 45 | }, 46 | { 47 | name = "gamewnd_preaud", 48 | label = "Preaudio", 49 | kind = "value", 50 | initial = function(ctx, val) 51 | local wnd = active_display().selected; 52 | return tostring(wnd.synch.preaudio); 53 | end, 54 | validator = gen_valid_num(0, 8), 55 | handler = function(ctx, val) 56 | local wnd = active_display().selected; 57 | wnd.synch.preaudio = tonumber(val); 58 | update_synch(wnd); 59 | end 60 | }, 61 | { 62 | name = "framealign", 63 | label = "Framealign", 64 | kind = "value", 65 | initial = function() return "0"; end, 66 | validator = gen_valid_num(0, 14), 67 | handler = function(ctx, val) 68 | local wnd = active_display().selected; 69 | wnd.synch.framealign = tonumber(cal); 70 | update_synch(wnd); 71 | end 72 | } 73 | }; 74 | 75 | local retrosub = { 76 | { 77 | name = "gamewnd_syncopt", 78 | label = "Synchronization", 79 | kind = "action", 80 | submenu = true, 81 | handler = synch_menu 82 | }, 83 | { 84 | name = "gamewnd_slotgrab", 85 | label = "Slotted-Grab", 86 | kind = "action", 87 | handler = function(ctx, val) 88 | local wnd = active_display().selected; 89 | iostatem_slotgrab(wnd); 90 | end 91 | } 92 | }; 93 | 94 | return { 95 | atype = "game", 96 | default_shader = {"simple", "noalpha"}, 97 | actions = { 98 | { 99 | name = "gamewnd_retro", 100 | label = "Game", 101 | kind = "action", 102 | submenu = true, 103 | handler = retrosub 104 | }, 105 | -- props witll be projected upon the window during setup (unless there 106 | -- are overridden defaults) 107 | }, 108 | props = { 109 | kbd_period = 0, 110 | kbd_delay = 0, 111 | scalemode = "aspect", 112 | filtermode = FILTER_NONE, 113 | rate_unlimited = true, 114 | clipboard_block = true, 115 | font_block = true, 116 | -- current defaults, safe values match the synchronization menu above 117 | synch = { 118 | preaudio = 1, 119 | skipmode = "None", 120 | framealign = 8, 121 | jitterstep = 0, 122 | jitterxfer = 0 123 | } 124 | } 125 | }; 126 | -------------------------------------------------------------------------------- /durden/atypes/lwa.lua: -------------------------------------------------------------------------------- 1 | local rtbl = { 2 | atype = "lightweight arcan", 3 | actions = { 4 | }, 5 | bindings = {}, 6 | dispatch = {}, 7 | props = { 8 | kbd_period = 0, 9 | kbd_delay = 0, 10 | default_shader = {"simple", "crop"}, 11 | scalemode = "stretch", 12 | rate_unlimited = true, 13 | filtermode = FILTER_NONE, 14 | clipboard_block = true, 15 | font_block = false 16 | }, 17 | }; 18 | return rtbl; 19 | -------------------------------------------------------------------------------- /durden/atypes/remoting.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Remoting archetype, settings and menus specific for remoting- frameserver 3 | -- sessions, e.g. keymap switching, bandwidth regulation, clipboard integration 4 | -- 5 | return { 6 | atype = "remoting", 7 | props = { 8 | scalemode = "aspect", 9 | filtermode = FILTER_NONE, 10 | font_block = true, 11 | clipboard_block = true, 12 | rate_unlimited = false 13 | }, 14 | default_shader = {"simple", "noalpha"} 15 | }; 16 | -------------------------------------------------------------------------------- /durden/atypes/tui.lua: -------------------------------------------------------------------------------- 1 | local res = system_load("atypes/terminal.lua")(); 2 | res.atype = "tui"; 3 | return res; 4 | -------------------------------------------------------------------------------- /durden/atypes/vm.lua: -------------------------------------------------------------------------------- 1 | return { 2 | dispatch = {}, 3 | -- actions are exposed as target- menu 4 | actions = {}, 5 | -- labels is mapping between known symbol and string to forward 6 | labels = {}, 7 | atype = "vm", 8 | props = { 9 | -- keep as client for now, when the server-side rendering can do cropping 10 | -- and clipping correctly for tui surfaces we can reconsider.. 11 | scalemode = "client", 12 | font_block = true, 13 | filtermode = FILTER_NONE, 14 | allowed_segments = {"tui", "handover"} 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /durden/atypes/x11-redirect.lua: -------------------------------------------------------------------------------- 1 | return { 2 | dispatch = {}, 3 | actions = {}, 4 | labels = {}, 5 | atype = "x11-redirect", 6 | props = { 7 | scalemode = "client", 8 | font_block = true, 9 | filtermode = FILTER_NONE, 10 | clipboard_block = false, 11 | rate_unlimited = true, 12 | allowed_segments = {} 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /durden/autorun.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- This file can be added to run custom commands at startup, 3 | -- and more advanced such commands in particular as the others can 4 | -- be defined interactively through the autostart tool. 5 | -- 6 | -- helpful commands: 7 | -- 8 | -- timer_add_idle(name (text), value (seconds), once (bool), enterfn, exitfn) 9 | -- timer_add_periodic(name, delay, once (bool), commandfn) 10 | -- 11 | 12 | -- run user defined autostart items 13 | dispatch_symbol("/global/settings/tools/autostart/run"); 14 | -------------------------------------------------------------------------------- /durden/cursor/default/cell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/cell.png -------------------------------------------------------------------------------- /durden/cursor/default/context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/context.png -------------------------------------------------------------------------------- /durden/cursor/default/crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/crosshair.png -------------------------------------------------------------------------------- /durden/cursor/default/default.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | -- generic 4 | default = {"default.png", 0, 0}, 5 | wait = {"wait.png", 12, 12}, 6 | forbidden = {"forbidden.png", 12, 12}, 7 | grabhint = {"grabhint.png", 8, 10}, 8 | crosshair = {"crosshair.png", 12, 12}, 9 | hand = {"pointer.png", 14, 6}, 10 | ["zoom-in"] = {"zoom-in.png", 11, 11}, 11 | ["zoom-out"] = {"zoom-out.png", 11, 11}, 12 | help = {"help.png", 0, 0}, 13 | ["context-menu"] = {"context.png", 1, 1}, 14 | -- data oriented 15 | typefield = {"typefield.png", 12, 12}, 16 | datafield = {"typefield.png", 12, 12}, 17 | ["vertical-datafield"] = {"verticaldata.png", 12, 12}, 18 | cell = {"cell.png", 12, 12}, 19 | alias = {"alias.png", 12, 12}, 20 | -- drag and drop 21 | drag = {"drag.png", 8, 7}, 22 | ["drag-drop"] = {"drag.png", 8, 7}, 23 | ["drag-reject"] = {"drag-reject.png", 0, 0}, 24 | -- resizing operations 25 | sizeall = {"rz_all.png", 16, 16}, 26 | west = {"rz_left.png", 0, 5}, 27 | east = {"rz_right.png", 16, 15}, 28 | north = {"rz_up.png", 5, 0}, 29 | south = {"rz_down.png", 5, 0}, 30 | ["west-east"] = {"rz_leftright.png", 15, 15}, 31 | ["north-south"] = {"rz_updown.png", 12, 12}, 32 | ["north-west"] = {"rz_diag_r.png", 6, 6}, 33 | ["south-west"] = {"rz_diag_l.png", 6, 6}, 34 | ["north-east"] = {"rz_diag_l.png", 6, 6}, 35 | ["south-east"] = {"rz_diag_r.png", 6, 6}, 36 | ["north-west-south-east"] = {"rz_diag_l.png", 6, 6}, 37 | ["south-west-north-east"] = {"rz_diag_r.png", 6, 6}, 38 | } 39 | -------------------------------------------------------------------------------- /durden/cursor/default/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/default.png -------------------------------------------------------------------------------- /durden/cursor/default/drag-reject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/drag-reject.png -------------------------------------------------------------------------------- /durden/cursor/default/drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/drag.png -------------------------------------------------------------------------------- /durden/cursor/default/forbidden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/forbidden.png -------------------------------------------------------------------------------- /durden/cursor/default/grabhint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/grabhint.png -------------------------------------------------------------------------------- /durden/cursor/default/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/help.png -------------------------------------------------------------------------------- /durden/cursor/default/pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/pointer.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_all.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_col.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_col.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_diag_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_diag_l.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_diag_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_diag_r.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_down.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_left.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_leftright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_leftright.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_right.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_up.png -------------------------------------------------------------------------------- /durden/cursor/default/rz_updown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/rz_updown.png -------------------------------------------------------------------------------- /durden/cursor/default/typefield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/typefield.png -------------------------------------------------------------------------------- /durden/cursor/default/wait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/wait.png -------------------------------------------------------------------------------- /durden/cursor/default/zoom-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/zoom-in.png -------------------------------------------------------------------------------- /durden/cursor/default/zoom-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/cursor/default/zoom-out.png -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/dracula.lua: -------------------------------------------------------------------------------- 1 | -- entries marked foreground/background takes 6 values (fr, fg, fb, br, gb, bb) 2 | -- tui clients will use first set, terminal clients second, entries with an empty 3 | -- or nil table will retain whatever client default is 4 | 5 | return { 6 | {0xf8, 0xf8, 0xf2}, -- primary (base color/foreground) 7 | {}, -- secondary (alternate base color) 8 | {0x28, 0x2a, 0x36}, -- background 9 | {0xf8, 0xf8, 0xf2, 0x28, 0x2a, 0x36}, -- text (foreground+background) 10 | {0x97, 0x1a, 0x00}, -- cursor (normal state) 11 | {0xd7, 0x99, 0x21}, -- alt-cursor (scrollback/special state) 12 | {0x44, 0x47, 0x5a}, -- highlight selection, active-word (foreground+background) 13 | {}, -- label : prompts, data labels (foreground+background) 14 | {}, -- warning : alert user but non-fatal (foreground+background) 15 | {0xff, 0x55, 0x55, 0x21, 0x22, 0x2c}, -- error : alert user, requires action (foreground+background) 16 | {}, -- alert : alert user, immediate input / action (foreground+background) 17 | {0x07, 0x66, 0x78}, -- ref : urls, file-paths, ... (foreground + background) 18 | {0x62, 0x72, 0xa4}, -- inactive : inaccessible element (foreground + background) 19 | {0xfb, 0xf1, 0xc7, 0x07, 0x66, 0x78}, -- ui : generic UI elements like menubar 20 | 21 | -- terminal clients below -- 22 | {0x21, 0x22, 0x2c}, -- black 1 23 | {0xff, 0x55, 0x55}, -- red 2 24 | {0x50, 0xfa, 0x7b}, -- green 3 25 | {0xf1, 0xfa, 0x8c}, -- yellow 4 26 | {0xbd, 0x93, 0xf9}, -- blue 5 27 | {0xff, 0x79, 0xc6}, -- magenta 6 28 | {0x88, 0xe9, 0xfd}, -- cyan 7 29 | {0xf8, 0xf8, 0xf2}, -- light-grey 8 30 | {0x62, 0x72, 0xa4}, -- dark-grey 9 31 | {0xff, 0x6e, 0x6e}, -- light-red 10 32 | {0x69, 0xff, 0x94}, -- light-green 11 33 | {0xff, 0xff, 0xa5}, -- light-yellow 12 34 | {0xd6, 0xac, 0xff}, -- light-blue 13 35 | {0xff, 0x92, 0xdf}, -- light-magenta 14 36 | {0xa4, 0xff, 0xff}, -- light-cyan 15 37 | {0xff, 0xff, 0xff}, -- white 16 38 | 39 | {0xf8, 0xf8, 0xf2}, -- foreground 40 | {0x28, 0x2a, 0x36}, -- background 41 | } 42 | -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/gruvbox-light.lua: -------------------------------------------------------------------------------- 1 | -- entries marked foreground/background takes 6 values (fr, fg, fb, br, gb, bb) 2 | -- tui clients will use first set, terminal clients second, entries with an empty 3 | -- or nil table will retain whatever client default is 4 | 5 | return { 6 | {0x3c, 0x38, 0x36}, -- primary (base color/foreground) 7 | {}, -- secondary (alternate base color) 8 | {0xf9, 0xf5, 0xd7}, -- background 9 | {0x3c, 0x38, 0x36, 0xf9, 0xf5, 0xd7}, -- text (foreground+background) 10 | {0x98, 0x97, 0x1a}, -- cursor (normal state) 11 | {0xd7, 0x99, 0x21}, -- alt-cursor (scrollback/special state) 12 | {0xfb, 0xf1, 0xc7, 0x45, 0x85, 0x88}, -- highlight selection, active-word (foreground+background) 13 | {0xb5, 0x76, 0x14, 0xf9, 0xf5, 0xd7}, -- label : prompts, data labels (foreground+background) 14 | {0xd7, 0x99, 0x21, 0x45, 0x85, 0x88}, -- warning : alert user but non-fatal (foreground+background) 15 | {0xfb, 0xf1, 0xc7, 0xcc, 0x24, 0x1d}, -- error : alert user, requires action (foreground+background) 16 | {0x7c, 0x6f, 0x64, 0xb1, 0x62, 0x86}, -- alert : alert user, immediate input / action (foreground+background) 17 | {0x07, 0x66, 0x78}, -- ref : urls, file-paths, ... (foreground + background) 18 | {0xfc, 0x6f, 0x64}, -- inactive : inaccessible element (foreground + background) 19 | {0xfb, 0xf1, 0xc7, 0x07, 0x66, 0x78}, -- ui : generic UI elements like menubar 20 | 21 | -- terminal clients below -- 22 | {0xfd, 0xf4, 0xc1}, -- black 23 | {0xcc, 0x24, 0x1d}, -- red 24 | {0x98, 0x97, 0x1a}, -- green 25 | {0xd7, 0x99, 0x21}, -- yellow 26 | {0x45, 0x85, 0x88}, -- blue 27 | {0xb1, 0x62, 0x86}, -- magenta 28 | {0x68, 0x9d, 0x6a}, -- cyan 29 | {0x7c, 0x6f, 0x64}, -- light-grey 30 | {0x92, 0x83, 0x74}, -- dark-grey 31 | {0x9d, 0x00, 0x06}, -- light-red 32 | {0x79, 0x74, 0x0e}, -- light-green 33 | {0xb5, 0x76, 0x14}, -- light-yellow 34 | {0x07, 0x66, 0x78}, -- light-blue 35 | {0xd3, 0x86, 0x9b}, -- light-magenta 36 | {0x8e, 0xc0, 0x7c}, -- light-cyan 37 | {0xeb, 0xdb, 0xb2}, -- white 38 | 39 | {0x3c, 0x38, 0x36}, -- foreground 40 | {0xf9, 0xf5, 0xd7} -- background 41 | } 42 | -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/gruvbox.lua: -------------------------------------------------------------------------------- 1 | -- entries marked foreground/background takes 6 values (fr, fg, fb, br, gb, bb) 2 | -- tui clients will use first set, terminal clients second, entries with an empty 3 | -- or nil table will retain whatever client default is 4 | 5 | return { 6 | {0xa8, 0x99, 0x84}, -- primary (base color/foreground) 7 | {}, -- secondary (alternate base color) 8 | {0x28, 0x28, 0x28}, -- background 9 | {0xa8, 0x99, 0x84, 0x28, 0x28, 0x28}, -- text (foreground+background) 10 | {}, -- cursor (normal state) 11 | {}, -- alt-cursor (scrollback/special state) 12 | {}, -- highlight selection, active-word (foreground+background) 13 | {}, -- label : prompts, data labels (foreground+background) 14 | {}, -- warning : alert user but non-fatal (foreground+background) 15 | {}, -- error : alert user, requires action (foreground+background) 16 | {}, -- alert : alert user, immediate input / action (foreground+background) 17 | {}, -- ref : urls, file-paths, ... (foreground + background) 18 | {}, -- inactive : inaccessible element (foreground + background) 19 | {}, -- ui : generic UI elements like menubar 20 | 21 | -- terminal clients below -- 22 | {0x28, 0x28, 0x28}, -- black 23 | {0xcc, 0x24, 0x1d}, -- red 24 | {0x98, 0x97, 0x1a}, -- green 25 | {0xd7, 0x99, 0x21}, -- yellow 26 | {0x45, 0x85, 0x88}, -- blue 27 | {0xb1, 0x62, 0x86}, -- magenta 28 | {0x68, 0x9d, 0x6a}, -- cyan 29 | {0xa8, 0x99, 0x84}, -- light-grey 30 | {0x92, 0x83, 0x74}, -- dark-grey 31 | {0xfb, 0x49, 0x34}, -- light-red 32 | {0xb8, 0xbb, 0x26}, -- light-green 33 | {0xfa, 0xbd, 0x2f}, -- light-yellow 34 | {0x83, 0xa5, 0x98}, -- light-blue 35 | {0xd3, 0x86, 0x9b}, -- light-magenta 36 | {0x8e, 0xc0, 0x7c}, -- light-cyan 37 | {0xeb, 0xdb, 0xb2}, -- white 38 | 39 | {0xa8, 0x99, 0x84}, -- foreground 40 | {0x28, 0x28, 0x28}, -- background 41 | } 42 | -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/solarized-light.lua: -------------------------------------------------------------------------------- 1 | -- scheme: 2 | -- by: 3 | return { 4 | {88, 110, 117}, 5 | {}, -- secondary 6 | {253, 246, 227}, 7 | {88, 110, 227, 253, 246, 227}, 8 | {88, 110, 117}, 9 | {}, -- alt-cursor 10 | {}, -- highlight 11 | {}, -- label 12 | {}, -- warning 13 | {}, -- error 14 | {}, -- alert 15 | {}, -- reference 16 | {}, -- inactive 17 | {}, -- ui 18 | {0, 43, 54}, 19 | {220, 50, 47}, 20 | {133, 153, 0}, 21 | {181, 137, 0}, 22 | {38, 139, 210}, 23 | {108, 113, 196}, 24 | {42, 161, 152}, 25 | {147, 161, 161}, 26 | {101, 123, 131}, 27 | {220, 50, 47}, 28 | {133, 153, 0}, 29 | {181, 137, 0}, 30 | {38, 139, 210}, 31 | {108, 113, 196}, 32 | {42, 161, 152}, 33 | {253, 246, 227}, 34 | {88, 110, 117}, 35 | {253, 246, 227}, 36 | } -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/solarized.lua: -------------------------------------------------------------------------------- 1 | -- scheme: 2 | -- by: 3 | return { 4 | {147, 161, 161}, 5 | {}, -- secondary 6 | {0, 43, 54}, 7 | {147, 161, 54, 0, 43, 54}, 8 | {147, 161, 161}, 9 | {}, -- alt-cursor 10 | {}, -- highlight 11 | {}, -- label 12 | {}, -- warning 13 | {}, -- error 14 | {}, -- alert 15 | {}, -- reference 16 | {}, -- inactive 17 | {}, -- ui 18 | {0, 43, 54}, 19 | {220, 50, 47}, 20 | {133, 153, 0}, 21 | {181, 137, 0}, 22 | {38, 139, 210}, 23 | {108, 113, 196}, 24 | {42, 161, 152}, 25 | {147, 161, 161}, 26 | {101, 123, 131}, 27 | {220, 50, 47}, 28 | {133, 153, 0}, 29 | {181, 137, 0}, 30 | {38, 139, 210}, 31 | {108, 113, 196}, 32 | {42, 161, 152}, 33 | {253, 246, 227}, 34 | {147, 161, 161}, 35 | {0, 43, 54}, 36 | } -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/srcery.lua: -------------------------------------------------------------------------------- 1 | return { 2 | {252, 232, 195}, 3 | {}, -- secondary 4 | {28, 27, 25}, 5 | {252, 232, 25, 28, 27, 25}, 6 | {251, 184, 41}, 7 | {4, 71, 214}, 8 | {}, -- highlight 9 | {}, -- label 10 | {}, -- warning 11 | {}, -- error 12 | {}, -- alert 13 | {}, -- reference 14 | {}, -- inactive 15 | {}, -- ui 16 | {28, 27, 25}, 17 | {239, 47, 39}, 18 | {81, 159, 80}, 19 | {251, 184, 41}, 20 | {44, 120, 191}, 21 | {224, 44, 109}, 22 | {10, 174, 179}, 23 | {208, 191, 161}, 24 | {145, 129, 117}, 25 | {247, 83, 65}, 26 | {152, 188, 55}, 27 | {254, 208, 110}, 28 | {104, 168, 228}, 29 | {255, 92, 143}, 30 | {83, 253, 233}, 31 | {252, 232, 195}, 32 | {252, 232, 195}, 33 | {28, 27, 25}, 34 | } -------------------------------------------------------------------------------- /durden/devmaps/colorschemes/twilight.lua: -------------------------------------------------------------------------------- 1 | return { 2 | {167, 167, 167}, 3 | {0, 0, 0}, 4 | {}, -- background 5 | {167, 167, 0, 0, 0, 0}, 6 | {}, -- cursor 7 | {}, -- alt-cursor 8 | {}, -- highlight 9 | {}, -- label 10 | {}, -- warning 11 | {}, -- error 12 | {}, -- alert 13 | {}, -- reference 14 | {}, -- inactive 15 | {}, -- ui 16 | {0, 0, 0}, 17 | {207, 106, 76}, 18 | {143, 157, 106}, 19 | {249, 238, 152}, 20 | {117, 135, 166}, 21 | {155, 133, 157}, 22 | {175, 196, 219}, 23 | {167, 167, 167}, 24 | {95, 90, 96}, 25 | {207, 106, 76}, 26 | {143, 157, 106}, 27 | {249, 238, 152}, 28 | {117, 135, 166}, 29 | {155, 133, 157}, 30 | {175, 196, 219}, 31 | {255, 255, 255}, 32 | {167, 167, 167}, 33 | {0, 0, 0}, 34 | } 35 | -------------------------------------------------------------------------------- /durden/devmaps/composition/basic.lua: -------------------------------------------------------------------------------- 1 | -- basic test layout for something 2 | 3 | return { 4 | width = 1280, 5 | height = 720, 6 | dynamic = false, 7 | items = { 8 | { 9 | order = 0, 10 | x = 0, 11 | x2 = 1280, 12 | y = 0, 13 | y2 = 720, 14 | rotation = 0, 15 | shader = "vignette", 16 | static_media = "$random:wallpapers/*.jpg", 17 | reload_timer = 1000, 18 | reload_fade = 10 19 | }, 20 | { 21 | order = 1, 22 | x = 150, 23 | x2 = 855, 24 | y = 40, 25 | y2 = 430, 26 | slot = "preview", 27 | }, 28 | { 29 | order = 2, 30 | x = 730, 31 | x2 = 970, 32 | y = 260, 33 | y2 = 430, 34 | slot = "extra_1" 35 | }, 36 | { 37 | order = 1, 38 | x = 1000, 39 | x2 = 1140, 40 | y = 260, 41 | y2 = 430, 42 | slot = "mascot", 43 | }, 44 | { 45 | order = 1, 46 | x = 800, 47 | y = 100, 48 | x2 = 1180, 49 | y2 = 660, 50 | selector = "list", 51 | config = { 52 | font = "default.ttf", 53 | font_sz = 24, 54 | text_color = "ffffff", 55 | background = {28, 28, 28, 127}, 56 | animation = 10 57 | } 58 | } 59 | }, 60 | on_load = "/target/composition/selectors/list/generate=/home" 61 | } 62 | -------------------------------------------------------------------------------- /durden/devmaps/display/README.md: -------------------------------------------------------------------------------- 1 | Display 2 | ======= 3 | 4 | These device configurations files are simply lua scripts that will be 5 | scanned once upon startup. They are used for initial configuration of 6 | devices where autodetection is wrong or you may want special treatment 7 | in regards to window manager, synchronization or density. 8 | 9 | The scripts are expected to return a table with the following fields: 10 | 11 | (obligatory) 12 | name (string) = 'identifier' : used for scripting / logging reference 13 | ident (string) = 'pattern' : name can be found in global/display/displays and 14 | is the first part followed by / and then the 15 | serial. 16 | 17 | the following optional fields will be used when found: 18 | wm (string) = 'ignore' : specify how the display should be treated, 19 | currently accepted values: 20 | ignore - never use this display 21 | tiler - tiling window manager (default) 22 | 23 | will be expanded later to support displays dedicated 24 | for media output, VR compositing, etc. 25 | 26 | backlight (number 0..1) : set default initial backlight value 27 | ppcm (number) : specify pixels per centimers 28 | width (number) : try to pick a mode that match this width 29 | height (number) : try to pick a mode that match this height 30 | tag : nil or 'VR' : special subtype that some tools and clients may look for 31 | -------------------------------------------------------------------------------- /durden/devmaps/display/index.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | name = 'valve_index', 4 | ident = 'IndexHMD/unknown', 5 | wm = 'ignore', 6 | tag = 'VR' 7 | }; 8 | -------------------------------------------------------------------------------- /durden/devmaps/display/lg100.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | name = 'lg100', 4 | ident = 'ToshibaUH2D/unknown', 5 | wm = 'ignore', 6 | tag = 'VR' 7 | }; 8 | -------------------------------------------------------------------------------- /durden/devmaps/display/psvr.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | name = 'sony_morpheus', 4 | ident = '^SCEIHMD', 5 | wm = 'ignore', 6 | tag = 'VR' 7 | }; 8 | -------------------------------------------------------------------------------- /durden/devmaps/display/rift.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | name = 'oculus_rift', 4 | ident = '^Rift/WMHD', 5 | wm = 'ignore', 6 | tag = 'VR' 7 | }; 8 | -------------------------------------------------------------------------------- /durden/devmaps/display/vive.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | name = 'htc_vive', 4 | ident = '^HTCVIVE', 5 | wm = 'ignore', 6 | tag = 'VR' 7 | }; 8 | -------------------------------------------------------------------------------- /durden/devmaps/display/vivepro.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | name = 'vivepro', 4 | ident = '^HTCVIVEPro', 5 | wm = 'ignore', 6 | tag = 'VR' 7 | }; 8 | -------------------------------------------------------------------------------- /durden/devmaps/game/README.md: -------------------------------------------------------------------------------- 1 | Game Device 2 | ============ 3 | 4 | These configuration files are lua scripts that are loaded/scanned once 5 | on startup. They are expected to return an identity string, a platform 6 | string two functions and two tables like this: 7 | 8 | return "My Game Device", "linux", function(subid) 9 | return "BUTTON" .. tostring(subid); 10 | end, function (subid) 11 | return "AXIS" .. tostring(subid+5), 1; 12 | end, 13 | {7,8,9}, {1, 4, 7}; 14 | 15 | Where the string identifies the device (new devices are matched against 16 | this string), the platform string specifies the input platform for where 17 | this is valid (the mapping can change between OSes and input platforms), 18 | the two functions are invoked to translate a subid to a valid BUTTONn 19 | and AXISn stringl, and the two tables are blacklisted digital and analog 20 | input subids to filter as early as possible. 21 | 22 | Easiest way to find the IDs to use for remapping is to run the 23 | tests/interactive/eventtest helper appl. 24 | -------------------------------------------------------------------------------- /durden/devmaps/game/linux_ps3.lua: -------------------------------------------------------------------------------- 1 | -- the device maps are somewhat simpler than keymaps in that we do not support 2 | -- n- states (press a then dash and merge into..) or state modifiers [btn1+btn2] 3 | -- but only a translation [SLOT(1), SUBID(4)] into something like PLAYER1_UP 4 | 5 | local remap_tbl = {}; 6 | remap_tbl[3] = "START"; 7 | remap_tbl[0] = "SELECT"; 8 | remap_tbl[4] = "UP"; 9 | remap_tbl[6] = "DOWN"; 10 | remap_tbl[7] = "LEFT"; 11 | remap_tbl[5] = "RIGHT"; 12 | remap_tbl[15] = "BUTTON1"; 13 | remap_tbl[12] = "BUTTON2"; 14 | remap_tbl[13] = "BUTTON3"; 15 | remap_tbl[14] = "BUTTON4"; 16 | remap_tbl[10] = "BUTTON5"; 17 | remap_tbl[11] = "BUTTON6"; 18 | remap_tbl[1] = "BUTTON7"; 19 | remap_tbl[2] = "BUTTON8"; 20 | remap_tbl[8] = "BUTTON9"; 21 | remap_tbl[9] = "BUTTON10"; 22 | remap_tbl[416] = "BUTTON11"; 23 | 24 | return "Sony PLAYSTATION(R)3 Controller", "linux", 25 | function(subid) 26 | return remap_tbl[subid] and remap_tbl[subid] or "BUTTON" .. tostring(subid); 27 | end, 28 | -- returns two arguments, label and sample scale factor 29 | function(subid) 30 | return "AXIS" .. tostring(subid+1), 1; 31 | end 32 | -------------------------------------------------------------------------------- /durden/devmaps/game/linux_ps4.lua: -------------------------------------------------------------------------------- 1 | -- the device maps are somewhat simpler than keymaps in that we do not support 2 | -- n- states (press a then dash and merge into..) or state modifiers [btn1+btn2] 3 | -- but only a translation [SLOT(1), SUBID(4)] into something like PLAYER1_UP 4 | 5 | local remap_tbl = {}; 6 | remap_tbl[65251] = "START"; 7 | remap_tbl[65248] = "SELECT"; 8 | remap_tbl[66] = "UP"; 9 | remap_tbl[67] = "DOWN"; 10 | remap_tbl[64] = "LEFT"; 11 | remap_tbl[65] = "RIGHT"; 12 | remap_tbl[16] = "BUTTON1"; 13 | remap_tbl[19] = "BUTTON2"; 14 | remap_tbl[18] = "BUTTON3"; 15 | remap_tbl[17] = "BUTTON4"; 16 | remap_tbl[20] = "BUTTON5"; 17 | remap_tbl[21] = "BUTTON6"; 18 | remap_tbl[26] = "BUTTON7"; 19 | remap_tbl[27] = "BUTTON8"; 20 | remap_tbl[28] = "BUTTON9"; 21 | remap_tbl[22] = "BUTTON10"; 22 | remap_tbl[23] = "BUTTON11"; 23 | remap_tbl[0] = "1"; 24 | remap_tbl[1] = "2"; 25 | remap_tbl[2] = "3"; 26 | remap_tbl[5] = "4"; 27 | remap_tbl[3] = "5"; 28 | remap_tbl[4] = "6"; 29 | 30 | return "Sony Computer Entertainment Wireless Controller", "linux", 31 | function(subid) 32 | return remap_tbl[subid] and remap_tbl[subid] or "BUTTON" .. tostring(subid); 33 | end, 34 | -- returns two arguments, label and sample scale factor 35 | function(subid) 36 | return "AXIS" .. tostring(subid+1), 1; -- maybe expose range and zones here 37 | end, 38 | {}, -- blacklist buttons 39 | {} -- blacklist analog 40 | -------------------------------------------------------------------------------- /durden/devmaps/game/linux_rband.lua: -------------------------------------------------------------------------------- 1 | -- the device maps are somewhat simpler than keymaps in that we do not support 2 | -- n- states (press a then dash and merge into..) or state modifiers [btn1+btn2] 3 | -- but only a translation [SLOT(1), SUBID(4)] into something like PLAYER1_UP 4 | 5 | local remap_tbl = {}; 6 | remap_tbl[27] = "START"; 7 | remap_tbl[26] = "SELECT"; 8 | remap_tbl[67] = "UP"; 9 | remap_tbl[66] = "DOWN"; 10 | remap_tbl[64] = "LEFT"; 11 | remap_tbl[65] = "RIGHT"; 12 | remap_tbl[16] = "BUTTON1"; 13 | remap_tbl[17] = "BUTTON2"; 14 | remap_tbl[20] = "BUTTON3"; 15 | remap_tbl[19] = "BUTTON4"; 16 | remap_tbl[22] = "BUTTON5"; 17 | remap_tbl[67] = "BUTTON6"; 18 | remap_tbl[66] = "BUTTON7"; 19 | remap_tbl[28] = "BUTTON8"; 20 | remap_tbl[3] = "1"; 21 | remap_tbl[2] = "2"; 22 | remap_tbl[5] = "3"; 23 | 24 | return "RedOctane Guitar Hero X-plorer", "linux", 25 | function(subid) 26 | return remap_tbl[subid] and remap_tbl[subid] or "BUTTON" .. tostring(subid); 27 | end, 28 | -- returns two arguments, label and sample scale factor 29 | function(subid) 30 | return "AXIS" .. tostring(subid+1), 1; 31 | end 32 | -------------------------------------------------------------------------------- /durden/devmaps/game/linux_x360.lua: -------------------------------------------------------------------------------- 1 | -- the device maps are somewhat simpler than keymaps in that we do not support 2 | -- n- states (press a then dash and merge into..) or state modifiers [btn1+btn2] 3 | -- but only a translation [SLOT(1), SUBID(4)] into something like PLAYER1_UP 4 | 5 | local remap_tbl = {}; 6 | remap_tbl[27] = "START"; 7 | remap_tbl[26] = "SELECT"; 8 | remap_tbl[66] = "UP"; 9 | remap_tbl[67] = "DOWN"; 10 | remap_tbl[64] = "LEFT"; 11 | remap_tbl[65] = "RIGHT"; 12 | remap_tbl[19] = "BUTTON1"; 13 | remap_tbl[20] = "BUTTON2"; 14 | remap_tbl[17] = "BUTTON3"; 15 | remap_tbl[16] = "BUTTON4"; 16 | remap_tbl[22] = "BUTTON5"; 17 | remap_tbl[23] = "BUTTON6"; 18 | remap_tbl[29] = "BUTTON7"; 19 | remap_tbl[30] = "BUTTON8"; 20 | remap_tbl[28] = "BUTTON9"; 21 | 22 | -- axis 23 | remap_tbl[0] = "1"; 24 | remap_tbl[1] = "2"; 25 | remap_tbl[2] = "5"; 26 | remap_tbl[3] = "3"; 27 | remap_tbl[4] = "4"; 28 | remap_tbl[5] = "6"; 29 | 30 | return "Microsoft X-Box 360 pad", "linux", 31 | function(subid) 32 | return remap_tbl[subid] and remap_tbl[subid] or "BUTTON" .. tostring(subid); 33 | end, 34 | -- returns two arguments, label and sample scale factor 35 | function(subid) 36 | return "AXIS" .. remap_tbl[subid] and remap_tbl[subid] or tostring(subid), 1; 37 | end 38 | -------------------------------------------------------------------------------- /durden/devmaps/game/sdl_darwin_ps3.lua: -------------------------------------------------------------------------------- 1 | -- the device maps are somewhat simpler than keymaps in that we do not support 2 | -- n- states (press a then dash and merge into..) or state modifiers [btn1+btn2] 3 | -- but only a translation [SLOT(1), SUBID(4)] into something like PLAYER1_UP 4 | 5 | local remap_tbl = {}; 6 | remap_tbl[3] = "START"; 7 | remap_tbl[0] = "SELECT"; 8 | remap_tbl[4] = "UP"; 9 | remap_tbl[6] = "DOWN"; 10 | remap_tbl[7] = "LEFT"; 11 | remap_tbl[5] = "RIGHT"; 12 | remap_tbl[15] = "BUTTON1"; 13 | remap_tbl[12] = "BUTTON2"; 14 | remap_tbl[13] = "BUTTON3"; 15 | remap_tbl[14] = "BUTTON4"; 16 | remap_tbl[15] = "BUTTON5"; 17 | remap_tbl[11] = "BUTTON6"; 18 | remap_tbl[8] = "BUTTON7"; 19 | remap_tbl[9] = "BUTTON8"; 20 | remap_tbl[10] = "BUTTON9"; 21 | 22 | return "PLAYSTATION(R)3", "darwin", 23 | function(subid) 24 | return remap_tbl[subid] and remap_tbl[subid] or "BUTTON" .. tostring(subid); 25 | end, 26 | -- returns two arguments, label and sample scale factor 27 | function(subid) 28 | return "AXIS" .. tostring(subid+1), 1; 29 | end 30 | -------------------------------------------------------------------------------- /durden/devmaps/keyboard/README.md: -------------------------------------------------------------------------------- 1 | Keyboard Maps 2 | ============= 3 | 4 | Initially, durden always tries to load the keymap with the name 5 | 'default' (if such a map exists) 6 | 7 | These device configurations files are simply lua scripts that will be 8 | scanned once upon startup. Each is a keymap that can be loaded manually 9 | or bound to a normal meta+key-press combination. The actual format is 10 | a table with a number of subtables and is best configured either through 11 | the user-interface or with a tool to export other native keymaps. 12 | 13 | Basic table layout: 14 | 15 | return { 16 | name = "mymap", 17 | map = { 18 | [plain] = {[25] = "a"},, 19 | ["lalt"] = {[25] = "!"}, 20 | ["ralt"] = {[21] = "@"}, 21 | ["rctrl"] = {}, 22 | ["lctrl"] = {}, 23 | ["lmeta"] = {}, 24 | ["rmeta"] = {}, 25 | ["num"] = {} 26 | }, 27 | symmap = 28 | { 29 | [58] = "ESCAPE" 30 | }, 31 | dctbl = 32 | { 33 | [25] = {25, 49, "!"} 34 | } 35 | meta_1_sym = "COLON", 36 | meta_2_sym = "GREATER" 37 | } 38 | 39 | The map table takes the subids of the translated device input table, 40 | applies the platform tracked modifier and sets the 'utf8' field to 41 | whatever codepoint it corresponds to. 42 | 43 | The dctbl table walks the subtable of subids until the entire sequence 44 | is provided, then adds/emits the utf8 codepoint at the end of the table. 45 | 46 | This is used for combinatory marks, e.g. 'e' + '!' -> ~ 47 | if the chain is broken, the normal map applies for the initial character. 48 | 49 | The symmap table remaps raw symbols, often used together with meta\_1\_sym 50 | and meta\_2\_sym for application specific keybindings. 51 | 52 | The symbolic names are lifted from SDL1.2, and shown in builtin/keyboard.lua 53 | -------------------------------------------------------------------------------- /durden/devmaps/menus/README.md: -------------------------------------------------------------------------------- 1 | Menu Selectors 2 | ============== 3 | Menu selectors are simply profiles that can be used to generate customised 4 | slices of various menu paths. These are dynamically generated each time they 5 | are 'triggered'. They register in the /menus/ path, with the name matching 6 | that of the filename of the .lua file itself. 7 | 8 | The big caveat to this approach is that it is possible to create menus with 9 | name collisions, and in the event on such collisions, the name of the entries 10 | will be modified to have a \_n where appended. 11 | 12 | If the entry is a table of strings instead of a string, the first entry will 13 | be treated as the new label (allowing renaming) and the second as the menu 14 | path. 15 | 16 | Some menus are referenced as part of other uielements, the included wsbtn, 17 | for instance, is the default for right-click on statusbar workspace icons 18 | as per the gconfig(ws\_popup) key. 19 | 20 | Example 21 | ======= 22 | return { 23 | "/global/open/terminal=", 24 | "/global/open/target", 25 | {"Dropdown", "/global/tools/dterm"} 26 | }; 27 | -------------------------------------------------------------------------------- /durden/devmaps/menus/cli_icon.lua: -------------------------------------------------------------------------------- 1 | -- this menu is applied as a context menu to the workspace- buttons in the statusbar 2 | return { 3 | {"CLI Group", "/global/open/terminal_group"}, 4 | {"Open", "/global/open/target"}, 5 | {"System", "/global/system"}, 6 | {"Settings", "/global/settings"}, 7 | {"Input", "/global/input"}, 8 | }; 9 | -------------------------------------------------------------------------------- /durden/devmaps/menus/floatbg.lua: -------------------------------------------------------------------------------- 1 | -- this menu is applied as a context menu to the workspace- buttons in the statusbar 2 | return { 3 | {"Open", "/global/open"}, 4 | {"Background", "/global/workspace/bg"}, 5 | }; 6 | -------------------------------------------------------------------------------- /durden/devmaps/menus/wsbtn.lua: -------------------------------------------------------------------------------- 1 | -- this menu is applied as a context menu to the workspace- buttons in the statusbar 2 | return { 3 | {"Stacked", "/global/workspace/layout/float"}, 4 | {"Tiling", "/global/workspace/layout/tile_toggle"}, 5 | {"Tiling-BSP", "/global/workspace/layout/tile_bsp"}, 6 | {"Tabbed", "/global/workspace/layout/tab"}, 7 | {"Vertical-tab", "/global/workspace/layout/vtab"}, 8 | {"Column-tab", "/global/workspace/layout/htab"}, 9 | }; 10 | -------------------------------------------------------------------------------- /durden/devmaps/osd/default.lua: -------------------------------------------------------------------------------- 1 | 2 | local tbl = 3 | { 4 | size = 18, 5 | { -- page 6 | {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "|", "$code=8;←"}, -- 'row' 7 | {"q", "w", "e", "r", "t", "y", "o", "i", "p", "|", "/"}, 8 | {"a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "\\", "$code=13;↲"}, 9 | {"z", "x", "c", "v", "b", "n", "m", "$", ".", ":", ","} 10 | }, 11 | { 12 | {"!", "@", "#", "$", "%", "^", "&", "(", ")", "[", "]"}, 13 | {"Q", "W", "E", "R", "T", "Y", "O", "P", "_"}, 14 | {"A", "S", "D", "F", "G", "H", "J", "K", "L", "{", "}"}, 15 | {"Z", "X", "C", "V", "B", "N", "M", "\"", "'", "`", "~"} 16 | }, 17 | { 18 | { 19 | "$code=282;F1", 20 | "$code=283;F2", 21 | "$code=284;F3", 22 | "$code=285;F4", 23 | "$code=286;F5", 24 | "$code=282;F6", 25 | "$code=283;F7", 26 | "$code=284;F8", 27 | "$code=285;F9", 28 | "$code=286;F10", 29 | }, 30 | {"1", "2", "3", "+", "/", "=", "@"}, 31 | {"4", "5", "6", "-", "<", ">"}, 32 | {"7", "8", "9", "%", "^", "#", "!"} 33 | }, 34 | bottom = 35 | {"$page=3;123", "$alias= ;Space", "$page=2;AZ", "$hide;❌"} 36 | } 37 | 38 | return tbl 39 | -------------------------------------------------------------------------------- /durden/devmaps/rotary/rotary.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | name = "surface_dial", 4 | label = "Surface Dial System Multi Axis", 5 | gestures = { 6 | ["click"] = nil, -- replace with desired path 7 | ["dblclick"] = nil, 8 | ["idle_enter"] = nil, 9 | ["idle_leave"] = nil, 10 | }, 11 | scale = 1, 12 | scale_press = 2 13 | }, 14 | { 15 | name = "power_mate", 16 | label = "Griffin PowerMate", 17 | gestures = { 18 | ["click"] = nil, -- replace with desired path 19 | ["dblclick"] = "/global", 20 | ["idle_enter"] = nil, 21 | ["idle_leave"] = nil, 22 | ["longpress"] = "/target" 23 | }, 24 | scale = 1, 25 | scale_press = 2 26 | }, 27 | -- while not exactly 'similar' to other rotary controllers, 28 | -- it is similar enough to emulate the rest (i.e. rz -> step) 29 | -- 30 | -- the : prefix in the path is an input module specific emulation action 31 | { 32 | name = "space_mouse", 33 | label = "3Dconnexion SpaceMouse Pro", 34 | buttons = { 35 | [1] = "/global/input/keyboard/symbol/escape", -- ESC 36 | [8] = "", -- Alt 37 | [9] = "", -- Shift 38 | [10] = "", -- Control 39 | [11] = "", -- spin 40 | [256] = "/global", -- Menu 41 | [268] = "/global/input/mouse/buttons/1", -- 1 42 | [269] = "/global/input/mouse/buttons/2", -- 2 43 | [270] = "/global/input/mouse/buttons/3", -- 3 44 | [281] = "", -- 4 45 | [257] = "/target", -- fit 46 | [258] = "", -- top 47 | [260] = "", -- right 48 | [261] = "", -- front 49 | [264] = "", -- roll 50 | }, 51 | gestures = { 52 | ["idle_enter"] = nil, 53 | ["idle_leave"] = nil, 54 | }, 55 | axis_map = { 56 | [4] = 0, -- x 57 | [3] = 1, -- y 58 | [2] = 2, -- z 59 | [5] = 3, -- rz 60 | }, 61 | resample = 62 | function(axis, sample) 63 | local norm = math.clamp(math.abs(sample) / 350, 0, 1); 64 | return sample * (1/350) * 32767; 65 | end, 66 | elastic = true, 67 | tick_rate = 2, -- affects sensitivity 68 | scale = 1, 69 | scale_press = 2 70 | } 71 | }; 72 | -------------------------------------------------------------------------------- /durden/devmaps/schemes/README.md: -------------------------------------------------------------------------------- 1 | UI Schemes 2 | ============ 3 | Warning: a bad profile may leave the system useless. 4 | 5 | These are presets of menu-paths that can be activated as part of some trigger, 6 | such as a workspace switch or macro keybinding. Although they can be set to 7 | activate any set of paths in sequence (security and stability risk, you are at 8 | your own risk here), intent is that it is used for the config/visual- paths 9 | though it is not enforced via some filter. 10 | 11 | Be particularly careful with target path that would cause some destructive 12 | change, e.g. window deletion. The same goes for global action that would change 13 | the setup being operated on, like reassignment etc. 14 | 15 | For normal 'my' startup actions, still use the autorun.lua mechanism. 16 | 17 | NOTES: 18 | The bindings, filters and on\_install feature are not yet complete. Schemes 19 | should be combinable, so that there can be preset schemes for a certain input 20 | or navigation setup - but another for defining the look and feel. 21 | 22 | Schemes in this folder are scanned at startup/reset time and can be found in 23 | global/config/schemes/name, . it is expected to return a table with the following 24 | format: 25 | 26 | return { 27 | name = "scheme_name", 28 | 29 | -- will be communicated to windows that support color-scheme 30 | -- definitions (external) and for the scope it is activated (optional) 31 | palette = { 32 | primary = {0, 255, 0}, 33 | secondary = {0, 127, 0}, 34 | background = {0, 0, 0}, 35 | label = {0, 255, 0}, 36 | warning = {127, 0, 0}, 37 | error = {255, 0, 0}, 38 | alert = {255, 255, 0}, 39 | inactive = {0, 127, 0}, 40 | }, 41 | 42 | -- default keybindings, these will not override entries in 43 | -- custs_ or custg_ (those bound via global/input/bind/... etc) 44 | -- but when switching profiles, the bindings defined in the last 45 | -- will be removed 46 | bindings = { 47 | }, 48 | 49 | -- since activating many menu paths will updated the saved value 50 | -- for the next time, the actions in this list will only be ran 51 | -- when a new profile is installed/switched to. 52 | on_install = { 53 | }, 54 | 55 | -- will be ran no matter what context the profile is activated in, 56 | -- target actions (# prefix) apply to the currently selected window. 57 | -- An added feature for menu paths here is that it is also possible 58 | -- to set multiple filter- domains for target actions with the 59 | -- $prefix, like: $title%pattern or $title=pattern. 60 | -- these can be chained, like $title%pattern$tag=mytag#window/move 61 | -- valid filter domains: 62 | -- mode=float | tabbed | fullscreen | tile | tab | vtab 63 | -- source=external | internal 64 | -- atype= terminal | wayland | x11 etc. (see atypes / *.lua) 65 | -- title= string 66 | -- tag= string 67 | 68 | -- valid 69 | actions = { 70 | "/global/action/one", 71 | "/global/action/two" 72 | }, 73 | 74 | -- will be ran if the profile is set globally. 75 | global = {}, 76 | 77 | -- will be ran if the profile is set on a display. Target actions 78 | -- will be applied to all windows in all workspaces on the display. 79 | display = { 80 | }, 81 | 82 | -- will be ran if the profile is set on a workspace. Target actions 83 | -- (#prefix) will be applied to all windows in the workspace by 84 | -- a silent select action. 85 | workspace = { 86 | "/global/action/one", 87 | "/target/action/two" 88 | }, 89 | 90 | -- will be run if the profile is set on a window. 91 | window = { 92 | }, 93 | }; 94 | 95 | See the default.lua for an example file that can be used to build on. The 96 | scheme- profiles are combined with the 'flair' tool for controlling visual 97 | effects. 98 | -------------------------------------------------------------------------------- /durden/devmaps/touch/default.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Default touch-pad profile, without this script available, 3 | -- the touchpad support will be disabled. Copy and change 'label', 4 | -- name and 'matchflt' to support customized profiles for different 5 | -- devices. 6 | -- 7 | 8 | return { 9 | label = "default", 10 | name = "default", 11 | 12 | -- device string pattern or explicit string for auto- selecting profile, 13 | -- not needed for the special 'default' name 14 | matchflt = nil, 15 | 16 | -- track / remember sample values to figure out device range 17 | autorange = true, 18 | 19 | -- invalid default range due to "autorange" 20 | range = {VRESW, VRESH, 1, 1}, 21 | 22 | -- other option is 'absmouse' 23 | classifier = "relmouse", 24 | 25 | -- ignore samples until we get one inside (>= [1,2] <= [3,4]) 26 | activation = {0.2, 0.2, 0.8, 0.8}, 27 | 28 | -- "pre-mouse" acceleration 29 | scale_x = 3.0, 30 | scale_y = 2.5, 31 | 32 | -- ignore samples between state changes for a number of ticks 33 | default_cooldown = 2, 34 | 35 | -- window for drag-vs-swipe evaluation 36 | mt_eval = 5, 37 | 38 | -- useful when combining touch displays, track pad and regular mouse, 39 | -- motion block stops cursor movement (gestures only) and warp_press 40 | -- makes digital events warp to last known device-specific x,y, send a 41 | -- press and then jump back 42 | motion_block = false, 43 | warp_press = false, 44 | 45 | -- ignore all digital events on the device, only use touch for 'click' 46 | button_block = false, 47 | 48 | -- reset touch- tracking after n ticks of no input samples 49 | timeout = 10, 50 | 51 | -- minimum weighted normalized distance to move for gesture to register 52 | swipe_threshold = 0.2, 53 | drag_threshold = 0.05, 54 | drag_step = 0.01, 55 | 56 | -- options for various rotated screens, inversions are applied after swap 57 | swap_xy = false, 58 | invert_x = false, 59 | invert_y = false, 60 | 61 | -- treat 2f drag gestures as analog mouse wheel, masking out any 62 | -- drag2_up/drag2_down gestures 63 | drag_2f_analog = false, 64 | drag_2f_analog_factor = {100, 100}, 65 | 66 | -- menu path to trigger on gestures, valid are: 67 | -- swipe(n)_(dir) where (n) == 2,3,4... and (dir) == up,down,left,right 68 | -- drag(n)_(dir) where (n) == 2,3,4... and (dir) == up,down,left,right 69 | gestures = { 70 | swipe3_right = '/global/workspace/switch/next', 71 | swipe3_left = '/global/workspace/switch/prev', 72 | drag2_up = '/global/input/mouse/button/4', 73 | drag2_down = '/global/input/mouse/button/5', 74 | } 75 | }; 76 | -------------------------------------------------------------------------------- /durden/devmaps/touch/elan9038_go.lua: -------------------------------------------------------------------------------- 1 | local remap_tbl = {}; 2 | remap_tbl[0] = 0; 3 | remap_tbl[1] = 0; 4 | 5 | -- special buttons: 6 | -- 32 - presence 7 | -- 33 - eraser presence 8 | -- 1 - pen buttoN 9 | -- 0 - pen on surface 10 | -- eraser-button : doesn't respond (kernel level) 11 | 12 | return { 13 | label = "Elan Surface GO Pen", 14 | name = "elan_9038_pen", 15 | matchstr = "ELAN9038:00 04F3:261A", 16 | autorange = false, 17 | range = {0, 0, 13312, 8960}, 18 | classifier = "absmouse", 19 | axis_remap = remap_tbl, 20 | activation = {0.0, 0.0, 1.0, 1.0}, 21 | scale_x = 1.0, 22 | scale_y = 1.0, 23 | button_gestures = { 24 | [32] = "ignore", 25 | [33] = "ignore" 26 | }, 27 | default_cooldown = 2, 28 | mt_eval = 5, 29 | mt_disable = true, 30 | motion_block = false, 31 | warp_press = true, 32 | timeout = 1, 33 | swipe_threshold = 0.2, 34 | drag_threshold = 0.2, 35 | gestures = { 36 | -- idle_return, popup helper menu to select / control modes 37 | ["idle_return"] = "/global", 38 | -- ["idle_return"] = "/global/tools/dterm", 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /durden/devmaps/touch/wacom_s2.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Wacom Intuos S 2", 3 | name = "wacom_s2", 4 | matchflt = "Wacom Intuos S 2 Pen", 5 | autorange = false, 6 | range = {0, 0, 15200, 9500}, 7 | classifier = "relmouse", 8 | activation = {0.0, 0.0, 1.0, 1.0}, 9 | scale_x = 1.0, 10 | scale_y = 1.0, 11 | submask = 0xffff, 12 | default_cooldown = 2, 13 | mt_eval = 5, 14 | motion_block = false, 15 | warp_press = false, 16 | timeout = 1, 17 | swipe_threshold = 0.2, 18 | drag_threshold = 0.2, 19 | gestures = { 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /durden/devmaps/tts/basic_eng.lua: -------------------------------------------------------------------------------- 1 | local tbl = 2 | { 3 | -- voice synthesiser arguments 4 | model = "English (Great Britain)", 5 | gain = 1.0, -- audo gain on source 6 | gap = 10, -- ms between words 7 | pitch = 60, -- 0 .. 100: 0 = low 8 | rate = 180, -- 10 .. 450: wpm 9 | range = 60, -- 0 .. 100: 0 = monotome 10 | channel = "l", -- l, r or lr, 11 | name = "basic_eng", 12 | punct = 1, -- 0: none, 1: all, 2: some 13 | cappitch = 5000, 14 | default = true, 15 | 16 | -- set of events that this voice will cover 17 | actions = { 18 | select = {"wind ", "tit ", "title_text", " "}, 19 | menu = "menu ", 20 | dispatch = "run ", 21 | clipboard = "clip set ", 22 | clipboard_paste = "clip paste ", 23 | notification = "notify ", 24 | menu = "menu ", 25 | a11ywnd = "wind ", 26 | }, 27 | 28 | -- called whenever voice flush is requested, disable by settil to false or nil 29 | reset_beep = {440, 0.1}, 30 | a11y_font_sz = 18, 31 | a11y_font = "hack.ttf", 32 | 33 | -- this would position the voice back and to left 34 | -- position = {-5, 0, -5}, 35 | 36 | -- pattern- matches and replacements 37 | replace = 38 | { 39 | {"^[-]", ""}, 40 | {"^terminal[-]", "term "}, 41 | {"$ [-] Chromium", ""}, 42 | {":", " colon "}, 43 | {";", " semicolon "}, 44 | {"%.", " dot "} 45 | }, 46 | 47 | -- special options and bindings for menu navigation which different input system 48 | menu = 49 | { 50 | key_echo = true, 51 | speak_prompt = "lctrl_t", 52 | speak_description = "lctrl_h", 53 | speak_path = "lctrl_p", 54 | speak_set = "lctrl_s", 55 | speak_reset = "lctrl_r", 56 | val_prefix = "val req ", 57 | val_suffix = "cur ", 58 | popup_prefix = "pop ", 59 | }, 60 | 61 | bindings = 62 | { 63 | r = "/global/tools/tts/voices/basic_eng/flush", 64 | F2 = "/global/tools/tts/voices/basic_eng/input/incrate", 65 | F3 = "/global/tools/tts/voices/basic_eng/input/decrate", 66 | t = "/global/tools/tts/voices/basic_eng/slow_replay", 67 | s = "/global/tools/tts/voices/basic_eng/text_window/row_down", 68 | d = "/global/tools/tts/voices/basic_eng/text_window/row_up", 69 | a = "/global/tools/tts/voices/basic_eng/text_window/cursor_before", 70 | f = "/global/tools/tts/voices/basic_eng/text_window/cursor_after", 71 | g = "/global/tools/tts/voices/basic_eng/text_window/synch_cursor" 72 | } 73 | } 74 | 75 | return tbl 76 | -------------------------------------------------------------------------------- /durden/devmaps/tts/cursor_eng.lua: -------------------------------------------------------------------------------- 1 | local tbl = 2 | { 3 | -- voice synthesiser arguments 4 | model = "English (Great Britain)", 5 | gain = 0.5, -- audo gain on source 6 | gap = 10, -- ms between words 7 | pitch = 40, -- 0 .. 100: 0 = low 8 | rate = 300, -- 10 .. 450: wpm 9 | range = 60, -- 0 .. 100: 0 = monotome 10 | channel = "r", -- l, r or lr, 11 | name = "cursor_eng", 12 | punct = 1, 13 | cappitch = 5000, 14 | 15 | -- set of events that this voice will cover 16 | actions = { 17 | cursor = "curs " 18 | }, 19 | 20 | cursor = 21 | { 22 | alt_text = "over ", 23 | xy_beep = {65.41, 523.25}, 24 | xy_beep_tone = "sine", 25 | xy_tuitone = "square", -- tone to play for cells with content 26 | xy_tuitone_length = 0.15, 27 | xy_tuitone_empty = "triangle", -- tone to play for empty cells 28 | xy_tuitone_empty_length = 0.1, -- shorter beep 29 | xy_tone_max = 0.15, -- at full brightness 30 | xy_tone_min = 0.05, -- at zero brightness 31 | xy_beep_timer = 15, -- how often the cursor will be sampled (1s = 25) 32 | gain = 0.7, -- max gain for the cursor tones 33 | }, 34 | 35 | reset_beep = {660, 0.1}, 36 | 37 | -- keybindings that will take over the defaults while voice is activated 38 | bindings = 39 | { 40 | q = "/global/tools/tts/voices/cursor_eng/cursor_region/ocr=64", 41 | w = "/global/tools/tts/voices/cursor_eng/cursor_region/ocr_window", 42 | e = "/global/tools/tts/voices/cursor_eng/cursor_region/edge_intensity=32,32", 43 | ["4"] = "/global/tools/tts/voices/cuersor_eng/flush", 44 | } 45 | } 46 | 47 | return tbl 48 | -------------------------------------------------------------------------------- /durden/firstrun.lua: -------------------------------------------------------------------------------- 1 | -- normally, add would query for a bind, don't want that to happen 2 | dispatch_bindtarget("/target/window/destroy"); 3 | dispatch_symbol("/global/settings/titlebar/buttons/left/add=icon_destroy"); 4 | 5 | dispatch_bindtarget("/target/window/minimize"); 6 | dispatch_symbol("/global/settings/titlebar/buttons/left/add_float=icon_minimize"); 7 | 8 | dispatch_bindtarget("/target/window/move_resize/maximize"); 9 | dispatch_symbol("/global/settings/titlebar/buttons/left/add_float=icon_maximize"); 10 | 11 | dispatch_bindtarget("/global"); 12 | dispatch_symbol("/global/settings/statusbar/buttons/left/add=Go"); 13 | 14 | -- terminal icon with a popup that also allows access to other menus 15 | dispatch_bindtarget("/global/open/terminal"); 16 | dispatch_symbol("/global/settings/statusbar/buttons/left/add=icon_cli"); 17 | 18 | dispatch_bindtarget("/global/tools/popup/menu=/menus/cli_icon"); 19 | dispatch_symbol("/global/settings/statusbar/buttons/left/extend/alternate_click/1"); 20 | 21 | dispatch_symbol("/global/settings/tools/presets") 22 | -------------------------------------------------------------------------------- /durden/fonts/default.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/fonts/default.ttf -------------------------------------------------------------------------------- /durden/fonts/emoji.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/fonts/emoji.ttf -------------------------------------------------------------------------------- /durden/fonts/hack.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/fonts/hack.ttf -------------------------------------------------------------------------------- /durden/fonts/hyperlegible.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/fonts/hyperlegible.otf -------------------------------------------------------------------------------- /durden/icons/default.lua: -------------------------------------------------------------------------------- 1 | -- icon set definition format 2 | -- 3 | -- indexed by unique identifier, referenced with icon_ prefix 4 | -- search path is prefixed icons/setname (same as lua file) 5 | -- 6 | -- source to the synthesizers and builtin shaders are in icon.lua 7 | -- 8 | -- 1. static image: 9 | -- ["myicon"] = { 10 | -- [24] = "myicon_24px.png", 11 | -- [16] = "myicon_16px.png" 12 | -- } 13 | -- 14 | -- 2. postprocessed (custom color, SDFs, ...) 15 | -- ["myicon"] = { 16 | -- [24] = function() 17 | -- return icon_synthesize_src("myicon_24px.png", 24, 18 | -- icon_colorize, {color = {"fff", 1.0, 0.0, 0.0}}); 19 | -- end 20 | -- } 21 | -- 22 | -- 3. synthesized 23 | -- ["myicon"] = { 24 | -- generator = 25 | -- function(px) 26 | -- return icon_synthesize(px, 27 | -- icon_unit_circle, {radius = {"f", 0.5}, color = {"fff", 1.0, 0.0, 0.0}}) 28 | -- end 29 | -- } 30 | -- 31 | -- and they can be mixed, i.e. if there is no direct match for a certain px size, 32 | -- the generator will be invoked. This is to allow both a SDF based vector synth 33 | -- as well as hand drawn overrides. 34 | -- 35 | -- It is up to the UI component that uses the icon to deal with the desired px 36 | -- size not actually being the returned one, and many will rather pad/relayout 37 | -- than force-scale. In that case, use the 3. method with icon_synthesize_src. 38 | -- 39 | return { 40 | ["cli"] = 41 | { 42 | [24] = function() 43 | return icon_synthesize_src("cli_24px.png", 24, 44 | icon_colorize, {color = {"fff", 1.0, 1.0, 1.0}}); 45 | end, 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /durden/icons/default/cli_24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/letoram/durden/5477be8823f0259d3d07bdcb0f6fd23b6d518756/durden/icons/default/cli_24px.png -------------------------------------------------------------------------------- /durden/input/classifiers/empty.lua: -------------------------------------------------------------------------------- 1 | -- local idevice_log, idevice_fmt = suppl_add_logfn("idevice"); 2 | -- local touchm_evlog = function(msg) 3 | -- idevice_log("submodule=touch:classifier=empty:" .. msg); 4 | -- end 5 | 6 | return 7 | { 8 | empty = { 9 | init = function(...) 10 | end, 11 | label = "Empty", 12 | description = "Classifier will silently discard all inputs", 13 | sample = function() end, 14 | tick = function() end, 15 | gestures = {}, 16 | menu = nil 17 | }} 18 | -------------------------------------------------------------------------------- /durden/input/classifiers/touch.lua: -------------------------------------------------------------------------------- 1 | local idevice_log, fmt = suppl_add_logfn("idevice"); 2 | local touchm_evlog = function(msg) 3 | idevice_log("submodule=touch:classifier=touch:" .. msg); 4 | end 5 | 6 | local function init(scaled, prof) 7 | prof.scaled = scaled; 8 | end 9 | 10 | local function sample(dev, io) 11 | -- ignore other sample types for the time being 12 | if not io.touch then 13 | return true, dev.touch_only and nil or io; 14 | end 15 | 16 | if dev.autorange then 17 | touchm_update_range(dev, io); 18 | end 19 | 20 | -- normalized 21 | local x = (io.x - dev.range[1]) / dev.range[3]; 22 | local y = (io.y - dev.range[2]) / dev.range[4]; 23 | 24 | -- match to active display (assuming that the inputs come from there), 25 | -- might want the option to pair this to a specific display (dynamically) 26 | -- as there are use-cases for both, i.e. using one device as a preview 27 | -- (asus screenpad or a smartphone docked). 28 | local ad = active_display(); 29 | local rt = active_display(true); 30 | local rx = x * ad.width; 31 | local ry = y * ad.height; 32 | 33 | if dev.in_mouse then 34 | mask_mouse_input(dev, io) 35 | return true, nil; 36 | end 37 | 38 | -- missing: check if we have any preconfigured zones (cregions) 39 | -- that accept touch action 40 | if scaled then 41 | local wnd = ad.selected; 42 | if not ad.selected then 43 | return; 44 | end 45 | io.x = x * wnd.effective_width; 46 | io.y = y * wnd.effective_height; 47 | wnd:input_table(io); 48 | return; 49 | end 50 | 51 | -- open question here is if touch is allowed to modify selection status 52 | -- based on its inputs or if that should be limited to the other navigation 53 | -- controls, currently going with yes - but maybe make it into an option 54 | local lst = pick_items(rx, ry, 1, true, rt); 55 | local hit = lst[1] 56 | local wnd; 57 | 58 | -- could be optimized for special cases by checking fullscreen state 59 | if hit then 60 | for i,v in ipairs(ad.windows) do 61 | if hit == v.canvas then 62 | wnd = v; 63 | break; 64 | end 65 | end 66 | 67 | if wnd then 68 | -- window takes in surface sized pixels 69 | io.x = rx - wnd.x; 70 | io.y = ry - wnd.y; 71 | 72 | wnd:input_table(io) 73 | end 74 | end 75 | 76 | -- still here? there might be some other UI element that could be emulated 77 | -- through mouse but messing with those event handlers directly has some 78 | -- problems, then it is better to switch to emulation mode - this will not 79 | -- work if mouse input is provided simultaneously but that edge case can 80 | -- probably be ignored for now 81 | -- dev.in_mouse = true; 82 | return true, nil; 83 | end 84 | 85 | local function tick(dev) 86 | -- there are new simpler models for gesture analysis here that we should 87 | -- perhaps keep a part of this module, or have one that is touch-gesture? 88 | end 89 | 90 | return { 91 | touch = 92 | { 93 | init = function(...) 94 | init(false, ...); 95 | end, 96 | sample = sample, 97 | tick = tick, 98 | label = "Touch-Fit", 99 | description = "touch will be forwarded to the surfaces it touches without affecting selection", 100 | menu = nil, 101 | gestures = {} 102 | }, 103 | touch_scaled = 104 | { 105 | init = function(...) 106 | init(true, ...); 107 | end, 108 | sample = sample, 109 | tick = tick, 110 | label = "Touch-Scaled", 111 | gestures = {}, 112 | description = "touch samples will follow active selection and client will have full display resolution", 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /durden/ipc/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /durden/menus/global/animations.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | name = "anim_speed", 4 | label = "Animation Speed", 5 | kind = "value", 6 | hint = "(1..100)", 7 | description = "Change the animation speed used for UI elements", 8 | validator = gen_valid_num(0, 100), 9 | initial = function() return tostring(gconfig_get("animation")); end, 10 | handler = function(ctx, val) 11 | gconfig_set("animation", tonumber(val)); 12 | end 13 | }, 14 | { 15 | name = "trans_speed", 16 | label = "Transition Speed", 17 | kind = "value", 18 | hint = "(1..100)", 19 | description = "Change the animation speed used in state transitions", 20 | validator = gen_valid_num(0, 100), 21 | initial = function() return tostring(gconfig_get("transition")); end, 22 | handler = function(ctx, val) 23 | gconfig_set("transition", tonumber(val)); 24 | end 25 | }, 26 | { 27 | name = "wnd_speed", 28 | label = "Window Animation Speed", 29 | kind = "value", 30 | hint = "(0..50)", 31 | description = "Change the animation speed used with window position/size", 32 | validator = gen_valid_num(0, 50), 33 | initial = function() return tostring(gconfig_get("wnd_animation")); end, 34 | handler = function(ctx, val) 35 | gconfig_set("wnd_animation", tonumber(val)); 36 | end 37 | }, 38 | { 39 | name = "popup_speed", 40 | label = "Popup Animation Speed", 41 | kind = "value", 42 | hint = "(0..50)", 43 | description = "Change the animation speed used for showing and hiding popup windows", 44 | validator = gen_valid_num(0, 50), 45 | initial = function() return tostring(gconfig_get("popup_animation")); end, 46 | handler = function(ctx, val) 47 | gconfig_set("popup_animation", tonumber(val)); 48 | end 49 | }, 50 | { 51 | name = "anim_in", 52 | label = "Transition-In", 53 | kind = "value", 54 | description = "Change the effect used when moving a workspace on-screen", 55 | set = {"none", "fade", "move-h", "move-v"}, 56 | initial = function() return tostring(gconfig_get("ws_transition_in")); end, 57 | handler = function(ctx, val) 58 | gconfig_set("ws_transition_in", val); 59 | end 60 | }, 61 | { 62 | name = "anim_out", 63 | label = "Transition-Out", 64 | kind = "value", 65 | description = "Change the effect used when moving a workspace off-screen", 66 | set = {"none", "fade", "move-h", "move-v"}, 67 | initial = function() return tostring(gconfig_get("ws_transition_out")); end, 68 | handler = function(ctx, val) 69 | gconfig_set("ws_transition_out", val); 70 | end 71 | }, 72 | }; 73 | -------------------------------------------------------------------------------- /durden/menus/global/bars.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | { 4 | name = "pad_top", 5 | label = "Pad Top", 6 | kind = "value", 7 | description = "Insert extra vertical spacing above the bar text", 8 | initial = function() return gconfig_get("sbar_tpad"); end, 9 | validator = function() return gen_valid_num(0, gconfig_get("sbar_sz")); end, 10 | handler = function(ctx, val) 11 | gconfig_set("sbar_tpad", tonumber(val)); 12 | gconfig_set("tbar_tpad", tonumber(val)); 13 | gconfig_set("lbar_tpad", tonumber(val)); 14 | end 15 | }, 16 | { 17 | name = "pad_bottom", 18 | label = "Pad Bottom", 19 | kind = "value", 20 | description = "Insert extra vertical spacing below the bar- text", 21 | initial = function() return gconfig_get("sbar_bpad"); end, 22 | validator = function() return gen_valid_num(0, gconfig_get("sbar_sz")); end, 23 | handler = function(ctx, val) 24 | gconfig_set("sbar_bpad", tonumber(val)); 25 | gconfig_set("tbar_bpad", tonumber(val)); 26 | gconfig_set("lbar_bpad", tonumber(val)); 27 | end 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /durden/menus/global/border.lua: -------------------------------------------------------------------------------- 1 | return 2 | { 3 | { 4 | name = "thickness", 5 | label = "Thickness", 6 | kind = "value", 7 | description = "Visible portion of the border area in tiled modes", 8 | hint = function() return 9 | string.format("(0..%d px)", gconfig_get("borderw")) end, 10 | validator = function(val) 11 | return gen_valid_num(0, gconfig_get("borderw"))(val); 12 | end, 13 | initial = function() return tostring(gconfig_get("bordert")); end, 14 | handler = function(ctx, val) 15 | local num = tonumber(val); 16 | gconfig_set("bordert", tonumber(val)); 17 | active_display():rebuild_border(); 18 | for k,v in pairs(active_display().spaces) do 19 | v:resize(); 20 | end 21 | end 22 | }, 23 | { 24 | name = "thickness_float", 25 | label = "Thickness (Float)", 26 | kind = "value", 27 | description = "Visible portion of the border area in float mode", 28 | hint = function() return 29 | string.format("(0..%d px)", gconfig_get("borderw_float")) end, 30 | validator = function(val) 31 | return gen_valid_num(0, gconfig_get("borderw_float"))(val); 32 | end, 33 | initial = function() return tostring(gconfig_get("bordert_float")); end, 34 | handler = function(ctx, val) 35 | local num = tonumber(val); 36 | gconfig_set("bordert_float", tonumber(val)); 37 | active_display():rebuild_border(); 38 | for k,v in pairs(active_display().spaces) do 39 | v:resize(); 40 | end 41 | end 42 | }, 43 | { 44 | name = "area", 45 | label = "Area", 46 | kind = "value", 47 | hint = "(0..100 px)", 48 | initial = function() return tostring(gconfig_get("borderw")); end, 49 | validator = gen_valid_num(0, 100), 50 | description = "Set the reserved (visible+nonvisible) border area", 51 | handler = function(ctx, val) 52 | gconfig_set("borderw", tonumber(val)); 53 | active_display():rebuild_border(); 54 | for wnd in all_windows(nil, true) do 55 | wnd:resize(wnd.width, wnd.height); 56 | end 57 | for k,v in pairs(active_display().spaces) do 58 | v:resize(); 59 | end 60 | end 61 | }, 62 | { 63 | name = "area_float", 64 | label = "Area (Float)", 65 | kind = "value", 66 | hint = "(0..100 px)", 67 | initial = function() return tostring(gconfig_get("borderw_float")); end, 68 | validator = gen_valid_num(0, 100), 69 | description = "Set the reserved (visible+nonvisible) border area", 70 | handler = function(ctx, val) 71 | gconfig_set("borderw_float", tonumber(val)); 72 | active_display():rebuild_border(); 73 | for wnd in all_windows(nil, true) do 74 | wnd:resize(wnd.width, wnd.height) 75 | end 76 | for k,v in pairs(active_display().spaces) do 77 | v:resize(); 78 | end 79 | end 80 | }, 81 | { 82 | name = "color", 83 | label = "Color", 84 | kind = "value", 85 | hint = "(r g b)[0..255]", 86 | widget = "special:colorpick_r8g8b8", 87 | initial = function() 88 | local bc = gconfig_get("border_color"); 89 | return string.format("%.0f %.0f %.0f", bc[1], bc[2], bc[3]); 90 | end, 91 | validator = suppl_valid_typestr("fff", 0, 255, 0), 92 | description = "The color used as the active border color state", 93 | handler = function(ctx, val) 94 | local tbl = suppl_unpack_typestr("fff", val, 0, 255); 95 | for wnd in all_windows(nil, true) do 96 | image_color(wnd.border, tbl[1], tbl[2], tbl[3]); 97 | end 98 | gconfig_set("border_color", tbl); 99 | end, 100 | }, 101 | }; 102 | -------------------------------------------------------------------------------- /durden/menus/global/global.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Globally available menus, settings and functions. All code here is just 3 | -- boiler-plate mapping to engine- or support script functions. 4 | -- 5 | 6 | local tools = { 7 | }; 8 | 9 | local toplevel = { 10 | { 11 | name = "open", 12 | label = "Open", 13 | kind = "action", 14 | submenu = true, 15 | description = "Start built-in tools or preset trusted applications", 16 | handler = system_load("menus/global/open.lua")() 17 | }, 18 | -- useful for idle- timers where you only want enter or exit behavior 19 | { 20 | name = "do_nothing", 21 | label = "Nothing", 22 | kind = "action", 23 | description = "Used for timer binding (enter- or exit- only)", 24 | invisible = true, 25 | handler = function() 26 | end 27 | }, 28 | { 29 | name = "workspace", 30 | label = "Workspace", 31 | kind = "action", 32 | description = "Current- or all- workspace related actions", 33 | submenu = true, 34 | handler = system_load("menus/global/workspace.lua")() 35 | }, 36 | { 37 | name = "display", 38 | label = "Display", 39 | kind = "action", 40 | submenu = true, 41 | description = "Display output controls", 42 | handler = system_load("menus/global/display.lua")() 43 | }, 44 | { 45 | name = "settings", 46 | label = "Config", 47 | kind = "action", 48 | submenu = true, 49 | description = "Persistent configuration tuning", 50 | handler = system_load("menus/global/settings.lua")() 51 | }, 52 | { 53 | name = "audio", 54 | label = "Audio", 55 | kind = "action", 56 | submenu = true, 57 | description = "Global audio controls", 58 | handler = system_load("menus/global/audio.lua")() 59 | }, 60 | { 61 | name = "input", 62 | label = "Input", 63 | kind = "action", 64 | submenu = true, 65 | description = "Global input settings", 66 | handler = system_load("menus/global/input.lua")() 67 | }, 68 | -- unsure if it is a good idea to expose these for access outside binding etc. 69 | { 70 | name = "windows", 71 | label = "Windows", 72 | kind = "action", 73 | eval = function() return false; end, 74 | submenu = true, 75 | handler = system_load("menus/global/windows.lua")() 76 | }, 77 | { 78 | name = "system", 79 | label = "System", 80 | kind = "action", 81 | submenu = true, 82 | description = "System- specific actions", 83 | handler = system_load("menus/global/system.lua")() 84 | }, 85 | { 86 | name = "tools", 87 | label = "Tools", 88 | kind = "action", 89 | submenu = true, 90 | descriptions = "Plugin/Tool activation and control", 91 | handler = tools 92 | } 93 | }; 94 | 95 | return toplevel; 96 | -------------------------------------------------------------------------------- /durden/menus/global/hud.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | name = "color", 4 | label = "Bar Color", 5 | kind = "value", 6 | hint = "(r g b)[0..255]", 7 | initial = function() 8 | local bc = gconfig_get("lbar_bg"); 9 | return string.format("%.0f %.0f %.0f", bc[1], bc[2], bc[3]); 10 | end, 11 | validator = suppl_valid_typestr("fff", 0, 255, 0), 12 | description = "The color used for the HUD bar", 13 | handler = function(ctx, val) 14 | local tbl = suppl_unpack_typestr("fff", val, 0, 255); 15 | gconfig_set("lbar_bg", tbl); 16 | end, 17 | }, 18 | { 19 | name = "selection_color", 20 | label = "Selection Color", 21 | kind = "value", 22 | hint = "(r g b)[0..255]", 23 | initial = function() 24 | local bc = gconfig_get("lbar_seltextbg"); 25 | return string.format("%.0f %.0f %.0f", bc[1], bc[2], bc[3]); 26 | end, 27 | validator = suppl_valid_typestr("fff", 0, 255, 0), 28 | description = "The color used to mark the current selection", 29 | handler = function(ctx, val) 30 | local tbl = suppl_unpack_typestr("fff", val, 0, 255); 31 | gconfig_set("lbar_seltextbg", tbl); 32 | end, 33 | }, 34 | { 35 | name = "opacity", 36 | label = "Background Opacity", 37 | kind = "value", 38 | hint = "(0..1)", 39 | initial = function() return tostring(gconfig_get("lbar_dim")); end, 40 | validator = gen_valid_num(0, 1), 41 | handler = function(ctx, val) 42 | gconfig_set("lbar_dim", tonumber(val)); 43 | end 44 | }, 45 | { 46 | name = "caret_color", 47 | label = "Caret Color", 48 | kind = "value", 49 | hint = "(r g b)[0..255]", 50 | initial = function() 51 | local bc = gconfig_get("lbar_caret_col"); 52 | return string.format("%.0f %.0f %.0f", bc[1], bc[2], bc[3]); 53 | end, 54 | validator = suppl_valid_typestr("fff", 0, 255, 0), 55 | description = "The color used to mark the current selection", 56 | handler = function(ctx, val) 57 | local tbl = suppl_unpack_typestr("fff", val, 0, 255); 58 | gconfig_set("lbar_caret_col", tbl); 59 | end, 60 | }, 61 | { 62 | name = "filter_function", 63 | label = "Filter Function", 64 | kind = "value", 65 | description = "Change the default candidate filtering function", 66 | set = {"prefix", "fuzzy"}, 67 | initial = function() return gconfig_get("lbar_fltfun"); end, 68 | handler = function(ctx, val) gconfig_set("lbar_fltfun", val); end 69 | }, 70 | { 71 | name = "menu_helper", 72 | label = "Menu Descriptions", 73 | description = "Set if this helper text should be shown or not", 74 | kind = "value", 75 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 76 | initial = function() 77 | return gconfig_get("menu_helper") and LBL_YES or LBL_NO; 78 | end, 79 | handler = suppl_flip_handler("menu_helper") 80 | }, 81 | { 82 | name = "password_mask", 83 | label = "Mask Password", 84 | description = "Replace password entry inputs with asterisks ('*')", 85 | kind = "value", 86 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 87 | initial = function() 88 | return gconfig_get("passmask") and LBL_YES or LBL_NO; 89 | end, 90 | handler = suppl_flip_handler("passmask") 91 | } 92 | }; 93 | -------------------------------------------------------------------------------- /durden/menus/global/led.lua: -------------------------------------------------------------------------------- 1 | local function get_ledent(rgb, devid, i) 2 | local validator, handler, hint; 3 | if (rgb) then 4 | validator = suppl_valid_typestr("fff", 0, 255, 0); 5 | handler = function(ctx, val) 6 | local tbl = suppl_unpack_typestr("fff", val, 0, 255); 7 | if (tbl) then 8 | set_led_rgb(devid, i-1, tbl[1], tbl[2], tbl[3], false); 9 | end 10 | end 11 | hint = "(r g b 0-255)"; 12 | else 13 | validator = gen_valid_float(0, 1); 14 | handler = function(ctx, val) 15 | set_led(devid, i-1, tonumber(val) > 0.0 and 1 or 0); 16 | end 17 | hint = "(0..1)"; 18 | end 19 | 20 | return { 21 | name = tostring(i), 22 | label = tostring(i), 23 | kind = "value", 24 | description = "Set LED " .. tostring(i) .. " to a specific value", 25 | hint = hint, 26 | validator = validator, 27 | handler = handler 28 | }; 29 | end 30 | 31 | local function get_led_menu(dev) 32 | local nled, var, rgb = controller_leds(dev.devid); 33 | if (not nled or nled <= 0) then 34 | return {}; 35 | end 36 | local res = {}; 37 | 38 | local all = get_ledent(rgb, dev.devid, -1); 39 | all.name = "all"; 40 | all.label = "All"; 41 | table.insert(res, all); 42 | 43 | for i=1,nled do 44 | table.insert(res, get_ledent(rgb, dev.devid, i)); 45 | end 46 | return res; 47 | end 48 | 49 | return function() 50 | local devs = ledm_devices("passive"); 51 | 52 | -- name/label are already set for us 53 | for k,v in pairs(devs) do 54 | v.label = v.label; 55 | v.kind = "action"; 56 | v.submenu = true; 57 | v.handler = function() 58 | return get_led_menu(v); 59 | end 60 | end 61 | return devs; 62 | end 63 | -------------------------------------------------------------------------------- /durden/menus/global/notification.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- quick and dirty first notification controls, more will come as part of 3 | -- widgets and tools, yet the path is provided so that they can reigster 4 | -- here. 5 | -- 6 | return { 7 | { 8 | name = "enable", 9 | label = "Enable", 10 | kind = "value", 11 | description = "Enable tools and widgets to receive event notifications", 12 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 13 | initial = function() return 14 | gconfig_get("notifications_enable") and LBL_YES or LBL_NO end, 15 | handler = suppl_flip_handler("notifications_enable") 16 | }, 17 | { 18 | name = "send", 19 | label = "Send", 20 | kind = "value", 21 | hint = "( severity(1..4):name(str):short(str)[:long(str)] )", 22 | description = "Synthesize a notification event", 23 | validator = function(val) 24 | if (not val or string.len(val) == 0) then 25 | return false; 26 | end 27 | local lst = string.split(val, ":"); 28 | if (not lst or #lst < 3) then 29 | return false; 30 | end 31 | local sev = tonumber(lst[1]); 32 | if (not sev or sev < 1 or sev > 4) then 33 | return false; 34 | end 35 | if (string.len(lst[2]) == 0 or string.len(lst[3]) == 0) then 36 | return false; 37 | end 38 | return true; 39 | end, 40 | handler = function(ctx, val) 41 | local lst = string.split(val, ":"); 42 | local sev = tonumber(lst[1]); 43 | notification_add(lst[2], nil, lst[3], lst[4], sev); 44 | end 45 | }, 46 | { 47 | name = "device_events", 48 | label = "Device Notifications", 49 | hint = "(-1 off, >= 0 ticks from start)", 50 | description = "Send notifications on device plug/unplug actions", 51 | initial = function() return tostring(gconfig_get("device_notification")); end, 52 | kind = "value", 53 | validator = gen_valid_num(-1, 1000), 54 | handler = function(ctx, val) 55 | gconfig_set("device_notification", tonumber(val)); 56 | end 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /durden/menus/global/record.lua: -------------------------------------------------------------------------------- 1 | local function inputh(wnd, source, status) 2 | if (status.kind == "terminated") then 3 | if (wnd.destroy) then 4 | wnd:destroy(); 5 | else 6 | delete_image(source); 7 | end 8 | end 9 | end 10 | 11 | return function(val, lbl) 12 | local r, g, b = suppl_hexstr_to_rgb(HC_PALETTE[2]); 13 | suppl_region_select(r, g, b, 14 | function(x1, y1, x2, y2) 15 | x1 = math.floor(x1); 16 | y1 = math.floor(y1); 17 | x2 = math.ceil(x2); 18 | y2 = math.ceil(y2); 19 | 20 | local dw = x2 - x1; 21 | local dh = y2 - y1; 22 | 23 | if (dw % 2 > 0) then 24 | x2 = x2 + 1; 25 | end 26 | 27 | if (dh % 2 > 0) then 28 | y2 = y2 + 1; 29 | end 30 | 31 | local dvid, vgrp, agrp = suppl_region_setup(x1, y1, x2, y2, true, false); 32 | if (not valid_vid(dvid)) then 33 | return; 34 | end 35 | show_image(dvid); 36 | 37 | -- bind to a timer so the window gets set up outside of the callback, 38 | -- this is important due to the feedback loop with the attach hook in advfloat 39 | -- reusing the suppl_region.. 40 | 41 | timer_add_periodic("recwnd" .. tostring(CLOCK), 2, true, function() 42 | local wnd = active_display():add_window(dvid, {scalemode = "stretch"}); 43 | local infn = function(source, status) 44 | inputh(wnd, source, status); 45 | end 46 | 47 | if (type(val) == "number" and valid_vid(val)) then 48 | define_recordtarget(dvid, val, "", vgrp, agrp, 49 | RENDERTARGET_DETACH, RENDERTARGET_NOSCALE, -1, infn); 50 | wnd:set_title("forwarding("..lbl..")"); 51 | else 52 | local argstr, srate, fn = suppl_build_recargs(vgrp, agrp, false, val); 53 | define_recordtarget(dvid, fn, argstr, vgrp, agrp, 54 | RENDERTARGET_DETACH, RENDERTARGET_NOSCALE, srate, infn); 55 | wnd:set_title("recording"); 56 | end 57 | end, true); 58 | end); 59 | end 60 | -------------------------------------------------------------------------------- /durden/menus/global/shaders.lua: -------------------------------------------------------------------------------- 1 | local function build_list(group) 2 | local res = {}; 3 | for i,v in ipairs(shader_list({group})) do 4 | local key, dom = shader_getkey(v, {group}); 5 | local rv = shader_uform_menu(key, dom); 6 | if (rv and #rv > 0) then 7 | table.insert(res, { 8 | name = key, 9 | label = v, 10 | submenu = true, 11 | kind = "action", 12 | handler = function() 13 | return rv; 14 | end 15 | }); 16 | end 17 | end 18 | return res; 19 | end 20 | 21 | local rebuild_query = { 22 | { 23 | name = "no", 24 | label = "No", 25 | kind = "action", 26 | handler = function() end 27 | }, 28 | { 29 | name = "yes", 30 | label = "Yes", 31 | description = "Warning: This can put the UI in an unstable state, Proceed?", 32 | kind = "action", 33 | dangerous = true, 34 | handler = function() 35 | shdrmgmt_scan(); 36 | end 37 | } 38 | }; 39 | 40 | return function() 41 | return 42 | { 43 | { 44 | name = "ui", 45 | label = "UI", 46 | description = "Change variables for shaders that belong to the 'UI' category", 47 | kind = "action", 48 | submenu = true, 49 | eval = function() return #build_list("ui") > 0; end, 50 | handler = function() 51 | return build_list("ui"); 52 | end 53 | }, 54 | { 55 | name = "effect", 56 | label = "Effect", 57 | description = "Change variables for shaders that belong to the 'Effect' category", 58 | kind = "action", 59 | submenu = true, 60 | eval = function() return #build_list("effect") > 0; end, 61 | handler = function() 62 | return build_list("effect"); 63 | end 64 | }, 65 | { 66 | name = "rebuild", 67 | description = "Recompile / Rescan the list of shaders", 68 | label = "Reset", 69 | kind = "action", 70 | submenu = true, 71 | handler = rebuild_query 72 | } 73 | }; 74 | end 75 | -------------------------------------------------------------------------------- /durden/menus/global/shadow.lua: -------------------------------------------------------------------------------- 1 | local res = { 2 | { 3 | name = "style", 4 | label = "Style", 5 | description = "Set the drawing method for windowed UI elements (on-creation)", 6 | set = {"soft", "textured", "none"}, 7 | kind = "value", 8 | initial = function() 9 | return gconfig_get("shadow_style"); 10 | end, 11 | handler = function(ctx, val) 12 | gconfig_set("shadow_style", val); 13 | end 14 | }, 15 | { 16 | name = "focus", 17 | label = "Focus Weight", 18 | description = "Set the shadow opacity when its owner is in focus", 19 | kind = "value", 20 | initial = function() 21 | return tostring(gconfig_get("shadow_focus")); 22 | end, 23 | validator = gen_valid_num(0, 1), 24 | handler = function(ctx, val) 25 | gconfig_set("shadow_focus", tonumber(val)); 26 | end 27 | }, 28 | { 29 | name = "defocus", 30 | label = "Defocus Weight", 31 | description = "Set the shadow opacity when its owner is not in focus", 32 | kind = "value", 33 | initial = function() 34 | return tostring(gconfig_get("shadow_defocus")); 35 | end, 36 | validator = gen_valid_num(0, 1), 37 | handler = function(ctx, val) 38 | gconfig_set("shadow_defocus", tonumber(val)); 39 | end 40 | }, 41 | { 42 | name = "offset", 43 | label = "Offset", 44 | description = "Set the shadow region offset", 45 | kind = "value", 46 | initial = function() 47 | return string.format("%.2d %.2d %.2d %.2d", 48 | gconfig_get("shadow_t"), gconfig_get("shadow_l"), 49 | gconfig_get("shadow_d"), gconfig_get("shadow_r") 50 | ); 51 | end, 52 | hint = "(t l d r) px (w + l|r, h + t|d)", 53 | validator = suppl_valid_typestr("ffff", 0.0, 100.0, 0.0), 54 | handler = function(ctx, val) 55 | local elem = string.split(val, " "); 56 | if (#elem ~= 4) then 57 | return; 58 | end 59 | gconfig_set("shadow_t", math.floor(tonumber(elem[1]))); 60 | gconfig_set("shadow_l", math.floor(tonumber(elem[2]))); 61 | gconfig_set("shadow_d", math.floor(tonumber(elem[3]))); 62 | gconfig_set("shadow_r", math.floor(tonumber(elem[4]))); 63 | end 64 | }, 65 | { 66 | name = "shader", 67 | label = "Shader", 68 | kind = "action", 69 | submenu = true, 70 | description = "Shader UI settings", 71 | alias = "/global/settings/visual/shaders/ui/dropshadow" 72 | }, 73 | { 74 | name = "color", 75 | label = "Color", 76 | kind = "value", 77 | description = "Set the shadow base color" 78 | }, 79 | }; 80 | 81 | suppl_append_color_menu( 82 | gconfig_get("shadow_color"), res[#res], 83 | function(fmt, r, g, b) 84 | gconfig_set("shadow_color", {r * 0.003921, g * 0.003921, b * 0.003921}); 85 | end); 86 | 87 | return res; 88 | -------------------------------------------------------------------------------- /durden/menus/global/windows.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- These are primarily to let the output/ipc system address individual 3 | -- windows. The caveat with this approach is that too much of the menu 4 | -- system was written using the active_display().selected approach for 5 | -- some reason (really stupid, yes..) so in order to use window-target 6 | -- invocation, we need to fake-select, run then revert-select. This is 7 | -- problematic when the window operation itself would change selection 8 | -- 9 | -- The workaround, with rewriting menu being out of scope, is to ret. 10 | -- the window itself, and have the ipc-invoker fake-select the window, 11 | -- run the remainder and revert selection if window is still alive. 12 | -- 13 | local function insert_first(dst, name, v) 14 | if (not dst[name]) then 15 | dst[name] = v; 16 | return; 17 | end 18 | local ind = 1; 19 | while true do 20 | local newname = name .. "_" .. tostring(ind); 21 | if (not dst[newname]) then 22 | dst[newname] = v; 23 | return; 24 | end 25 | ind = ind + 1; 26 | end 27 | end 28 | 29 | local function get_all_windows(fltfun) 30 | local res = {}; 31 | local count = 0; 32 | 33 | for ent in all_spaces_iter() do 34 | for i,v in ipairs(ent.children) do 35 | local name = fltfun(v); 36 | if (name) then 37 | count = count + 1; 38 | insert_first(res, name, v); 39 | end 40 | end 41 | end 42 | return count, res; 43 | end 44 | 45 | local function nameflt(wtbl) 46 | return wtbl.name; 47 | end 48 | 49 | local function wsflt(wtbl) 50 | return wtbl.name; 51 | end 52 | 53 | local function tagflt(wtbl) 54 | return wtbl.name; 55 | end 56 | 57 | local function titleflt(wtbl) 58 | return wtbl.name; 59 | end 60 | 61 | -- linearize map, sort, add menu structure, go. 62 | local function wndlist_to_menu(count, wtbl) 63 | local rtbl = {}; 64 | for k,v in pairs(wtbl) do 65 | table.insert(rtbl, { 66 | name = k, 67 | label = k, 68 | kind = "action", 69 | submenu = true, 70 | handler = function() 71 | end 72 | }); 73 | end 74 | -- table.sort format with arguments 75 | return rtbl; 76 | end 77 | 78 | return { 79 | { 80 | name = "name", 81 | label = "All", 82 | submenu = true, 83 | kind = "action", 84 | eval = function() return get_all_windows(nameflt) > 0; end, 85 | handler = function() 86 | return wndlist_to_menu(get_all_windows(nameflt)); 87 | end, 88 | }, 89 | { 90 | name = "workspace", 91 | label = "Workspace", 92 | submenu = true, 93 | eval = function() return get_all_windows(wsflt) > 0; end, 94 | handler = function() 95 | return wndlist_to_menu(get_all_windows(wsflt)); 96 | end, 97 | }, 98 | { 99 | name = "tag", 100 | label = "Tag", 101 | kind = "action", 102 | submenu = true, 103 | eval = function() return get_all_windows(tagflt) > 0; end, 104 | handler = function() 105 | return wndlist_to_menu(get_all_windows(tagflt)); 106 | end, 107 | }, 108 | { 109 | name = "title", 110 | label = "Title", 111 | kind = "action", 112 | submenu = true, 113 | eval = function() return get_all_windows(titleflt) > 0; end, 114 | handler = function() 115 | return wndlist_to_menu(get_all_windows(titleflt)); 116 | end 117 | }, 118 | }; 119 | -------------------------------------------------------------------------------- /durden/menus/global/x11.lua: -------------------------------------------------------------------------------- 1 | -- (1 is used for alpha, the k/v mapping comes from tui 2 | return { 3 | { 4 | name = "autows", 5 | kind = "value", 6 | label = "Autoassign Workspace", 7 | initial = function() 8 | return gconfig_get("xarcan_autows"); 9 | end, 10 | eval = function() 11 | return not gconfig_get("xarcan_seamless"); 12 | end, 13 | set = {"none", "float", "fullscreen", "tile", "tab"}, 14 | description = "Create a new workspace to host the Xarcan window", 15 | handler = 16 | function(ctx, val) 17 | gconfig_set("xarcan_autows", val); 18 | end, 19 | }, 20 | { 21 | name = "meta_wm", 22 | kind = "value", 23 | label = "WM Integration", 24 | description = "Let the X11 window manager control the workspace", 25 | initial = function() 26 | return gconfig_get("xarcan_metawm") and LBL_YES or LBL_NO; 27 | end, 28 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 29 | handler = 30 | function(ctx, val) 31 | suppl_flip_handler("xarcan_metawm")(ctx, val); 32 | end 33 | }, 34 | { 35 | name = "autows_nodecor", 36 | kind = "value", 37 | label = "Strip Decoration", 38 | description = "Remove titlebar and border from Root window", 39 | eval = function() 40 | return gconfig_get("xarcan_autows") ~= "none"; 41 | end, 42 | initial = function() 43 | return gconfig_get("xarcan_autows_nodecor") and LBL_YES or LBL_NO; 44 | end, 45 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 46 | handler = 47 | function(ctx, val) 48 | suppl_flip_handler("xarcan_autows_nodecor")(ctx, val); 49 | end, 50 | }, 51 | { 52 | name = "clipboard_synch", 53 | kind = "value", 54 | label = "Match Clipboards", 55 | description = "Provide X11 Clients with clipboard contents", 56 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 57 | handler = 58 | function(ctx, val) 59 | suppl_flip_handler("xarcan_clipboard_autopaste")(ctx, val); 60 | end 61 | }, 62 | { 63 | name = "autows_tagname", 64 | kind = "value", 65 | label = "Autotag", 66 | description = "Tag X11 workspace with DISPLAY", 67 | eval = function() 68 | return gconfig_get("xarcan_autows") ~= "none"; 69 | end, 70 | initial = function() 71 | return gconfig_get("xarcan_autows_tagname") and LBL_YES or LBL_NO; 72 | end, 73 | set = {LBL_YES, LBL_NO, LBL_FLIP}, 74 | handler = 75 | function(ctx, val) 76 | suppl_flip_handler("xarcan_autows_tagname")(ctx, val); 77 | end, 78 | }, 79 | }; 80 | -------------------------------------------------------------------------------- /durden/menus/target/audio.lua: -------------------------------------------------------------------------------- 1 | local function gain_stepv(gainv, abs) 2 | local wnd = active_display().selected; 3 | if (not abs) then 4 | gainv = gainv + (wnd.gain and wnd.gain or 1.0); 5 | end 6 | 7 | gainv = gainv < 0.0 and 0.0 or gainv; 8 | gainv = gainv > 1.0 and 1.0 or gainv; 9 | gainv = gainv * gconfig_get("global_gain"); 10 | wnd.gain = gainv; 11 | audio_gain(wnd.source_audio, gainv, gconfig_get("gain_fade")); 12 | end 13 | 14 | return { 15 | { 16 | name = "toggle", 17 | label = "Toggle On/Off", 18 | kind = "action", 19 | description = "Toggle audio playback on/off for this window", 20 | handler = function() 21 | local wnd = active_display().selected; 22 | if (wnd.save_gain) then 23 | wnd.gain = wnd.save_gain; 24 | audio_gain(wnd.source_audio, gconfig_get("global_gain") * wnd.gain); 25 | wnd.save_gain = nil; 26 | else 27 | wnd.save_gain = wnd.gain; 28 | wnd.gain = 0.0; 29 | audio_gain(wnd.source_audio, 0.0); 30 | end 31 | end 32 | }, 33 | { 34 | name = "move", 35 | label = "Move", 36 | kind = "value", 37 | hint = "(dx dy dz dt)(0..200)", 38 | validator = suppl_valid_typestr("ffff", -200, 200, 0), 39 | description = "Slide window from its current location in the room", 40 | eval = function() 41 | return audio_listener ~= nil and 42 | valid_vid(active_display().selected.audio_anchor) 43 | end, 44 | handler = function(ctx, val) 45 | local arg = suppl_unpack_typestr("ffff", val, 200, 200) 46 | local wnd = active_display().selected; 47 | if not valid_vid(wnd.audio_anchor) or not arg then 48 | return 49 | end 50 | wnd.audio_anchor_pos[1] = wnd.audio_anchor_pos[1] + arg[1] 51 | wnd.audio_anchor_pos[2] = wnd.audio_anchor_pos[2] + arg[2] 52 | wnd.audio_anchor_pos[3] = wnd.audio_anchor_pos[3] + arg[3] 53 | move3d_model(wnd.audio_anchor, unpack(wnd.audio_anchor_pos), arg[4]) 54 | end 55 | }, 56 | { 57 | name = "position", 58 | label = "Position", 59 | kind = "value", 60 | hint = "(x y z)", 61 | validator = suppl_valid_typestr("fff", -200, 200, 0), 62 | description = "Move window audio playback to a specific point in the room", 63 | eval = function() 64 | return audio_listener ~= nil; 65 | end, 66 | handler = function(ctx, val) 67 | local arg = suppl_unpack_typestr("fff", val, -200, 200) 68 | local wnd = active_display().selected; 69 | if not valid_vid(wnd.external) or not arg then 70 | return 71 | end 72 | 73 | if not valid_vid(wnd.audio_anchor) then 74 | wnd.audio_anchor = null_surface(1, 1) 75 | link_image(wnd.audio_anchor, wnd.anchor) 76 | image_mask_clear(wnd.audio_anchor, MASK_POSITION) 77 | end 78 | 79 | local x,y,z = unpack(arg) 80 | move3d_model(wnd.audio_anchor, x, y, -z) 81 | wnd.audio_anchor_pos = {x, y, z} 82 | audio_position(wnd.source_audio, wnd.audio_anchor) 83 | end, 84 | }, 85 | { 86 | name = "vol_p10", 87 | label = "+10%", 88 | kind = "action", 89 | description = "Increment local volume by 10%", 90 | handler = function() gain_stepv(0.1); end 91 | }, 92 | { 93 | name = "vol_n10", 94 | label = "-10%", 95 | kind = "action", 96 | description = "Decrement local volume by 10%", 97 | handler = function() gain_stepv(-0.1); end 98 | }, 99 | { 100 | name ="vol_set", 101 | label = "Volume", 102 | hint = "(0..1)", 103 | kind = "value", 104 | description = "Set the volume level to a specific value", 105 | validator = shared_valid01_float, 106 | handler = function(ctx, val) gain_stepv(tonumber(val), true); end 107 | }, 108 | }; 109 | -------------------------------------------------------------------------------- /durden/menus/target/coreopts.lua: -------------------------------------------------------------------------------- 1 | local function set_temporary(wnd, slot, opts, val) 2 | target_coreopt(wnd.external, slot, val); 3 | -- note: IF meta1 is set, we SAVE to persistant config 4 | -- [get from tgt/config IDs or from registered UUID 5 | end 6 | 7 | local function list_values(wnd, ind, optslot, trigfun) 8 | local res = {}; 9 | for k,v in ipairs(optslot.values) do 10 | table.insert(res, { 11 | handler = function() 12 | trigfun(wnd, ind, optslot, v); 13 | end, 14 | label = v, 15 | name = "val_" .. v, 16 | kind = "action" 17 | }); 18 | end 19 | return res; 20 | end 21 | 22 | local function list_coreopts(wnd, trigfun) 23 | local res = {}; 24 | for k,v in ipairs(wnd.coreopt) do 25 | if (#v.values > 0 and v.description) then 26 | table.insert(res, { 27 | name = "opt_" .. v.description, 28 | label = v.description, 29 | kind = "action", 30 | submenu = true, 31 | handler = function() 32 | return list_values(wnd, k, v, trigfun); 33 | end 34 | }); 35 | end 36 | end 37 | return res; 38 | end 39 | 40 | return { 41 | { 42 | name = "set", 43 | label = "Set", 44 | kind = "action", 45 | description = "Enumerate and set a client provided configuration key", 46 | submenu = true, 47 | handler = function() 48 | return list_coreopts(active_display().selected, set_temporary); 49 | end 50 | }, 51 | }; 52 | -------------------------------------------------------------------------------- /durden/menus/target/debug.lua: -------------------------------------------------------------------------------- 1 | local function query_tracetag() 2 | local bar = tiler_lbar(active_display(), function(ctx,msg,done,set) 3 | if (done and active_display().selected) then 4 | image_tracetag(active_display().selected.canvas, msg); 5 | end 6 | return {}; 7 | end); 8 | bar:set_label("tracetag (wnd.canvas):"); 9 | end 10 | 11 | local overlay_menu = 12 | { 13 | { 14 | name = "add_overlay", 15 | label = "Add Overlay", 16 | kind = "action", 17 | description = "Create / Attach a random color as an overlay to the window", 18 | handler = function() 19 | local wnd = active_display().selected; 20 | local col = fill_surface( 21 | 150, 100, 22 | math.random(32, 255), 23 | math.random(32, 255), 24 | math.random(32, 255) 25 | ); 26 | show_image(col); 27 | local key = tostring(CLOCK); 28 | local ol = wnd:add_overlay(tostring(CLOCK), col, { 29 | mouse_handler = suppl_detach_overlay_mh(wnd, key, col) 30 | }); 31 | ol.xofs = math.random(100); 32 | ol.yofs = math.random(100); 33 | wnd:synch_overlays(); 34 | end, 35 | }, 36 | { 37 | name = "del_overlay", 38 | label = "Drop Overlays", 39 | kind = "action", 40 | description = "Delete all overlays attached to the window", 41 | handler = function() 42 | local wnd = active_display().selected; 43 | local keys = {}; 44 | for key,_ in pairs(wnd.overlays) do 45 | table.insert(keys, key); 46 | end 47 | for _,v in ipairs(keys) do 48 | wnd:drop_overlay(key); 49 | end 50 | end 51 | } 52 | }; 53 | 54 | return { 55 | { 56 | name = "query_tracetag", 57 | label = "Tracetag", 58 | kind = "action", 59 | handler = query_tracetag 60 | }, 61 | { 62 | name = "overlays", 63 | label = "Overlays", 64 | kind = "action", 65 | submenu = true, 66 | handler = overlay_menu 67 | } 68 | }; 69 | -------------------------------------------------------------------------------- /durden/menus/target/target.lua: -------------------------------------------------------------------------------- 1 | local shared_actions = { 2 | { 3 | name = "input", 4 | label = "Input", 5 | submenu = true, 6 | kind = "action", 7 | description = "Mouse/Keyboard/Custom client inputs", 8 | eval = function() 9 | return not active_display().selected.menu_input_disable; 10 | end, 11 | handler = system_load("menus/target/input.lua")() 12 | }, 13 | { 14 | name = "state", 15 | label = "State", 16 | submenu = true, 17 | kind = "action", 18 | description = "Client state management", 19 | eval = function() 20 | local wnd = active_display().selected; 21 | return valid_vid(wnd.external, TYPE_FRAMESERVER) 22 | and not wnd.menu_state_disable; 23 | end, 24 | handler = system_load("menus/target/state.lua")() 25 | }, 26 | { 27 | name = "clipboard", 28 | label = "Clipboard", 29 | submenu = true, 30 | kind = "action", 31 | description = "Clipboard control and actions", 32 | eval = function() 33 | return active_display().selected and 34 | active_display().selected.clipboard_block ~= true; 35 | end, 36 | handler = system_load("menus/target/clipboard.lua")() 37 | }, 38 | { 39 | name = "options", 40 | label = "Options", 41 | submenu = true, 42 | kind = "action", 43 | description = "Client-supplied configuration keys", 44 | eval = function() 45 | local wnd = active_display().selected; 46 | return valid_vid(wnd.external, TYPE_FRAMESERVER) and 47 | wnd.coreopt and #wnd.coreopt > 0; 48 | end, 49 | handler = system_load("menus/target/coreopts.lua")() 50 | }, 51 | { 52 | name = "audio", 53 | label = "Audio", 54 | submenu = true, 55 | kind = "action", 56 | description = "Audio controls", 57 | eval = function(ctx) 58 | return active_display().selected.source_audio ~= nil; 59 | end, 60 | handler = system_load("menus/target/audio.lua")() 61 | }, 62 | { 63 | name = "video", 64 | label = "Video", 65 | kind = "action", 66 | submenu = true, 67 | description = "Video controls", 68 | handler = system_load("menus/target/video.lua")() 69 | }, 70 | { 71 | name = "window", 72 | label = "Window", 73 | kind = "action", 74 | submenu = true, 75 | description = "Window position and size controls", 76 | handler = system_load("menus/target/window.lua")() 77 | }, 78 | { 79 | name = "triggers", 80 | label = "Triggers", 81 | kind = "action", 82 | submenu = true, 83 | description = "Bind menu actions to window events", 84 | handler = system_load("menus/target/triggers.lua")() 85 | }, 86 | { 87 | name = "share", 88 | label = "Share", 89 | kind = "action", 90 | submenu = true, 91 | description = "Sharing, Streaming and Recording Options", 92 | handler = system_load("menus/target/share.lua")() 93 | }, 94 | { 95 | name = "debug", 96 | label = "Debug", 97 | kind = "action", 98 | eval = function() 99 | return DEBUGLEVEL > 0; 100 | end, 101 | submenu = true, 102 | handler = system_load("menus/target/debug.lua")(); 103 | } 104 | } 105 | 106 | return shared_actions; 107 | -------------------------------------------------------------------------------- /durden/menus/target/triggers.lua: -------------------------------------------------------------------------------- 1 | local function gen_trigger_menu(event) 2 | local res = { 3 | { 4 | name = "add", 5 | hidden = true, 6 | label = "Add", 7 | description = "Add a new trigger event", 8 | kind = "value", 9 | validator = function(val) 10 | if #val == 0 or not string.find(val, "=") then 11 | return; 12 | end 13 | end, 14 | handler = function(val) 15 | local wnd = active_display().selected; 16 | wnd:add_handler(event, function(wnd) 17 | dispatch_symbol_wnd(wnd, val); 18 | end); 19 | wnd.trigger_log = wnd.trigger_log and wnd.trigger_log or {}; 20 | table.insert(wnd.trigger_log, {#wnd.trigger_log, event, path}); 21 | end 22 | }, 23 | { 24 | name = "bind", 25 | label = "Bind", 26 | description = "Bind a path to the " .. event .. " trigger", 27 | kind = "action", 28 | interactive = true, 29 | handler = function() 30 | dispatch_symbol_bind( 31 | function(path) 32 | if (not path or #path == 0) then 33 | return; 34 | end 35 | 36 | local wnd = active_display().selected; 37 | wnd:add_handler(event, function(wnd) 38 | dispatch_symbol_wnd(wnd, path); 39 | end); 40 | wnd.trigger_log = wnd.trigger_log and wnd.trigger_log or {}; 41 | table.insert(wnd.trigger_log, {#wnd.trigger_log, event, path}); 42 | end); 43 | end, 44 | } 45 | }; 46 | 47 | local wnd = active_display().selected; 48 | if (not wnd.trigger_log) then 49 | return res; 50 | end 51 | 52 | for i, v in ipairs(wnd.trigger_log) do 53 | table.insert(res, { 54 | name = "remove_" .. tostring(i), 55 | label = tostring(i), 56 | description = "Remove " .. v[3], 57 | kind = "action", 58 | handler = function() 59 | wnd:drop_handler(v[2], v[3]); 60 | table.remove(wnd.trigger_log, i); 61 | end, 62 | }); 63 | end 64 | 65 | return res; 66 | end 67 | 68 | return { 69 | { 70 | name = "select", 71 | kind = "action", 72 | label = "Select", 73 | submenu = true, 74 | description = "Triggered when the window is selected/focused", 75 | handler = function() return gen_trigger_menu("select"); end 76 | }, 77 | { 78 | name = "deselect", 79 | kind = "action", 80 | label = "Deselect", 81 | submenu = true, 82 | description = "Triggered when the window is deselected/defocused", 83 | handler = function() return gen_trigger_menu("deselect"); end 84 | }, 85 | { 86 | name = "destroy", 87 | kind = "action", 88 | label = "Destroy", 89 | submenu = true, 90 | description = "Triggered just before the window is destroyed", 91 | handler = function() return gen_trigger_menu("destroy"); end 92 | } 93 | }; 94 | -------------------------------------------------------------------------------- /durden/meta_guard.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Meta_guard tries to prevent being locked into durden by changes in the input 3 | -- environment, as most actions actually depend on the meta key being pressed, 4 | -- this works as a decent heuristic. Possibly combined with a timer, though 5 | -- that is more context sensitive. Other possible heuristics would be the number 6 | -- of "dead" keypresses, though that would not 7 | -- 8 | 9 | local mgc = 0; 10 | local threshold = 40; 11 | local mg; 12 | local allow_guard = gconfig_get("meta_guard") 13 | 14 | -- Called when meta key has been rebound from the UI 15 | function meta_guard_reset(force) 16 | if (force) then 17 | mgc = threshold + 1; 18 | allow_guard = true; 19 | if (mg) then 20 | mg(); 21 | else 22 | meta_guard(); 23 | end 24 | else 25 | mgc = 0; 26 | meta_guard = mg; 27 | end 28 | end 29 | 30 | function meta_guard(s1, s2) 31 | if (s1 or s2 or not allow_guard) then 32 | mgc = 0; 33 | active_display():message(); 34 | meta_guard = function() return true; end 35 | return true; 36 | end 37 | 38 | local bindcall = function(sym, lbl) 39 | tiler_tbar(active_display(), lbl, gconfig_get("tbar_timeout"), 40 | function() 41 | dispatch_symbol(sym); 42 | end, SYSTEM_KEYS["cancel"]); 43 | end 44 | 45 | mgc = mgc + 1; 46 | if (mgc > threshold) then 47 | suppl_binding_queue(function() 48 | bindcall("/global/input/bind/meta", LBL_METAGUARD_META); 49 | end); 50 | 51 | suppl_binding_queue(function() 52 | bindcall("/global/input/bind/basic", LBL_METAGUARD_BASIC); 53 | end); 54 | 55 | suppl_binding_queue(function() 56 | bindcall("/global/input/bind/menu", LBL_METAGUARD_MENU); 57 | end); 58 | 59 | suppl_binding_queue(function() 60 | bindcall("/global/input/bind/target_menu", LBL_METAGUARD_TMENU); 61 | end); 62 | 63 | mgc = 0; 64 | active_display():message(); 65 | suppl_binding_queue(false); 66 | allow_guard = gconfig_get("meta_guard"); 67 | 68 | return false; 69 | else 70 | active_display():message(string.format(LBL_METAGUARD, threshold - mgc), -1); 71 | end 72 | 73 | return true; 74 | end 75 | 76 | mg = meta_guard; 77 | -------------------------------------------------------------------------------- /durden/models/README.models: -------------------------------------------------------------------------------- 1 | The 3D support here is mostly a fun 'map a custom display source on a 3d model' 2 | feature brought back from the AWB appl. 3 | 4 | For it to work, it requires models in a very specific and quite retarded format. 5 | Examples models (with blender sources) can be found @ https://www.bintray.com/letoram/arcan-aux 6 | 7 | The actual mesh format is expected to change ~0.7 from CTM to glTF (possibly with an offline/out-of-process json->lua convertion) 8 | -------------------------------------------------------------------------------- /durden/notification.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- This is currently just a simple hook- interface for other tools and 3 | -- widgets to attach to in order to be able to track and react on 4 | -- notifications. 5 | -- 6 | 7 | local listeners = {}; 8 | local log, fmt = suppl_add_logfn("notification"); 9 | 10 | function notification_register(key, handler) 11 | listeners[key] = handler; 12 | end 13 | 14 | function notification_deregister(key) 15 | listeners[key] = nil; 16 | end 17 | 18 | function notification_debug(msg, long) 19 | if (not long) then 20 | long = "" 21 | end 22 | notification_add("debug", nil, msg, long, 1); 23 | end 24 | 25 | -- 26 | -- add timestamp and attach to messages, form is: 27 | -- source [string identifier], 28 | -- symref [=nil, recpt. pick] - icon or emoji ref, nil 29 | -- short [short description], 30 | -- long [longer description, if present], 31 | -- urgency [1 = normal, 2 = important, 3 = urgent, 4 = critical] 32 | -- pathref [/some/optional/menu/path] 33 | -- 34 | function notification_add(source, symref, short, long, urgency, pathref) 35 | if (not gconfig_get("notifications_enable")) then 36 | return; 37 | end 38 | 39 | log( 40 | fmt( 41 | "source=%s:urgency=%d:msg=%s:path=%s:long=%s", 42 | source, urgency, short, 43 | pathref and pathref or "", 44 | long and long or "" 45 | ) 46 | ); 47 | 48 | if (type(urgency) ~= "number") then 49 | urgency = 1; 50 | end 51 | urgency = math.clamp(urgency, 1, 4); 52 | 53 | -- decent place to introduce some rate-limiting here 54 | for _,v in pairs(listeners) do 55 | v(source, symref, short, long, urgency, pathref); 56 | end 57 | 58 | if (valid_vid(symref)) then 59 | delete_image(symref); 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /durden/output/.gitignore: -------------------------------------------------------------------------------- 1 | *.mkv 2 | *.raw 3 | *.png 4 | -------------------------------------------------------------------------------- /durden/shaders/audio/bars.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- simple bar spectogram, adapted from guycooks reference at shadertoy 3 | label = 'Bars', 4 | version = 1, 5 | filter = "none", 6 | frag = [[ 7 | uniform sampler2D map_tu0; 8 | uniform float obj_opacity; 9 | varying vec2 texco; 10 | 11 | #define bars 32.0 12 | #define bar_sz (1.0 / bars) 13 | #define bar_gap (0.1 * bar_sz) 14 | 15 | float h2rgb(float h){ 16 | if (h < 0.0) 17 | h += 1.0; 18 | if (h < 0.16667) 19 | return 0.1 + 4.8 * h; 20 | if (h < 0.5) 21 | return 0.9; 22 | if (h < 0.66669) 23 | return 0.1 + 4.8 * (0.6667 - h); 24 | return 0.1; 25 | } 26 | 27 | vec3 i2c(float i) 28 | { 29 | float h = 0.6667 - (i * 0.6667); 30 | return vec3(h2rgb(h + 0.3334), h2rgb(h), h2rgb(h - 0.3334)); 31 | } 32 | 33 | void main() 34 | { 35 | if (obj_opacity < 0.01) 36 | discard; 37 | 38 | vec2 uv = vec2(1.0 - texco.s, 1.0 - texco.t); 39 | float start = floor(uv.x * bars) / bars; 40 | 41 | if (uv.x - start < bar_gap || uv.x > start + bar_sz - bar_gap){ 42 | gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); 43 | return; 44 | } 45 | 46 | /* rather low resolution as we've done no funky "pack float in rgba" trick */ 47 | float intens = 0.0; 48 | for (float s = 0.0; s < bar_sz; s += bar_sz * 0.02){ 49 | intens += texture2D(map_tu0, vec2(start + s, 0.5)).g; 50 | } 51 | 52 | intens *= 0.02; 53 | intens = clamp(intens, 0.005, 1.0); 54 | 55 | float i = float(intens > uv.y); 56 | gl_FragColor = vec4(i2c(intens) * i, obj_opacity); 57 | }]], 58 | uniforms = {} 59 | }; 60 | -------------------------------------------------------------------------------- /durden/shaders/display/basic.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Basic", 4 | filter = "none", 5 | -- needed to have txcos that is relative to orig. size 6 | uniforms = { 7 | }, 8 | frag = 9 | [[ 10 | uniform sampler2D map_tu0; 11 | varying vec2 texco; 12 | 13 | void main(){ 14 | vec3 col = texture2D(map_tu0, texco).rgb; 15 | gl_FragColor = vec4(col, 1.0); 16 | }]] 17 | }; 18 | -------------------------------------------------------------------------------- /durden/shaders/display/gamma.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Gamma", 4 | filter = "none", 5 | uniforms = { 6 | exponent = { 7 | label = "Exponent", 8 | utype = "fff", 9 | default = {2.2, 2.2, 2.2}, 10 | low = 0.1, 11 | high = 3.0 12 | } 13 | }, 14 | frag = 15 | [[ 16 | uniform sampler2D map_tu0; 17 | uniform vec3 exponent; 18 | varying vec2 texco; 19 | 20 | void main(){ 21 | vec3 col = pow(texture2D(map_tu0, texco).rgb, 1.0 / exponent); 22 | gl_FragColor = vec4(col, 1.0); 23 | }]] 24 | }; 25 | -------------------------------------------------------------------------------- /durden/shaders/display/hsv.lua: -------------------------------------------------------------------------------- 1 | -- courtesy of https://gamedev.stackexchange.com/questions/59797/glsl-shader-change-hue-saturation-brightness 2 | 3 | return { 4 | version = 1, 5 | label = "HSV", 6 | filter = "none", 7 | uniforms = { 8 | weights = { 9 | label = "Weight", 10 | utype = "fff", 11 | low = 0.0, 12 | high = 360.0, 13 | default = {0.0, 1.0, 1.0} 14 | } 15 | }, 16 | frag = 17 | [[ 18 | uniform sampler2D map_tu0; 19 | uniform vec3 weights; 20 | varying vec2 texco; 21 | 22 | vec3 rgb2hsv(vec3 c) 23 | { 24 | vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); 25 | vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); 26 | vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); 27 | 28 | float d = q.x - min(q.w, q.y); 29 | float e = 1.0e-10; 30 | return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); 31 | } 32 | 33 | vec3 hsv2rgb(vec3 c) 34 | { 35 | vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); 36 | vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); 37 | return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); 38 | } 39 | 40 | void main(){ 41 | vec3 col = texture2D(map_tu0, texco).rgb; 42 | vec3 hsv = rgb2hsv(col).xyz; 43 | hsv.x = mod(hsv.x + (weights.x / 360.0), 1.0); 44 | hsv.yz *= weights.yz; 45 | hsv.yz = clamp(hsv.yz, 0.0, 1.0); 46 | col = hsv2rgb(hsv); 47 | 48 | gl_FragColor = vec4(col, 1.0); 49 | }]] 50 | }; 51 | -------------------------------------------------------------------------------- /durden/shaders/display/quilt.lua: -------------------------------------------------------------------------------- 1 | -- from GH/LoneTech/LookingGlass/lightfield.md 2 | 3 | return { 4 | version = 1, 5 | label = "Quilt", 6 | filter = "none", 7 | uniforms = { 8 | pitch = { 9 | label = "Pitch", 10 | utype = "f", 11 | low = 0, 12 | high = 180, 13 | default = {52.59063022315584} 14 | }, 15 | slope = { 16 | label = "Slope", 17 | utype = "f", 18 | low = -45, 19 | high = 45, 20 | default = {-7.224844213324757}, 21 | }, 22 | center = { 23 | label = "Center", 24 | utype = "f", 25 | low = 0, 26 | high = 10, 27 | default = { 28 | 0.176902174949646 29 | -- 0.4664787566771096 this was the value found in visual.json, but 30 | -- gives a .. weird effect 31 | } 32 | }, 33 | width = { 34 | label = "Width", 35 | utype = "f", 36 | default = {1536}, 37 | low = 640, 38 | high = 8192 39 | }, 40 | height = { 41 | label = "Height", 42 | utype = "f", 43 | default = {2048}, 44 | low = 640, 45 | high = 8192 46 | }, 47 | dpi = { 48 | label = "DPI", 49 | utype = "f", 50 | default = {324}, 51 | low = 96, 52 | high = 600 53 | }, 54 | tiles = { 55 | label = "Tiles", 56 | utype = "ff", 57 | default = {5, 9}, 58 | low = {1}, 59 | high = {20} 60 | } 61 | }, 62 | frag = 63 | [[ 64 | uniform sampler2D map_tu0; 65 | uniform vec2 tiles; 66 | uniform float width; 67 | uniform float height; 68 | uniform float pitch; 69 | uniform float slope; 70 | uniform float center; 71 | uniform float dpi; 72 | 73 | varying vec2 texco; 74 | 75 | vec2 map(vec2 pos, float a) { 76 | vec2 tile = vec2(tiles.x-1.0, 0.0); 77 | vec2 dir = vec2(-1.0,1.0); 78 | 79 | a = fract(a) * tiles.y; 80 | tile.y += dir.y * floor(a); 81 | a = fract(a) * tiles.x; 82 | tile.x += dir.x * floor(a); 83 | return (tile + pos) / tiles; 84 | } 85 | 86 | void main() 87 | { 88 | float tilt = -height / (width*slope); 89 | float pitch_adjusted = pitch * width / dpi * cos(atan(1.0, slope)); 90 | float subp = 1.0 / (3.0*width) * pitch_adjusted; 91 | 92 | vec4 res; 93 | float a; 94 | a = (texco.s + texco.t * tilt) * pitch_adjusted - center; 95 | res.r = texture2D(map_tu0, map(texco, a)).x; 96 | res.g = texture2D(map_tu0, map(texco, a + subp)).y; 97 | res.b = texture2D(map_tu0, map(texco, a + 2.0 * subp)).z; 98 | res.a = 1.0; 99 | 100 | gl_FragColor = res; 101 | } 102 | ]] 103 | }; 104 | -------------------------------------------------------------------------------- /durden/shaders/display/weight.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Weighted", 4 | filter = "none", 5 | uniforms = { 6 | weights = { 7 | label = "Weights", 8 | utype = "fff", 9 | low = 0.0, 10 | high = 100.0, 11 | default = {1.0, 1.0, 1.0} 12 | } 13 | }, 14 | frag = 15 | [[ 16 | uniform sampler2D map_tu0; 17 | uniform vec3 weights; 18 | varying vec2 texco; 19 | 20 | void main(){ 21 | vec3 col = texture2D(map_tu0, texco).rgb; 22 | gl_FragColor = vec4(col * weights, 1.0); 23 | }]] 24 | }; 25 | -------------------------------------------------------------------------------- /durden/shaders/effect/crt_lottes.lua: -------------------------------------------------------------------------------- 1 | -- Timothy Lottes CRT shader 2 | -- 3 | 4 | return { 5 | version = 1, 6 | label = "CRT-Lottes", 7 | filter = "bilinear", 8 | -- needed to have txcos that is relative to orig. size 9 | passes = { 10 | { 11 | filter = "none", 12 | output = "none", 13 | scale = {1.0, 1.0}, 14 | maps = {}, 15 | frag_source = "crt_lottes.frag", 16 | uniforms = { 17 | hard_scan = { 18 | label = "Hard scan", 19 | utype = "f", 20 | default = {-8.0}, 21 | low = -20.0, 22 | high = 0.0, 23 | step = 1.0 24 | }, 25 | hard_pix = { 26 | label = "Hard Pix", 27 | utype = "f", 28 | default = {-3.0}, 29 | low = -20.0, 30 | high = 0.0, 31 | step = 1.0 32 | }, 33 | warp_xy = { 34 | label = "Warp XY", 35 | utype = "ff", 36 | default = {0.031, 0.041}, 37 | low = 0.0, 38 | high = 0.125, 39 | step = 0.01 40 | }, 41 | mask_dark = { 42 | label = "Dark Mask", 43 | utype = "f", 44 | default = {0.5}, 45 | low = 0, 46 | high = 2.0, 47 | step = 0.1 48 | }, 49 | mask_light = { 50 | label = "Light Mask", 51 | utype = "f", 52 | default = {1.5}, 53 | low = 0.0, 54 | high = 2.0, 55 | step = 0.1 56 | }, 57 | linear_gamma = { 58 | label = "Linear Gamma", 59 | utype = "f", 60 | default = {1.0}, 61 | low = 0.0, 62 | high = 1.0, 63 | step = 1.0 64 | }, 65 | shadow_mask = { 66 | label = "Shadow Mask", 67 | utype = "f", 68 | default = {3.0}, 69 | low = 0.0, 70 | high = 4.0, 71 | step = 1.0 72 | }, 73 | bright_boost = { 74 | label = "Brightness Boost", 75 | utype = "f", 76 | default = {1.0}, 77 | low = 0.0, 78 | high = 2.0, 79 | step = 0.05 80 | }, 81 | bloom_x = { 82 | label = "Bloom X", 83 | utype = "f", 84 | default = {-1.5}, 85 | low = -2.0, 86 | high = -0.5, 87 | step = 0.1 88 | }, 89 | bloom_y = { 90 | label = "Bloom Y", 91 | utype = "f", 92 | default = {-2.0}, 93 | low = -4.0, 94 | high = -1.0, 95 | step = 0.1 96 | }, 97 | bloom_amount = { 98 | label = "Bloom Amount", 99 | utype = "f", 100 | default = {0.15}, 101 | low = 0.0, 102 | high = 1.0, 103 | step = 0.05 104 | }, 105 | filter_shape = { 106 | label = "Filter Shape", 107 | utype = "f", 108 | default = {2.0}, 109 | low = 0.0, 110 | high = 10.0, 111 | step = 0.05 112 | } 113 | } 114 | } 115 | } 116 | }; 117 | 118 | -------------------------------------------------------------------------------- /durden/shaders/effect/gaussian.lua: -------------------------------------------------------------------------------- 1 | -- simple 2-pass gaussian blur effect 2 | -- note that the scaling doesn't work on targets that autocrop, 3 | -- typically the terminal 4 | local punif = { 5 | weight = { 6 | label = "weight", 7 | utype = 'f', 8 | default = 1.0, 9 | low = 0.1, 10 | high = 2.0 11 | } 12 | }; 13 | 14 | return { 15 | version = 1, 16 | label = "Gaussian Blur", 17 | filter = "bilinear", 18 | passes = { 19 | { 20 | filter = "bilinear", 21 | output = "bilinear", 22 | scale = {0.5, 0.5}, 23 | maps = {}, 24 | uniforms = punif, 25 | frag_source = "gaussian_h.frag", 26 | }, 27 | { 28 | filter = "bilinear", 29 | output = "bilinear", 30 | uniforms = punif, 31 | scale = {1.0, 1.0}, 32 | maps = {}, 33 | frag_source = "gaussian_v.frag", 34 | } 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /durden/shaders/effect/gaussian_h.frag: -------------------------------------------------------------------------------- 1 | uniform sampler2D map_tu0; 2 | uniform float obj_opacity; 3 | uniform vec2 obj_output_sz; 4 | uniform float weight; 5 | varying vec2 texco; 6 | 7 | void main() 8 | { 9 | vec4 sum = vec4(0.0); 10 | float blurh = 1.0 / obj_output_sz.x; 11 | sum += texture2D(map_tu0, vec2(texco.x - 4.0 * blurh, texco.y)) * 0.05; 12 | sum += texture2D(map_tu0, vec2(texco.x - 3.0 * blurh, texco.y)) * 0.09; 13 | sum += texture2D(map_tu0, vec2(texco.x - 2.0 * blurh, texco.y)) * 0.12; 14 | sum += texture2D(map_tu0, vec2(texco.x - 1.0 * blurh, texco.y)) * 0.15; 15 | sum += texture2D(map_tu0, vec2(texco.x - 0.0 * blurh, texco.y)) * 0.16; 16 | sum += texture2D(map_tu0, vec2(texco.x + 1.0 * blurh, texco.y)) * 0.15; 17 | sum += texture2D(map_tu0, vec2(texco.x + 2.0 * blurh, texco.y)) * 0.12; 18 | sum += texture2D(map_tu0, vec2(texco.x + 3.0 * blurh, texco.y)) * 0.09; 19 | sum += texture2D(map_tu0, vec2(texco.x + 4.0 * blurh, texco.y)) * 0.05; 20 | gl_FragColor = vec4(sum.r * weight, sum.g * weight, sum.b * weight, obj_opacity); 21 | } 22 | -------------------------------------------------------------------------------- /durden/shaders/effect/gaussian_v.frag: -------------------------------------------------------------------------------- 1 | uniform sampler2D map_tu0; 2 | uniform float obj_opacity; 3 | uniform vec2 obj_output_sz; 4 | varying vec2 texco; 5 | uniform float weight; 6 | 7 | void main() 8 | { 9 | vec4 sum = vec4(0.0); 10 | float blurv = 1.0 / obj_output_sz.y; 11 | sum += texture2D(map_tu0, vec2(texco.x, texco.y - 4.0 * blurv)) * 0.05; 12 | sum += texture2D(map_tu0, vec2(texco.x, texco.y - 3.0 * blurv)) * 0.09; 13 | sum += texture2D(map_tu0, vec2(texco.x, texco.y - 2.0 * blurv)) * 0.12; 14 | sum += texture2D(map_tu0, vec2(texco.x, texco.y - 1.0 * blurv)) * 0.15; 15 | sum += texture2D(map_tu0, vec2(texco.x, texco.y - 0.0 * blurv)) * 0.16; 16 | sum += texture2D(map_tu0, vec2(texco.x, texco.y + 1.0 * blurv)) * 0.15; 17 | sum += texture2D(map_tu0, vec2(texco.x, texco.y + 2.0 * blurv)) * 0.12; 18 | sum += texture2D(map_tu0, vec2(texco.x, texco.y + 3.0 * blurv)) * 0.09; 19 | sum += texture2D(map_tu0, vec2(texco.x, texco.y + 4.0 * blurv)) * 0.05; 20 | gl_FragColor = vec4(sum.r * weight, sum.g * weight, sum.b * weight, obj_opacity); 21 | } 22 | -------------------------------------------------------------------------------- /durden/shaders/effect/rounded.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * shadow solution courtesy of Evan Wallace, 3 | * 'Fast Rounded Rectangle Shadows' 4 | * madebyevan.com/shaders/fast-rounded-rectangle-shadows 5 | * (MIT license), see github.com/evanw/glfx.js 6 | */ 7 | uniform float obj_opacity; 8 | uniform float radius; 9 | uniform float sigma; 10 | uniform vec2 obj_output_sz; 11 | uniform sampler2D map_tu0; 12 | varying vec2 texco; 13 | 14 | vec2 error_function(vec2 x) 15 | { 16 | vec2 s = sign(x), a = abs(x); 17 | x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a; 18 | x *= x; 19 | return s - s / (x * x); 20 | } 21 | 22 | float gaussian(float x, float sigma) 23 | { 24 | const float pi = 3.141592653589793; 25 | return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma); 26 | } 27 | 28 | float rounded_shadow_x(float x, float y, float sigma, float corner, vec2 halfv) 29 | { 30 | float delta = min(halfv.y - corner - abs(y), 0.0); 31 | float curved = halfv.x - corner + sqrt(max(0.0, corner * corner - delta * delta)); 32 | vec2 integral = 0.5 + 0.5 * error_function((x + vec2(-curved, curved)) * (sqrt(0.5)/sigma)); 33 | return integral.y - integral.x; 34 | } 35 | 36 | float rounded_box_shadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) 37 | { 38 | vec2 center = (lower + upper) * 0.5; 39 | vec2 halfv = (upper - lower) * 0.5; 40 | point -= center; 41 | float low = point.y - halfv.y; 42 | float high = point.y + halfv.y; 43 | float start = clamp(-3.0 * sigma, low, high); 44 | float end = clamp(3.0 * sigma, low, high); 45 | 46 | float step = (end - start) / 4.0; 47 | float y = start + step * 0.5; 48 | float value = 0.0; 49 | for (int i = 0; i < 4; i++){ 50 | value += rounded_shadow_x(point.x, point.y - y, sigma, corner, halfv) * gaussian(y, sigma) * step; 51 | y += step; 52 | } 53 | return value; 54 | } 55 | 56 | void main() 57 | { 58 | float a = rounded_box_shadow( 59 | vec2(0.0, 0.0), obj_output_sz, obj_output_sz * texco, sigma, radius); 60 | vec3 obj_col = texture2D(map_tu0, texco).rgb; 61 | gl_FragColor = vec4(obj_col, a * obj_opacity); 62 | } 63 | -------------------------------------------------------------------------------- /durden/shaders/effect/rounded.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Rounded", 4 | filter = "none", 5 | no_rendertarget = true, 6 | passes = { 7 | { 8 | filter = "none", 9 | output = "none", 10 | scale = {1.0, 1.0}, 11 | maps = {}, 12 | frag_source = "rounded.frag", 13 | uniforms = { 14 | radius = { 15 | label = 'Radius', 16 | utype = 'f', 17 | default = 5, 18 | description = 'Corner Radius Circle', 19 | low = 1, 20 | high = 100, 21 | }, 22 | sigma = { 23 | label = 'Sigma', 24 | utype = 'f', 25 | default = 2, 26 | description = 'Shadow Blur Coefficient', 27 | low = 1, 28 | high = 100 29 | }, 30 | } 31 | } 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /durden/shaders/simple/crop.lua: -------------------------------------------------------------------------------- 1 | local bgc = gconfig_get("term_bgcol"); 2 | 3 | return { 4 | version = 1, 5 | label = "Crop", 6 | filter = "none", 7 | -- needed to have txcos that is relative to orig. size 8 | uniforms = { 9 | color = { 10 | label = "Color", 11 | utype = "ffff", 12 | default = {bgc[1], bgc[2], bgc[3], gconfig_get("term_opa")} 13 | }, 14 | }, 15 | frag = 16 | [[ 17 | uniform sampler2D map_tu0; 18 | uniform float obj_opacity; 19 | uniform vec4 color; 20 | varying vec2 texco; 21 | 22 | void main() 23 | { 24 | if (texco.s > 1.0 || texco.t > 1.0) 25 | gl_FragColor = vec4(color.r, color.g, color.b, 26 | color.a * obj_opacity); 27 | else{ 28 | vec4 col = texture2D(map_tu0, texco); 29 | gl_FragColor = vec4( 30 | col.r, col.g, col.b, obj_opacity * col.a); 31 | } 32 | } 33 | ]] 34 | }; 35 | -------------------------------------------------------------------------------- /durden/shaders/simple/edge_luma.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Edge Detection", 4 | filter = "none", 5 | uniforms = { 6 | }, 7 | frag = 8 | [[ 9 | uniform sampler2D map_tu0; 10 | uniform vec2 obj_output_sz; 11 | uniform float obj_opacity; 12 | varying vec2 texco; 13 | 14 | void main(void) 15 | { 16 | vec4 n[9]; 17 | float ss = 1.0 / obj_output_sz.x; 18 | float st = 1.0 / obj_output_sz.y; 19 | 20 | /* sample around current */ 21 | vec4 samples[9]; 22 | samples[0] = texture2D(map_tu0, texco + vec2(-ss, -st)); 23 | samples[1] = texture2D(map_tu0, texco + vec2(0.0, -st)); 24 | samples[2] = texture2D(map_tu0, texco + vec2(-ss, -st)); 25 | samples[3] = texture2D(map_tu0, texco + vec2(-ss, 0.0)); 26 | samples[4] = texture2D(map_tu0, texco); 27 | samples[5] = texture2D(map_tu0, texco + vec2( ss, 0.0)); 28 | samples[6] = texture2D(map_tu0, texco + vec2(-ss, st)); 29 | samples[7] = texture2D(map_tu0, texco + vec2(0.0, st)); 30 | samples[8] = texture2D(map_tu0, texco + vec2( ss, st)); 31 | 32 | vec4 edge_h = samples[2] + (2.0 * samples[5]) + 33 | samples[8]-(samples[0] + (2.0 * samples[3]) + samples[6]); 34 | 35 | vec4 edge_v = samples[0] + (2.0 * samples[1]) + 36 | samples[2]-(samples[6] + (2.0 * samples[7]) + samples[8]); 37 | 38 | vec4 sobel = sqrt(edge_h * edge_h + edge_v * edge_v); 39 | float luma = max(max(sobel.r, sobel.g), sobel.b); 40 | 41 | gl_FragColor = vec4(luma, luma, luma, obj_opacity); 42 | } 43 | ]] 44 | }; 45 | -------------------------------------------------------------------------------- /durden/shaders/simple/gray.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Luma", 4 | filter = "none", 5 | uniforms = { 6 | }, 7 | frag = 8 | [[ 9 | uniform sampler2D map_tu0; 10 | uniform float obj_opacity; 11 | varying vec2 texco; 12 | 13 | void main() 14 | { 15 | vec3 col = texture2D(map_tu0, texco).rgb; 16 | float luma = 0.2126 * col.r + 0.7152 * col.g + 0.0722 * col.b; 17 | gl_FragColor = vec4(luma, luma, luma, obj_opacity); 18 | }]] 19 | }; 20 | -------------------------------------------------------------------------------- /durden/shaders/simple/inv_light.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Invert Light", 4 | filter = "none", 5 | uniforms = { 6 | }, 7 | frag = 8 | [[ 9 | uniform sampler2D map_tu0; 10 | uniform float obj_opacity; 11 | varying vec2 texco; 12 | 13 | void main() 14 | { 15 | vec3 col = texture2D(map_tu0, texco).rgb; 16 | float mv = min(min(col.r, col.g), col.b); 17 | float Mv = 1.0 - max(max(col.r, col.g), col.b); 18 | float delta = Mv - mv; 19 | col += vec3(delta, delta, delta); 20 | gl_FragColor = vec4(col, obj_opacity); 21 | }]] 22 | }; 23 | -------------------------------------------------------------------------------- /durden/shaders/simple/inv_light_color.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Invert/Preserve", 4 | description = "Inverts light/dark but preserves color at the expense of contrast", 5 | filter = "none", 6 | uniforms = { 7 | }, 8 | frag = 9 | [[ 10 | uniform sampler2D map_tu0; 11 | uniform float obj_opacity; 12 | varying vec2 texco; 13 | 14 | void main() 15 | { 16 | vec3 c = texture2D(map_tu0, texco).rgb; 17 | float shift = c.a - min(c.r, min(c.g, c.b)) - max(c.r, max(c.g, c.b)); 18 | c = vec4(shift + c.r, shift + c.g, shift + c.b, c.a); 19 | gl_FragColor = vec4(c.r, c.g, c.b, c.a * obj_opacity); 20 | }]] 21 | }; 22 | -------------------------------------------------------------------------------- /durden/shaders/simple/invert.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Invert", 4 | filter = "none", 5 | uniforms = { 6 | }, 7 | frag = 8 | [[ 9 | uniform sampler2D map_tu0; 10 | uniform float obj_opacity; 11 | varying vec2 texco; 12 | 13 | void main() 14 | { 15 | vec3 col = texture2D(map_tu0, texco).rgb; 16 | gl_FragColor = vec4(1.0 - col.r, 1.0 - col.g, 1.0 - col.b, obj_opacity); 17 | }]] 18 | }; 19 | -------------------------------------------------------------------------------- /durden/shaders/simple/noalpha.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "No Alpha", 4 | filter = "none", 5 | -- needed to have txcos that is relative to orig. size 6 | uniforms = { 7 | }, 8 | frag = 9 | [[ 10 | uniform sampler2D map_tu0; 11 | uniform float obj_opacity; 12 | varying vec2 texco; 13 | 14 | void main() 15 | { 16 | vec3 col = texture2D(map_tu0, texco).rgb; 17 | gl_FragColor = vec4( 18 | col.r, col.g, col.b, obj_opacity); 19 | }]] 20 | }; 21 | -------------------------------------------------------------------------------- /durden/shaders/simple/nocanvas.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "No Canvas", 4 | filter = "none", 5 | -- needed to have txcos that is relative to orig. size 6 | uniforms = { 7 | }, 8 | frag = 9 | [[ 10 | void main() 11 | { 12 | discard; 13 | }]] 14 | }; 15 | -------------------------------------------------------------------------------- /durden/shaders/simple/sidecol.lua: -------------------------------------------------------------------------------- 1 | -- this one is really only useful for autolayouter that can set the added state value 2 | 3 | local res = 4 | { 5 | version = 1, 6 | label = "Sidecolor", 7 | filter = "none", 8 | hidden = true, 9 | uniforms = { 10 | col = { 11 | label = "Color", 12 | utype = "fff", 13 | default = {1.0, 1.0, 1.0}, 14 | description = "Base color to multiply against" 15 | } 16 | }, 17 | frag = 18 | [[ 19 | uniform sampler2D map_tu0; 20 | uniform float obj_opacity; 21 | uniform vec3 col; 22 | varying vec2 texco; 23 | 24 | void main() 25 | { 26 | vec3 tx = texture2D(map_tu0, texco).rgb; 27 | 28 | float cv = 0.2126 * tx.r + 0.7152 * tx.g + 0.0722 * tx.b; 29 | 30 | gl_FragColor = vec4(cv * col.r, cv * col.g, cv * col.b, obj_opacity); 31 | }]], 32 | states = { 33 | nisse = {uniforms = { col = {1.0, 0.0, 0.0} } } 34 | } 35 | }; 36 | 37 | -- add each hc entry number as a 'state', then when the shader is set on the 38 | -- target the assigned uniform set id would resolve to a matching shader_ugroup 39 | local f = 1.0 / 255.0; 40 | for i,v in ipairs(HC_PALETTE) do 41 | local r, g, b = suppl_hexstr_to_rgb(v); 42 | res.states[tostring(i)] = { uniforms = { col = {r * f, g * f, b * f} } }; 43 | end 44 | 45 | return res; 46 | -------------------------------------------------------------------------------- /durden/shaders/simple/stretchcrop.lua: -------------------------------------------------------------------------------- 1 | local bgc = gconfig_get("term_bgcol"); 2 | 3 | return { 4 | version = 1, 5 | label = "Stretch-Crop", 6 | filter = "none", 7 | -- needed to have txcos that is relative to orig. size 8 | uniforms = { 9 | color = { 10 | label = "Color", 11 | utype = "ffff", 12 | default = {bgc[1], bgc[2], bgc[3], gconfig_get("term_opa")} 13 | }, 14 | }, 15 | frag = 16 | [[ 17 | uniform sampler2D map_tu0; 18 | uniform float obj_opacity; 19 | uniform vec2 obj_output_sz; 20 | uniform vec2 obj_storage_sz; 21 | uniform vec4 color; 22 | varying vec2 texco; 23 | 24 | void main() 25 | { 26 | vec2 txa = (obj_output_sz / obj_storage_sz) * texco; 27 | vec2 txb = txa; //(obj_storage_sz / obj_output_sz) * texco; 28 | 29 | if (txa.s > 1.0 || txa.t > 1.0) 30 | gl_FragColor = vec4(color.r, color.g, color.b, color.a * obj_opacity); 31 | else{ 32 | vec4 col = texture2D(map_tu0, txb); 33 | gl_FragColor = vec4(col.r, col.g, col.b, obj_opacity * col.a); 34 | } 35 | } 36 | ]] 37 | }; 38 | -------------------------------------------------------------------------------- /durden/shaders/simple/vignette.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Vignette", 4 | filter = "none", 5 | uniforms = { 6 | amount = { 7 | label = "Radius", 8 | utype = "f", 9 | low = 0.0, 10 | high = 50.0, 11 | default = {15.0}, 12 | }, 13 | }, 14 | frag = 15 | [[ 16 | uniform sampler2D map_tu0; 17 | uniform float obj_opacity; 18 | varying vec2 texco; 19 | uniform vec3 factor; 20 | uniform float amount; 21 | 22 | void main() 23 | { 24 | vec4 col = texture2D(map_tu0, texco); 25 | vec2 suv = texco * (1.0 - texco.yx); 26 | float vig = suv.x * suv.y * amount; 27 | vig = pow(vig, 0.25); 28 | 29 | gl_FragColor = vec4(col.rgb * vig, obj_opacity); 30 | }]] 31 | }; 32 | -------------------------------------------------------------------------------- /durden/shaders/ui/border.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- 'Middle-weight' border shader based on a discard stage 3 | -- 4 | -- The distinction between state color and obj_color is to have a per-object 5 | -- coloring with state overrides without resorting to another dimension of 6 | -- ugroups. 7 | -- 8 | -- The weight is used as color blend weight against the object color 9 | -- 10 | return { 11 | label = "Border", 12 | version = 1, 13 | frag = 14 | [[ 15 | uniform float border; 16 | uniform float thickness; 17 | uniform float obj_opacity; 18 | uniform vec4 col; 19 | uniform vec2 obj_output_sz; 20 | uniform vec3 obj_col; 21 | uniform float weight; 22 | varying vec2 texco; 23 | 24 | void main() 25 | { 26 | float margin_s = (border / obj_output_sz.x); 27 | float margin_t = (border / obj_output_sz.y); 28 | float margin_w = (thickness / obj_output_sz.x); 29 | float margin_h = (thickness / obj_output_sz.y); 30 | 31 | /* discard both inner and outer border in order to support 'gaps' */ 32 | if ( 33 | ( texco.s <= 1.0 - margin_s && texco.s >= margin_s && 34 | texco.t <= 1.0 - margin_t && texco.t >= margin_t ) || 35 | ( 36 | texco.s < margin_w || texco.t < margin_h || 37 | texco.s > 1.0 - margin_w || texco.t > 1.0 - margin_h 38 | ) 39 | ) 40 | discard; 41 | 42 | gl_FragColor = vec4(mix(obj_col.rgb, col.rgb, weight), col.a * obj_opacity); 43 | } 44 | ]], 45 | uniforms = { 46 | border = { 47 | label = 'Area Width', 48 | utype = 'f', 49 | ignore = true, 50 | default = gconfig_get("borderw"), 51 | low = 0.1, 52 | high = 40.0 53 | }, 54 | thickness = { 55 | label = 'Thickness', 56 | utype = 'f', 57 | ignore = true, 58 | default = (gconfig_get("borderw") - gconfig_get("bordert")), 59 | low = 0.1, 60 | high = 20.0 61 | }, 62 | col = { 63 | label = 'Color', 64 | utype = 'ffff', 65 | default = {1.0, 1.0, 1.0, 1.0} 66 | }, 67 | weight = { 68 | label = 'Weight', 69 | utype = 'f', 70 | default = {0.0}, 71 | description = 'Mix weight between source color and state color' 72 | }, 73 | }, 74 | states = { 75 | suspended = {uniforms = { col = {0.6, 0.0, 0.0, 0.9}, weight = 1.0 } }, 76 | active = { uniforms = { col = {0.0, 0.0, 0.0, 0.9}, weight = 0.0} }, 77 | inactive = { uniforms = { col = {0.0, 0.0, 0.0, 0.9}, weight = 0.8} }, 78 | alert = { uniforms = { col = {1.0, 0.54, 0.0, 0.9}, weight = 1.0} }, 79 | } 80 | }; 81 | -------------------------------------------------------------------------------- /durden/shaders/ui/border_float.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- 'Middle-weight' border shader based on a discard stage 3 | -- 4 | -- The distinction between state color and obj_color is to have a per-object 5 | -- coloring with state overrides without resorting to another dimension of 6 | -- ugroups. 7 | -- 8 | -- The weight is used as color blend weight against the object color 9 | -- 10 | return { 11 | label = "Border(Float)", 12 | version = 1, 13 | frag = 14 | [[ 15 | uniform float border; 16 | uniform float thickness; 17 | uniform float obj_opacity; 18 | uniform vec4 col; 19 | uniform vec2 obj_output_sz; 20 | uniform vec3 obj_col; 21 | uniform float weight; 22 | varying vec2 texco; 23 | 24 | void main() 25 | { 26 | float margin_s = (border / obj_output_sz.x); 27 | float margin_t = (border / obj_output_sz.y); 28 | float margin_w = (thickness / obj_output_sz.x); 29 | float margin_h = (thickness / obj_output_sz.y); 30 | 31 | /* discard both inner and outer border in order to support 'gaps' */ 32 | if ( 33 | ( texco.s <= 1.0 - margin_s && texco.s >= margin_s && 34 | texco.t <= 1.0 - margin_t && texco.t >= margin_t ) || 35 | ( 36 | texco.s < margin_w || texco.t < margin_h || 37 | texco.s > 1.0 - margin_w || texco.t > 1.0 - margin_h 38 | ) 39 | ) 40 | discard; 41 | 42 | gl_FragColor = vec4(mix(obj_col.rgb, col.rgb, weight), col.a * obj_opacity); 43 | } 44 | ]], 45 | uniforms = { 46 | border = { 47 | label = 'Area Width', 48 | utype = 'f', 49 | ignore = true, 50 | default = gconfig_get("borderw_float"), 51 | low = 0.1, 52 | high = 40.0 53 | }, 54 | thickness = { 55 | label = 'Thickness', 56 | utype = 'f', 57 | ignore = true, 58 | default = (gconfig_get("borderw_float") - gconfig_get("bordert_float")), 59 | low = 0.1, 60 | high = 20.0 61 | }, 62 | col = { 63 | label = 'Color', 64 | utype = 'ffff', 65 | default = {1.0, 1.0, 1.0, 1.0} 66 | }, 67 | weight = { 68 | label = 'Weight', 69 | utype = 'f', 70 | default = {0.0}, 71 | description = 'Mix weight between source color and state color' 72 | }, 73 | }, 74 | states = { 75 | suspended = {uniforms = { col = {0.6, 0.0, 0.0, 0.9}, weight = 1.0 } }, 76 | active = { uniforms = { col = {0.0, 0.0, 0.0, 0.9}, weight = 0.0} }, 77 | inactive = { uniforms = { col = {0.0, 0.0, 0.0, 0.9}, weight = 0.8} }, 78 | alert = { uniforms = { col = {1.0, 0.54, 0.0, 0.9}, weight = 1.0} }, 79 | } 80 | }; 81 | -------------------------------------------------------------------------------- /durden/shaders/ui/dropshadow.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * shadow solution courtesy of Evan Wallace, 3 | * 'Fast Rounded Rectangle Shadows' 4 | * madebyevan.com/shaders/fast-rounded-rectangle-shadows 5 | * (MIT license), see github.com/evanw/glfx.js 6 | */ 7 | uniform float obj_opacity; 8 | uniform float radius; 9 | uniform float sigma; 10 | uniform vec2 obj_output_sz; 11 | uniform sampler2D map_tu0; 12 | uniform vec3 color; 13 | uniform float weight; 14 | uniform float mix_factor; 15 | varying vec2 texco; 16 | 17 | vec2 error_function(vec2 x) 18 | { 19 | vec2 s = sign(x), a = abs(x); 20 | x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a; 21 | x *= x; 22 | return s - s / (x * x); 23 | } 24 | 25 | float gaussian(float x, float sigma) 26 | { 27 | const float pi = 3.141592653589793; 28 | return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma); 29 | } 30 | 31 | float rounded_shadow_x(float x, float y, float sigma, float corner, vec2 halfv) 32 | { 33 | float delta = min(halfv.y - corner - abs(y), 0.0); 34 | float curved = halfv.x - corner + sqrt(max(0.0, corner * corner - delta * delta)); 35 | vec2 integral = 0.5 + 0.5 * error_function((x + vec2(-curved, curved)) * (sqrt(0.5)/sigma)); 36 | return integral.y - integral.x; 37 | } 38 | 39 | float rounded_box_shadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) 40 | { 41 | vec2 center = (lower + upper) * 0.5; 42 | vec2 halfv = (upper - lower) * 0.5; 43 | point -= center; 44 | float low = point.y - halfv.y; 45 | float high = point.y + halfv.y; 46 | float start = clamp(-3.0 * sigma, low, high); 47 | float end = clamp(3.0 * sigma, low, high); 48 | 49 | float step = (end - start) / 4.0; 50 | float y = start + step * 0.5; 51 | float value = 0.0; 52 | for (int i = 0; i < 4; i++){ 53 | value += rounded_shadow_x(point.x, point.y - y, sigma, corner, halfv) * gaussian(y, sigma) * step; 54 | y += step; 55 | } 56 | return value; 57 | } 58 | 59 | void main() 60 | { 61 | float padding = 3.0 * sigma; 62 | vec2 vert = mix(vec2(0.0, 0.0) - padding, obj_output_sz + padding, texco); 63 | 64 | vec2 rvec = vec2(radius, radius); 65 | vec2 high = obj_output_sz; 66 | vec3 col = color; 67 | 68 | if (mix_factor > 0.001){ 69 | col = texture2D(map_tu0, texco).rgb; 70 | col = mix(col, color, mix_factor); 71 | } 72 | 73 | float a = rounded_box_shadow(vec2(0.0, 0.0), high, vert, sigma, radius); 74 | if (a > 0.99) 75 | discard; 76 | 77 | gl_FragColor = vec4(col, max(obj_opacity * weight * a, 0.0)); 78 | } 79 | -------------------------------------------------------------------------------- /durden/shaders/ui/dropshadow.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Dropshadow", 4 | filter = "none", 5 | frag_source = "dropshadow.frag", 6 | uniforms = { 7 | radius = { 8 | label = 'Radius', 9 | utype = 'f', 10 | default = 5, 11 | description = 'Corner Radius Circle', 12 | low = 1, 13 | high = 20, 14 | }, 15 | sigma = { 16 | label = 'Sigma', 17 | utype = 'f', 18 | default = 2, 19 | description = 'Shadow Blur Coefficient', 20 | low = 1, 21 | high = 20 22 | }, 23 | weight = { 24 | label = 'Weight', 25 | utype = 'f', 26 | default = 0.5, 27 | description = 'Shadow Blur Weight', 28 | low = 0.1, 29 | high = 1.0 30 | }, 31 | color = { 32 | label = "Color", 33 | utype = 'fff', 34 | default = {1.0, 0.0, 1.0}, 35 | low = 0.0, 36 | high = 1.0, 37 | description = 'Base shadow color to use', 38 | }, 39 | mix_factor = { 40 | label = "Mix Factor", 41 | utype = 'f', 42 | default = 0, 43 | low = 0, 44 | high = 1, 45 | description = '> 0, mix source texture with base color' 46 | } 47 | } 48 | }; 49 | -------------------------------------------------------------------------------- /durden/shaders/ui/lbar.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Launchbar", 3 | version = 1, 4 | frag = 5 | [[ 6 | uniform vec3 obj_col; 7 | uniform float obj_opacity; 8 | 9 | void main() 10 | { 11 | gl_FragColor = vec4(obj_col, obj_opacity); 12 | } 13 | ]], 14 | uniforms = {} 15 | }; 16 | -------------------------------------------------------------------------------- /durden/shaders/ui/lbar_tile.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Launchbar(Tile)", 4 | frag = [[ 5 | uniform vec4 col_bg; 6 | uniform float obj_opacity; 7 | uniform vec2 obj_output_sz; 8 | 9 | void main() 10 | { 11 | gl_FragColor = vec4(col_bg.rgb, col_bg.a * obj_opacity); 12 | } 13 | ]], 14 | uniforms = { 15 | col_bg = { 16 | label = "Background Color", 17 | utype = 'ffff', 18 | default = {1.0, 0.08, 0.08, 1.0}, 19 | low = 0, 20 | high = 1.0 21 | }, 22 | }, 23 | states = { 24 | active = { uniforms = { col_bg = {0.1, 0.1, 0.1, 1.0} } }, 25 | inactive = { uniforms = { col_bg = {0.05, 0.05, 0.05, 0.5} } } 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /durden/shaders/ui/lbar_tiletext.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Launchbar(TileText)", 4 | frag = [[ 5 | uniform sampler2D map_tu0; 6 | uniform vec4 col; 7 | uniform float obj_opacity; 8 | varying vec2 texco; 9 | 10 | void main() 11 | { 12 | vec4 txv = texture2D(map_tu0, texco).rgba; 13 | gl_FragColor = vec4(col.rgb * txv.rgb, 14 | txv.a * col.a * obj_opacity); 15 | } 16 | ]], 17 | uniforms = { 18 | col = { 19 | label = "Text Color", 20 | utype = 'ffff', 21 | default = {1.0, 1.0, 1.0, 1.0}, 22 | low = 0, 23 | high = 1.0 24 | }, 25 | }, 26 | states = { 27 | active = { uniforms = { col = {1.0, 1.0, 1.0, 1.0} } }, 28 | inactive = { uniforms = { col = {0.5, 0.5, 0.5, 1.0} } }, 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /durden/shaders/ui/lbarbg.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Launchbar(Background)", 3 | version = 1, 4 | frag = 5 | [[ 6 | uniform vec4 col; 7 | uniform float obj_opacity; 8 | 9 | void main() 10 | { 11 | gl_FragColor = vec4(col.rgb, col.a * obj_opacity); 12 | } 13 | ]], 14 | uniforms = { 15 | col = { 16 | label = 'Color', 17 | utype = 'ffff', 18 | default = {0.0, 0.0, 0.0, 0.8}, 19 | low = 0.0, 20 | high = 1.0 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /durden/shaders/ui/miniature.lua: -------------------------------------------------------------------------------- 1 | -- used for text labels and similar items on statusbar that need to 2 | -- inherit visibility but not subject itself to that alpha 3 | return { 4 | label = "Miniature", 5 | version = 1, 6 | frag = 7 | [[ 8 | uniform sampler2D map_tu0; 9 | uniform vec2 obj_output_sz; 10 | uniform float obj_opacity; 11 | varying vec2 texco; 12 | 13 | void main() 14 | { 15 | float step_s = 1.0 / obj_output_sz.x; 16 | float step_t = 1.0 / obj_output_sz.y; 17 | 18 | /* bias towards center */ 19 | if (texco.x > 0.5) 20 | step_s = step_s * -1.0; 21 | 22 | if (texco.y > 0.5) 23 | step_t = step_t * -1.0; 24 | 25 | /* sample 2x2 */ 26 | vec3 sum = vec3(0); 27 | vec3 a = texture2D(map_tu0, 28 | vec2(texco.x + 0.0 * step_s, texco.y + 0.0 * step_t)).rgb; 29 | vec3 b = texture2D(map_tu0, 30 | vec2(texco.x + 1.0 * step_s, texco.y + 0.0 * step_t)).rgb; 31 | vec3 c = texture2D(map_tu0, 32 | vec2(texco.x + 1.0 * step_s, texco.y + 1.0 * step_t)).rgb; 33 | vec3 d = texture2D(map_tu0, 34 | vec2(texco.x + 0.0 * step_s, texco.y + 1.0 * step_t)).rgb; 35 | 36 | /* and add together, maybe adjust weights on intensity? */ 37 | sum += a * 0.2; 38 | sum += b * 0.2; 39 | sum += c * 0.2; 40 | sum += d * 0.2; 41 | 42 | gl_FragColor = vec4(sum, obj_opacity); 43 | } 44 | ]], 45 | uniforms = { 46 | }, 47 | states = { 48 | active = { uniforms = { } } 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /durden/shaders/ui/popup.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * shadow solution courtesy of Evan Wallace, 3 | * 'Fast Rounded Rectangle Shadows' 4 | * madebyevan.com/shaders/fast-rounded-rectangle-shadows 5 | * (MIT license), see github.com/evanw/glfx.js 6 | */ 7 | uniform float obj_opacity; 8 | uniform float radius; 9 | uniform float sigma; 10 | uniform float weight; 11 | uniform vec2 obj_output_sz; 12 | uniform vec3 shadow_color; 13 | uniform vec3 background_color; 14 | uniform vec3 border_color; 15 | uniform vec3 select_color; 16 | uniform vec2 range; 17 | varying vec2 texco; 18 | 19 | vec2 error_function(vec2 x) 20 | { 21 | vec2 s = sign(x), a = abs(x); 22 | x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a; 23 | x *= x; 24 | return s - s / (x * x); 25 | } 26 | 27 | float gaussian(float x, float sigma) 28 | { 29 | const float pi = 3.141592653589793; 30 | return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma); 31 | } 32 | 33 | float rounded_shadow_x(float x, float y, float sigma, float corner, vec2 halfv) 34 | { 35 | float delta = min(halfv.y - corner - abs(y), 0.0); 36 | float curved = halfv.x - corner + sqrt(max(0.0, corner * corner - delta * delta)); 37 | vec2 integral = 0.5 + 0.5 * error_function((x + vec2(-curved, curved)) * (sqrt(0.5)/sigma)); 38 | return integral.y - integral.x; 39 | } 40 | 41 | float rounded_box_shadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) 42 | { 43 | vec2 center = (lower + upper) * 0.5; 44 | vec2 halfv = (upper - lower) * 0.5; 45 | point -= center; 46 | float low = point.y - halfv.y; 47 | float high = point.y + halfv.y; 48 | float start = clamp(-3.0 * sigma, low, high); 49 | float end = clamp(3.0 * sigma, low, high); 50 | 51 | float step = (end - start) / 4.0; 52 | float y = start + step * 0.5; 53 | float value = 0.0; 54 | for (int i = 0; i < 4; i++){ 55 | value += rounded_shadow_x(point.x, point.y - y, sigma, corner, halfv) * gaussian(y, sigma) * step; 56 | y += step; 57 | } 58 | return value; 59 | } 60 | 61 | float sstep(float e0, float e1, float x) 62 | { 63 | float s = clamp((x - e0) / (e1 - e0), 0.0, 1.0); 64 | return s * s - (3.0 - 2.0 * s); 65 | } 66 | 67 | void main() 68 | { 69 | float padding = 3.0 * sigma; 70 | vec2 vert = mix(vec2(0.0, 0.0) - padding, obj_output_sz + padding, texco); 71 | 72 | vec2 rvec = vec2(radius, radius); 73 | vec2 high = obj_output_sz; 74 | vec3 col = background_color; 75 | 76 | /* with a in a small interval (say 0.90 to 0.99) use the border-color instead */ 77 | float a = rounded_box_shadow(vec2(0.0, 0.0), high, vert, sigma, radius); 78 | 79 | if (a < 0.99){ 80 | col = border_color; 81 | if (a < 0.95){ 82 | col = shadow_color; 83 | a *= weight; 84 | } 85 | } 86 | 87 | /* blend in the cursor, gradient it out towards the edge */ 88 | else if (texco.t > range.x && texco.t < range.y){ 89 | col = mix(select_color, col, texco.s); 90 | } 91 | 92 | gl_FragColor = vec4(col, max(obj_opacity * a, 0.0)); 93 | } 94 | -------------------------------------------------------------------------------- /durden/shaders/ui/popup.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Popup", 4 | filter = "none", 5 | frag_source = "popup.frag", 6 | uniforms = { 7 | radius = { 8 | label = 'Radius', 9 | utype = 'f', 10 | default = 5, 11 | description = 'Corner Radius Circle', 12 | low = 1, 13 | high = 20, 14 | }, 15 | sigma = { 16 | label = 'Sigma', 17 | utype = 'f', 18 | default = 2, 19 | description = 'Shadow Blur Coefficient', 20 | low = 1, 21 | high = 20 22 | }, 23 | weight = { 24 | label = 'Weight', 25 | utype = 'f', 26 | default = 0.5, 27 | description = 'Shadow Blur Weight', 28 | low = 0.1, 29 | high = 1.0 30 | }, 31 | shadow_color = { 32 | label = "Shadow", 33 | utype = 'fff', 34 | default = {0.05, 0.05, 0.05}, 35 | low = 0.0, 36 | high = 1.0, 37 | description = 'Base shadow color to use', 38 | }, 39 | background_color = { 40 | label = "Background", 41 | utype = 'fff', 42 | default = {0.3, 0.3, 0.3}, 43 | low = 0.0, 44 | high = 1.0, 45 | description = 'Background color to use', 46 | }, 47 | border_color = { 48 | label = "Border", 49 | utype = 'fff', 50 | default = {0.7, 0.7, 0.7}, 51 | low = 0.0, 52 | high = 1.0, 53 | description = "Border color to use" 54 | }, 55 | select_color = { 56 | label = "Select", 57 | utype = 'fff', 58 | default = {0.3, 0.3, 0.7}, 59 | low = 0.0, 60 | high = 1.0, 61 | description = "Selection color to use", 62 | }, 63 | range = { 64 | label = "Range", 65 | utype = 'ff', 66 | hidden = true, 67 | default = {0.2, 0.3}, 68 | low = 0.0, 69 | high = 1.0, 70 | description = "Surface-coordinates for selection color" 71 | } 72 | } 73 | }; 74 | -------------------------------------------------------------------------------- /durden/shaders/ui/regmark.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Region-Border", 4 | uniforms = { 5 | border = { 6 | label = 'Border Size', 7 | utype = 'f', 8 | default = 1.0, 9 | low = 0.0, 10 | high = 10.0 11 | }, 12 | col = { 13 | label = 'Color', 14 | utype = 'fff', 15 | default = {1.0, 1.0, 1.0}, 16 | low = 0.0, 17 | high = 1.0 18 | }, 19 | }, 20 | frag = [[ 21 | uniform sampler2D map_tu0; 22 | uniform vec2 obj_output_sz; 23 | uniform float border; 24 | uniform float obj_opacity; 25 | uniform vec3 col; 26 | varying vec2 texco; 27 | 28 | void main() 29 | { 30 | float bstep_x = border / obj_output_sz.x; 31 | float bstep_y = border / obj_output_sz.y; 32 | 33 | bvec2 marg1 = greaterThan(texco, vec2(1.0 - bstep_x, 0.99 - bstep_y)); 34 | bvec2 marg2 = lessThan(texco, vec2(bstep_x, bstep_y)); 35 | float f = float( !(any(marg1) || any(marg2)) ); 36 | 37 | gl_FragColor = vec4(mix(col, texture2D(map_tu0, texco).rgb, f), 1.0); 38 | } 39 | ]], 40 | states = { 41 | active = { 42 | uniforms = { 43 | } 44 | } 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /durden/shaders/ui/regsel.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Selection(Region)", 4 | frag = [[ 5 | uniform sampler2D map_tu0; 6 | uniform vec2 obj_output_sz; 7 | uniform float obj_opacity; 8 | varying vec2 texco; 9 | 10 | void main() 11 | { 12 | float bstep_x = 1.0 / obj_output_sz.x; 13 | float bstep_y = 1.0 / obj_output_sz.y; 14 | 15 | bvec2 marg1 = greaterThan(texco, vec2(1.0 - bstep_x, 1.0 - bstep_y)); 16 | bvec2 marg2 = lessThan(texco, vec2(bstep_x, bstep_y)); 17 | float f = float( !(any(marg1) || any(marg2)) ); 18 | 19 | gl_FragColor = vec4(texture2D(map_tu0, texco).rgb, 20 | 1.0 - ((1.0 - obj_opacity) * f)); 21 | } 22 | ]], 23 | uniforms = { 24 | }, 25 | states = { 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /durden/shaders/ui/rounded.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Rounded(Soft)", 3 | version = 1, 4 | frag = 5 | [[ 6 | /* 7 | * shadow solution courtesy of Evan Wallace, 8 | * 'Fast Rounded Rectangle Shadows' 9 | * madebyevan.com/shaders/fast-rounded-rectangle-shadows 10 | * (MIT license), see github.com/evanw/glfx.js 11 | */ 12 | uniform float obj_opacity; 13 | uniform float radius; 14 | uniform float sigma; 15 | uniform vec2 obj_output_sz; 16 | uniform vec3 obj_col; 17 | varying vec2 texco; 18 | 19 | vec2 error_function(vec2 x) 20 | { 21 | vec2 s = sign(x), a = abs(x); 22 | x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a; 23 | x *= x; 24 | return s - s / (x * x); 25 | } 26 | 27 | float gaussian(float x, float sigma) 28 | { 29 | const float pi = 3.141592653589793; 30 | return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma); 31 | } 32 | 33 | float rounded_shadow_x(float x, float y, float sigma, float corner, vec2 halfv) 34 | { 35 | float delta = min(halfv.y - corner - abs(y), 0.0); 36 | float curved = halfv.x - corner + sqrt(max(0.0, corner * corner - delta * delta)); 37 | vec2 integral = 0.5 + 0.5 * error_function((x + vec2(-curved, curved)) * (sqrt(0.5)/sigma)); 38 | return integral.y - integral.x; 39 | } 40 | 41 | float rounded_box_shadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) 42 | { 43 | vec2 center = (lower + upper) * 0.5; 44 | vec2 halfv = (upper - lower) * 0.5; 45 | point -= center; 46 | float low = point.y - halfv.y; 47 | float high = point.y + halfv.y; 48 | float start = clamp(-3.0 * sigma, low, high); 49 | float end = clamp(3.0 * sigma, low, high); 50 | 51 | float step = (end - start) / 4.0; 52 | float y = start + step * 0.5; 53 | float value = 0.0; 54 | for (int i = 0; i < 4; i++){ 55 | value += rounded_shadow_x(point.x, point.y - y, sigma, corner, halfv) * gaussian(y, sigma) * step; 56 | y += step; 57 | } 58 | return value; 59 | } 60 | 61 | void main() 62 | { 63 | float a = rounded_box_shadow( 64 | vec2(0.0, 0.0), obj_output_sz, obj_output_sz * texco, sigma, radius); 65 | gl_FragColor = vec4(obj_col, a * obj_opacity); 66 | } 67 | 68 | ]], 69 | uniforms = { 70 | radius = { 71 | label = 'Radius', 72 | utype = 'f', 73 | default = 5, 74 | description = 'Corner Radius Circle', 75 | low = 1, 76 | high = 100, 77 | }, 78 | sigma = { 79 | label = 'Sigma', 80 | utype = 'f', 81 | default = 2, 82 | description = 'Shadow Blur Coefficient', 83 | low = 1, 84 | high = 100 85 | }, 86 | }, 87 | states = { 88 | } 89 | }; 90 | -------------------------------------------------------------------------------- /durden/shaders/ui/rounded_border.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * shadow solution courtesy of Evan Wallace, 3 | * 'Fast Rounded Rectangle Shadows' 4 | * madebyevan.com/shaders/fast-rounded-rectangle-shadows 5 | * (MIT license), see github.com/evanw/glfx.js 6 | */ 7 | uniform float obj_opacity; 8 | uniform float radius; 9 | uniform float sigma; 10 | uniform float weight; 11 | uniform float border_thickness; 12 | 13 | uniform vec2 obj_output_sz; 14 | uniform vec3 obj_col; 15 | uniform vec3 shadow_color; 16 | uniform vec3 border_color; 17 | varying vec2 texco; 18 | uniform sampler2D map_tu0; 19 | 20 | vec2 error_function(vec2 x) 21 | { 22 | vec2 s = sign(x), a = abs(x); 23 | x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a; 24 | x *= x; 25 | return s - s / (x * x); 26 | } 27 | 28 | float gaussian(float x, float sigma) 29 | { 30 | const float pi = 3.141592653589793; 31 | return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma); 32 | } 33 | 34 | float rounded_shadow_x(float x, float y, float sigma, float corner, vec2 halfv) 35 | { 36 | float delta = min(halfv.y - corner - abs(y), 0.0); 37 | float curved = halfv.x - corner + sqrt(max(0.0, corner * corner - delta * delta)); 38 | vec2 integral = 0.5 + 0.5 * error_function((x + vec2(-curved, curved)) * (sqrt(0.5)/sigma)); 39 | return integral.y - integral.x; 40 | } 41 | 42 | float rounded_box_shadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) 43 | { 44 | vec2 center = (lower + upper) * 0.5; 45 | vec2 halfv = (upper - lower) * 0.5; 46 | point -= center; 47 | float low = point.y - halfv.y; 48 | float high = point.y + halfv.y; 49 | float start = clamp(-3.0 * sigma, low, high); 50 | float end = clamp(3.0 * sigma, low, high); 51 | 52 | float step = (end - start) / 4.0; 53 | float y = start + step * 0.5; 54 | float value = 0.0; 55 | for (int i = 0; i < 4; i++){ 56 | value += rounded_shadow_x(point.x, point.y - y, sigma, corner, halfv) * gaussian(y, sigma) * step; 57 | y += step; 58 | } 59 | return value; 60 | } 61 | 62 | void main() 63 | { 64 | float padding = 3.0 * sigma; 65 | vec2 vert = mix(vec2(0.0, 0.0) - padding, obj_output_sz + padding, texco); 66 | 67 | vec2 rvec = vec2(radius, radius); 68 | vec2 high = obj_output_sz; 69 | vec3 col; 70 | 71 | /* with a in a small interval (say 0.90 to 0.99) use the border-color instead */ 72 | float a = rounded_box_shadow(vec2(0.0, 0.0), high, vert, sigma, radius); 73 | 74 | if (a < 0.99){ 75 | col = border_color; 76 | if (a < 0.99 - border_thickness){ 77 | col = shadow_color; 78 | a *= weight; 79 | } 80 | } 81 | else { 82 | col = texture2D(map_tu0, texco).rgb; 83 | } 84 | 85 | gl_FragColor = vec4(col, max(obj_opacity * a, 0.0)); 86 | } 87 | -------------------------------------------------------------------------------- /durden/shaders/ui/rounded_border.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Rounded Border", 4 | filter = "none", 5 | frag_source = "rounded_border.frag", 6 | uniforms = { 7 | radius = { 8 | label = 'Radius', 9 | utype = 'f', 10 | default = 20, 11 | description = 'Corner Radius Circle', 12 | low = 1, 13 | high = 20, 14 | }, 15 | sigma = { 16 | label = 'Sigma', 17 | utype = 'f', 18 | default = 2, 19 | description = 'Shadow Blur Coefficient', 20 | low = 1, 21 | high = 20 22 | }, 23 | weight = { 24 | label = 'Weight', 25 | utype = 'f', 26 | default = 0.5, 27 | description = 'Shadow Blur Weight', 28 | low = 0.1, 29 | high = 1.0 30 | }, 31 | shadow_color = { 32 | label = "Shadow", 33 | utype = 'fff', 34 | default = {0.05, 0.05, 0.05}, 35 | low = 0.0, 36 | high = 1.0, 37 | description = 'Base shadow color to use', 38 | }, 39 | border_color = { 40 | label = "Border", 41 | utype = 'fff', 42 | default = {0.7, 0.7, 0.7}, 43 | low = 0.0, 44 | high = 1.0, 45 | description = "Border color to use" 46 | }, 47 | border_thickness = { 48 | label = "Thickness", 49 | utype = 'f', 50 | default = {0.04}, 51 | low = 0.01, 52 | high = 0.1, 53 | description = "Range assigned for border", 54 | }, 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /durden/shaders/ui/sbar_item.lua: -------------------------------------------------------------------------------- 1 | -- used for text labels and similar items on statusbar that need to 2 | -- inherit visibility but not subject itself to that alpha 3 | return { 4 | label = "Statusbar(TileText)", 5 | version = 1, 6 | frag = 7 | [[ 8 | uniform sampler2D map_tu0; 9 | uniform float factor; 10 | uniform float mix_u; 11 | uniform vec3 col; 12 | varying vec2 texco; 13 | 14 | void main() 15 | { 16 | vec4 txcol = texture2D(map_tu0, texco); 17 | vec3 bc = mix(col, txcol.rgb, mix_u); 18 | gl_FragColor = vec4(bc.rgb * factor, txcol.a); 19 | } 20 | ]], 21 | uniforms = { 22 | col = { 23 | label = 'Color', 24 | utype = 'fff', 25 | default = {1.0, 1.0, 1.0}, 26 | low = 0.0, 27 | high = 1.0 28 | }, 29 | factor = { 30 | label = 'Factor', 31 | utype = 'f', 32 | default = 1.0, 33 | low = 0.1, 34 | high = 1.0 35 | }, 36 | -- use static color or override? 37 | mix_u = { 38 | label = 'Mix', 39 | utype = 'f', 40 | default = 1.0, 41 | low = 0.0, 42 | high = 1.0 43 | } 44 | }, 45 | states = { 46 | inactive = { uniforms = { factor = 0.3 } } 47 | } 48 | }; 49 | -------------------------------------------------------------------------------- /durden/shaders/ui/sbar_item_bg.lua: -------------------------------------------------------------------------------- 1 | return { 2 | version = 1, 3 | label = "Statusbar(Tile)", 4 | frag = [[ 5 | uniform float border; 6 | uniform float factor; 7 | uniform vec3 obj_col; 8 | uniform vec4 col_bg; 9 | uniform vec2 obj_output_sz; 10 | varying vec2 texco; 11 | 12 | #ifdef FULL_BORDER 13 | float full_border(float bstep_x, float bstep_y) 14 | { 15 | bvec2 marg1 = greaterThan(texco, vec2(1.0 - bstep_x, 1.0 - bstep_y)); 16 | bvec2 marg2 = lessThan(texco, vec2(bstep_x, bstep_y)); 17 | return float( !(any(marg1) || any(marg2)) ); 18 | } 19 | #else 20 | float underline(float bstep_y) 21 | { 22 | return float( !(texco.t > 1.0 - bstep_y && (texco.s > 0.2 && texco.s < 0.8 )) ); 23 | } 24 | #endif 25 | 26 | void main() 27 | { 28 | float bstep_y = border/obj_output_sz.y; 29 | 30 | #ifdef FULL_BORDER 31 | float bstep_x = border/obj_output_sz.x; 32 | float f = full_border(bstep_x, bstep_y); 33 | #else 34 | float f = underline(bstep_y); 35 | #endif 36 | vec4 fg = vec4(obj_col.r, obj_col.g, obj_col.b, 1.0); 37 | gl_FragColor = 38 | vec4(factor, factor, factor, 0.3) * vec4(mix(fg, col_bg, f)); 39 | } 40 | ]], 41 | uniforms = { 42 | border = { 43 | label = 'Border Size', 44 | utype = 'f', 45 | default = 1.0, 46 | low = 0.0, 47 | high = 10.0 48 | }, 49 | col_bg = { 50 | label = "Tile Color", 51 | utype = 'ffff', 52 | default = {0.135, 0.135, 0.135, 1.0}, 53 | low = 0, 54 | high = 1.0 55 | }, 56 | factor = { 57 | label = "Factor", 58 | utype = 'f', 59 | default = 1.0, 60 | low = 0.1, 61 | high = 1.0 62 | } 63 | }, 64 | states = { 65 | inactive = { uniforms = { 66 | factor = 0.2 67 | } }, 68 | alert = { uniforms = { 69 | col_bg = {0.549, 0.549, 0.0, 1.0}, 70 | factor = 1.0 71 | } } 72 | } 73 | }; 74 | -------------------------------------------------------------------------------- /durden/shaders/ui/sbar_msg_bg.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Statusbar(TextBg)", 3 | version = 1, 4 | frag = 5 | [[ 6 | uniform vec4 col; 7 | float obj_opacity; 8 | 9 | void main() 10 | { 11 | gl_FragColor = col; 12 | } 13 | ]], 14 | uniforms = { 15 | col = { 16 | label = 'Color', 17 | utype = 'ffff', 18 | default = {1.0, 1.0, 1.0, 0.01} 19 | } 20 | }, 21 | states = { 22 | active = { uniforms = { col = {1.0, 1.0, 1.0, 0.2} } }, 23 | locked = { uniforms = { col = {0.4078, 0.05, 0.05, 0.9} } } 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /durden/shaders/ui/sbar_msg_text.lua: -------------------------------------------------------------------------------- 1 | -- used for text labels and similar items on statusbar that need to 2 | -- inherit visibility but not subject itself to that alpha 3 | return { 4 | label = "Statusbar(Text)", 5 | version = 1, 6 | frag = 7 | [[ 8 | uniform sampler2D map_tu0; 9 | varying vec2 texco; 10 | float obj_opacity; 11 | 12 | void main() 13 | { 14 | gl_FragColor = vec4(texture2D(map_tu0, texco).rgba); 15 | } 16 | ]], 17 | uniforms = { 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /durden/shaders/ui/statusbar.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Statusbar", 3 | version = 1, 4 | frag = 5 | [[ 6 | uniform vec4 col; 7 | float obj_opacity; 8 | 9 | void main() 10 | { 11 | gl_FragColor = col; 12 | } 13 | ]], 14 | uniforms = { 15 | col= { 16 | label = 'Color', 17 | utype = 'ffff', 18 | default = {0.5, 0.5, 0.5, 0.1} 19 | } 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /durden/shaders/ui/titlebar.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Titlebar", 3 | version = 1, 4 | frag = 5 | [[ 6 | uniform vec4 col; 7 | uniform float obj_opacity; 8 | uniform vec3 obj_col; 9 | uniform float weight; 10 | 11 | void main() 12 | { 13 | gl_FragColor = vec4(mix(obj_col.rgb, col.rgb, weight), col.a * obj_opacity); 14 | } 15 | ]], 16 | uniforms = { 17 | col = { 18 | label = 'Color', 19 | utype = 'ffff', 20 | default = {1.0, 1.0, 1.0, 1.0} 21 | }, 22 | weight = { 23 | label = 'Weight', 24 | utype = 'f', 25 | default = {0.0}, 26 | description = 'Mix weight between source color and state color' 27 | } 28 | }, 29 | states = { 30 | suspended = {uniforms = { col = {0.6, 0.0, 0.0, 0.9}, weight = 1.0 } }, 31 | active = { uniforms = { col = {0.0, 0.0, 0.0, 0.9}, weight = 0.0} }, 32 | inactive = { uniforms = { col = {0.0, 0.0, 0.0, 0.9}, weight = 0.8} }, 33 | alert = { uniforms = { col = {1.0, 0.54, 0.0, 0.9}, weight = 1.0} } 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /durden/shaders/ui/titlebar_icon.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Titlebar(icon)", 3 | version = 1, 4 | frag = 5 | [[ 6 | uniform float obj_opacity; 7 | uniform sampler2D map_tu0; 8 | uniform vec4 weights; 9 | varying vec2 texco; 10 | 11 | void main() 12 | { 13 | vec4 col = texture2D(map_tu0, texco).rgba; 14 | col.a *= obj_opacity; 15 | gl_FragColor = weights * col; 16 | } 17 | ]], 18 | uniforms = { 19 | weights = { 20 | label = 'Weights', 21 | utype = 'ffff', 22 | default = {1.0, 1.0, 1.0, 0.2} 23 | } 24 | }, 25 | states = { 26 | suspended = {uniforms = { weights = {1.0, 0.0, 0.0, 0.2} } }, 27 | active = { uniforms = { weights = {0.5, 0.5, 0.5, 0.7} } }, 28 | inactive = { uniforms = { weights = {1.0, 1.0, 1.0, 0.2} } }, 29 | alert = { uniforms = { weights = {1.0, 1.0, 1.0, 1.0} } }, 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /durden/shaders/ui/titlebar_iconbg.lua: -------------------------------------------------------------------------------- 1 | return { 2 | label = "Titlebar(iconbg)", 3 | version = 1, 4 | frag = 5 | [[ 6 | void main() 7 | { 8 | discard; 9 | } 10 | ]], 11 | uniforms = { 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /durden/shaders/ui/titlebar_text.lua: -------------------------------------------------------------------------------- 1 | -- used for text labels and similar items on statusbar that need to 2 | -- inherit visibility but not subject itself to that alpha 3 | return { 4 | label = "Titlebar(Text)", 5 | version = 1, 6 | frag = [[ 7 | uniform sampler2D map_tu0; 8 | varying vec2 texco; 9 | uniform vec3 col; 10 | uniform float obj_opacity; 11 | 12 | void main() 13 | { 14 | float alpha = texture2D(map_tu0, texco).a; 15 | gl_FragColor = vec4(col.rgb, alpha * obj_opacity); 16 | } 17 | ]], 18 | uniforms = { 19 | col= { 20 | label = 'Color', 21 | utype = 'fff', 22 | default = {1.0, 1.0, 1.0}, 23 | low = 0.0, 24 | high = 1.0 25 | } 26 | }, 27 | states = { 28 | active = { uniforms = { col= {1.0, 1.0, 1.0} } }, 29 | inactive = { uniforms = { col= {0.8, 1.0, 0.8} } }, 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /durden/tools/.gitignore: -------------------------------------------------------------------------------- 1 | senseye* 2 | -------------------------------------------------------------------------------- /durden/tools/advfloat.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Advanced float handler 3 | -- 4 | -- Kept here as a means to start removing policy from tiler.lua 5 | -- and letting more parts of the codebase be "opt out" 6 | -- 7 | -- Since it is rather big, it have been split out into multiple subscripts, 8 | -- while this one is kept as an entry point for consolidating menu 9 | -- mapping and configuration keys. 10 | -- 11 | -- cactions : cursor regions - path activation on mouse behavior 12 | -- gridfit : split the screen into a 9-cell region for pseudo-tiler 13 | -- autolay : automatic reposition/relayouting heuristics 14 | -- spawnctl : intercept and regulate initial window position and size 15 | -- minimize : minimize- target controls 16 | -- bginput : input handlers for the wallpaper image (if one is set) 17 | -- icons : desktop icon support 18 | -- 19 | 20 | local floatmenu = { 21 | { 22 | kind = "value", 23 | name = "spawn_action", 24 | initial = gconfig_get("advfloat_spawn"), 25 | label = "Spawn Method", 26 | description = "Change how new windows are being sized and positioned", 27 | -- missing (split/share selected) or join selected 28 | set = {"click", "cursor", "draw", "auto"}, 29 | handler = function(ctx, val) 30 | mode = val; 31 | gconfig_set("advfloat_spawn", val); 32 | end 33 | }, 34 | }; 35 | 36 | menus_register("global", "settings/wspaces", 37 | { 38 | kind = "action", 39 | name = "float", 40 | submenu = true, 41 | label = "Float", 42 | description = "Advanced float workspace layout", 43 | handler = floatmenu 44 | }); 45 | system_load("tools/advfloat/cactions.lua")(); 46 | system_load("tools/advfloat/minimize.lua")(); 47 | system_load("tools/advfloat/spawnctl.lua")(); 48 | system_load("tools/advfloat/bginput.lua")(); 49 | system_load("tools/advfloat/bgicons.lua")(); 50 | 51 | local workspace_menu = { 52 | { 53 | kind = "action", 54 | submenu = true, 55 | name = "autolayout", 56 | label = "Layouter", 57 | description = "Apply an automatic layouting technique", 58 | handler = system_load("tools/advfloat/autolay.lua")() 59 | } 60 | }; 61 | 62 | menus_register("target", "window", 63 | { 64 | kind = "action", 65 | submenu = true, 66 | name = "gridalign", 67 | label = "Grid-Fit", 68 | eval = function() 69 | local wnd = active_display().selected; 70 | return (wnd and wnd.space.mode == "float"); 71 | end, 72 | description = "Size and fit the current window to a virtual grid cell", 73 | handler = system_load("tools/advfloat/gridfit.lua")() 74 | }); 75 | 76 | menus_register("target", "window/move_resize", 77 | { 78 | kind = "action", 79 | submenu = false, 80 | name = "drawrz", 81 | eval = function() 82 | return active_display().selected.space.mode == "float"; 83 | end, 84 | label = "Draw-Resize", 85 | handler = system_load("tools/advfloat/rzctl.lua")() 86 | }); 87 | 88 | menus_register("global", "workspace", 89 | { 90 | kind = "action", 91 | name = "float", 92 | label = "Float", 93 | submenu = true, 94 | description = "(advfloat-tool) active workspace specific actions", 95 | eval = function() 96 | return active_display().spaces[active_display().space_ind].mode == "float"; 97 | end, 98 | handler = workspace_menu 99 | }); 100 | -------------------------------------------------------------------------------- /durden/tools/advfloat/bginput.lua: -------------------------------------------------------------------------------- 1 | -- just leverage the normal 'fallthrough input' in the tiler input handler 2 | -- dispatch function. Check if we should forward to an active client or swallow 3 | -- certain actions like right-click for popup. 4 | 5 | local inputh = function(wm, iot) 6 | local space = wm:active_space(); 7 | if (space and space.background_src_input and 8 | valid_vid(space.background_src, TYPE_FRAMESERVER)) then 9 | target_input(space.background_src, iot); 10 | end 11 | end 12 | 13 | -- toggle fallthrough on and off so the wallpaper can have normal click/rclick 14 | -- when the background is not set to an actual client 15 | local function background_hook(space, vid, generic) 16 | space:set_background_old(vid, generic); 17 | if type(vid) ~= "number" or not valid_vid(vid, TYPE_FRAMESERVER) then 18 | space.wm:fallthrough_input(); 19 | else 20 | space.wm:fallthrough_input(inputh); 21 | end 22 | end 23 | 24 | menus_register("target", "window", 25 | { 26 | name = "canvas_to_bg", 27 | label = "Workspace-Background", 28 | kind = "action", 29 | description = "Set windows contents as workspace background", 30 | handler = function() 31 | local wnd = active_display().selected; 32 | 33 | if (valid_vid(wnd.external)) then 34 | -- hook set_background so that we can turn input block/grab on/off 35 | if (not wnd.space.set_background_old) then 36 | wnd.space.set_background_old = wnd.space.set_background; 37 | wnd.space.set_background = background_hook; 38 | end 39 | 40 | wnd.space:set_background(wnd.external, nil, true); 41 | 42 | -- disable 'focus hints' for the window as otherwise some clients will block io 43 | wnd.dispstat_block_old = wnd.dispstat_block; 44 | wnd.dispstat_block = true; 45 | else 46 | wnd.dispstat_block = wnd.dispstat_block_old; 47 | wnd.space:set_background(wnd.canvas); 48 | end 49 | end 50 | }); 51 | -------------------------------------------------------------------------------- /durden/tools/advfloat/cactions_cfg.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- This file describes 'cursor action' regions, rectangular regions 3 | -- in floating workspace mode where some action will be taken if you 4 | -- drag a window around. They can be used to implement behavior like 5 | -- "drag window to edge to resize to fixed size", trigger migration 6 | -- to a specific screen and so on. 7 | -- 8 | 9 | local cactions = {}; 10 | 11 | -- this example, if uncommented, would exec the overview tool if the 12 | -- cursor in its non-drag state is moved to the top left corner. These 13 | -- are always invisible. 14 | -- 15 | -- table.insert(cactions, { 16 | -- region = {0.0, 0.0, 0.001, 0.001}, 17 | -- on_over = function() 18 | -- dispatch_symbol("!tools/overview/ws_tile") 19 | -- end 20 | --}); 21 | 22 | -- this example, if uncommented, would trigger a window center 23 | -- if dropped to the left edge of the user area, with a preview on 24 | -- how that would look. It's slightly more complicated as it needs 25 | -- to create / manage the "center- preview". 26 | -- table.insert(cactions, { 27 | -- region = {0.0, 0.0, 0.05, 1.0}, 28 | -- visible = true, 29 | -- on_drag_over = function(ctx, wnd, vid) 30 | -- local nsrf = color_surface(wnd.width, wnd.height, 0, 255, 0); 31 | -- blend_image(nsrf, 0.5, gconfig_get("transition")); 32 | -- order_image(nsrf, 65532); 33 | -- move_image(nsrf, 34 | -- 0.5 * (wnd.wm.width - wnd.width), 0.5 * ( wnd.wm.height - wnd.height)); 35 | -- ctx.temp_vid = nsrf; 36 | -- image_mask_set(nsrf, MASK_UNPICKABLE); 37 | -- blend_image(vid, 0.7, gconfig_get("transition")); 38 | -- end, 39 | -- on_drag_out = function(ctx, wnd, vid) 40 | -- if (valid_vid(ctx.temp_vid)) then 41 | -- expire_image(ctx.temp_vid, 10); 42 | -- blend_image(ctx.temp_vid, 0.0, 10); 43 | -- ctx.temp_vid = nil; 44 | -- end 45 | -- end, 46 | -- on_drop = function(ctx, wnd) 47 | -- if (valid_vid(ctx.temp_vid)) then 48 | -- expire_image(ctx.temp_vid, 10); 49 | -- blend_image(ctx.temp_vid, 0.0, 10); 50 | -- ctx.temp_vid = nil; 51 | -- end 52 | 53 | -- if (wnd.move) then 54 | -- wnd:move(0.5*(wnd.wm.width - wnd.width), 55 | -- 0.5*(wnd.wm.height - wnd.height), false, true); 56 | -- end 57 | -- end 58 | --}); 59 | 60 | return cactions; 61 | -------------------------------------------------------------------------------- /durden/tools/advfloat/rzctl.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local wnd = active_display().selected; 3 | if (not wnd) then 4 | return; 5 | end 6 | 7 | local x, y = mouse_xy(); 8 | -- warp the mouse to use that as the positioning 9 | mouse_absinput_masked( 10 | wnd.x + wnd.pad_left, wnd.y + wnd.pad_top, true); 11 | 12 | local r, g, b = suppl_hexstr_to_rgb(HC_PALETTE[1]); 13 | suppl_region_select( 14 | r, g, b, 15 | function(x1, y1, x2, y2) 16 | -- protect against toctu 17 | if (not wnd or not wnd.move) then 18 | return; 19 | end 20 | 21 | local w = x2 - x1; 22 | local h = y2 - y1; 23 | 24 | if valid_vid(wnd.external) then 25 | wnd:displayhint(w, h, wnd.dispmask); 26 | else 27 | wnd:resize_effective(w, h); 28 | end 29 | 30 | mouse_absinput_masked(x, y, true); 31 | end 32 | ); 33 | 34 | mouse_absinput( 35 | wnd.x + wnd.pad_left + wnd.effective_w, 36 | wnd.y + wnd.pad_top + wnd.effective_h 37 | ) 38 | end 39 | -------------------------------------------------------------------------------- /durden/tools/autostart.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- This tool simply keeps track of paths to start when the tool itself is 3 | -- loaded Decent improvements on this would be to detect a key that causes a 4 | -- script failure and mask- that one out on the next iteration. 5 | -- 6 | local items = {}; 7 | local log = suppl_add_logfn("tools"); 8 | 9 | local function synch_table() 10 | drop_keys("autostart_%"); 11 | local lst = {}; 12 | for i,v in ipairs(items) do 13 | lst["autostart_" .. tostring(i)] = v; 14 | end 15 | store_key(lst); 16 | end 17 | 18 | local oldshutdown = durden_shutdown; 19 | durden_shutdown = function(...) 20 | store_key("autostart_ok", 1); 21 | return oldshutdown(...); 22 | end 23 | 24 | -- even with manual gaps, this will give us a compact item list 25 | local ind = 1; 26 | while true do 27 | local val = get_key("autostart_" .. tostring(ind)); 28 | if not val then 29 | break 30 | end 31 | ind = ind + 1; 32 | table.insert(items, val); 33 | end 34 | log("name=autostart:kind=status:message=loaded " .. tostring(#items)); 35 | if (get_key("autostart_ok")) then 36 | for i,v in ipairs(items) do 37 | dispatch_symbol(v); 38 | end 39 | store_key("autostart_ok", ""); 40 | end 41 | 42 | local function gen_rm_menu() 43 | local res = {}; 44 | for i,v in ipairs(items) do 45 | table.insert(res,{ 46 | name = tostring(i), 47 | description = v, 48 | label = tostring(i), 49 | kind = "action", 50 | -- self modifying, need refresh 51 | handler = function() 52 | log("name=autostart:kind=removed:index=" .. tostring(i)); 53 | table.remove(items, i); 54 | synch_table(); 55 | end 56 | }); 57 | end 58 | return res; 59 | end 60 | 61 | local root = 62 | { 63 | { 64 | name = "add", 65 | kind = "action", 66 | label = "Add", 67 | description = "Append a new item to the autostart list", 68 | interactive = true, 69 | handler = function(ctx) 70 | dispatch_symbol_bind(function(path) 71 | if path and #path > 0 and path ~= "/global/settings/tools/autostart/run" then 72 | log("name=autostart:kind=added:path=" .. path); 73 | table.insert(items, path); 74 | synch_table(); 75 | end 76 | end); 77 | end 78 | }, 79 | { 80 | name = "remove", 81 | label = "Remove", 82 | kind = "action", 83 | description = "Remove an existing autostart item", 84 | eval = function() 85 | return #items > 0; 86 | end, 87 | submenu = true, 88 | handler = function() 89 | return gen_rm_menu(); 90 | end, 91 | }, 92 | { 93 | name = "run", 94 | label = "Run", 95 | kind = "action", 96 | description = "Run the current list of autostart items in sequence", 97 | eval = function() 98 | return #items > 0; 99 | end, 100 | handler = function() 101 | for i,v in ipairs(items) do 102 | dispatch_symbol(v); 103 | end 104 | end 105 | }, 106 | }; 107 | 108 | menus_register("global", "settings/tools", 109 | { 110 | name = "autostart", 111 | label = "Autostart", 112 | submenu = true, 113 | kind = "action", 114 | handler = root 115 | }); 116 | -------------------------------------------------------------------------------- /durden/tools/flair/background.lua: -------------------------------------------------------------------------------- 1 | -- effects intended for the background layer, so will substitute into 2 | -- the workspace wallpaper or lockscreen background, e.g. rain drops 3 | return {}; 4 | -------------------------------------------------------------------------------- /durden/tools/flair/create.lua: -------------------------------------------------------------------------------- 1 | return {}; 2 | -------------------------------------------------------------------------------- /durden/tools/flair/display.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- display- global effects 3 | -- 4 | -- these are treated as either a freestanding effect that exist in the same 5 | -- attachment as the targeted display, or as a last- stage compositing effect 6 | -- that goes with the rt. The latter case is a singleton due to its cost and 7 | -- the problem that its output becomes the display rendertarget input source 8 | -- for last stage colorization etc. shader. 9 | -- 10 | -- this is activated per display in order to have displays where this is not 11 | -- enabled, e.g. a HMD or presentation projector. 12 | -- 13 | 14 | local snow_rules, snow_opts = 15 | system_load("tools/flair/display/snow.lua", false)(); 16 | 17 | local confetti_rules, confetti_opts = 18 | system_load("tools/flair/display/confetti.lua", false)(); 19 | 20 | return { 21 | { 22 | name = "snow", 23 | label = "Snow", 24 | description = "Snow Simulator", 25 | create = function(disp, ...) 26 | return flair_supp_psys("snow", snow_rules, snow_opts); 27 | end 28 | }, 29 | { 30 | name = "confetti", 31 | label = "Confetti", 32 | description = "Confetti", 33 | create = function(disp, ...) 34 | return flair_supp_psys("confetti", confetti_rules, confetti_opts); 35 | end 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /durden/tools/flair/display/snow.lua: -------------------------------------------------------------------------------- 1 | -- simple particle rules modelling snow 2 | -- 3 | -- none of the fun stuff yet (force-field wind motion matching cursor movement) 4 | -- or collision-detection / response (merge/accumulate on surfaces) 5 | -- 6 | local white = fill_surface(4, 4, 255, 255, 255); 7 | local ht = {}; 8 | 9 | local function snow_create(state, system) 10 | image_sharestorage(white, state.vid); 11 | blend_image(state.vid, 0.5 + 0.5 * math.random()); 12 | rotate_image(state.vid, math.random(0, 359)); 13 | state.velocity_x = 0; 14 | state.velocity_y = 0; 15 | local props = image_surface_properties(state.vid); 16 | state.mass = props.width * props.height; 17 | state.acceleration_x = 0; 18 | state.acceleration_y = math.random() * 2; 19 | state.force_x = 0; 20 | state.force_y = 0; 21 | end 22 | 23 | local function snow_update(state, system) 24 | if (state.fixed) then 25 | return; 26 | end 27 | nudge_image(state.vid, state.velocity_x, state.velocity_y, 1); 28 | state.velocity_x = state.velocity_x + state.acceleration_x + system.force_x; 29 | state.velocity_y = state.velocity_y + state.acceleration_y + system.force_y; 30 | return image_surface_properties(state.vid).y < system.display.height; 31 | end 32 | 33 | local step_sz = 2 * 3.1457 / 360.0; 34 | local counter = 0; 35 | 36 | -- vary the global wind 37 | local function snow_step(system) 38 | counter = (counter + 0.01) % 360; 39 | system.force_x = math.pow(math.sin(counter * step_sz) * 0.5 + 0.5, 4); 40 | system.force_y = math.abs(math.sin(counter * step_sz)) * 0.05; 41 | return true; 42 | end 43 | 44 | local function snow_expire(state) 45 | delete_image(state.vid); 46 | end 47 | 48 | return { 49 | create = snow_create, 50 | update = snow_update, 51 | expire = snow_expire, 52 | step = snow_step, 53 | collision_model = "full" 54 | }; 55 | -------------------------------------------------------------------------------- /durden/tools/flair/drag.lua: -------------------------------------------------------------------------------- 1 | local effects = {}; 2 | local cloth = system_load("tools/flair/cloth.lua")(); 3 | if (cloth) then 4 | table.insert(effects, cloth); 5 | end 6 | 7 | return effects; 8 | -------------------------------------------------------------------------------- /durden/tools/flair/hide.lua: -------------------------------------------------------------------------------- 1 | local function scale_effect(wm, wnd, x, y, w, h, hide) 2 | local dx, dy, dw, dh, dopa; 3 | dx = x; dy = y; dw = w; dh = h; dopa = 0.0; 4 | 5 | if (not hide) then 6 | local props = image_surface_resolve(wnd.canvas); 7 | dx = props.x; 8 | dy = props.y; 9 | dw = props.width; 10 | dh = props.height; 11 | dopa = 1.0; 12 | else 13 | wnd:hide(); 14 | end 15 | 16 | local vid = flair_supp_clone(wnd); 17 | local tv = gconfig_get("flair_speed"); 18 | if (valid_vid(vid)) then 19 | if (not hide) then 20 | move_image(vid, x, y); 21 | resize_image(vid, w, h); 22 | blend_image(vid, dopa, tv); 23 | tag_image_transform(vid, MASK_OPACITY, 24 | function() 25 | wnd:show(); 26 | end); 27 | else 28 | blend_image(vid, dopa, tv); 29 | end 30 | move_image(vid, dx, dy, tv, hide and INTERP_EXPOUT or nil); 31 | resize_image(vid, dw, dh, tv, hide and INTERP_EXPOUT or nil); 32 | else 33 | wnd:show(); 34 | end 35 | end 36 | 37 | return { 38 | scale = scale_effect 39 | }; 40 | -------------------------------------------------------------------------------- /durden/tools/flair/select.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | return { 4 | flash = function(wm, wnd, space, space_active, popup) 5 | if (popup or not space_active or wm ~= active_display()) then 6 | return; 7 | end 8 | 9 | -- this might be a bit icky if the window also animate resize, we don't 10 | -- have a reliable mechanism to say (match parent size), though we should. 11 | local cw = image_surface_resolve(wnd.canvas); 12 | local surface = color_surface(1, 1, 255, 255, 255); 13 | if not valid_vid(surface) then 14 | return; 15 | end 16 | 17 | link_image(surface, wnd.canvas, ANCHOR_UL, ANCHOR_SCALE_WH); 18 | image_inherit_order(surface, true); 19 | image_mask_set(surface, MASK_UNPICKABLE); 20 | 21 | -- cover popups, subsurfaces and other crap 22 | order_image(surface, 9); 23 | blend_image(surface, 0.5, 5); 24 | blend_image(surface, 0.0, 5); 25 | expire_image(surface, 10); 26 | end, 27 | shake = function(wm, wnd, space, space_active, popup) 28 | if not space_active or wm ~= active_display() then 29 | return; 30 | end 31 | for i=1,2 do 32 | local dx = math.random(5, 10); 33 | local dy = math.random(5, 10); 34 | move_image(wnd.anchor, wnd.x + dx, wnd.y + dy, 1); 35 | move_image(wnd.anchor, wnd.x - dx, wnd.y - dy, 1); 36 | end 37 | move_image(wnd.anchor, wnd.x, wnd.y, 1); 38 | end 39 | }; 40 | -------------------------------------------------------------------------------- /durden/tools/popup.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- menu- popup tool 3 | -- 4 | -- this is simply to allow user- bindable / scriptable controls to use 5 | -- the uiprim/popup and the corresponding uimap/popup to glue together 6 | -- user customizable popup menus, real implementation is thus in the 7 | -- other scripts mentioned. 8 | -- 9 | local log, fmt = suppl_add_logfn("tools"); 10 | local mpos = mouse_xy; 11 | 12 | local function popup(path, x, y) 13 | local menu = menu_resolve(path); 14 | if not menu then 15 | log(fmt("tool=popup:kind=error:message=couldn't resolve:path=%s", path)); 16 | return; 17 | end 18 | 19 | -- convert single entry resolve 20 | if (type(menu[1]) ~= "table") then 21 | menu = {menu}; 22 | end 23 | 24 | log(fmt("tool=popup:kind=spawn:x=%d:y=%d:entries=%d", x, y, #menu)); 25 | uimap_popup(menu, x, y); 26 | end 27 | 28 | local popup_positions = { 29 | { 30 | kind = "cursor", 31 | label = "Cursor", 32 | kind = "action", 33 | description = "Spawn new popups at the current mouse cursor", 34 | handler = function() 35 | mpos = mouse_xy; 36 | end, 37 | }, 38 | { 39 | kind = "position", 40 | label = "Position", 41 | kind = "value", 42 | hint = "(normalised: 0..1 0..1)", 43 | validator = suppl_valid_typestr("ff", 0, 1, 0), 44 | description = "Spawn new popups at a fixed position on the current screen", 45 | handler = function(val) 46 | local tbl = suppl_unpack_typestr("ff", 0, 1, 0); 47 | if not tbl then 48 | return; 49 | end 50 | local x = tbl[1]; 51 | local y = tbl[2]; 52 | mpos = function() 53 | local ad = active_display(); 54 | return math.floor(ad.max_w * x), math.floor(ad.max_h * y); 55 | end 56 | end 57 | } 58 | }; 59 | 60 | local popup_menu = { 61 | { 62 | name = "position", 63 | label = "Position", 64 | kind = "action", 65 | submenu = true, 66 | handler = popup_positions 67 | }, 68 | { 69 | name = "menu", 70 | kind = "value", 71 | label = "Menu", 72 | description = "Spawn a popup for the specified menu path", 73 | hint = "(/path/to/elem)", 74 | validator = function(val) 75 | return val and #val > 0; 76 | end, 77 | handler = function(ctx, val) 78 | local x, y = mpos(); 79 | popup(val, x, y); 80 | end, 81 | }, 82 | }; 83 | 84 | menus_register("global", "tools", 85 | { 86 | name = "popup", 87 | label = "Popup", 88 | kind = "action", 89 | submenu = true, 90 | description = "Popup- spawning related controls", 91 | handler = popup_menu 92 | }); 93 | -------------------------------------------------------------------------------- /durden/tools/scroll.lua: -------------------------------------------------------------------------------- 1 | local shader = 2 | [[ 3 | uniform float radius; 4 | uniform float inner_radius; 5 | varying vec2 texco; 6 | 7 | uniform vec2 current; 8 | uniform vec2 pending; 9 | 10 | uniform vec3 cur_col; 11 | uniform vec3 pnd_col; 12 | uniform vec3 obj_col; 13 | uniform bool filled; 14 | 15 | void main() 16 | { 17 | vec2 range = texco * 2.0 - vec2(1.0); 18 | float lrange = length(range); 19 | 20 | float vis = lrange - radius; 21 | float vis2 = lrange - inner_radius; 22 | 23 | /* can do without fwidth? just smoothstep(length, 0.0, 0.9) / blur_radius, 24 | to get a drop shadow we could mix another length on a displaced UV and 25 | mix with the colored circle */ 26 | 27 | float step = fwidth(vis); 28 | vis = smoothstep(step, -step, vis); 29 | float ang = atan(range.t, range.s) + 3.1457; 30 | 31 | step = fwidth(vis2); 32 | vis2 = smoothstep(step, -step, vis2); 33 | 34 | bool outer = (vis > 0.0 && vis2 > 0.0); 35 | outer = (filled && !outer) || (!filled && outer); 36 | 37 | vec3 col = obj_col; 38 | if (ang >= current.s && ang <= current.t) 39 | col = cur_col; 40 | else if (ang >= pending.s && ang <= pending.t) 41 | col = pnd_col; 42 | 43 | gl_FragColor = vec4(mix(col.rgb, obj_col, float(outer)), vis); 44 | } 45 | ]] 46 | 47 | local shid 48 | local function setup_shader() 49 | shid = build_shader(nil, shader, "round") 50 | shader_uniform(shid, "radius", "f", 1.0) 51 | shader_uniform(shid, "inner_radius", "f", 0.9) 52 | shader_uniform(shid, "pnd_col", "fff", 1.0, 1.0, 1.0) 53 | shader_uniform(shid, "cur_col", "fff", 0.0, 1.0, 1.0) 54 | shader_uniform(shid, "obj_col", "fff", 0.3, 0.0, 0.0) 55 | shader_uniform(shid, "current", "ff", 0.0, 0.1) 56 | shader_uniform(shid, "pending", "ff", 0.1, 0.1) 57 | shader_uniform(shid, "filled", "b", true) 58 | shader_uniform(shid, "current", "ff", 0, 3.14) 59 | end 60 | 61 | local function show_circle(wnd) 62 | local x, y = mouse_xy() 63 | if not shid then 64 | setup_shader() 65 | end 66 | 67 | local button = color_surface(64, 64, 0, 255, 0) 68 | image_shader(button, shid) 69 | move_image(button, x, y) 70 | image_mask_set(button, MASK_UNPICKABLE) 71 | 72 | local capture = color_surface(wnd.wm.width, wnd.wm.height, 255, 0, 0) 73 | link_image(capture, wnd.wm.order_anchor) 74 | link_image(button, capture) 75 | show_image({capture, button}) 76 | 77 | image_inherit_order(capture, true) 78 | image_inherit_order(button, true) 79 | 80 | -- MOUSE_WHEELPY, WHEELNY 81 | local bgmh 82 | bgmh = { 83 | name = "wheel_capture", 84 | button = function(ctx, vid, ind, pressed, x, y) 85 | if ind ~= MOUSE_WHEELPY and ind ~= MOUSE_WHEELNY then 86 | mouse_droplistener(bgmh) 87 | blend_image(button, gconfig_get("animation")) 88 | expire_image(capture, gconfig_get("animation")) 89 | end 90 | print(x, y, ind) 91 | end, 92 | own = function(ctx, vid) 93 | return vid == capture 94 | end 95 | } 96 | 97 | mouse_addlistener(bgmh) 98 | order_image(button, 1) 99 | end 100 | 101 | menus_register("target", "input", { 102 | label = "Scroll Circle", 103 | description = "Popup a scroll circle at the cursor position", 104 | name = "scroll_circle", 105 | kind = "action", 106 | eval = function() 107 | return active_display().selected.got_scroll ~= nil 108 | end, 109 | handler = function() 110 | show_circle(active_display().selected) 111 | end 112 | }) 113 | -------------------------------------------------------------------------------- /durden/uiprim/uiprim.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2016-2019, Björn Ståhl 2 | -- License: 3-Clause BSD 3 | -- Reference: http://durden.arcan-fe.com 4 | -- Description: loader and namespace wrapper 5 | 6 | system_load("uiprim/lbar.lua")(); 7 | system_load("uiprim/bbar.lua")(); 8 | system_load("uiprim/buttongrid.lua")(); 9 | system_load("uiprim/bar.lua")(); 10 | uiprim_icon_spawn = system_load("uiprim/icons.lua")(); 11 | uiprim_popup_spawn = system_load("uiprim/popup.lua")(); 12 | -------------------------------------------------------------------------------- /durden/whitelist.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- populate res with key = true entries where key corresponds to a valid 3 | -- function or target / menu path that should be accesible for binding via the 4 | -- status-bar %{A format or through the control pipe channel. 5 | -- 6 | -- for value path binding e.g. #path/to/somewhere=val, strip the =val part as 7 | -- it is the path that will be evaluated, the normal validator for the path 8 | -- will still be applied for [val] 9 | -- 10 | local res = { 11 | input_lock_on = true, 12 | input_lock_off = true, 13 | input_lock_toggle = true 14 | }; 15 | 16 | return res; 17 | -------------------------------------------------------------------------------- /durden/widgets/ascii.lua: -------------------------------------------------------------------------------- 1 | -- simple "normal" ascii helper for binding UTF-8 sequences just replicate this 2 | -- with different name and file to get another, with more extended values .. 3 | local tsupp = system_load("widgets/support/text.lua")(); 4 | 5 | local tbl = { 6 | {"(20)", "\" \""} 7 | }; 8 | 9 | for i=0x21,0x7e do 10 | table.insert(tbl, {string.format("(%.2x) ", i), string.char(i)}); 11 | end 12 | 13 | for i=0xa0,0xbf do 14 | table.insert(tbl, {string.format("(c2 %.2x) ", i), 15 | string.char(0xc2)..string.char(i)}); 16 | end 17 | 18 | for i=0x80,0xbf do 19 | table.insert(tbl, {string.format("(c3 %.2x) ", i), 20 | string.char(0xc3)..string.char(i)}); 21 | end 22 | 23 | local function on_click(ctx, lbl, i) 24 | lbl = lbl[1]; 25 | local start = string.find(lbl, "%("); 26 | if (not start) then 27 | return; 28 | end 29 | local stop = string.find(lbl, "%)"); 30 | if (not stop or stop + 1 <= start - 1) then 31 | return; 32 | end 33 | local seq = string.sub(lbl, start + 1, stop - 1); 34 | local lbar = tiler_lbar_isactive(true); 35 | if (not lbar) then 36 | return; 37 | end 38 | lbar.inp:set_str(seq); 39 | end 40 | 41 | local function probe(ctx, yh) 42 | return tsupp.setup(ctx, {tbl}, yh, on_click, nil); 43 | end 44 | 45 | local function show(ctx, anchor, ofs) 46 | return tsupp.show(ctx, anchor, 47 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 48 | end 49 | 50 | local function destroy(ctx) 51 | return tsupp.destroy(ctx); 52 | end 53 | 54 | return { 55 | name = "ascii", -- user identifiable string 56 | paths = {"special:u8"}, 57 | show = show, 58 | probe = probe, 59 | destroy = destroy 60 | }; 61 | -------------------------------------------------------------------------------- /durden/widgets/bindings.lua: -------------------------------------------------------------------------------- 1 | -- simple "normal" ascii helper for binding UTF-8 sequences just replicate this 2 | -- with different name and file to get another, with more extended values .. 3 | local tsupp = system_load("widgets/support/text.lua")(); 4 | 5 | local function probe(ctx, yh) 6 | local lst = dispatch_list(); 7 | -- group based on meta key presses 8 | local m1g = {}; 9 | local m2g = {}; 10 | local m1m2g = {}; 11 | local miscg = {}; 12 | 13 | for k,v in ipairs(lst) do 14 | if (string.match(v, "m1_m2")) then 15 | table.insert(m1m2g, v); 16 | elseif (string.match(v, "m1_")) then 17 | table.insert(m1g, v); 18 | elseif (string.match(v, "m2_")) then 19 | table.insert(m2g, v); 20 | else 21 | table.insert(miscg, v); 22 | end 23 | end 24 | 25 | return tsupp.setup(ctx, {m1g, m2g, m1m2g, miscg}, yh); 26 | end 27 | 28 | local function show(ctx, anchor, ofs) 29 | return tsupp.show(ctx, anchor, 30 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 31 | end 32 | 33 | local function destroy(ctx) 34 | return tsupp.destroy(ctx); 35 | end 36 | 37 | return { 38 | name = "bindings", 39 | paths = {"special:custom", "/global/input/bind"}, 40 | show = show, 41 | probe = probe, 42 | destroy = destroy 43 | }; 44 | -------------------------------------------------------------------------------- /durden/widgets/cheatsheet.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Simple "cheat sheet" helper that, based on vim titlebar 3 | -- ident content tries to load the approriate cheat sheet(s) 4 | -- 5 | -- should also allow clickable "force spawn new?" 6 | -- 7 | 8 | local tsupp = system_load("widgets/support/text.lua")(); 9 | local log, fmt = suppl_add_logfn("tools"); 10 | local sheets = {}; 11 | 12 | local function reglob() 13 | local lst = glob_resource("widgets/cheatsheets/*.txt"); 14 | for k,v in ipairs(lst) do 15 | if (sheets[v] == nil) then 16 | -- open_rawresource, read up to n lines and add to sheets, blocking 17 | local lines = {}; 18 | if (open_rawresource("widgets/cheatsheets/" .. v)) then 19 | local line, ok; 20 | repeat 21 | line, ok = read_rawresource(); 22 | if (line) then 23 | table.insert(lines, line); 24 | end 25 | until(#lines > 256 or not ok); 26 | close_rawresource(); 27 | end 28 | if (#lines > 1) then 29 | sheets[v] = lines; 30 | log(fmt("tool=widget-cheatsheet:kind=status:name=%s:lines=%d", v, #lines)) 31 | end 32 | end 33 | end 34 | end 35 | 36 | local function probe(ctx, yh, sheetset) 37 | return tsupp.setup(ctx, sheetset, yh); 38 | end 39 | 40 | local function show(ctx, anchor, ofs) 41 | return tsupp.show(ctx, anchor, 42 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 43 | end 44 | 45 | local function destroy(ctx) 46 | return tsupp.destroy(ctx); 47 | end 48 | 49 | local function ident(ctx, pathid) 50 | local wnd = active_display().selected; 51 | if (pathid ~= "/target" or not wnd or not wnd.ident or not wnd.prefix) then 52 | return false; 53 | end 54 | 55 | ctx.sheetset = {}; 56 | local strset = {}; 57 | if (#wnd.ident > 0) then 58 | table.insert(strset, wnd.ident); 59 | end 60 | if (#wnd.prefix > 0) then 61 | table.insert(strset, wnd.prefix); 62 | end 63 | 64 | -- each sheet can apply either always or pattern match on set of windows tags 65 | local sheetset = {}; 66 | for k,v in pairs(sheets) do 67 | if (v[1] == "*") then 68 | table.insert(sheetset, v); 69 | else 70 | for i,j in ipairs(strset) do 71 | if string.match(j, v[1]) then 72 | table.insert(sheetset, v); 73 | break; 74 | end 75 | end 76 | end 77 | end 78 | 79 | return #sheetset > 0 and sheetset or nil; 80 | end 81 | 82 | reglob(); 83 | 84 | return { 85 | name = "cheatsheet", 86 | paths = {ident}, 87 | show = show, 88 | probe = probe, 89 | destroy = destroy 90 | }; 91 | -------------------------------------------------------------------------------- /durden/widgets/cheatsheets/gdb.txt: -------------------------------------------------------------------------------- 1 | ^gdb 2 | ---- Stopping ---- 3 | clear -- delete all bkpts 4 | b [file:func] 5 | cond [expr] 6 | delete 7 | catch ev -- throw, exec, fork 8 | watch 9 | handle sig act -- [no][stop,print,pass] 10 | 11 | ---- Stepping ---- 12 | n/ni [count] -- next/next instr. 13 | until [loc] -- continue until 14 | finish -- until frame return 15 | return [expr] 16 | signal num -- send signal n. 17 | jump [line][*addr] -- set PC 18 | 19 | ---- Stack ---- 20 | bt up/down [n] -- backtrace 21 | info args|locals|reg|all-reg 22 | 23 | ---- Execution ---- 24 | run 25 | tty dev -- for stdin/stdout 26 | kill 27 | [set,show] args 28 | set env var str 29 | unset env var 30 | show env var 31 | 32 | ---- Data ---- 33 | p expr -- eval. expr 34 | set var=expr 35 | ptype type 36 | display [/f] expr -- expr on stop 37 | info signals 38 | disassemble 39 | X/sz[Nuf] [Nuf: b(1), h(2), w(4), g(8) 40 | 41 | ---- Symbols ---- 42 | info addr s 43 | info func [regex] 44 | info var [regex] -- globals 45 | 46 | ---- Special ---- 47 | target [pid],[host],[file] 48 | set follow-fork-mode child 49 | set follow-exec-mode new 50 | 51 | --- Function Tracing ---- 52 | set logging on 53 | set confirm off 54 | rbreak . 55 | OR (intel) record btrace 56 | -------------------------------------------------------------------------------- /durden/widgets/cheatsheets/lldb.txt: -------------------------------------------------------------------------------- 1 | ^lldb 2 | ---- Stopping ---- 3 | clear -- delete all bkpts 4 | br s [--method -M] [name] 5 | br s [--file fn --line n] 6 | br del 7 | wa s v name 8 | wa s e -- 9 | 10 | ---- Stepping ---- 11 | n/ni [count] -- next/next instr. 12 | thread until [loc] -- continue until 13 | finish -- until frame return 14 | thread return [expr] 15 | thread jump [addr] 16 | pro hand [-p,-n,-s bool] signal 17 | register write pc '$pc+8' 18 | 19 | ---- Stack ---- 20 | frame variable --no-args (fr v -a) 21 | target variable var (fr v -f x var) 22 | thread backtrace (bt) 23 | frame select num (fr s num) 24 | frame select --relative num (fr s -rnum) 25 | 26 | ---- Execution ---- 27 | process launch -- < args > 28 | process launch --tty=dev -- 29 | target create fn 30 | target create --core corefile 31 | kill 32 | settings show target.run-args 33 | settings [set,rem,show] target.env-vars var 34 | 35 | ---- Data ---- 36 | expr (int) printf("expr %d", 4+5) 37 | print (int) printf("expr %d", 4+5) 38 | expr (unsigned int) $var = expr; 39 | disassemble --frame 40 | x/sz [Nuf] expr [Nuf: b(1), h(2), w(4), g(8)] 41 | 42 | ---- Thread ---- 43 | thread list threads 44 | thread num 45 | thread apply all bt 46 | 47 | ---- Symbols ---- 48 | registers read 49 | registers read --format binary rax 50 | memory read 51 | 52 | ---- Special ---- 53 | gdb-remote [host:port] 54 | process attach [--waitfor] [--name or --pid] val 55 | target stop-hook add 56 | memory read outfile startaddr endaddr 57 | -------------------------------------------------------------------------------- /durden/widgets/cheatsheets/lua-ptn.txt: -------------------------------------------------------------------------------- 1 | .+%.lua 2 | ---- Patterns ---- 3 | . all characters 4 | + (1) * (0) - (0+) ? (0 or 1) 5 | %a letters 6 | %c control characters 7 | %d digits 8 | %l lower case letters 9 | %p punctuation characters 10 | %s space characters 11 | %u upper case letters 12 | %w alphanumeric characters 13 | %x hexadecimal digits 14 | %z NUL- character 15 | %% match % 16 | [] define charset 17 | upcase %(SLP,..) negate 18 | 19 | ---- string. ---- 20 | byte(s, [, i [, j]]) -- string to num-code 21 | char(...) -- num-code to string 22 | find(s, ptn [, init [, plain]]) 23 | format(fmtstr, ...) -- %q for lua-str esc. 24 | gmatch(s, ptn) -> iter for ptn 25 | gsub(s, ptn, repl [, n]) 26 | len, lower, upper, reverse 27 | rep(s, n) 28 | sub(s, i [, j]) 29 | 30 | ---- math. ---- 31 | acos, asin, atan, atan2(y, x) 32 | cos [h], sin [h], ang, deg, rad 33 | ceil, floor, fmod(x, y), modf(x) 34 | pow, exp, frexp, ldexp, log, log10 35 | max(x, ...), min(x, ...) 36 | abs, sqrt, 37 | pi, huge, random, randomseed 38 | 39 | ---- table. ---- 40 | insert(tbl, [pos, ], val) 41 | maxn(tbl) -- largest > 0 numind) 42 | remove(tbl, [, pos]) 43 | concat(tbl, [, sep [, i [, j]]]) 44 | sort(tbl, [, comp]) -- comp:fn ret bool 45 | 46 | ---- os. ---- 47 | clock (CPU time consumed) 48 | difftime(t1, t2) 49 | time([tbl]) 50 | 51 | ---- () ---- 52 | ipairs, next(tbl, [, ind]), pairs 53 | assert, error 54 | pcall(f, arg1, ...) -- bool, retvs 55 | select(ind, fcall) -- for multret 56 | type, tonumber, tostring 57 | -------------------------------------------------------------------------------- /durden/widgets/helper.lua: -------------------------------------------------------------------------------- 1 | -- Just a quick way to show a simple helper message when the menu is used for 2 | -- other purposes, e.g. binding. Add any context detection to 'paths' and then 3 | -- populate the messages in probe. 4 | 5 | local tsupp = system_load("widgets/support/text.lua")(); 6 | 7 | local function probe(ctx, yh) 8 | local lines = {}; 9 | 10 | -- can either be a string or a table of strings 11 | local msg = dispatch_user_message() 12 | if msg then 13 | if type(msg) == "table" then 14 | for _,v in ipairs(table) do 15 | if type(v) == "string" then 16 | table.insert(lines, msg) 17 | end 18 | end 19 | elseif type(msg) == "string" then 20 | table.insert(lines, msg) 21 | end 22 | end 23 | return tsupp.setup(ctx, {lines}, yh); 24 | end 25 | 26 | local function show(ctx, anchor, ofs) 27 | return tsupp.show(ctx, anchor, 28 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 29 | end 30 | 31 | local function destroy(ctx) 32 | tsupp.destroy(ctx); 33 | end 34 | 35 | return { 36 | name = "texthelper", 37 | paths = { 38 | function(ctx, pathid) 39 | return dispatch_user_message() ~= nil 40 | end 41 | }, 42 | show = show, 43 | probe = probe, 44 | destroy = destroy 45 | }; 46 | -------------------------------------------------------------------------------- /durden/widgets/icons.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- One 'large group' of icons to pick from, populated using the known glyphs 3 | -- when the icon:ref subset gets finished, it too will be used here as a helper 4 | -- for the inputs that can take advantage of icon references - such as adding 5 | -- statusbar and titlebar icons. 6 | -- 7 | -- This is primarily a quick conveniece as it makes too many assumptions and 8 | -- has rather poor performance - and thus only activate on the 'rare but can 9 | -- be allowed to cost' config of UI icons as we don't have a decent asynch 10 | -- way of generating the slices at the moment. 11 | -- 12 | -- The intermediate fix is to simply cache the groups and invalidate on yh 13 | -- changes, will cost a few MB of memory but prevent second-long stalls 14 | -- each and every time 15 | -- 16 | 17 | local tsupp = system_load("widgets/support/text.lua")(); 18 | local tbl = system_load("widgets/support/unicode_data.lua")(); 19 | 20 | for i,v in ipairs(tbl) do 21 | tbl[i] = { 22 | "(" .. tbl[i] .. ") ", 23 | string.to_u8(v) 24 | }; 25 | end 26 | 27 | local function on_click(ctx, lbl, i) 28 | lbl = lbl[1]; 29 | local start = string.find(lbl, "%("); 30 | if (not start) then 31 | return; 32 | end 33 | local stop = string.find(lbl, "%)"); 34 | if (not stop or stop + 1 <= start - 1) then 35 | return; 36 | end 37 | local seq = string.sub(lbl, start + 1, stop - 1); 38 | local lbar = tiler_lbar_isactive(true); 39 | if (not lbar) then 40 | return; 41 | end 42 | lbar.inp:set_str("0x_" .. seq); 43 | end 44 | 45 | local function probe(ctx, yh) 46 | return tsupp.setup(ctx, {tbl}, yh, on_click); 47 | end 48 | 49 | local function show(ctx, anchor, ofs) 50 | return tsupp.show(ctx, anchor, 51 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 52 | end 53 | 54 | local function destroy(ctx) 55 | return tsupp.destroy(ctx); 56 | end 57 | 58 | return { 59 | name = "unicode", -- user identifiable string 60 | paths = { 61 | "special:icon" 62 | }, 63 | show = show, 64 | probe = probe, 65 | destroy = destroy 66 | }; 67 | -------------------------------------------------------------------------------- /durden/widgets/labels.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- label helper that shows the currently exposed labels, 3 | -- current / default bindings and allow you to directly 4 | -- input them by clicking 5 | -- 6 | 7 | local tsupp = system_load("widgets/support/text.lua")(); 8 | 9 | local function send_input(dst, lbl) 10 | local iotbl = { 11 | kind = "digital", 12 | label = lbl, 13 | translated = true, 14 | active = true, 15 | devid = 8, 16 | subid = 8 17 | }; 18 | 19 | dst:input_table(iotbl); 20 | iotbl.active = false; 21 | dst:input_table(iotbl); 22 | end 23 | 24 | -- this click handler 25 | local function on_click(ctx, lbl, i) 26 | local wnd = active_display().selected; 27 | lbl = table.find_key_i(wnd.input_labels, "label", lbl); 28 | if (not lbl) then 29 | return; 30 | end 31 | 32 | send_input(wnd, wnd.input_labels[lbl].label); 33 | end 34 | 35 | local function on_motion(ctx, lbl, i) 36 | -- need to re-resolve as our list is sorted 37 | local wnd = active_display().selected; 38 | if (not wnd.input_labels) then 39 | return; 40 | end 41 | 42 | local lbar = tiler_lbar_isactive(true); 43 | if (not lbar) then 44 | return; 45 | end 46 | 47 | lbl = table.find_key_i(wnd.input_labels, "label", lbl); 48 | if (lbl) then 49 | lbl = wnd.input_labels[lbl].label; 50 | lbar:set_helper(lbl and lbl or ""); 51 | end 52 | end 53 | 54 | local function probe(ctx, yh) 55 | local wnd = active_display().selected; 56 | if (not wnd.input_labels or #wnd.input_labels == 0) then 57 | return 0; 58 | end 59 | 60 | -- preprocess / sort the list of known labels 61 | local linear = {}; 62 | for k,v in ipairs(wnd.input_labels) do 63 | if (#v.label > 0) then 64 | table.insert(linear, v.label); 65 | end 66 | end 67 | table.sort(linear, 68 | function(a, b) 69 | return a < b; 70 | end 71 | ); 72 | 73 | return tsupp.setup(ctx, {linear}, yh, on_click, on_motion); 74 | end 75 | 76 | -- show, called with an anchor and a group ofs / position 77 | local function show(ctx, anchor, ofs) 78 | return tsupp.show(ctx, anchor, 79 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 80 | end 81 | 82 | local function destroy(ctx) 83 | tsupp.destroy(ctx); 84 | end 85 | 86 | return { 87 | name = "labels", 88 | paths = {"/target/input"}, 89 | show = show, 90 | probe = probe, 91 | destroy = destroy 92 | }; 93 | -------------------------------------------------------------------------------- /durden/widgets/support/unicode_data.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "20 00 00 00", 3 | "23 00 00 00", 4 | "2a 00 00 00", 5 | "30 00 00 00", 6 | "31 00 00 00", 7 | "32 00 00 00", 8 | "33 00 00 00", 9 | "34 00 00 00", 10 | "35 00 00 00", 11 | "36 00 00 00", 12 | "37 00 00 00", 13 | "38 00 00 00", 14 | "39 00 00 00", 15 | "c2 a9 00 00", 16 | "c2 ae 00 00", 17 | "e2 80 8d 00", 18 | "e2 80 bc 00", 19 | "e2 81 89 00", 20 | "e2 83 a3 00", 21 | "e2 84 a2 00", 22 | "e2 84 b9 00", 23 | "e2 86 94 00", 24 | "e2 86 95 00", 25 | "e2 86 96 00", 26 | "e2 86 97 00", 27 | "e2 86 98 00", 28 | "e2 86 99 00", 29 | "e2 86 a9 00", 30 | "e2 86 aa 00", 31 | "e2 8c 9a 00", 32 | "e2 8c 9b 00", 33 | "e2 8c a8 00", 34 | "e2 8f 8f 00", 35 | "e2 8f a9 00", 36 | "e2 8f aa 00", 37 | "e2 8f ab 00", 38 | "e2 8f ac 00", 39 | "e2 8f ad 00", 40 | "e2 8f ae 00", 41 | "e2 8f af 00", 42 | "e2 8f b0 00", 43 | "e2 8f b1 00", 44 | "e2 8f b2 00", 45 | "e2 8f b3 00", 46 | "e2 8f b8 00", 47 | "e2 8f b9 00", 48 | "e2 8f ba 00", 49 | "e2 93 82 00", 50 | "e2 96 aa 00", 51 | "e2 96 ab 00", 52 | "e2 96 b6 00", 53 | "e2 97 80 00", 54 | "e2 97 bb 00", 55 | "e2 97 bc 00", 56 | "e2 97 bd 00", 57 | "e2 97 be 00", 58 | "e2 98 80 00", 59 | "e2 98 81 00", 60 | "e2 98 82 00", 61 | "e2 98 83 00", 62 | "e2 98 84 00", 63 | "e2 98 8e 00", 64 | "e2 98 91 00", 65 | "e2 98 94 00", 66 | "e2 98 95 00", 67 | "e2 98 98 00", 68 | "e2 98 9d 00", 69 | "e2 98 a0 00", 70 | "e2 98 a2 00", 71 | "e2 98 a3 00", 72 | "e2 98 a6 00", 73 | "e2 98 aa 00", 74 | "e2 98 ae 00", 75 | "e2 98 af 00", 76 | "e2 98 b8 00", 77 | "e2 98 b9 00", 78 | "e2 98 ba 00", 79 | "e2 99 88 00", 80 | "e2 99 89 00", 81 | "e2 99 8a 00", 82 | "e2 99 8b 00", 83 | "e2 99 8c 00", 84 | "e2 99 8d 00", 85 | "e2 99 8e 00", 86 | "e2 99 8f 00", 87 | "e2 99 90 00", 88 | "e2 99 91 00", 89 | "e2 99 92 00", 90 | "e2 99 93 00", 91 | "e2 99 a0 00", 92 | "e2 99 a3 00", 93 | "e2 99 a5 00", 94 | "e2 99 a6 00", 95 | "e2 99 a8 00", 96 | "e2 99 bb 00", 97 | "e2 99 bf 00", 98 | "e2 9a 92 00", 99 | "e2 9a 93 00", 100 | "e2 9a 94 00", 101 | "e2 9a 96 00", 102 | "e2 9a 97 00", 103 | "e2 9a 99 00", 104 | "e2 9a 9b 00", 105 | "e2 9a 9c 00", 106 | "e2 9a a0 00", 107 | "e2 9a a1 00", 108 | "e2 9a aa 00", 109 | "e2 9a ab 00", 110 | "e2 9a b0 00", 111 | "e2 9a b1 00", 112 | "e2 9a bd 00", 113 | "e2 9a be 00", 114 | "e2 9b 84 00", 115 | "e2 9b 85 00", 116 | "e2 9b 88 00", 117 | "e2 9b 8e 00", 118 | "e2 9b 8f 00", 119 | "e2 9b 91 00", 120 | "e2 9b 93 00", 121 | "e2 9b 94 00", 122 | "e2 9b a9 00", 123 | "e2 9b aa 00", 124 | "e2 9b b0 00", 125 | "e2 9b b1 00", 126 | "e2 9b b2 00", 127 | "e2 9b b3 00", 128 | "e2 9b b4 00", 129 | "e2 9b b5 00", 130 | "e2 9b b7 00", 131 | "e2 9b b8 00", 132 | "e2 9b b9 00", 133 | "e2 9b ba 00", 134 | "e2 9b bd 00", 135 | "e2 9c 82 00", 136 | "e2 9c 85 00", 137 | "e2 9c 88 00", 138 | "e2 9c 89 00", 139 | "e2 9c 8a 00", 140 | "e2 9c 8b 00", 141 | "e2 9c 8c 00", 142 | "e2 9c 8d 00", 143 | "e2 9c 8f 00", 144 | "e2 9c 92 00", 145 | "e2 9c 94 00", 146 | "e2 9c 96 00", 147 | "e2 9c 9d 00", 148 | "e2 9c a1 00", 149 | "e2 9c a8 00", 150 | "e2 9c b3 00", 151 | "e2 9c b4 00", 152 | "e2 9d 84 00", 153 | "e2 9d 87 00", 154 | "e2 9d 8c 00", 155 | "e2 9d 8e 00", 156 | "e2 9d 93 00", 157 | "e2 9d 94 00", 158 | "e2 9d 95 00", 159 | "e2 9d 97 00", 160 | "e2 9d a3 00", 161 | "e2 9d a4 00", 162 | "e2 9e 95 00", 163 | "e2 9e 96 00", 164 | "e2 9e 97 00", 165 | "e2 9e a1 00", 166 | "e2 9e b0 00", 167 | "e2 9e bf 00", 168 | "e2 a4 b4 00", 169 | "e2 a4 b5 00", 170 | "e2 ac 85 00", 171 | "e2 ac 86 00", 172 | "e2 ac 87 00", 173 | "e2 ac 9b 00", 174 | "e2 ac 9c 00", 175 | "e2 ad 90 00", 176 | "e2 ad 95 00", 177 | "e3 80 b0 00", 178 | "e3 80 bd 00", 179 | "e3 8a 97 00", 180 | "e3 8a 99 00", 181 | "ef b8 8f 00", 182 | "ef bf bf 00" 183 | }; 184 | -------------------------------------------------------------------------------- /durden/widgets/sysdbg.lua: -------------------------------------------------------------------------------- 1 | local tsupp = system_load("widgets/support/text.lua")(); 2 | 3 | local function probe(ctx, yh) 4 | local lines = {}; 5 | local wnd = active_display().selected; 6 | 7 | table.insert(lines, 8 | string.format("mouse-handlers : %d", mouse_handlercount())); 9 | 10 | local total, used = current_context_usage(); 11 | table.insert(lines, 12 | string.format("context-usage: %d / %d", used, total)); 13 | 14 | local iostate_dbg = iostatem_debug(); 15 | table.insert(lines, 16 | string.format("io-state: %s", iostate_dbg)); 17 | 18 | return tsupp.setup(ctx, {lines}, yh); 19 | end 20 | 21 | local function show(ctx, anchor, ofs) 22 | return tsupp.show(ctx, anchor, 23 | ctx.group_cache[ofs], 1, #ctx.group_cache[ofs], nil, ofs); 24 | end 25 | 26 | local function destroy(ctx) 27 | tsupp.destroy(ctx); 28 | end 29 | 30 | return { 31 | name = "sysdbg", 32 | paths = {function(ctx, pathid) 33 | if (pathid == "/global/system") then 34 | return DEBUGLEVEL > 0; 35 | end 36 | end}, 37 | show = show, 38 | probe = probe, 39 | destroy = destroy 40 | }; 41 | -------------------------------------------------------------------------------- /util/color_conv.lua: -------------------------------------------------------------------------------- 1 | -- This is a simple stand-alone script for converting json export output 2 | -- from https://terminal.sexy into color-schemes that can be used as part 3 | -- of target/video/color/schemes and global/settings/visual/colors/... 4 | 5 | local json = dofile('./json.lua') 6 | 7 | if not arg[1] or not arg[2] then 8 | error("use: color-in.json color-out.lua") 9 | end 10 | 11 | file = io.open(arg[1]) 12 | 13 | local inp = file:read("*all") 14 | local res = json.decode(inp) 15 | 16 | local rt = 17 | { 18 | "{}, -- primary", 19 | "{}, -- secondary", 20 | "{}, -- background", 21 | "{}, -- text", 22 | "{}, -- cursor", 23 | "{}, -- alt-cursor", 24 | "{}, -- highlight", 25 | "{}, -- label", 26 | "{}, -- warning", 27 | "{}, -- error", 28 | "{}, -- alert", 29 | "{}, -- reference", 30 | "{}, -- inactive", 31 | "{}, -- ui" 32 | } 33 | 34 | local term_i = 15 35 | local function getcol(v) 36 | local r = string.sub(v, 2, 3) 37 | local g = string.sub(v, 4, 5) 38 | local b = string.sub(v, 6, 7) 39 | return { 40 | tonumber(r, 16), 41 | tonumber(g, 16), 42 | tonumber(b, 16) 43 | } 44 | end 45 | 46 | -- 1..16 + foreground and background 47 | for k,v in pairs(res.color) do 48 | local col = getcol(v) 49 | table.insert(rt, string.format("{%d, %d, %d},", col[1], col[2], col[3])) 50 | end 51 | 52 | if res.foreground then 53 | local col = getcol(res.foreground) 54 | table.insert(rt, string.format("{%d, %d, %d},", col[1], col[2], col[3])) 55 | rt[1] = rt[#rt] 56 | 57 | if res.background then 58 | local col2 = getcol(res.background) 59 | table.insert(rt, string.format("{%d, %d, %d},", col2[1], col2[2], col2[3])) 60 | rt[3] = rt[#rt] 61 | rt[4] = string.format("{%d, %d, %d, %d, %d, %d},", 62 | col[1], col[2], col2[3], col2[1], col2[2], col2[3]) 63 | end 64 | end 65 | 66 | if res.cursor then 67 | local col = getcol(res.cursor) 68 | rt[5] = string.format("{%d, %d, %d},", col[1], col[2], col[3]) 69 | rt[6] = string.format("{%d, %d, %d},", 255 - col[1], 255 - col[2], 255 - col[3]) 70 | else 71 | rt[5] = rt[1] 72 | end 73 | 74 | -- auto-assign into labeled slots is worse, some base assumptions might be possible, 75 | -- e.g. error tends to be terminal 76 | -- 77 | -- 'red', warning terminal 'yellow', inactive 'dark-grey' and sanity check against 78 | -- fg/bg values. but might as well do this somewhere else 79 | -- 80 | -- label (8), warning (9), error (10), alert (11), ref (12), inactive (13), ui (14) 81 | -- 82 | local out = io.output(arg[2]) 83 | 84 | if res.name then 85 | out:write("-- scheme: " .. res.name .. "\n") 86 | end 87 | 88 | if res.author then 89 | out:write("-- by: " .. res.author .. "\n") 90 | end 91 | 92 | out:write("return {\n") 93 | 94 | for _,v in ipairs(rt) do 95 | out:write(v .. "\n") 96 | end 97 | 98 | out:write("}") 99 | out:close() 100 | --------------------------------------------------------------------------------