diff options
author | makefu <github@syntax-fehler.de> | 2021-03-19 09:17:48 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2021-03-19 09:17:48 +0100 |
commit | 8c28e9f4170d05e3e9dfb89985ce4f352cd91245 (patch) | |
tree | 82407d4e8454b3abfbb8288f8bc6765c64bf036b /tv | |
parent | 758660945c712b645e755e9101a9fd3d8a325c91 (diff) | |
parent | 3bbbc82ae9ab9f0ac737b2ff0b55b50ae9c77b8a (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv')
-rw-r--r-- | tv/2configs/gitrepos.nix | 6 | ||||
-rw-r--r-- | tv/2configs/hw/w110er.nix | 2 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/Paths.hs | 3 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs | 14 | ||||
-rw-r--r-- | tv/5pkgs/haskell/xmonad-tv/src/main.hs | 28 | ||||
-rw-r--r-- | tv/5pkgs/simple/mpvterm/default.nix | 8 | ||||
-rw-r--r-- | tv/5pkgs/simple/mpvterm/mpvterm.patch | 146 |
7 files changed, 200 insertions, 7 deletions
diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix index 5b6a70b27..2e73640ff 100644 --- a/tv/2configs/gitrepos.nix +++ b/tv/2configs/gitrepos.nix @@ -96,6 +96,8 @@ let { nix-writers = { cgit.desc = "collection of package builders"; }; + pager = { + }; populate = { cgit.desc = "source code installer"; }; @@ -113,7 +115,9 @@ let { ni = { }; } // mapAttrs (_: recursiveUpdate { cgit.section = "3. Haskell libraries"; }) { + X11-aeson = {}; blessings = {}; + hack = {}; hc = {}; mime = {}; quipper = {}; @@ -121,7 +125,9 @@ let { wai-middleware-time = {}; web-routes-wai-custom = {}; xintmap = {}; + xmonad-aeson = {}; xmonad-stockholm = {}; + xmonad-web = {}; } // mapAttrs (_: recursiveUpdate { cgit.section = "4. museum"; }) { cac-api = { cgit.desc = "CloudAtCost API command line interface"; diff --git a/tv/2configs/hw/w110er.nix b/tv/2configs/hw/w110er.nix index 693cef5ac..818d1aca6 100644 --- a/tv/2configs/hw/w110er.nix +++ b/tv/2configs/hw/w110er.nix @@ -28,6 +28,8 @@ with import <stockholm/lib>; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + hardware.enableRedistributableFirmware = true; + hardware.opengl.driSupport32Bit = true; hardware.opengl.extraPackages = [ pkgs.vaapiIntel ]; diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs b/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs index b2ad01ae7..2569b60c3 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs @@ -32,3 +32,6 @@ xcalib = findExecutable "xcalib" xdpychvt :: FilePath xdpychvt = findExecutable "xdpychvt" + +xterm :: FilePath +xterm = findExecutable "xterm" diff --git a/tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs b/tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs new file mode 100644 index 000000000..74222712d --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs @@ -0,0 +1,14 @@ +module XMonad.Extra where + +import XMonad +import qualified Data.Map as Map +import qualified XMonad.StackSet as W + + +isFloating :: Window -> WindowSet -> Bool +isFloating w = + Map.member w . W.floating + +isFloatingX :: Window -> X Bool +isFloatingX w = + isFloating w <$> gets windowset diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index e5a4473fe..48127a594 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -7,11 +7,12 @@ module Main (main) where import System.Exit (exitFailure) import Control.Exception -import Control.Monad.Extra (whenJustM) +import Control.Monad.Extra (ifM, whenJustM) import qualified Data.List import Graphics.X11.ExtraTypes.XF86 import Text.Read (readEither) import XMonad +import XMonad.Extra (isFloatingX) import System.IO (hPutStrLn, stderr) import System.Environment (getArgs, getEnv, getEnvironment, lookupEnv) import System.Posix.Process (executeFile) @@ -60,9 +61,8 @@ main = getArgs >>= \case args -> hPutStrLn stderr ("bad arguments: " <> show args) >> exitFailure -queryPrefix :: Query String -> String -> Query Bool -queryPrefix query prefix = - fmap (Data.List.isPrefixOf prefix) query +(=??) :: Query a -> (a -> Bool) -> Query Bool +(=??) x p = fmap p x mainNoArgs :: IO () @@ -88,7 +88,8 @@ mainNoArgs = do , manageHook = composeAll [ appName =? "fzmenu-urxvt" --> doCenterFloat - , appName `queryPrefix` "pinentry" --> doCenterFloat + , appName =?? Data.List.isPrefixOf "pinentry" --> doCenterFloat + , appName =?? Data.List.isInfixOf "Float" --> doCenterFloat , title =? "Upload to Imgur" --> doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8)) , placeHook (smart (1,0)) @@ -154,8 +155,8 @@ myKeys conf = Map.fromList $ , ((_S , xK_Menu ), gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.shift) ) , ((_C , xK_Menu ), toggleWS) - , ((_4 , xK_space ), sendMessage NextLayout) - , ((_4M , xK_space ), resetLayout) + , ((_4 , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ sendMessage NextLayout) + , ((_4M , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ resetLayout) , ((_4 , xK_m ), windows W.focusMaster) , ((_4 , xK_j ), windows W.focusDown) @@ -218,6 +219,19 @@ myKeys conf = Map.fromList $ def { XMonad.Prompt.font = myFont } +xdeny :: X () +xdeny = + forkFile + Paths.xterm + [ "-fn", myFont + , "-geometry", "300x100" + , "-name", "AlertFloat" + , "-bg", "#E4002B" + , "-e", "sleep", "0.05" + ] + Nothing + + pagerConfig :: PagerConfig pagerConfig = def { pc_font = myFont diff --git a/tv/5pkgs/simple/mpvterm/default.nix b/tv/5pkgs/simple/mpvterm/default.nix new file mode 100644 index 000000000..66ad08a78 --- /dev/null +++ b/tv/5pkgs/simple/mpvterm/default.nix @@ -0,0 +1,8 @@ +{ pkgs }: + +pkgs.mpv-unwrapped.overrideAttrs (old: rec { + pname = "mpvterm"; + patches = old.patches or [] ++ [ + ./mpvterm.patch + ]; +}) diff --git a/tv/5pkgs/simple/mpvterm/mpvterm.patch b/tv/5pkgs/simple/mpvterm/mpvterm.patch new file mode 100644 index 000000000..12636880d --- /dev/null +++ b/tv/5pkgs/simple/mpvterm/mpvterm.patch @@ -0,0 +1,146 @@ +commit 5ded4dac370ce5d8d727c5d3891448f942edbfdf +Author: tv <tv@krebsco.de> +Date: Sat Feb 27 22:54:55 2021 +0100 + + x11: add input forwarding support + +diff --git a/video/out/x11_common.c b/video/out/x11_common.c +index ac551fae8e..2e95451d7f 100644 +--- a/video/out/x11_common.c ++++ b/video/out/x11_common.c +@@ -25,6 +25,10 @@ + #include <string.h> + #include <assert.h> + ++#include <stdarg.h> ++#include <sys/socket.h> ++#include <sys/un.h> ++ + #include <X11/Xmd.h> + #include <X11/Xlib.h> + #include <X11/Xutil.h> +@@ -1097,6 +1101,73 @@ static void release_all_keys(struct vo *vo) + x11->win_drag_button1_down = false; + } + ++ ++#define FORWARD_START 1 ++#define FORWARD_READY 2 ++#define FORWARD_ERROR 3 ++static int forward_state = FORWARD_START; ++static int forward_fd, forward_len; ++static struct sockaddr_un forward_un; ++static char forward_buf[BUFSIZ]; ++ ++static void forward_start(void) { ++ const char *socket_path = getenv("FORWARD_SOCKET"); ++ if (socket_path == NULL) { ++ fprintf(stderr, "forward_start: environment variable FORWARD_SOCKET not set\n"); ++ forward_state = FORWARD_ERROR; ++ return; ++ } ++ ++ if ((forward_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { ++ perror("socket"); ++ } else { ++ memset(&forward_un, 0, sizeof(forward_un)); ++ forward_un.sun_family = AF_UNIX; ++ strcpy(forward_un.sun_path, socket_path); ++ forward_len = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); ++ forward_state = FORWARD_READY; ++ } ++} ++static void forward_send(const char *fmt, ...) { ++ if (forward_state != FORWARD_READY) return; ++ ++ va_list argp; ++ va_start(argp, fmt); ++ int n1 = vsnprintf(forward_buf, BUFSIZ, fmt, argp); ++ if (n1 < BUFSIZ + 1) { ++ forward_buf[n1++] = '\n'; ++ forward_buf[n1] = '\0'; ++ int n2 = sendto(forward_fd, forward_buf, n1, 0, (struct sockaddr *)&forward_un, forward_len); ++ if (n2 < 0) { ++ perror("sendto"); ++ } ++ } ++} ++static const char *forward_keyname(KeySym keySym) { ++ const char *name; ++ if (keySym == NoSymbol) { ++ name = "NoSymbol"; ++ } else if (!(name = XKeysymToString(keySym))) { ++ name = "NoName"; ++ } ++ return name; ++} ++static void forward_keydown(KeySym keySym) { ++ forward_send("xdotool keydown %s", forward_keyname(keySym)); ++} ++static void forward_keyup(KeySym keySym) { ++ forward_send("xdotool keyup %s", forward_keyname(keySym)); ++} ++static void forward_mousedown(int button) { ++ forward_send("xdotool mousedown %d", button); ++} ++static void forward_mouseup(int button) { ++ forward_send("xdotool mouseup %d", button); ++} ++static void forward_mousemove(int x, int y) { ++ forward_send("xdotool mousemove %d %d", x, y); ++} ++ + void vo_x11_check_events(struct vo *vo) + { + struct vo_x11_state *x11 = vo->x11; +@@ -1105,6 +1176,10 @@ void vo_x11_check_events(struct vo *vo) + + xscreensaver_heartbeat(vo->x11); + ++ if (forward_state == FORWARD_START) { ++ forward_start(); ++ } ++ + while (XPending(display)) { + XNextEvent(display, &Event); + MP_TRACE(x11, "XEvent: %d\n", Event.type); +@@ -1146,6 +1221,7 @@ void vo_x11_check_events(struct vo *vo) + if (mpkey) + mp_input_put_key(x11->input_ctx, mpkey | modifiers); + } ++ forward_keydown(XLookupKeysym(&Event.xkey, 0)); + break; + } + case FocusIn: +@@ -1161,6 +1237,7 @@ void vo_x11_check_events(struct vo *vo) + break; + case KeyRelease: + release_all_keys(vo); ++ forward_keyup(XLookupKeysym(&Event.xkey, 0)); + break; + case MotionNotify: + if (x11->win_drag_button1_down && !x11->fs && +@@ -1182,6 +1259,7 @@ void vo_x11_check_events(struct vo *vo) + Event.xmotion.y); + } + x11->win_drag_button1_down = false; ++ forward_mousemove(Event.xmotion.x, Event.xmotion.y); + break; + case LeaveNotify: + if (Event.xcrossing.mode != NotifyNormal) +@@ -1204,6 +1282,7 @@ void vo_x11_check_events(struct vo *vo) + get_mods(Event.xbutton.state) | MP_KEY_STATE_DOWN); + long msg[4] = {XEMBED_REQUEST_FOCUS}; + vo_x11_xembed_send_message(x11, msg); ++ forward_mousedown(Event.xbutton.button); + break; + case ButtonRelease: + if (Event.xbutton.button - 1 >= MP_KEY_MOUSE_BTN_COUNT) +@@ -1213,6 +1292,7 @@ void vo_x11_check_events(struct vo *vo) + mp_input_put_key(x11->input_ctx, + (MP_MBTN_BASE + Event.xbutton.button - 1) | + get_mods(Event.xbutton.state) | MP_KEY_STATE_UP); ++ forward_mouseup(Event.xbutton.button); + break; + case MapNotify: + x11->window_hidden = false; |