forked from speedie/spmenu
some improvements to documentation and spmenu_run
This commit is contained in:
parent
ca52c5986e
commit
ca7cd97e08
20
docs/docs.md
20
docs/docs.md
|
@ -407,6 +407,7 @@ dmenu compatibility can be achieved using these arguments:
|
||||||
|
|
||||||
`-sb color`
|
`-sb color`
|
||||||
: Set the selected background color
|
: Set the selected background color
|
||||||
|
|
||||||
`-sf color`
|
`-sf color`
|
||||||
: Set the selected foreground color
|
: Set the selected foreground color
|
||||||
|
|
||||||
|
@ -457,6 +458,8 @@ There are also a few image related arguments, such as:
|
||||||
|
|
||||||
`-is`, `-ig`, `-it`, `-ib`, `-ic`, `-itc` and `-gc`.
|
`-is`, `-ig`, `-it`, `-ib`, `-ic`, `-itc` and `-gc`.
|
||||||
|
|
||||||
|
NOTE: Vector images (such as .svg) can be displayed too.
|
||||||
|
|
||||||
Colored text
|
Colored text
|
||||||
============
|
============
|
||||||
|
|
||||||
|
@ -501,8 +504,21 @@ spmenu loads `~/.config/spmenu/spmenurc` or alternatively if you're
|
||||||
old fashioned, `~/.spmenurc`. This requires that `xrdb` is available on your
|
old fashioned, `~/.spmenurc`. This requires that `xrdb` is available on your
|
||||||
operating system.
|
operating system.
|
||||||
|
|
||||||
You can also use wildcards (such as `*`) to achieve a global colorscheme. Programs like
|
You can also use wildcards (such as `*`) to achieve a global colorscheme.
|
||||||
`pywal` do this.
|
Programs like `pywal` do this to apply universal colorschemes.
|
||||||
|
|
||||||
|
Run launcher
|
||||||
|
============
|
||||||
|
|
||||||
|
spmenu includes a shell script called spmenu_run. It lists executable programs in $PATH and displays them to the user in a list. Not only that but it shows recently run programs first in the list.
|
||||||
|
|
||||||
|
spmenu_run will interpret any arguments as spmenu arguments and pass them to spmenu. Therefore `spmenu_run --prompt 'Run:'` will set the prompt to `Run:`. While it is similar to dmenu_run (and achieves the same goal), this version has some extra features.
|
||||||
|
|
||||||
|
The selected option is piped to /bin/sh (by default). Unlike dmenu_run, spmenu_run has some cool features. For example:
|
||||||
|
|
||||||
|
- Prepending `#` will spawn it in a terminal instead of just a shell.
|
||||||
|
- Prepending `magnet ` will open a magnet link in $TORRENT
|
||||||
|
- Prepending `www` will open a page in $BROWSER
|
||||||
|
|
||||||
License
|
License
|
||||||
=======
|
=======
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
[ ! -f "$HOME/.config/spmenu/spmenu_run.conf" ] && \
|
|
||||||
mkdir -p "$HOME/.config/spmenu"; \
|
|
||||||
touch "$HOME/.config/spmenu/spmenu_run.conf"
|
|
||||||
|
|
||||||
[ -f "$HOME/.config/spmenu/spmenu_run.conf" ] && \
|
|
||||||
"$HOME/.config/spmenu/spmenu_run.conf"
|
|
||||||
|
|
||||||
[ -z "$TERMINAL" ] && TERMINAL="st -e"
|
[ -z "$TERMINAL" ] && TERMINAL="st -e"
|
||||||
[ -z "$BROWSER" ] && BROWSER="xdg-open"
|
[ -z "$BROWSER" ] && BROWSER="xdg-open"
|
||||||
[ -z "$TORRENT" ] && TORRENT="qbittorrent"
|
[ -z "$TORRENT" ] && TORRENT="qbittorrent"
|
||||||
|
@ -17,12 +10,15 @@ path() { echo "$PATH" | tr ':' '\n' | uniq | sed 's#$#/#' | xargs ls -lu --time-
|
||||||
parse() {
|
parse() {
|
||||||
dout="$(path | sed "s/\&/\&/g" | spmenu -im -H "$HISTORY" "$@")"
|
dout="$(path | sed "s/\&/\&/g" | spmenu -im -H "$HISTORY" "$@")"
|
||||||
|
|
||||||
|
# parse
|
||||||
[ "$(printf '%c' "$dout")" = "#" ] && RUN_ARG="$TERMINAL"
|
[ "$(printf '%c' "$dout")" = "#" ] && RUN_ARG="$TERMINAL"
|
||||||
[ "$(printf "$dout" | awk '{ print $1 }')" = "magnet" ] && "$TORRENT" "$(printf "$dout" | sed "s/magnet //")" && return
|
[ "$(printf "$dout" | awk '{ print $1 }')" = "magnet" ] && "$TORRENT" "$(printf "$dout" | sed "s/magnet //")"
|
||||||
[ "$(printf "$dout" | awk '{ print $1 }')" = "www" ] && "$BROWSER" "$(printf "$dout" | sed "s/www //")" && return
|
[ "$(printf "$dout" | awk '{ print $1 }')" = "www" ] && "$BROWSER" "$(printf "$dout" | sed "s/www //")"
|
||||||
|
|
||||||
# terminal
|
# terminal
|
||||||
[ "$RUN_ARG" != "$TERMINAL" ] && printf "%s" "$dout" | sed "s/#//g" | ${SHELL:-"/bin/sh"} & return
|
[ -z "$RUN_ARG" ] && \
|
||||||
|
printf "%s" "$dout" | sed "s/#//g" | ${SHELL:-"/bin/sh"} &
|
||||||
|
|
||||||
[ "$RUN_ARG" = "$TERMINAL" ] && $TERMINAL -e "$(printf "%s" "$dout" | sed "s/#//g")"; return
|
[ "$RUN_ARG" = "$TERMINAL" ] && $TERMINAL -e "$(printf "%s" "$dout" | sed "s/#//g")"; return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
32
spmenu.1
32
spmenu.1
|
@ -427,7 +427,9 @@ Set the normal background color
|
||||||
Set the normal foreground color
|
Set the normal foreground color
|
||||||
.TP
|
.TP
|
||||||
\f[V]-sb color\f[R]
|
\f[V]-sb color\f[R]
|
||||||
Set the selected background color \f[V]-sf color\f[R]
|
Set the selected background color
|
||||||
|
.TP
|
||||||
|
\f[V]-sf color\f[R]
|
||||||
Set the selected foreground color
|
Set the selected foreground color
|
||||||
.SH Keybinds
|
.SH Keybinds
|
||||||
.PP
|
.PP
|
||||||
|
@ -479,6 +481,8 @@ There are also a few image related arguments, such as:
|
||||||
.PP
|
.PP
|
||||||
\f[V]-is\f[R], \f[V]-ig\f[R], \f[V]-it\f[R], \f[V]-ib\f[R],
|
\f[V]-is\f[R], \f[V]-ig\f[R], \f[V]-it\f[R], \f[V]-ib\f[R],
|
||||||
\f[V]-ic\f[R], \f[V]-itc\f[R] and \f[V]-gc\f[R].
|
\f[V]-ic\f[R], \f[V]-itc\f[R] and \f[V]-gc\f[R].
|
||||||
|
.PP
|
||||||
|
NOTE: Vector images (such as .svg) can be displayed too.
|
||||||
.SH Colored text
|
.SH Colored text
|
||||||
.PP
|
.PP
|
||||||
spmenu supports colored text through SGR sequences.
|
spmenu supports colored text through SGR sequences.
|
||||||
|
@ -525,7 +529,31 @@ This requires that \f[V]xrdb\f[R] is available on your operating system.
|
||||||
.PP
|
.PP
|
||||||
You can also use wildcards (such as \f[V]*\f[R]) to achieve a global
|
You can also use wildcards (such as \f[V]*\f[R]) to achieve a global
|
||||||
colorscheme.
|
colorscheme.
|
||||||
Programs like \f[V]pywal\f[R] do this.
|
Programs like \f[V]pywal\f[R] do this to apply universal colorschemes.
|
||||||
|
.SH Run launcher
|
||||||
|
.PP
|
||||||
|
spmenu includes a shell script called spmenu_run.
|
||||||
|
It lists executable programs in $PATH and displays them to the user in a
|
||||||
|
list.
|
||||||
|
Not only that but it shows recently run programs first in the list.
|
||||||
|
.PP
|
||||||
|
spmenu_run will interpret any arguments as spmenu arguments and pass
|
||||||
|
them to spmenu.
|
||||||
|
Therefore \f[V]spmenu_run --prompt \[aq]Run:\[aq]\f[R] will set the
|
||||||
|
prompt to \f[V]Run:\f[R].
|
||||||
|
While it is similar to dmenu_run (and achieves the same goal), this
|
||||||
|
version has some extra features.
|
||||||
|
.PP
|
||||||
|
The selected option is piped to /bin/sh (by default).
|
||||||
|
Unlike dmenu_run, spmenu_run has some cool features.
|
||||||
|
For example:
|
||||||
|
.IP \[bu] 2
|
||||||
|
Prepending \f[V]#\f[R] will spawn it in a terminal instead of just a
|
||||||
|
shell.
|
||||||
|
.IP \[bu] 2
|
||||||
|
Prepending \f[V]magnet\f[R] will open a magnet link in $TORRENT
|
||||||
|
.IP \[bu] 2
|
||||||
|
Prepending \f[V]www\f[R] will open a page in $BROWSER
|
||||||
.SH License
|
.SH License
|
||||||
.PP
|
.PP
|
||||||
spmenu is licensed under the MIT license.
|
spmenu is licensed under the MIT license.
|
||||||
|
|
Loading…
Reference in a new issue