summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'tv/5pkgs')
-rw-r--r--tv/5pkgs/default.nix9
-rw-r--r--tv/5pkgs/haskell/default.nix2
l---------tv/5pkgs/haskell/lib1
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/default.nix8
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/Build.hs24
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs113
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/main.hs53
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal5
l---------tv/5pkgs/lib1
-rw-r--r--tv/5pkgs/override/default.nix2
-rw-r--r--tv/5pkgs/override/fzf/complete1.patch90
-rw-r--r--tv/5pkgs/override/fzf/default.nix8
l---------tv/5pkgs/override/lib1
-rw-r--r--tv/5pkgs/rpi/default.nix4
l---------tv/5pkgs/rpi/lib1
-rw-r--r--tv/5pkgs/simple/alacritty-font-size.nix67
-rw-r--r--tv/5pkgs/simple/alacritty-tv.nix93
-rw-r--r--tv/5pkgs/simple/bash-fzf-history.nix2
-rw-r--r--tv/5pkgs/simple/default.nix2
-rw-r--r--tv/5pkgs/simple/imagescan-plugin-networkscan.nix2
l---------tv/5pkgs/simple/lib1
-rw-r--r--tv/5pkgs/simple/pinentry-urxvt/default.nix78
l---------tv/5pkgs/simple/pinentry-urxvt/lib1
-rw-r--r--tv/5pkgs/simple/q/default.nix4
l---------tv/5pkgs/simple/q/lib1
-rw-r--r--tv/5pkgs/vim/default.nix6
-rw-r--r--tv/5pkgs/vim/hack.nix4
l---------tv/5pkgs/vim/lib1
-rw-r--r--tv/5pkgs/vim/nix.nix4
-rw-r--r--tv/5pkgs/vim/showsyntax.nix2
-rw-r--r--tv/5pkgs/vim/tv.nix2
-rw-r--r--tv/5pkgs/vim/vim.nix4
32 files changed, 472 insertions, 124 deletions
diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix
index 5a018a1..245d054 100644
--- a/tv/5pkgs/default.nix
+++ b/tv/5pkgs/default.nix
@@ -1,4 +1,4 @@
-with import ../../lib;
+with import ./lib;
let
pushBack = x: xs:
if elem x xs then
@@ -14,7 +14,6 @@ fix
(foldl' (flip extends) (_: super)
(map
(name: import (./. + "/${name}"))
- (filter
- (name: name != "default.nix" && !hasPrefix "." name)
- (pushBack "override"
- (attrNames (readDir ./.))))))
+ (pushBack "override"
+ (attrNames
+ (filterAttrs isNixDirEntry (readDir ./.))))))
diff --git a/tv/5pkgs/haskell/default.nix b/tv/5pkgs/haskell/default.nix
index 33fd250..f05223d 100644
--- a/tv/5pkgs/haskell/default.nix
+++ b/tv/5pkgs/haskell/default.nix
@@ -1,4 +1,4 @@
-with import <stockholm/lib>;
+with import ./lib;
let
overrides = self: super:
mapNixDir (path: self.callPackage path {}) [
diff --git a/tv/5pkgs/haskell/lib b/tv/5pkgs/haskell/lib
new file mode 120000
index 0000000..dc598c5
--- /dev/null
+++ b/tv/5pkgs/haskell/lib
@@ -0,0 +1 @@
+../lib \ No newline at end of file
diff --git a/tv/5pkgs/haskell/xmonad-tv/default.nix b/tv/5pkgs/haskell/xmonad-tv/default.nix
index edb5f25..be3eca9 100644
--- a/tv/5pkgs/haskell/xmonad-tv/default.nix
+++ b/tv/5pkgs/haskell/xmonad-tv/default.nix
@@ -1,6 +1,6 @@
{ mkDerivation, aeson, base, bytestring, containers, directory
-, extra, lib, template-haskell, th-env, unix, X11, xmonad
-, xmonad-contrib, xmonad-stockholm
+, extra, filepath, lib, systemd, template-haskell, th-env
+, transformers, unix, X11, xmonad, xmonad-contrib
}:
mkDerivation {
pname = "xmonad-tv";
@@ -9,8 +9,8 @@ mkDerivation {
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
- aeson base bytestring containers directory extra template-haskell
- th-env unix X11 xmonad xmonad-contrib xmonad-stockholm
+ aeson base bytestring containers directory extra filepath systemd
+ template-haskell th-env transformers unix X11 xmonad xmonad-contrib
];
license = lib.licenses.mit;
}
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Build.hs b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs
new file mode 100644
index 0000000..553a129
--- /dev/null
+++ b/tv/5pkgs/haskell/xmonad-tv/src/Build.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeApplications #-}
+
+module Build where
+
+import XMonad (Dimension)
+import THEnv.JSON (getCompileEnvJSONExp)
+
+
+myFont :: String
+myFont =
+ "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*"
+
+myScreenWidth :: Dimension
+myScreenWidth =
+ $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_SCREEN_WIDTH")
+
+myTermFontWidth :: Dimension
+myTermFontWidth =
+ $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_TERM_FONT_WIDTH")
+
+myTermPadding :: Dimension
+myTermPadding =
+ 2
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs b/tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs
new file mode 100644
index 0000000..d4a4d93
--- /dev/null
+++ b/tv/5pkgs/haskell/xmonad-tv/src/Shutdown.hs
@@ -0,0 +1,113 @@
+{-# LANGUAGE LambdaCase #-}
+
+module Shutdown
+ ( newShutdownEventHandler
+ , shutdown
+ )
+ where
+
+import Control.Applicative ((<|>), empty)
+import Control.Concurrent (threadDelay)
+import Control.Monad (forever, guard, when)
+import Data.Monoid (All(All))
+import System.Directory (XdgDirectory(XdgData), createDirectoryIfMissing, doesFileExist, getAppUserDataDirectory, getXdgDirectory)
+import System.Exit (exitSuccess)
+import System.Environment (lookupEnv)
+import System.FilePath ((</>))
+import System.IO.Error (isDoesNotExistError, tryIOError)
+import System.IO (hPutStrLn, stderr)
+import System.Posix.Process (getProcessID)
+import System.Posix.Signals (nullSignal, signalProcess)
+import System.Posix.Types (ProcessID)
+import XMonad hiding (getXMonadDataDir)
+
+
+-- XXX this is for compatibility with both xmonad<0.17 and xmonad>=0.17
+getXMonadDataDir :: IO String
+getXMonadDataDir = xmEnvDir <|> xmDir <|> xdgDir
+ where
+ -- | Check for xmonad's environment variables first
+ xmEnvDir :: IO String
+ xmEnvDir =
+ maybe empty pure =<< lookupEnv "XMONAD_DATA_DIR"
+
+ -- | Check whether the config file or a build script is in the
+ -- @~\/.xmonad@ directory
+ xmDir :: IO String
+ xmDir = do
+ d <- getAppUserDataDirectory "xmonad"
+ conf <- doesFileExist $ d </> "xmonad.hs"
+ build <- doesFileExist $ d </> "build"
+ pid <- doesFileExist $ d </> "xmonad.pid"
+
+ -- Place *everything* in ~/.xmonad if yes
+ guard $ conf || build || pid
+ pure d
+
+ -- | Use XDG directories as a fallback
+ xdgDir :: IO String
+ xdgDir = do
+ d <- getXdgDirectory XdgData "xmonad"
+ d <$ createDirectoryIfMissing True d
+
+
+newShutdownEventHandler :: IO (Event -> X All)
+newShutdownEventHandler = do
+ writeProcessIDToFile
+ return handleShutdownEvent
+
+handleShutdownEvent :: Event -> X All
+handleShutdownEvent = \case
+ ClientMessageEvent { ev_message_type = mt } -> do
+ isShutdownEvent <- (mt ==) <$> getAtom "XMONAD_SHUTDOWN"
+ when isShutdownEvent $ do
+ broadcastMessage ReleaseResources
+ writeStateToFile
+ io exitSuccess >> return ()
+ return (All (not isShutdownEvent))
+ _ ->
+ return (All True)
+
+sendShutdownEvent :: IO ()
+sendShutdownEvent = do
+ dpy <- openDisplay ""
+ rw <- rootWindow dpy $ defaultScreen dpy
+ a <- internAtom dpy "XMONAD_SHUTDOWN" False
+ allocaXEvent $ \e -> do
+ setEventType e clientMessage
+ setClientMessageEvent e rw a 32 0 currentTime
+ sendEvent dpy rw False structureNotifyMask e
+ sync dpy False
+
+shutdown :: IO ()
+shutdown = do
+ pid <- readProcessIDFromFile
+ sendShutdownEvent
+ hPutStrLn stderr ("waiting for: " <> show pid)
+ result <- tryIOError (waitProcess pid)
+ if isSuccess result
+ then hPutStrLn stderr ("result: " <> show result <> " [AKA success^_^]")
+ else hPutStrLn stderr ("result: " <> show result)
+ where
+ isSuccess = either isDoesNotExistError (const False)
+
+waitProcess :: ProcessID -> IO ()
+waitProcess pid = forever (signalProcess nullSignal pid >> threadDelay 10000)
+
+--
+-- PID file stuff
+--
+
+getProcessIDFileName :: IO FilePath
+getProcessIDFileName = (</> "xmonad.pid") <$> getXMonadDataDir
+
+writeProcessIDToFile :: IO ()
+writeProcessIDToFile = do
+ pidFileName <- getProcessIDFileName
+ pid <- getProcessID
+ writeFile pidFileName (show pid)
+
+readProcessIDFromFile :: IO ProcessID
+readProcessIDFromFile = do
+ pidFileName <- getProcessIDFileName
+ read <$> readFile pidFileName
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
index 81373f4..c921d42 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs
+++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
@@ -1,6 +1,4 @@
{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE TypeApplications #-}
module Main (main) where
@@ -32,25 +30,9 @@ import Data.Ratio
import XMonad.Hooks.Place (placeHook, smart)
import XMonad.Actions.PerWorkspaceKeys (chooseAction)
-import XMonad.Stockholm.Pager
-import XMonad.Stockholm.Shutdown
+import Shutdown (shutdown, newShutdownEventHandler)
-import THEnv.JSON (getCompileEnvJSONExp)
-
-
-myFont :: String
-myFont = "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*"
-
-myScreenWidth :: Dimension
-myScreenWidth =
- $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_SCREEN_WIDTH")
-
-myTermFontWidth :: Dimension
-myTermFontWidth =
- $(getCompileEnvJSONExp (id @Dimension) "XMONAD_BUILD_TERM_FONT_WIDTH")
-
-myTermPadding :: Dimension
-myTermPadding = 2
+import Build (myFont, myScreenWidth, myTermFontWidth, myTermPadding)
main :: IO ()
@@ -136,13 +118,6 @@ spawnRootTerm =
Nothing
-spawnTermAt :: String -> X ()
-spawnTermAt ws = do
- env <- io getEnvironment
- let env' = ("XMONAD_SPAWN_WORKSPACE", ws) : env
- forkFile {-pkg:rxvt_unicode-}"urxvtc" [] (Just env')
-
-
myKeys :: XConfig Layout -> Map (KeyMask, KeySym) (X ())
myKeys conf = Map.fromList $
[ ((_4 , xK_Escape ), forkFile {-pkg-}"slock" [] Nothing)
@@ -151,11 +126,9 @@ myKeys conf = Map.fromList $
, ((_4 , xK_o ), forkFile {-pkg:fzmenu-}"otpmenu" [] Nothing)
, ((_4 , xK_p ), forkFile {-pkg:fzmenu-}"passmenu" [] Nothing)
- , ((_4 , xK_x ), chooseAction spawnTermAt)
+ , ((_4 , xK_x ), forkFile {-pkg:rxvt_unicode-}"urxvtc" [] Nothing)
, ((_4C , xK_x ), spawnRootTerm)
- , ((0 , xK_Menu ), gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.view) )
- , ((_S , xK_Menu ), gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.shift) )
, ((_C , xK_Menu ), toggleWS)
, ((_4 , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ sendMessage NextLayout)
@@ -233,23 +206,3 @@ xdeny =
, "-e", "sleep", "0.05"
]
Nothing
-
-
-pagerConfig :: PagerConfig
-pagerConfig = def
- { pc_font = myFont
- , pc_cellwidth = 64
- , pc_matchmethod = MatchPrefix
- , pc_windowColors = windowColors
- }
- where
- windowColors _ _ _ True _ = ("#ef4242","#ff2323")
- windowColors wsf m c u wf = do
- let y = defaultWindowColors wsf m c u wf
- if m == False && wf == True
- then ("#402020", snd y)
- else y
-
-
-allWorkspaceNames :: W.StackSet i l a sid sd -> X [i]
-allWorkspaceNames = return . map W.tag . W.workspaces
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
index f3bd2e0..a3ddcb0 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
+++ b/tv/5pkgs/haskell/xmonad-tv/src/xmonad-tv.cabal
@@ -15,14 +15,15 @@ executable xmonad
containers,
directory,
extra,
+ filepath,
template-haskell,
th-env,
unix,
X11,
xmonad,
- xmonad-contrib,
- xmonad-stockholm
+ xmonad-contrib
other-modules:
+ Shutdown,
THEnv.JSON
default-language: Haskell2010
ghc-options: -O2 -Wall -threaded
diff --git a/tv/5pkgs/lib b/tv/5pkgs/lib
new file mode 120000
index 0000000..dc598c5
--- /dev/null
+++ b/tv/5pkgs/lib
@@ -0,0 +1 @@
+../lib \ No newline at end of file
diff --git a/tv/5pkgs/override/default.nix b/tv/5pkgs/override/default.nix
index f719a9f..87b7ce9 100644
--- a/tv/5pkgs/override/default.nix
+++ b/tv/5pkgs/override/default.nix
@@ -1,4 +1,4 @@
-with import ../../../lib;
+with import ./lib;
self: super:
mapNixDir (path: import path self super) ./.
diff --git a/tv/5pkgs/override/fzf/complete1.patch b/tv/5pkgs/override/fzf/complete1.patch
index 4b2126a..3e3f2c4 100644
--- a/tv/5pkgs/override/fzf/complete1.patch
+++ b/tv/5pkgs/override/fzf/complete1.patch
@@ -1,50 +1,72 @@
+commit 57cbd76c068121b685399fdb4649e7ba537983d6
+Author: tv <tv@krebsco.de>
+Date: Mon Dec 5 15:24:30 2022 +0100
+
+ Add --complete-1 option
+
+diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
+index 79e7291..3b8a753 100644
+--- a/man/man1/fzf.1
++++ b/man/man1/fzf.1
+@@ -685,6 +685,9 @@ interactive finder and automatically select the only match
+ If there is no match for the initial query (\fB--query\fR), do not start
+ interactive finder and exit immediately
+ .TP
++.B "--complete-1"
++Exit interactive finder when there's exactly one match
++.TP
+ .BI "-f, --filter=" "STR"
+ Filter mode. Do not start interactive finder. When used with \fB--no-sort\fR,
+ fzf becomes a fuzzy-version of grep.
diff --git a/src/core.go b/src/core.go
-index a18c3a1..a3d92a4 100644
+index 2ddddc3..09afff2 100644
--- a/src/core.go
+++ b/src/core.go
-@@ -331,6 +331,13 @@ func Run(opts *Options, version string, revision string) {
+@@ -337,8 +337,14 @@ func Run(opts *Options, version string, revision string) {
+ }
+ determine(val.final)
}
- }
- terminal.UpdateList(val, clearSelection())
-+ if (opts.Complete1) {
-+ count := val.Length()
-+ if count == 1 {
++ } else {
++ if opts.Complete1 && val.Length() == 1 {
+ opts.Printer(val.Get(0).item.AsString(opts.Ansi))
+ terminal.reqBox.Set(reqClose, nil)
++ } else {
++ terminal.UpdateList(val, clearSelection())
+ }
-+ }
+ }
+- terminal.UpdateList(val, clearSelection())
}
}
}
diff --git a/src/options.go b/src/options.go
-index a55dc34..7f121cd 100644
+index 5400311..1e38fe4 100644
--- a/src/options.go
+++ b/src/options.go
-@@ -92,6 +92,7 @@ const usage = `usage: fzf [options]
- -1, --select-1 Automatically select the only match
- -0, --exit-0 Exit immediately when there's no match
- -f, --filter=STR Filter mode. Do not start interactive finder.
-+ --complete-1 Exit interactive finder when there's exactly one match
- --print-query Print query as the first line
- --expect=KEYS Comma-separated list of keys to complete fzf
- --read0 Read input delimited by ASCII NUL characters
-@@ -208,6 +209,7 @@ type Options struct {
- Query string
- Select1 bool
- Exit0 bool
-+ Complete1 bool
- Filter *string
- ToggleSort bool
- Expect map[tui.Event]string
-@@ -269,6 +271,7 @@ func defaultOptions() *Options {
- Query: "",
- Select1: false,
- Exit0: false,
-+ Complete1: false,
- Filter: nil,
- ToggleSort: false,
- Expect: make(map[tui.Event]string),
-@@ -1311,6 +1314,8 @@ func parseOptions(opts *Options, allArgs []string) {
+@@ -108,6 +108,7 @@ const usage = `usage: fzf [options]
+ -1, --select-1 Automatically select the only match
+ -0, --exit-0 Exit immediately when there's no match
+ -f, --filter=STR Filter mode. Do not start interactive finder.
++ --complete-1 Exit interactive finder when there's exactly one match
+ --print-query Print query as the first line
+ --expect=KEYS Comma-separated list of keys to complete fzf
+ --read0 Read input delimited by ASCII NUL characters
+@@ -274,6 +275,7 @@ type Options struct {
+ Query string
+ Select1 bool
+ Exit0 bool
++ Complete1 bool
+ Filter *string
+ ToggleSort bool
+ Expect map[tui.Event]string
+@@ -342,6 +344,7 @@ func defaultOptions() *Options {
+ Query: "",
+ Select1: false,
+ Exit0: false,
++ Complete1: false,
+ Filter: nil,
+ ToggleSort: false,
+ Expect: make(map[tui.Event]string),
+@@ -1546,6 +1549,8 @@ func parseOptions(opts *Options, allArgs []string) {
opts.Exit0 = true
case "+0", "--no-exit-0":
opts.Exit0 = false
diff --git a/tv/5pkgs/override/fzf/default.nix b/tv/5pkgs/override/fzf/default.nix
index 661db0e..2254d45 100644
--- a/tv/5pkgs/override/fzf/default.nix
+++ b/tv/5pkgs/override/fzf/default.nix
@@ -1,9 +1,7 @@
self: super:
super.fzf.overrideAttrs (old: {
- # XXX cannot use `patches` because fzf has a custom patchPhase
- patchPhase = ''
- patch -Np1 < ${./complete1.patch}
- ${old.patchPhase or ""}
- '';
+ patches = old.patches or [] ++ [
+ ./complete1.patch
+ ];
})
diff --git a/tv/5pkgs/override/lib b/tv/5pkgs/override/lib
new file mode 120000
index 0000000..dc598c5
--- /dev/null
+++ b/tv/5pkgs/override/lib
@@ -0,0 +1 @@
+../lib \ No newline at end of file
diff --git a/tv/5pkgs/rpi/default.nix b/tv/5pkgs/rpi/default.nix
index f0ac47f..e41d637 100644
--- a/tv/5pkgs/rpi/default.nix
+++ b/tv/5pkgs/rpi/default.nix
@@ -1,6 +1,4 @@
-let
- lib = import <stockholm/lib>;
-in
+with import ./lib;
self: super:
diff --git a/tv/5pkgs/rpi/lib b/tv/5pkgs/rpi/lib
new file mode 120000
index 0000000..dc598c5
--- /dev/null
+++ b/tv/5pkgs/rpi/lib
@@ -0,0 +1 @@
+../lib \ No newline at end of file
diff --git a/tv/5pkgs/simple/alacritty-font-size.nix b/tv/5pkgs/simple/alacritty-font-size.nix
new file mode 100644
index 0000000..84bc3f6
--- /dev/null
+++ b/tv/5pkgs/simple/alacritty-font-size.nix
@@ -0,0 +1,67 @@
+{ pkgs }:
+
+pkgs.writeDashBin "font-size-alacritty" ''
+ # usage: font-size-alacritty (+N|-N|=N)
+ # Increase by, decrease by, or set font size to the value N.
+
+ set -efu
+
+ min_size=8
+
+ op=''${1%%[0-9]*}
+ op=''${op:-=}
+
+ value=''${1#[=+-]}
+
+ window_id=$(${pkgs.xdotool}/bin/xdotool getactivewindow)
+
+ current_size=$(
+ ${pkgs.xorg.xprop}/bin/xprop -notype -id $window_id FONT_SIZE |
+ ${pkgs.gnused}/bin/sed -rn 's/.* = ([0-9]+)$/\1/p'
+ )
+
+ # usage: set_font_size WINDOW_ID FONT_SIZE
+ set_font_size() {
+ ${pkgs.alacritty}/bin/alacritty msg config -w $1 font.size=$2
+ ${pkgs.xorg.xprop}/bin/xprop -id $1 -f FONT_SIZE 32c -set FONT_SIZE $2
+ }
+
+ # usage: reset_font_size WINDOW_ID
+ reset_font_size() {
+ ${pkgs.alacritty}/bin/alacritty msg config -w $1 font.size=$min_size
+ ${pkgs.xorg.xprop}/bin/xprop -id $1 -remove FONT_SIZE
+ }
+
+ # usage: make_next_size
+ make_next_size() {
+ case $op in
+ -) next_size=$(expr $current_size - $value) ;;
+ =) next_size=$value ;;
+ +)
+ next_size=$(expr $current_size + $value)
+ test $next_size -ge $min_size || next_size=$min_size
+ ;;
+ esac
+ }
+
+ if test -z "$current_size"; then
+ current_size=0
+ make_next_size
+ if test $next_size -ge $min_size; then
+ ${pkgs.alacritty}/bin/alacritty msg config -w $window_id \
+ font.normal.family='Input Mono' \
+ font.normal.style=Condensed \
+ font.bold.family='Input Mono' \
+ font.bold.style=Bold
+ set_font_size $window_id $next_size
+ fi
+ else
+ make_next_size
+ if test $next_size -ge $min_size; then
+ set_font_size $window_id $next_size
+ else
+ ${pkgs.alacritty}/bin/alacritty msg config -w $window_id -r
+ reset_font_size $window_id
+ fi
+ fi
+''
diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix
new file mode 100644
index 0000000..466ff27
--- /dev/null
+++ b/tv/5pkgs/simple/alacritty-tv.nix
@@ -0,0 +1,93 @@
+{ pkgs }:
+
+let
+ lib = import ./lib;
+ font-size = arg: {
+ program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty";
+ args = [arg];
+ };
+ config = {
+ bell.animation = "EaseOut";
+ bell.duration = 50;
+ bell.color = "#ff00ff";
+ colors.cursor.cursor = "#f042b0";
+ colors.primary.background = "#202020";
+ colors.primary.foreground = "#d0d7d0";
+ colors.normal.black = "#000000";
+ colors.normal.red = "#cd0000";
+ colors.normal.green = "#00cd00";
+ colors.normal.yellow = "#bc7004";
+ colors.normal.blue = "#4343be";
+ colors.normal.magenta = "#cb06cb";
+ colors.normal.cyan = "#04c9c9";
+ colors.normal.white = "#bebebe";
+ colors.bright.black = "#727272";
+ colors.bright.red = "#fb6262";
+ colors.bright.green = "#72fb72";
+ colors.bright.yellow = "#fbfb72";
+ colors.bright.blue = "#7272fb";
+ colors.bright.magenta = "#fb53fb";
+ colors.bright.cyan = "#72fbfb";
+ colors.bright.white = "#fbfbfb";
+ draw_bold_text_with_bright_colors = true;
+ font.normal.family = "Clean";
+ font.bold.family = "Clean";
+ font.bold.style = "Regular";
+ font.size = 10;
+ hints.enabled = [
+ {
+ regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+";
+ mouse.enabled = true;
+ post_processing = true;
+ action = "Select";
+ }
+ ];
+ key_bindings = [
+ { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; }
+ { key = "Up"; mods = "Control"; command = font-size "+1"; }
+ { key = "Down"; mods = "Control"; command = font-size "-1"; }
+ { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; }
+ ];
+ scrolling.multiplier = 8;
+ };
+ config-file = pkgs.writeJSON "alacritty-tv.json" config;
+in
+
+pkgs.symlinkJoin {
+ name = "alacritty-tv";
+ paths = [
+ (pkgs.writeDashBin "alacritty" ''
+ # usage:
+ # alacritty [--singleton] [ARGS...]
+
+ set -efu
+
+ # Use home so Alacritty can find the configuration without arguments.
+ # HOME will be reset once in Alacritty.
+ HOME=$TMPDIR/Alacritty
+ export HOME
+
+ # Install stored configuration if it has changed.
+ # This allows for both declarative updates and runtime modifications.
+ ${pkgs.coreutils}/bin/mkdir -p "$HOME"
+ ref=$(${pkgs.coreutils}/bin/cat "$HOME"/ref)
+ if test "$ref" != ${config-file}; then
+ echo ${config-file} > "$HOME"/ref
+ ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml
+ fi
+
+ case ''${1-} in
+ --singleton)
+ shift
+ if ! ${pkgs.alacritty}/bin/alacritty msg create-window "$@"; then
+ ${pkgs.alacritty}/bin/alacritty "$@" &
+ fi
+ ;;
+ *)
+ exec ${pkgs.alacritty}/bin/alacritty "$@"
+ ;;
+ esac
+ '')
+ pkgs.alacritty
+ ];
+}
diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix
index 88a8e9e..1166ec7 100644
--- a/tv/5pkgs/simple/bash-fzf-history.nix
+++ b/tv/5pkgs/simple/bash-fzf-history.nix
@@ -1,4 +1,4 @@
-with import <stockholm/lib>;
+with import ./lib;
{ pkgs
, edit-key ? "ctrl-e"
diff --git a/tv/5pkgs/simple/default.nix b/tv/5pkgs/simple/default.nix
index 9fb45dd..82a19a9 100644
--- a/tv/5pkgs/simple/default.nix
+++ b/tv/5pkgs/simple/default.nix
@@ -1,4 +1,4 @@
-with import ../../../lib;
+with import ./lib;
self: super:
diff --git a/tv/5pkgs/simple/imagescan-plugin-networkscan.nix b/tv/5pkgs/simple/imagescan-plugin-networkscan.nix
index c3f2dea..4f9b84b 100644
--- a/tv/5pkgs/simple/imagescan-plugin-networkscan.nix
+++ b/tv/5pkgs/simple/imagescan-plugin-networkscan.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
preFixup = ''
patchelf --set-interpreter \
- ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
+ ${pkgs.pkgsi686Linux.glibc}/lib/ld-linux-x86-64.so.2 \
$out/lib/utsushi/networkscan
# libstdc++.so.6
diff --git a/tv/5pkgs/simple/lib b/tv/5pkgs/simple/lib
new file mode 120000
index 0000000..dc598c5
--- /dev/null
+++ b/tv/5pkgs/simple/lib
@@ -0,0 +1 @@
+../lib \ No newline at end of file
diff --git a/tv/5pkgs/simple/pinentry-urxvt/default.nix b/tv/5pkgs/simple/pinentry-urxvt/default.nix
index 65b76c0..ad8039f 100644
--- a/tv/5pkgs/simple/pinentry-urxvt/default.nix
+++ b/tv/5pkgs/simple/pinentry-urxvt/default.nix
@@ -1,8 +1,7 @@
+with import ./lib;
{ pkgs, ... }@args:
let
- lib = import <stockholm/lib>;
-
# config cannot be declared in the input attribute set because that would
# cause callPackage to inject the wrong config. Instead, get it from ...
# via args.
@@ -20,7 +19,11 @@ let
type = lib.types.str;
};
display = lib.mkOption {
- default = ":0";
+ default = null;
+ type = lib.types.nullOr lib.types.str;
+ };
+ xwud.className = lib.mkOption {
+ default = "PinentryUrxvtXwudFloat";
type = lib.types.str;
};
};
@@ -30,12 +33,77 @@ let
in
+ # pinentry-urxvt - A mechanism for PIN entry utilizing rxvt-unicode
+ #
+ # This spawns a PIN entry terminal on top of a tinted screenshot of the
+ # current display's root window. The display for spawning the terminal can
+ # be predefined, in which case both the current and the predefined display
+ # will show the screenshot.
+ #
+ # The purpose of the screenshot, aside from looking nice, is to prevent entry
+ # of the PIN into the wrong window, e.g. by accidentally moving the cursor
+ # while typing. If necessary, the screenshot can be closed by sending 'q',
+ # 'Q', or ctrl-c while its focused.
+ #
pkgs.write "pinentry-urxvt" {
"/bin/pinentry".link = pkgs.writeDash "pinentry-urxvt-wrapper" ''
set -efu
+
+ trap cleanup EXIT
+
+ cleanup() {
+ ${pkgs.utillinux}/bin/kill -- $(${pkgs.coreutils}/bin/cat "$displayers")
+ rm "$displayers"
+ rm "$screenshot"
+ }
+
+ displayers=$(${pkgs.coreutils}/bin/mktemp -t pinentry-urxvt.$$.displayers.XXXXXXXX)
+ screenshot=$(${pkgs.coreutils}/bin/mktemp -t pinentry-urxvt.$$.screenshot.XXXXXXXX)
+
+ ${pkgs.xorg.xwd}/bin/xwd -root |
+ ${pkgs.imagemagick}/bin/convert xwd:- -fill \#424242 -colorize 80% xwd:"$screenshot"
+
+ display_screenshot() {
+ ${pkgs.exec "pinentry-urxvt.display_screenshot" {
+ filename = "${pkgs.xorg.xwud}/bin/xwud";
+ argv = [
+ cfg.xwud.className
+ "-noclick"
+ ];
+ }} < "$screenshot" &
+ wait_for_screenshot $! && echo $! >>"$displayers"
+ }
+
+ # Wait for the xwud window by trying to intercept the call to munmap().
+ # If it cannot be intercepted within 0.1s, assume that attaching strace
+ # wasn't fast enough or xwud doesn't call munmap() anymore. In either
+ # case fall back to search the window by class name, assuming there can
+ # be only one per display.
+ wait_for_screenshot() {
+ if ! \
+ ${pkgs.coreutils}/bin/timeout 0.1 \
+ ${pkgs.strace}/bin/strace -p "$1" -e munmap 2>&1 |
+ read -r _
+ then
+ until ${pkgs.xdotool}/bin/xdotool search \
+ --classname ${lib.shell.escape cfg.xwud.className}
+ do
+ ${pkgs.coreutils}/bin/sleep 0.1
+ done
+ fi
+ }
+
+ display_screenshot
+
+ ${lib.optionalString (cfg.display != null) /* sh */ ''
+ if test