From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13603 invoked from network); 4 Jun 2021 18:49:17 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 4 Jun 2021 18:49:17 -0000 Received: from mail-ed1-f44.google.com ([209.85.208.44]) by 1ess; Fri Jun 4 14:28:04 -0400 2021 Received: by mail-ed1-f44.google.com with SMTP id b11so12222871edy.4 for <9front@9front.org>; Fri, 04 Jun 2021 11:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=XJDNdolbJbxOKliqPtrFNQx1XnoYixoJ3ChzjYxRX2o=; b=KPrjCFlTLV6Fj/CXFBXOJnpWpIBtbkL6h7n9a3RSFvX5uLszQWrbJMBihN0nwgFS5B nFre/vWFMDRBfRqv5R3rQ3n8sUt9m6HcBzZFeA4pZI3wkrzuNi1gjd/9QuqII+bzWiOd BFroe3/IIjj/0bKItL7LXPdvEumkbTEeTyY7OnlPFNxEugfI1XmDoe50p+eXSojUHkau p+EBwyUFIfru9+NxlspDOBt9nNod2kYvV48HZVgEdV0pGUZiBP+B34S3FRDks0EBoZpN gLFLMMIqtvYSOlJXj7W15SAxxa8nkbD92xYWF8D3NH9vungiG2epybKGWwn36sza+zMF sa2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=XJDNdolbJbxOKliqPtrFNQx1XnoYixoJ3ChzjYxRX2o=; b=TzVuG/Ab+ze3fU4Xw7CQ/KdXwk5PVN2unQ5jAYxXYq66Kfc50rtNlInf06xBFPd4gF x7NYJImlViJkpNr9wNsc2RjguySjW4t46d2KP4HkUogQCe+uhGb31WVXdF51eV+aU9oH v0If8qWsT4jmV/4dFq6dTFIK4wp1gZDfgMtL9zQ9C7ZQ1+D4MzpP7izyY8Ra4COj04Dv W9u/m9wltGq6YE8VPoCOZqO6Uc5ubN3Gw28gNB2+sS4Z9i7dOb8Be3rjpmxTILhZBU+j wc0dIKz9AiKAIBJGcd/r0Cz/W6Pvb83jUGWHf2IrhWpk0bVqBu4FaSNqT3KxisgrU3rZ Cgiw== X-Gm-Message-State: AOAM532tp8QZD6jHkiZ2bUddWRXHnIWN3M5INie83wbRiKL7b+R4sQ50 4aKShfhWEbcYbN9NXW+w14feyZN1jGxHA2dfSYF9zzDet90= X-Google-Smtp-Source: ABdhPJzbtotWg08jkH7ZdSkndkLZ332Y5diKrH0xHC9lWNsI2SQoeDi/yX3F69KOhSj43IMdUY2dRDIW0L30eijojSo= X-Received: by 2002:aa7:dd0b:: with SMTP id i11mr6013092edv.51.1622830846501; Fri, 04 Jun 2021 11:20:46 -0700 (PDT) MIME-Version: 1.0 From: binary cat Date: Fri, 4 Jun 2021 14:20:28 -0400 Message-ID: To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: method realtime backend Subject: [9front] program to bind/rebind keys Reply-To: 9front@9front.org Precedence: bulk The program would operate by opening /dev/kbd, then binding its output to /dev/kbd. It would read a list of keybindings (from a file and/or command line options), then operate in a loop of reading a key from (the old) /dev/kbd, checking if it matches any of the bindings given to it. If it finds a match, it executes the action associated with it. Otherwise, it passes the keypress on. This could be used for global keyboard shortcuts by wrapping around rio, or for per-program keyboard shortcuts. `awk` is surprisingly close to working for this, but it has a few problems, both with reading input delimited by NUL instead of LF, and with non-printable characters in regular expressions. I'm up to provide a bounty for this, although first I'd like to have a rough idea of how difficult it would be to either write such a program, or to fix the problems with `awk`, so I know how much a reasonable bounty would be. -- binarycat