From fd41443c9047b91e8ca1952881a096a2270f8643 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 29 Jan 2019 01:28:36 +0100 Subject: tv rxvt_unicode: finish running selection --- tv/5pkgs/override/default.nix | 6 ++++ tv/5pkgs/override/rxvt_unicode/default.nix | 6 ++++ .../rxvt_unicode/finish-running-selection.patch | 41 ++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 tv/5pkgs/override/default.nix create mode 100644 tv/5pkgs/override/rxvt_unicode/default.nix create mode 100644 tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/override/default.nix b/tv/5pkgs/override/default.nix new file mode 100644 index 000000000..cd7c5645b --- /dev/null +++ b/tv/5pkgs/override/default.nix @@ -0,0 +1,6 @@ +with import ; +self: super: { + rxvt_unicode = self.callPackage ./rxvt_unicode { + rxvt_unicode = super.rxvt_unicode; + }; +} diff --git a/tv/5pkgs/override/rxvt_unicode/default.nix b/tv/5pkgs/override/rxvt_unicode/default.nix new file mode 100644 index 000000000..858a46be6 --- /dev/null +++ b/tv/5pkgs/override/rxvt_unicode/default.nix @@ -0,0 +1,6 @@ +{ rxvt_unicode }: +rxvt_unicode.overrideAttrs (old: { + patches = old.patches ++ [ + ./finish-running-selection.patch + ]; +}) diff --git a/tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch b/tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch new file mode 100644 index 000000000..a342ccf5c --- /dev/null +++ b/tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch @@ -0,0 +1,41 @@ +diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h +index 56c9a3f..429055d 100644 +--- a/src/rxvttoolkit.h ++++ b/src/rxvttoolkit.h +@@ -384,6 +384,7 @@ struct rxvt_selection + { + rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term); + void run (); ++ void finish (char *data = 0, unsigned int len = 0); + ~rxvt_selection (); + + rxvt_term *term; // terminal to paste to, may be 0 +@@ -404,7 +405,6 @@ private: + void timer_cb (ev::timer &w, int revents); ev::timer timer_ev; + void x_cb (XEvent &xev); xevent_watcher x_ev; + +- void finish (char *data = 0, unsigned int len = 0); + void stop (); + bool request (Atom target, int selnum); + void handle_selection (Window win, Atom prop, bool delete_prop); +diff --git a/src/screen.C b/src/screen.C +index 9eb375a..77e7109 100644 +--- a/src/screen.C ++++ b/src/screen.C +@@ -2736,11 +2736,11 @@ rxvt_term::paste (char *data, unsigned int len) NOTHROW + void + rxvt_term::selection_request (Time tm, int selnum) NOTHROW + { +- if (!selection_req) +- { +- selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); +- selection_req->run (); +- } ++ if (selection_req) ++ selection_req->finish (); ++ ++ selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); ++ selection_req->run (); + } + + /* ------------------------------------------------------------------------- */ -- cgit v1.2.3 From 7c8ace182566cdbca89f4d3e2203b38e6e1f23d9 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 31 Jan 2019 11:15:58 +0100 Subject: tv rxvt_unicode: fetch patch --- tv/5pkgs/override/default.nix | 2 +- tv/5pkgs/override/rxvt_unicode.nix | 9 +++++ tv/5pkgs/override/rxvt_unicode/default.nix | 6 ---- .../rxvt_unicode/finish-running-selection.patch | 41 ---------------------- 4 files changed, 10 insertions(+), 48 deletions(-) create mode 100644 tv/5pkgs/override/rxvt_unicode.nix delete mode 100644 tv/5pkgs/override/rxvt_unicode/default.nix delete mode 100644 tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/override/default.nix b/tv/5pkgs/override/default.nix index cd7c5645b..99c1b3ec9 100644 --- a/tv/5pkgs/override/default.nix +++ b/tv/5pkgs/override/default.nix @@ -1,6 +1,6 @@ with import ; self: super: { - rxvt_unicode = self.callPackage ./rxvt_unicode { + 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/override/rxvt_unicode/default.nix b/tv/5pkgs/override/rxvt_unicode/default.nix deleted file mode 100644 index 858a46be6..000000000 --- a/tv/5pkgs/override/rxvt_unicode/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ rxvt_unicode }: -rxvt_unicode.overrideAttrs (old: { - patches = old.patches ++ [ - ./finish-running-selection.patch - ]; -}) diff --git a/tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch b/tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch deleted file mode 100644 index a342ccf5c..000000000 --- a/tv/5pkgs/override/rxvt_unicode/finish-running-selection.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h -index 56c9a3f..429055d 100644 ---- a/src/rxvttoolkit.h -+++ b/src/rxvttoolkit.h -@@ -384,6 +384,7 @@ struct rxvt_selection - { - rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term); - void run (); -+ void finish (char *data = 0, unsigned int len = 0); - ~rxvt_selection (); - - rxvt_term *term; // terminal to paste to, may be 0 -@@ -404,7 +405,6 @@ private: - void timer_cb (ev::timer &w, int revents); ev::timer timer_ev; - void x_cb (XEvent &xev); xevent_watcher x_ev; - -- void finish (char *data = 0, unsigned int len = 0); - void stop (); - bool request (Atom target, int selnum); - void handle_selection (Window win, Atom prop, bool delete_prop); -diff --git a/src/screen.C b/src/screen.C -index 9eb375a..77e7109 100644 ---- a/src/screen.C -+++ b/src/screen.C -@@ -2736,11 +2736,11 @@ rxvt_term::paste (char *data, unsigned int len) NOTHROW - void - rxvt_term::selection_request (Time tm, int selnum) NOTHROW - { -- if (!selection_req) -- { -- selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); -- selection_req->run (); -- } -+ if (selection_req) -+ selection_req->finish (); -+ -+ selection_req = new rxvt_selection (display, selnum, tm, vt, xa[XA_VT_SELECTION], this); -+ selection_req->run (); - } - - /* ------------------------------------------------------------------------- */ -- cgit v1.2.3 From 45d6a5385a274c25da9d0720370e7b38baeb13fe Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Feb 2019 11:00:10 +0100 Subject: tv bash-fzf-history: init --- tv/5pkgs/simple/bash-fzf-history.nix | 91 ++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 tv/5pkgs/simple/bash-fzf-history.nix (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix new file mode 100644 index 000000000..e9a21b95d --- /dev/null +++ b/tv/5pkgs/simple/bash-fzf-history.nix @@ -0,0 +1,91 @@ +with import ; +{ 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__() ( + result=$( + HISTTIMEFORMAT= history | + FZF_DEFAULT_OPTS="${toString [ + /* 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 + ) + if test -n "$result"; then + shopt -s extglob + + key=''${result%%$'\n'*} + line=''${result##*([^0-9])} + index=''${line%%[^0-9]*} + command=''${line##*([0-9 ])} + + 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 // + rec { + bind = /* sh */ ''bind -x '"${load-keyseq}": . ${script}' ''; + } -- cgit v1.2.3 From 6cfbc67cb236671af6781bd6a5b628d5300f67ab Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Feb 2019 11:53:31 +0100 Subject: tv bash-fzf-history: use array instead of extglob --- tv/5pkgs/simple/bash-fzf-history.nix | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix index e9a21b95d..8b3fe9e58 100644 --- a/tv/5pkgs/simple/bash-fzf-history.nix +++ b/tv/5pkgs/simple/bash-fzf-history.nix @@ -33,7 +33,8 @@ with import ; ]}' __fzf_history__() ( - result=$( + IFS=$'\n' + result=( $( HISTTIMEFORMAT= history | FZF_DEFAULT_OPTS="${toString [ /* sh */ "--tac" @@ -45,15 +46,18 @@ with import ; /* sh */ "$FZF_DEFAULT_OPTS" /* sh */ "+m" ]}" \ - ${pkgs.fzf}/bin/fzf - ) + ${pkgs.fzf}/bin/fzf | + ${pkgs.gnused}/bin/sed ' + /^ *[0-9]/{ + s/^ *// + s/ \+/\n/;# index + } + ' + ) ) if test -n "$result"; then - shopt -s extglob - - key=''${result%%$'\n'*} - line=''${result##*([^0-9])} - index=''${line%%[^0-9]*} - command=''${line##*([0-9 ])} + key=''${result[0]} + index=''${result[1]} + command=''${result[2]} echo "$command${mark-prefix}$key" else -- cgit v1.2.3 From c1bd2a0851dc163a77699b00759f8ae4aa38a65d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Feb 2019 11:54:03 +0100 Subject: tv bash-fzf-history: show timestamp --- tv/5pkgs/simple/bash-fzf-history.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix index 8b3fe9e58..7b92ea0cd 100644 --- a/tv/5pkgs/simple/bash-fzf-history.nix +++ b/tv/5pkgs/simple/bash-fzf-history.nix @@ -35,8 +35,9 @@ with import ; __fzf_history__() ( IFS=$'\n' result=( $( - HISTTIMEFORMAT= history | + HISTTIMEFORMAT=$'\e[38;5;244m%Y-%m-%dT%H:%M:%S\e[m ' history | FZF_DEFAULT_OPTS="${toString [ + /* sh */ "--ansi" /* sh */ "--tac" /* sh */ "--sync" /* sh */ "-n2..,.." @@ -51,13 +52,15 @@ with import ; /^ *[0-9]/{ s/^ *// s/ \+/\n/;# index + s/ \+/\n/;# date } ' ) ) if test -n "$result"; then key=''${result[0]} index=''${result[1]} - command=''${result[2]} + date=''${result[2]} + command=''${result[3]} echo "$command${mark-prefix}$key" else -- cgit v1.2.3 From 0b60d5da163980483a233ab60492c9c5a5c59cf8 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Feb 2019 13:11:46 +0100 Subject: tv bash-fzf-history: support unknown timestamps --- tv/5pkgs/simple/bash-fzf-history.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix index 7b92ea0cd..b603dedd9 100644 --- a/tv/5pkgs/simple/bash-fzf-history.nix +++ b/tv/5pkgs/simple/bash-fzf-history.nix @@ -35,7 +35,12 @@ with import ; __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" -- cgit v1.2.3 From e51a19cb8be0ae1d9a45d1c22b45ec71e099a2ff Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 9 Feb 2019 04:04:23 +0100 Subject: tv xmonad: remove unused language extensions --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index b7d4e9bca..e78480219 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 -- cgit v1.2.3 From d3b23eac6eb79076b1b60615d26bfebafc927e65 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 9 Feb 2019 04:05:39 +0100 Subject: tv xmonad: use launch --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index e78480219..c528017d7 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -47,7 +47,7 @@ mainNoArgs = do let width = 1366 workspaces0 <- getWorkspaces0 handleShutdownEvent <- newShutdownEventHandler - xmonad + launch $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ def { terminal = Paths.urxvtc -- cgit v1.2.3 From c69c75f2c63b350615ec8026538c879b91b7a6ea Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 16 Feb 2019 16:01:03 +0100 Subject: tv bash-fzf-history: use overrideDerivation --- tv/5pkgs/simple/bash-fzf-history.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tv/5pkgs') diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix index b603dedd9..88a8e9e4a 100644 --- a/tv/5pkgs/simple/bash-fzf-history.nix +++ b/tv/5pkgs/simple/bash-fzf-history.nix @@ -97,7 +97,6 @@ with import ; bind -s | ${pkgs.gnugrep}/bin/grep __fzf_ >&2 ''; in - script // - rec { + script.overrideAttrs (old: rec { bind = /* sh */ ''bind -x '"${load-keyseq}": . ${script}' ''; - } + }) -- cgit v1.2.3