File: plugins-helper

package info (click to toggle)
clifm 1.26.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,816 kB
  • sloc: ansic: 64,595; sh: 3,133; python: 1,851; makefile: 567
file content (51 lines) | stat: -rw-r--r-- 1,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Some common functions for Clifm plugins
# Author: L. Abramovich
# License: GPL2+

cmd_exists()
{
	if type "$1" > /dev/null 2>&1; then
		echo "1";
	else
		echo "0";
	fi
}

# Get the current terminal amount of supported colors: normally 8 or 256
term_colors()
{
	if type tput > /dev/null 2>&1; then
		echo "$(tput colors)"
	else
		echo "8"
	fi
}

# Return the appropriate value for FZF --color option, honoring no-color
# directives
get_fzf_colors()
{
	if [ -n "$CLIFM_NO_COLOR" ] || [ -n "$NO_COLOR" ] \
	|| [ -n "$CLIFM_COLORLESS" ]; then
		echo "bw"
	else
		echo "16,prompt:6,fg+:-1,pointer:2,marker:2,hl:5,hl+:5,gutter:-1"
	fi
}

# Make sure FZF interface won't be messed up when running on an 8 bit
# terminal emulator
fzf_borders()
{
	if [ "$(term_colors)" -eq 256 ]; then
		echo "--border=left"
	else
		echo "--no-unicode"
	fi
}

# A few fixed values to construct the FZF interface
fzf_height="${CLIFM_FZF_HEIGHT:-80}%"
fzf_prompt="Clifm > "
colorize=1
[ -n "$CLIFM_COLORLESS" ] && colorize=0