Compare commits
3 Commits
d45e45e011
...
5312fd7bf2
Author | SHA1 | Date |
---|---|---|
Michel | 5312fd7bf2 | |
Michel | e0b9335f2b | |
Michel | 9be893d07f |
|
@ -0,0 +1,2 @@
|
|||
export NC_STORAGE="$HOME/NC-Michel/Linux/folder"
|
||||
export ALT_HISTORY_FILE="$HOME/NC-Michel/Linux/another-folder/history"
|
|
@ -1,2 +0,0 @@
|
|||
export NC_STORAGE="$HOME/NC-Michel/Linux/VDell"
|
||||
export ALT_HISTORY_FILE="$HOME/NC-Michel/Linux/michdell/history"
|
55
.zshrc
55
.zshrc
|
@ -311,16 +311,61 @@ bindkey -M viins '\en' nnn-file-widget
|
|||
|
||||
# Whiptail helper
|
||||
#
|
||||
menu_choose() {
|
||||
# see https://stackoverflow.com/questions/1970180/whiptail-how-to-redirect-output-to-environment-variable
|
||||
|
||||
whiptail_checklist() {
|
||||
autoload zmathfunc; zmathfunc # min, max, sum
|
||||
eval $(resize) # COLUMNS, LINES
|
||||
|
||||
local res title="$1" text="$2"
|
||||
(( width=max(30, $#text) ))
|
||||
shift 2
|
||||
|
||||
# Make tags compatible with whiptail
|
||||
local -a tags
|
||||
for tag;
|
||||
{ tags+=($tag $tag) }
|
||||
for tag; do
|
||||
tags+=($tag $tag 0)
|
||||
(( width=max(width, $#tag) ))
|
||||
done
|
||||
|
||||
# see https://stackoverflow.com/questions/1970180/whiptail-how-to-redirect-output-to-environment-variable
|
||||
tag=$(whiptail --title $title --menu $text 25 40 15 $tags --notags 3>&1 1>&2 2>&3 3>&-)
|
||||
# Compute "best" width & height
|
||||
(( list_height=min(20, ${#*}, LINES * .5) ))
|
||||
(( height=min(list_height+8, LINES) ))
|
||||
(( width=min(width + 9, COLUMNS * .75) ))
|
||||
|
||||
tag=$(whiptail --title $title \
|
||||
--checklist $text $height $width $list_height $tags \
|
||||
--separate-output --notags 3>&1 1>&2 2>&3 3>&-)
|
||||
res=$?
|
||||
|
||||
# Use res=${(f)"$(whiptail_checklist...)"} to ignore spaces
|
||||
echo $tag
|
||||
return $res
|
||||
}
|
||||
|
||||
whiptail_menu() {
|
||||
autoload zmathfunc; zmathfunc # min, max, sum
|
||||
eval $(resize) # COLUMNS, LINES
|
||||
|
||||
local res title="$1" text="$2"
|
||||
(( width=max(30, $#text) ))
|
||||
shift 2
|
||||
|
||||
# Make tags compatible with whiptail
|
||||
local -a tags
|
||||
for tag; do
|
||||
tags+=($tag $tag)
|
||||
(( width=max(width, $#tag) ))
|
||||
done
|
||||
|
||||
# Compute "best" width & height
|
||||
(( menu_height=min(20, ${#*}, LINES * .5) ))
|
||||
(( height=min(menu_height+8, LINES) ))
|
||||
(( width=min(width + 5, COLUMNS * .75) ))
|
||||
|
||||
tag=$(whiptail --title $title \
|
||||
--menu $text $height $width $menu_height $tags \
|
||||
--notags 3>&1 1>&2 2>&3 3>&-)
|
||||
res=$?
|
||||
|
||||
echo $tag
|
||||
|
|
|
@ -4,6 +4,14 @@
|
|||
alias xterm='xterm -bg black -fg white -fa Hack -fs 10'
|
||||
|
||||
|
||||
## Mount dev folders
|
||||
#
|
||||
# Note: To be done first, so other actions can use mounted folders.
|
||||
#
|
||||
[[ -x $HOME/bin/mount_dev.zsh ]] &&
|
||||
xterm -geometry 120x40 -title "Mount devices" -hold -e $HOME/bin/mount_dev.zsh
|
||||
|
||||
|
||||
## Start periodic actions
|
||||
#
|
||||
$HOME/bin/every-hour.zsh
|
||||
|
|
Loading…
Reference in New Issue