Parcourir la source

Add new tool: eedmenu, a eecc-enabled dmenu wrapper

A dmenu wrapper to leverage inireader for easier work with style
configuration and to compose key/value based menus.
Alois Mahdal il y a 10 ans
Parent
révision
3352ebb062
2 fichiers modifiés avec 54 ajouts et 0 suppressions
  1. 53
    0
      bin/eedmenu.in
  2. 1
    0
      setup/mk.sh

+ 53
- 0
bin/eedmenu.in Voir le fichier

@@ -0,0 +1,53 @@
1
+#!/bin/bash
2
+
3
+. <(ffoom init)
4
+ffoo import core
5
+ffoo import ini
6
+
7
+FFOO_INI_PATH="__FFOO_INI_PATH__"
8
+
9
+usage() {
10
+    usage_is "[-l|--lines] [-d|--delim] [-e|--read-eeini]"
11
+}
12
+
13
+numbered=false
14
+lines=10
15
+maybe_cut=cat
16
+maybe_read_eeini=cat
17
+
18
+while true; do case $1 in
19
+    -l|--lines)         lines=$2;                   shift 2 ;;
20
+    -d|--delim)         delim=$2;                   shift 2 ;;
21
+    -e|--read-eeini)    read_eeini=$2; delim='=';   shift 2 ;;
22
+    "")                 break                               ;;
23
+    *)  usage
24
+esac done
25
+
26
+test -n "$delim"        && maybe_cut=do_cut
27
+test -n "$read_eeini"   && maybe_read_eeini=do_read_eeini
28
+
29
+host=$(hostname -s)
30
+nb="$(iniread -p style.color.nbg)"
31
+nf="$(iniread -p style.color.nfg)"
32
+sb="$(iniread -p style.color.sng)"
33
+sf="$(iniread -p style.color.sfg)"
34
+fn="$(iniread -p style.font)"
35
+fn=${fn:--*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*}
36
+arg_nb="${nb:+-nb $nb}"
37
+arg_nf="${nf:+-nf $nf}"
38
+arg_sb="${sb:+-sb $sb}"
39
+arg_sf="${sf:+-sf $sf}"
40
+arg_fn="${fn:+-fn $fn}"
41
+style="$arg_nb $arg_nf $arg_sb $arg_sf $arg_fn"
42
+
43
+do_cut() {
44
+    cut -d$delim -f2-
45
+}
46
+
47
+do_read_eeini() {
48
+    iniread $read_eeini
49
+}
50
+
51
+$maybe_read_eeini \
52
+  | dmenu -l $lines $style \
53
+  | $maybe_cut

+ 1
- 0
setup/mk.sh Voir le fichier

@@ -11,6 +11,7 @@ bindir=${DESTDIR}${PREFIX}/bin
11 11
 
12 12
 list_of_bins() {
13 13
     echo bin/eeabrt
14
+    echo bin/eedmenu
14 15
     echo bin/eeget
15 16
     echo bin/eeiam
16 17
     echo bin/eeini