tRemoved old bar script - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit b84d48bc7a2081c58e069f09f417a85e9af3b0ce
(DIR) parent fd2b3f7ca22c7040c6165805f843c71808ef6352
(HTM) Author: z3bra <willy@mailoo.org>
Date: Mon, 3 Nov 2014 21:33:28 +0100
Removed old bar script
Diffstat:
D bar/config.sh | 72 -------------------------------
D bar/status.sh | 227 -------------------------------
2 files changed, 0 insertions(+), 299 deletions(-)
---
(DIR) diff --git a/bar/config.sh b/bar/config.sh
t@@ -1,72 +0,0 @@
-#!/bin/bash
-
-# Color used in the bar (extracted from .Xresources)
-# * 0 : black
-# * 1 : red
-# * 2 : green
-# * 3 : yellow
-# * 4 : blue
-# * 5 : magenta
-# * 6 : cyan
-# * 7 : white
-
-# unified colors
-bg="8"
-fg="9"
-hl="8"
-
-# separator
-sp=" "
-
-# path to executable
-bar="/usr/bin/bar -f"
-
-#info icons (from stlarch_font package. use gbdfed to view/modify font)
-i_arch='\ue0a1' # arch logo
-i_pkgs='\ue14d' # pacman
-i_pkgs='\ue0aa' # pacman ghost
-i_mail='\ue072' # mail icon
-i_wifi='\ue0f0' # signal
-i_netw='\ue149' # wired
-i_time='\ue017' # clock
-i_batt='\ue040' # thunder
-i_sect='\ue10c' # power (on A/C)
-i_load='\ue021' # micro chip
-i_memy='\ue145' # floppy
-i_musk='\ue04d' # headphones
-i_alsa='\ue05d' # speaker
-
-# workspace icons / names (α β γ δ ε ζ η θ ι κ λ)
-i_trm=$(echo -e '0')
-i_web=$(echo -e '1')
-i_dev=$(echo -e '2')
-i_com=$(echo -e '3')
-i_fun=$(echo -e '4')
-i_sys=$(echo -e '5')
-i_wrk=$(echo -e '6')
-i_meh=$(echo -e '7')
-i_far=$(echo -e '8')
-
-
-# specific parameters
-# desktop names
-dskp_tag=('' $i_trm $i_web $i_dev $i_com $i_fun $i_sys $i_wrk $i_meh $i_far)
-
-# colors
-colors=(black red green yellow blue cyan magenta white black white)
-
-# now playing format
-mpc_format='[%title% ]|[%file%]'
-
-# volume channel
-alsa_channel='Master'
-
-# define you own interfaces
-net_wire='eth0'
-net_wifi='wlan0'
-
-# Only the time ? with seconds ? Maybe the current year...?
-date_format="%H.%M"
-
-# The default program to use, is -O <program> is not passed
-default_output='bar'
(DIR) diff --git a/bar/status.sh b/bar/status.sh
t@@ -1,227 +0,0 @@
-#!/bin/sh
-
-source $(dirname $0)/config.sh
-
-OUT=$default_output
-
-function fg() {
- case $1 in
- bar) echo "\f$2" ;;
- tmux) echo "#[fg=${colors[$2]}]" ;;
- none) echo "" ;;
- ?) echo "\f$2" ;;
- esac
-}
-
-function bg() {
- case $1 in
- bar) echo "\b$2" ;;
- tmux) echo "#[bg=$2]" ;;
- none) echo "" ;;
- ?) echo "\b$2" ;;
- esac
-}
-
-# print formatted output. need 2 params: display <value> <icon>
-function display () {
- if [ -n "$1" ]; then
- echo -n "$(fg $OUT ${hl})"
- echo -en "$2 "
- echo "$(fg $OUT ${fg})$1"
- fi
-}
-
-function workspaces () {
- dskp_num=$(xprop -root _NET_NUMBER_OF_DESKTOPS | cut -d ' ' -f3)
- dskp_cur=$(xprop -root _NET_CURRENT_DESKTOP | cut -d ' ' -f3)
-
- buffer=""
-
- for w in $(seq 1 $(($dskp_num-1))); do
- if [ "$w" -eq "$dskp_cur" ]; then
- buffer="$buffer$(echo -e '\ue190')"
- #buffer="$buffer\u${fg} ${dskp_tag[$w]} \u${bg}"
- else
- buffer="$buffer$(fg $OUT ${hl})$(echo -e '\ue190')$(fg $OUT ${fg})"
- #buffer="$buffer ${dskp_tag[$w]} "
- fi
- done
-
- echo -n "${buffer}"
-}
-
-function ratgrp() {
- dskp_tag=('' 'MEH' 'WEB' 'DEV')
- dskp_cur=$(ratpoison -c 'groups' | cut -sd'*' -f1)
- dskp_num=$(ratpoison -c 'groups'| wc -l)
-
- val=""
-
- for w in $(seq 1 $dskp_num); do
- if [ "$w" -eq "$dskp_cur" ]; then
- val="$val\u${fg} ${dskp_tag[$w]} \u${bg}"
- else
- val="$val ${dskp_tag[$w]} "
- fi
- done
-
- echo -n "${val}"
-}
-
-function groups() {
- if [ "$(xprop -root _NET_WM_NAME|cut -d\" -f2)" = "ratpoison" ]; then
- echo "$(ratgrp)"
- else
- echo "$(workspaces)"
- fi
-}
-
-function mails () {
- new=$(~/bin/mcount ~/var/mail/INBOX/new/)
- #cur=$(~/bin/mcount ~/var/mail/INBOX/cur/)
- #val="$new/$cur"
- val="$new"
- ico=${i_mail}
-
- display "$val" "$ico"
-}
-
-function mpd_now_playing () {
- val=$(mpc current --format "$mpc_format" 2>/dev/null)
- ico=${i_musk}
-
- if [[ -z $val ]]; then
- val=''
- ico=''
- fi
-
- display "$val" "$ico"
-}
-
-function volume () {
- val=$(amixer sget $alsa_channel | sed -n 's/.*\[\([0-9/]*%\)\].*/\1/p' | uniq)
- ico=${i_alsa}
-
- display "$val" "$ico"
-}
-
-function battery () {
- val=$(acpi -b | sed 's/^.* \([0-9]*%\).*$/\1/')
- ico=${i_batt}
-
- display "$val" "$ico"
-}
-
-function packages () {
-
- val=$"$(pacman -Q| wc -l) pkg"
- ico=${i_pkgs}
-
- display "$val" "$ico"
-}
-
-function memory () {
-
- mem_tot=$(free -m| sed -n 2p| awk '{print $2}')
- mem_use=$(free -m| sed -n 3p| awk '{print $3}')
- val="$(echo "$mem_use*100/$mem_tot" | bc)%"
- ico=${i_memy}
-
- display "$val" "$ico"
-}
-
-function gputemp () {
-
- val="$(nvidia-smi -q -d TEMPERATURE | grep Gpu | sed 's/.*: //')"
- ico=${i_grap}
-
- display "$val" "$ico"
-}
-
-function gpufanspeed () {
-
- val="$(nvidia-smi -q | grep "Fan" | sed 's/.*: \([0-9]*\).*$/\1/')%"
- ico=${i_fans}
-
- display "$val" "$ico"
-}
-
-function processes () {
-
- val="$(iostat -c | sed -n "4p" | awk -F " " '{print $1}')%"
- ico=${i_load}
-
- display "$val" "$ico"
-}
-
-function network () {
-
- interface_up=$(ip link | grep 'state UP' | wc -l)
-
- if [ ${interface_up} -gt 1 ]; then
- val="multi connection"
- ico=${i_netw}
- else
-
- net_interface=$(ip link| grep 'state UP'|
- sed 's/[0-9]: \([^:]*\):.*$/\1/')
- if [ "$net_interface" = "$net_wire" ]; then
- val=$(ip addr show $net_interface| grep 'inet '|
- sed 's#.* \(.*\)/.*$#\1#')
- ico=${i_netw}
- elif [ "$net_interface" = "$net_wifi" ]; then
- val=$(ip addr show $net_interface| grep 'inet '|
- sed 's#.* \(.*\)/.*$#\1#')
- ico=${i_wifi}
- else
- val=""
- ico=${i_netw}
- fi
- fi
-
- [[ -z "$val" ]] && val="disconnected"
-
- display "$val" "$ico"
-}
-
-function clock () {
- val=$(date +${date_format})
- ico=${i_time}
-
- display "$val" "$ico"
-}
-
-function fillbar () {
- while getopts "B:F:H:LCRO:s:bcflmnprtvw" opt; do
- case $opt in
- # Specific options for bar-aint-recursive
- B) bg=$OPTARG ;; # background color
- F) fg=$OPTARG ;; # foreground color
- H) hl=$OPTARG ;; # highlights color
- L) buffer="${buffer}\l " ;; # left justify
- C) buffer="${buffer}\c " ;; # center text
- R) buffer="${buffer}\r " ;; # right justify
-
- # Which program is the output intended for ? (bar|tmux|none)
- O) OUT=$OPTARG ;;
-
- # Content of the output
- b) [[ -n "$(battery)" ]] && buffer="${buffer}$(battery) ${sp}" ;;
- c) [[ -n "$(clock)" ]] && buffer="${buffer}$(clock) ${sp}" ;;
- f) [[ -n "$(gpufanspeed)" ]] && buffer="${buffer}$(gpufanspeed) ${sp}" ;;
- l) [[ -n "$(mpd_now_playing)" ]] && buffer="${buffer}$(mpd_now_playing) ${sp}" ;;
- m) [[ -n "$(mails)" ]] && buffer="${buffer}$(mails) ${sp}" ;;
- n) [[ -n "$(network)" ]] && buffer="${buffer}$(network) ${sp}" ;;
- p) [[ -n "$(processes)" ]] && buffer="${buffer}$(processes) ${sp}" ;;
- r) [[ -n "$(memory)" ]] && buffer="${buffer}$(memory) ${sp}" ;;
- t) [[ -n "$(gputemp)" ]] && buffer="${buffer}$(gputemp) ${sp}" ;;
- v) [[ -n "$(volume)" ]] && buffer="${buffer}$(volume) ${sp}" ;;
- w) [[ -n "$(groups)" ]] && buffer="${buffer}$(groups) ${sp}" ;;
- esac
- done
-
- # Set the default fg/bg and remove trailing separator (if any)
- echo "$(bg $OUT ${bg})$(fg $OUT ${fg}) $buffer " | sed "s/${sp}$//"
-}
-
-fillbar $@