.screenrc with per-machine customizable backtick scripts. hwtemp-desktop.sh backtick for ASRock X399 Taichi CPUTIN, loadavg.sh backtick for fixed load average backtick and memory.sh for new memory usage backtick.

This commit is contained in:
Alexey Skobkin 2017-11-22 01:52:04 +03:00
parent 5583f05550
commit 8a507afb11
7 changed files with 38 additions and 4 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.idea/

1
screen/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/backticks/?.sh

View file

@ -9,7 +9,7 @@ screen -t sudo2 sudo -i
select 0
# Huge scrollback
defscrollback 4000
defscrollback 16000
altscreen on
term screen-256color
@ -19,15 +19,16 @@ bind '.' next
hardstatus alwayslastline
# Backtick commands to output in the hardstatus
backtick 1 5 5 sh -c 'sensors | fgrep -i "core " | tr "\n" " " | sed -e "s/Core\ [0-9]\:[ ]\++//g;s/ ([^)]*)//g;s/ $//"'
backtick 2 10 10 sh -c 'uptime | awk "{print \$8 \$9 \$10}" | sed -e "s/,/ /g"'
backtick 1 5 5 sh -c '~/.dotfiles/screen/backticks/1.sh'
backtick 2 10 10 sh -c '~/.dotfiles/screen/backticks/2.sh'
backtick 3 10 10 sh -c '~/.dotfiles/screen/backticks/3.sh'
# http://www.gnu.org/software/screen/manual/html_node/String-Escapes.html
#
# %H : hostname
# %= : expand to fill all space (used here to make remaining content flush right)
# %` : print output of 'backtick' command (defined elsewhere in .screenrc)
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %2` ][ %1` ][%{B} %d-%m-%Y %{W}%c %{g}]'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][ %1` ][ %2` ][ %3` ][%{B} %d-%m-%Y %{W}%c %{g}]'
# use hjkl keys to resize regions
#bind -c rsz h eval "resize -h -5" "command -c rsz"

22
screen/README.md Normal file
View file

@ -0,0 +1,22 @@
# GNU Screen configuration
```bash
cd ~/.dotfiles/screen
```
1. Create symbolic link for main config file:
```bash
ln -s .screenrc ~/.screenrc
```
2. Create symbolic links for [backtick](https://www.gnu.org/software/screen/manual/html_node/Backtick.html) scripts for each machine.
```bash
# Choose desired backtick scripts for each (1-3) slot and create symbolic links
# Suppose your current machine is 'desktop'
cd backticks
ln -s hwtemp-desktop.sh 1.sh
ln -s loadavg.sh 2.sh
ln -s memory.sh 3.sh
```

View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Core i7-4820k
#sensors | fgrep -i "core " | tr "\n" " " | sed -e "s/Core\ [0-9]\:[ ]\++//g;s/ ([^)]*)//g;s/ $//"
# Threadripper 1950X (via motherboard sensors, not die)
sensors | fgrep 'CPUTIN' | awk '{print $2}'

2
screen/backticks/loadavg.sh Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
cat /proc/loadavg | awk '{print $1, $2, $3}'

2
screen/backticks/memory.sh Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
free -h | fgrep -i 'mem:' | awk '{print $3, "/", $2}'