guest@dotshare [~/groups/misc/misc] $ ls lypheas-lemonbar/ | cat

lyphea's lemonbar (scrot, raw, dl)

lyphea Jul 30, 2017 (misc/misc)

SCROT

 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash

## ┬  ┌─┐┌┬┐┌─┐┌┐┌┌┐ ┌─┐┬─┐
## │  ├┤ ││││ ││││├┴┐├─┤├┬┘
## ┴─┘└─┘┴ ┴└─┘┘└┘└─┘┴ ┴┴└─


clock() {
  date '+%d/%m %H:%M'
}

battery() {
  BATC=/sys/class/power_supply/BAT1/capacity
  BATS=/sys/class/power_supply/BAT1/status

  test "`cat $BATS`" = "Charging" && echo -n '+' || echo -n '-'

  sed -n p $BATC
}

volume() {
  amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p'| uniq
}

cpuload() {
  LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'`
  bc <<< $LINE
}

memused() {
  free -m | awk 'NR==2{printf "%.2f", $3*100/$2}'
}

network() {
  read lo int1 int2 <<< `ip link | sed -n 's/^[0-9]: \(.*\):.*$/\1/p'`
  if iwconfig $int1 >/dev/null 2>&1; then
      wifi=$int1
      eth0=$int2
  else
      wifi=$int2
      eth0=$int1
  fi
  ip link show $eth0 | grep 'state UP' >/dev/null && int=$eth0 ||int=$wifi

  #int=eth0

  ping -c 1 8.8.8.8 >/dev/null 2>&1 && 
      echo "$int +" || echo "$int -"
}

groups() {
  cur=`xprop -root _NET_CURRENT_DESKTOP | awk '{print $3}'`
  tot=`xprop -root _NET_NUMBER_OF_DESKTOPS | awk '{print $3}'`

  for w in `seq 0 $((cur - 1))`; do line="${line}="; done
  line="${line}|"
  for w in `seq $((cur + 2)) $tot`; do line="${line}="; done
  echo $line
}

nowplaying() {
  cur=`mpc current`
  ## this line allow to choose whether the output will scroll or not
  test "$1" = "scroll" && PARSER='skroll -n20 -d0.5 -r' || PARSER='cat'
  test -n "$cur" && $PARSER <<< $cur || echo "-- stopped --"
}

## this loop will fill a buffer with our infos, and output it to stdout.
while :; do
    echo "%{l} $(nowplaying)\
          %{r} $(cpuload)/$(memused) $(network) $(volume) $(clock)"

    sleep 1 ## the bar will be updated every second
done

CLICK TO VIEW

x