summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2019-03-21 20:09:09 +0100
committerjeschli <jeschli@gmail.com>2019-03-21 20:09:09 +0100
commita045a7f054859efcb40baf8ded13bcb7fd706d01 (patch)
treedf23b0d31db9fc0b0087f4d5d4c7b3dd7a88b44c /tv/5pkgs
parented499a84a9fe067c80e5a4768482333863c1e9ad (diff)
parent550faa1f64434951cd3949bc96a25012349f0090 (diff)
Merge branch 'master' of prism.r:stockholm into new-master
Diffstat (limited to 'tv/5pkgs')
-rw-r--r--tv/5pkgs/haskell/xmonad-tv/src/main.hs6
-rw-r--r--tv/5pkgs/override/default.nix6
-rw-r--r--tv/5pkgs/override/rxvt_unicode.nix9
-rw-r--r--tv/5pkgs/simple/bash-fzf-history.nix102
4 files changed, 118 insertions, 5 deletions
diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
index b7d4e9bca..c528017d7 100644
--- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs
+++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs
@@ -1,8 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable #-} -- for XS
-{-# LANGUAGE FlexibleContexts #-} -- for xmonad'
{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-
module Main (main) where
@@ -51,7 +47,7 @@ mainNoArgs = do
let width = 1366
workspaces0 <- getWorkspaces0
handleShutdownEvent <- newShutdownEventHandler
- xmonad
+ launch
$ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ")
$ def
{ terminal = Paths.urxvtc
diff --git a/tv/5pkgs/override/default.nix b/tv/5pkgs/override/default.nix
new file mode 100644
index 000000000..99c1b3ec9
--- /dev/null
+++ b/tv/5pkgs/override/default.nix
@@ -0,0 +1,6 @@
+with import <stockholm/lib>;
+self: super: {
+ rxvt_unicode = self.callPackage ./rxvt_unicode.nix {
+ rxvt_unicode = super.rxvt_unicode;
+ };
+}
diff --git a/tv/5pkgs/override/rxvt_unicode.nix b/tv/5pkgs/override/rxvt_unicode.nix
new file mode 100644
index 000000000..da657fb20
--- /dev/null
+++ b/tv/5pkgs/override/rxvt_unicode.nix
@@ -0,0 +1,9 @@
+{ fetchurl, rxvt_unicode }:
+rxvt_unicode.overrideAttrs (old: {
+ patches = old.patches ++ [
+ (fetchurl {
+ url = https://cgit.krebsco.de/rxvt-unicode/patch/?id=15f3f94;
+ sha256 = "12vldwsds27c9l15ffc6svk9mj17jhypcz736pvpmpqbsymlkz2p";
+ })
+ ];
+})
diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix
new file mode 100644
index 000000000..88a8e9e4a
--- /dev/null
+++ b/tv/5pkgs/simple/bash-fzf-history.nix
@@ -0,0 +1,102 @@
+with import <stockholm/lib>;
+{ pkgs
+
+, edit-key ? "ctrl-e"
+, exec-key ? "enter"
+, edit-mark ? "${mark-prefix}${edit-key}"
+, exec-mark ? "${mark-prefix}${exec-key}"
+, edit-command ? "\"\""
+, exec-command ? "accept-line"
+, mark-prefix ? " #FZFKEY:"
+, finish-keyseq ? "\\C-x\\C-p"
+, rebind-keyseq ? "\\C-x\\C-o"
+
+, start-keyseq ? "\\C-f"
+, load-keyseq ? start-keyseq
+}: let
+ script = pkgs.writeBash "bash-fzf-history.sh" ''
+ if ! command -v fzf >/dev/null; then
+ # Alternatively rewrite ${pkgs.fzf}/share/fzf/* to use absolute paths.
+ fzf() {
+ ${pkgs.fzf}/bin/fzf "$@"
+ }
+ fi
+
+ . ${pkgs.fzf}/share/fzf/key-bindings.bash
+ . ${pkgs.fzf}/share/fzf/completion.bash
+
+ FZF_DEFAULT_OPTS='${toString [
+ /* sh */ "--height=40%"
+ /* sh */ "--inline-info"
+ /* sh */ "--min-height=4"
+ /* sh */ "--reverse"
+ ]}'
+
+ __fzf_history__() (
+ IFS=$'\n'
+ result=( $(
+ # To add "unknown timestamps" to each line of the history:
+ # sed -i '/^#[0-9]/{n;b};s/^/#1\n/' "$HISTFILE"
+ HISTTIMEFORMAT=$'\e[38;5;244m%Y-%m-%dT%H:%M:%S\e[m ' history |
+ ${pkgs.gnused}/bin/sed '
+ s/\(\x1b\[[0-9;]*\)244m1970-[0-9T:-]*/\1237m????-??-??T??:??:??/
+ ' |
+ FZF_DEFAULT_OPTS="${toString [
+ /* sh */ "--ansi"
+ /* sh */ "--tac"
+ /* sh */ "--sync"
+ /* sh */ "-n2..,.."
+ /* sh */ "--tiebreak=index"
+ /* sh */ "--bind=ctrl-r:toggle-sort"
+ /* sh */ "--expect=${edit-key},${exec-key}"
+ /* sh */ "$FZF_DEFAULT_OPTS"
+ /* sh */ "+m"
+ ]}" \
+ ${pkgs.fzf}/bin/fzf |
+ ${pkgs.gnused}/bin/sed '
+ /^ *[0-9]/{
+ s/^ *//
+ s/ \+/\n/;# index
+ s/ \+/\n/;# date
+ }
+ '
+ ) )
+ if test -n "$result"; then
+ key=''${result[0]}
+ index=''${result[1]}
+ date=''${result[2]}
+ command=''${result[3]}
+
+ echo "$command${mark-prefix}$key"
+ else
+ # Ensure no empty new line gets produced when fzf was aborted.
+ echo '${edit-mark}'
+ fi
+ )
+
+ __fzf_rebind_finish_keyseq__() {
+ local suffix=
+ case $READLINE_LINE in
+ *'${edit-mark}')
+ suffix='${edit-mark}'
+ bind '"${finish-keyseq}": ${edit-command}'
+ ;;
+ *'${exec-mark}')
+ suffix='${exec-mark}'
+ bind '"${finish-keyseq}": ${exec-command}'
+ ;;
+ esac
+ READLINE_LINE=${"\${READLINE_LINE:0:-\${#suffix}}"}
+ }
+ bind -x '"${rebind-keyseq}": __fzf_rebind_finish_keyseq__'
+
+ bind '"\C-r": reverse-search-history'
+ bind '"${start-keyseq}": " \C-e\C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er\e^${rebind-keyseq}${finish-keyseq}"'
+
+ echo '# fzf key bindings loaded:' >&2
+ bind -s | ${pkgs.gnugrep}/bin/grep __fzf_ >&2
+ '';
+in
+ script.overrideAttrs (old: rec {
+ bind = /* sh */ ''bind -x '"${load-keyseq}": . ${script}' '';
+ })