WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit d32361d

Browse files
Merge pull request #17 from andresgongora/develop
Develop
2 parents 39eaf2a + 35b5576 commit d32361d

12 files changed

+832
-770
lines changed

README.md

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![synth-shell](doc/synth-shell-status.jpg)
22

33

4-
**synth-shell-status** shows a summary of your system's current health.
4+
**synth-shell-greeter** shows a summary of your system's current health.
55
- Automatically printed in new terminal sessions (local, SSH, ...).
66
- Monitor your servers, RaspberryPis, and workstations. All system info you
77
need at a glance (e.g. external IP address, CPU temperature, etc.).
@@ -18,36 +18,33 @@
1818
# Setup
1919
<!--------------------------------------+-------------------------------------->
2020

21-
### Automatic setup
21+
22+
### Arch Linux
23+
24+
You may install `synth-shell-greeter` from AUR:
25+
https://aur.archlinux.org/packages/synth-shell-greeter-git/
26+
27+
28+
29+
### Manual setup
2230

2331
The included [setup script](setup.sh) will guide you step by step through the
24-
process and let you choose what features to install. During this setup, you can
25-
choose to install synth-shell for your user only (recommended) or system-wide
26-
(superuser privileges required). To proceed,
27-
[open and play this link in a separate tab](https://www.youtube.com/embed/MpN91wHAr1k)
28-
and enter the following into your terminal:
32+
installatioj process. Just clone this repository and run it:
2933
```
30-
git clone --recursive https://github.com/andresgongora/synth-shell.git
31-
chmod +x synth-shell/setup.sh
32-
synth-shell/setup.sh
34+
git clone --recursive https://github.com/andresgongora/synth-shell-greeter.git
35+
synth-shell-greeter/setup.sh
3336
```
3437

35-
Note that for `fancy-bash-prompt.sh` you might also need
36-
[power-line fonts](https://github.com/powerline/fonts). You can instal it
37-
as follows (the exact name of the package varies from distro to distro):
38-
39-
* ArchLinux: `sudo pacman -S powerline-fonts`
40-
* Debian/Ubuntu: `sudo apt install fonts-powerline`
38+
You can then test your script by running it from wherever you installed it.
39+
Usually this is to your user's `.config` folder, so you should run:
40+
```
41+
~/.config/synth-shell/synth-shell-greeter.sh
42+
```
4143

42-
Finally, open up a new terminal and test that everything works. Sometimes,
43-
despite power-line fonts being properly installed, the triangle separator
44-
for `fancy-bash-prompt.sh` (if installed) might still not show. In this case,
45-
make sure that your `locale` is set to UTF-8 by editing `/etc/locale.conf` file
46-
(select your language but in UTF-8 format) and running `sudo locale-gen`.
47-
[More info on locale](https://wiki.archlinux.org/index.php/locale).
48-
Alternatively, try a different font in your terminal emulator. Some fonts
49-
do not support special characters. We get the best results with
50-
[hack-ttf](https://sourcefoundry.org/hack/).
44+
If you want it to appear everytime you open a new terminal, run
45+
```
46+
echo "~/.config/synth-shell/synth-shell-greeter.sh" >> ~/.bashrc
47+
```
5148

5249

5350

@@ -61,11 +58,6 @@ folders depending on how you installed **synth-shell**:
6158

6259

6360

64-
### Uninstallation
65-
Run the setup script again (like during the installation), but choose
66-
`uninstall` when prompted.
67-
68-
6961

7062
<br/><br/>
7163

@@ -83,9 +75,10 @@ prints a user-configurable ASCII logo to impress your crush from the library
8375
with how awesome you are.
8476

8577
Feel free to customize your status report through the many available options
86-
in `~/.config/synth-shell/status.config` (user-only install) or
87-
`/etc/synth-shell/status.config` (system-wide install),or by replacing their
88-
content with the examples files you can find under the same directory.
78+
in `~/.config/synth-shell/synth-shell-greeter.config` (user-only install) or
79+
`/etc/synth-shell/synth-shell-greeter.config` (system-wide install), or by
80+
replacing their content with the examples files you can find under the same
81+
directory.
8982

9083
![status configuration options](doc/status_config_preview.png)
9184

config/examples/synth-shell-greeter.org.uma.scbi.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ print_info="
5454
##==============================================================================
5555
## STATUS BARS
5656
##==============================================================================
57-
memory_units="GB"
58-
swap_units="GB"
59-
hdd_units="GB"
60-
home_units="TB"
57+
bar_memory_units="GB"
58+
bar_swap_units="GB"
59+
bar_hdd_units="GB"
60+
bar_home_units="TB"
6161

config/os/synth-shell-greeter.archlinux.config

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66
## - https://wiki.archlinux.org/index.php/ASCII_art
77
## - https://bbs.archlinux.org/viewtopic.php?id=24208&p=6
88

9-
logo=" .
9+
logo="\e[0;94m .
1010
\e[0;94m #
1111
\e[0;94m ###
1212
\e[0;94m #####
13-
\e[0;94m ######
14-
\e[0;94m ; #####;
15-
\e[0;94m +##.#####
16-
\e[0;94m +##########
13+
\e[0;94m '######
14+
\e[0;94m .. #####:
15+
\e[0;94m ###.#####
16+
\e[0;94m ###########
1717
\e[0;94m ######\e[0;34m#####\e[0;94m##;
18-
\e[0;94m ###\e[0;34m############\e[0;94m+
18+
\e[0;94m ###\e[0;34m############\e[0;94m
1919
\e[0;94m #\e[0;34m###### #######
20-
\e[0;34m .######; ;###;\`\".
21-
\e[0;34m .#######; ;#####.
22-
\e[0;34m #########. .########\`
23-
\e[0;34m ######\' \'######
24-
\e[0;34m ;#### ####;
25-
\e[0;34m ##\' \'##
26-
\e[0;34m #\' \`#
27-
\e[0;34m ' \` "
20+
\e[0;34m ######: :###.\`\".
21+
\e[0;34m #######: :####:.
22+
\e[0;34m :########. .########
23+
\e[0;34m :#####' '#####:
24+
\e[0;34m :#### ####:
25+
\e[0;34m ##' '##
26+
\e[0;34m #' '#
27+
\e[0;34m ' ' "
2828

2929

3030

config/synth-shell-greeter.config.default

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,31 +117,38 @@ format_logo=" -c blue -e bold"
117117
##==============================================================================
118118
## STATUS BARS
119119
##
120-
## This option controls the behaviour of the visual status bars that are plotted
121-
## for CPU, Memory, Swap and HDD usage. You can set the percentage that
120+
## These option controls the behaviour of the visual status bars that are
121+
## plotted for CPU, Memory, Swap and HDD usage. You can set the percentage that
122122
## determines when the current usage is deemed critical. If said percentage
123123
## is surpassed, the color of the bars will change and extra information
124124
## might be plotted in addition (e.g. if the CPU usage is too high, the most
125125
## demanding processes are printed to terminal).
126126
##==============================================================================
127127

128-
crit_cpu_percent=40
129-
print_cpu_hogs_num=3 # Num processes to show if CPU usage is high
130-
crit_ram_percent=75
131-
print_memory_hogs=3 # Num processes to show if memory usage is high
132-
crit_swap_percent=25
133-
crit_hdd_percent=85
134-
crit_home_percent=85
128+
bar_cpu_crit_percent=40
129+
bar_ram_crit_percent=75
130+
bar_swap_crit_percent=25
131+
bar_hdd_crit_percent=85
132+
bar_home_crit_percent=85
135133

136-
memory_units="MB"
137-
swap_units="MB"
138-
hdd_units="GB"
139-
home_units="GB"
134+
bar_ram_units="MB"
135+
bar_swap_units="MB"
136+
bar_hdd_units="GB"
137+
bar_home_units="GB"
138+
139+
cpu_crit_print=true
140+
cpu_crit_print_num=3
141+
ram_crit_print=true
142+
ram_crit_print_num=3
140143

141144
bar_length=9 # Number of characters that comprise a bar
142145
bar_num_digits=5 # Control num digits next to bar
146+
bar_padding_after=0 # Extra spaces after bar
143147
info_label_width=16 # Desired length of the info labels
144-
148+
bar_bracket_char_left='['
149+
bar_bracket_char_right=']'
150+
bar_fill_char='|'
151+
bar_background_char=' '
145152

146153

147154
##==============================================================================
@@ -158,3 +165,4 @@ print_extra_new_line_top=true # Extra line before logo and info
158165
print_extra_new_line_bot=true # Extra line after logo and info
159166

160167

168+

setup.sh

Lines changed: 52 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -28,63 +28,41 @@
2828

2929
##==============================================================================
3030
##
31-
setup()
32-
{
33-
include() { source "$( cd $( dirname "${BASH_SOURCE[0]}" ) >/dev/null 2>&1 && pwd )/$1" ; }
34-
include 'bash-tools/bash-tools/user_io.sh'
35-
include 'bash-tools/bash-tools/hook_script.sh'
36-
include 'bash-tools/bash-tools/assemble_script.sh'
37-
38-
39-
## SWITCH BETWEEN AUTOMATIC AND USER INSTALLATION
40-
if [ "$#" -eq 0 ]; then
41-
local output_script="$HOME/.config/synth-shell/synth-shell-greeter.sh"
42-
local output_config_dir="$HOME/.config/synth-shell"
43-
cp "$output_config_dir/synth-shell-greeter.config" "$output_config_dir/synth-shell-greeter.config.backup"
44-
printInfo "Installing script as $output_script"
45-
local action=$(promptUser "Add hook your .bashrc file or equivalent?\n\tRequired for autostart on new terminals" "[Y]/[n]?" "yYnN" "y")
46-
case "$action" in
47-
""|y|Y ) hookScript $output_script ;;
48-
n|N ) ;;
49-
*) printError "Invalid option"; exit 1
50-
esac
31+
include(){ { [ -z "$_IR" ]&&_IR="$PWD"&&cd "$(dirname "$PWD/$0")"&&include "$1"&&cd "$_IR"&&unset _IR;}||{ local d=$PWD&&cd "$(dirname "$PWD/$1")"&&. "$(basename "$1")"&&cd "$d";}||{ echo "Include failed $PWD->$1"&&exit 1;};}
32+
33+
include 'bash-tools/bash-tools/user_io.sh'
34+
include 'bash-tools/bash-tools/hook_script.sh'
35+
include 'bash-tools/bash-tools/assemble_script.sh'
36+
37+
38+
## SWITCH BETWEEN AUTOMATIC AND USER INSTALLATION
39+
if [ "$#" -eq 0 ]; then
40+
OUTPUT_SCRIPT="$HOME/.config/synth-shell/synth-shell-greeter.sh"
41+
OUTPUT_CONFIG_DIR="$HOME/.config/synth-shell"
42+
cp "$OUTPUT_CONFIG_DIR/synth-shell-greeter.config" \
43+
"$OUTPUT_CONFIG_DIR/synth-shell-greeter.config.backup"
44+
printInfo "Installing script as $OUTPUT_SCRIPT"
45+
USER_CHOICE=$(promptUser "Add hook your .bashrc file or equivalent?\n\tRequired for autostart on new terminals" "[Y]/[n]?" "yYnN" "y")
46+
case "$USER_CHOICE" in
47+
""|y|Y ) hookScript $OUTPUT_SCRIPT ;;
48+
n|N ) ;;
49+
*) printError "Invalid option"; exit 1
50+
esac
5151

52-
else
53-
local output_script="$1"
54-
local output_config_dir="$2"
55-
fi
56-
57-
58-
## DEFINE LOCAL VARIABLES
59-
local dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
60-
local input_script="$dir/synth-shell-greeter/synth-shell-greeter.sh"
61-
local input_config_dir="$dir/config/"
62-
63-
64-
## HEADER TO BE ADDED AT THE TOP OF THE ASSEMBLED SCRIPT
65-
local output_script_header=$(printf '%s'\
66-
"##!/bin/bash\n"\
67-
"\n"\
68-
"## +-----------------------------------+-----------------------------------+\n"\
69-
"## | |\n"\
70-
"## | Copyright (c) 2014-2020, Andres Gongora <[email protected]> |\n"\
71-
"## | https://github.com/andresgongora/synth-shell-greeter |\n"\
72-
"## | Visit the above URL for details of license and authorship. |\n"\
73-
"## | |\n"\
74-
"## | This program is free software: you can redistribute it and/or modify |\n"\
75-
"## | it under the terms of the GNU General Public License as published by |\n"\
76-
"## | the Free Software Foundation, either version 3 of the License, or |\n"\
77-
"## | (at your option) any later version. |\n"\
78-
"## | |\n"\
79-
"## | This program is distributed in the hope that it will be useful, |\n"\
80-
"## | but WITHOUT ANY WARRANTY; without even the implied warranty of |\n"\
81-
"## | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n"\
82-
"## | GNU General Public License for more details. |\n"\
83-
"## | |\n"\
84-
"## | You should have received a copy of the GNU General Public License |\n"\
85-
"## | along with this program. If not, see <http://www.gnu.org/licenses/>. |\n"\
86-
"## | |\n"\
87-
"## +-----------------------------------------------------------------------+\n"\
52+
else
53+
OUTPUT_SCRIPT="$1"
54+
OUTPUT_CONFIG_DIR="$2"
55+
fi
56+
57+
58+
## DEFINE LOCAL VARIABLES
59+
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
60+
INPUT_SCRIPT="$DIR/synth-shell-greeter/synth-shell-greeter.sh"
61+
INPUT_CONFIG_DIR="$DIR/config/"
62+
63+
64+
## HEADER TO BE ADDED AT THE TOP OF THE ASSEMBLED SCRIPT
65+
OUTPUT_SCRIPT_HEADER=$(printf '%s'\
8866
"##\n"\
8967
"##\n"\
9068
"## =======================\n"\
@@ -93,43 +71,31 @@ setup()
9371
"## =======================\n"\
9472
"##\n"\
9573
"## This file was generated by an installation script.\n"\
96-
"## If you edit this file, it might be overwritten without warning\n"\
97-
"## and you might lose all your changes.\n"\
74+
"## It might be overwritten without warning at any time\n"\
75+
"## and you will lose all your changes.\n"\
9876
"##\n"\
9977
"## Visit for instructions and more information:\n"\
10078
"## https://github.com/andresgongora/synth-shell/\n"\
79+
"##\n"\
10180
"##\n\n\n")
10281

10382

104-
## SETUP SCRIPT
105-
assembleScript "$input_script" "$output_script" "$output_script_header"
106-
107-
108-
## SETUP CONFIGURATION FILES
109-
[ -d "$output_config_dir" ] || mkdir -p "$output_config_dir"
110-
cp -r "$input_config_dir/." "$output_config_dir/"
111-
83+
## SETUP SCRIPT
84+
assembleScript "$INPUT_SCRIPT" "$OUTPUT_SCRIPT" "$OUTPUT_SCRIPT_HEADER"
11285

113-
## SETUP DEFAULT SYNTH-SHELL-GREETER CONFIG FILE
114-
local config_file="$output_config_dir/synth-shell-greeter.config"
115-
if [ ! -f "$config_file" ]; then
116-
local distro=$(cat /etc/os-release | grep "ID=" | sed 's/ID=//g' | head -n 1)
117-
case "$distro" in
118-
'arch' ) cp "$output_config_dir/os/synth-shell-greeter.archlinux.config" "$config_file" ;;
119-
'manjaro' ) cp "$output_config_dir/os/synth-shell-greeter.manjaro.config" "$config_file" ;;
120-
*) cp "$output_config_dir/synth-shell-greeter.config.default" "$config_file" ;;
121-
esac
122-
fi
123-
}
12486

87+
## SETUP CONFIGURATION FILES
88+
[ -d "$OUTPUT_CONFIG_DIR" ] || mkdir -p "$OUTPUT_CONFIG_DIR"
89+
cp -r "$INPUT_CONFIG_DIR/." "$OUTPUT_CONFIG_DIR/"
12590

12691

127-
128-
129-
130-
##==============================================================================
131-
## SCRIPT
132-
##==============================================================================
133-
134-
setup $@
135-
92+
## SETUP DEFAULT SYNTH-SHELL-GREETER CONFIG FILE
93+
CONFIG_FILE="$OUTPUT_CONFIG_DIR/synth-shell-greeter.config"
94+
if [ ! -f "$CONFIG_FILE" ]; then
95+
DISTRO=$(cat /etc/os-release | grep "ID=" | sed 's/ID=//g' | head -n 1)
96+
case "$DISTRO" in
97+
'arch' ) cp "$OUTPUT_CONFIG_DIR/os/synth-shell-greeter.archlinux.config" "$CONFIG_FILE" ;;
98+
'manjaro' ) cp "$OUTPUT_CONFIG_DIR/os/synth-shell-greeter.manjaro.config" "$CONFIG_FILE" ;;
99+
*) cp "$OUTPUT_CONFIG_DIR/synth-shell-greeter.config.default" "$CONFIG_FILE" ;;
100+
esac
101+
fi

0 commit comments

Comments
 (0)