Changed lots of things, too lazy to comment it all.

This commit is contained in:
2014-04-22 22:15:26 +02:00
parent 54686eef5a
commit 95f5781a21
15 changed files with 181 additions and 538 deletions

View File

@@ -16,8 +16,26 @@ update_interval_on_battery 1.0
#use_spacer left
TEXT
[
{ "full_text" : " " }, \
[\
{ "full_text" : "\
${if_running mpd}\
${if_mpd_playing}\
${if_match "${mpd_status}" == "Paused"}\
\
${else}\
\
${endif}\
${mpd_artist} - ${mpd_title} ${mpd_elapsed}/${mpd_length}\
${else}\
 stopped\
${endif}\
${else}\
 down\
${endif}\
" , "name" : "mpd" },\
\
\
\
${if_existing /sys/class/net/wlp2s0}\
{ "full_text" : "  \
${if_up wlp2s0}\
@@ -45,11 +63,11 @@ ${endif}\
${else}\#FF0000\
${endif}\
" , "name" : "wireless" },\
${endif}
${endif}\
\
\
\
${if_existing /sys/class/net/enp0s3}
${if_existing /sys/class/net/enp0s3}\
{ "full_text" : " \
enp0s3: \
${if_up enp0s3}\
@@ -65,11 +83,11 @@ ${endif}\
${else}\#FF0000\
${endif}\
" },\
${endif}
${endif}\
\
\
\
${if_existing /sys/class/net/enp1s0}
${if_existing /sys/class/net/enp1s0}\
{ "full_text" : " \
enp1s0: \
${if_up enp1s0}\
@@ -85,11 +103,11 @@ ${endif}\
${else}\#FF0000\
${endif}\
" },\
${endif}
${endif}\
\
\
\
${if_existing /sys/class/net/eth0}
${if_existing /sys/class/net/eth0}\
{ "full_text" : " \
eth0: \
${if_up eth0}\
@@ -105,17 +123,17 @@ ${endif}\
${else}\#FF0000\
${endif}\
" },\
${endif}
${endif}\
\
\
\
{ "full_text" : "  \
${pre_exec bash $HOME/.i3/scripts/pa-volume.bash status} " , "color" : "\#FFFFFF" , "name" : "volume" },\
${texeci 3600 bash $HOME/.i3/scripts/pa-volume.bash status} " , "color" : "\#FFFFFF" , "name" : "volume" },\
\
\
\
${if_existing /sys/class/power_supply/BAT1}\
${execi 10 bash $HOME/.i3/scripts/status.d/battery.bash conky}\
${texeci 10 bash $HOME/.i3/scripts/status.d/battery.bash conky}\
${endif}\
\
\
@@ -124,7 +142,7 @@ ${endif}\
\
\
\
{ "full_text" : "  ${execi 60 bash ~/.i3/scripts/status.d/conky_pacman.bash} " , "color" : "\#FFFFFF" , "name" : "pacman" },\
{ "full_text" : "  ${texeci 60 bash ~/.i3/scripts/status.d/conky_pacman.bash} " , "color" : "\#FFFFFF" , "name" : "pacman" },\
\
\
\

View File

@@ -10,12 +10,12 @@ X_MAX=1920
# paths to scripts used.
PA_VOLUME_SCRIPT="$HOME/.i3/scripts/pa-volume.bash"
I3BAR_UPDATE="$HOME/.i3/scripts/update-status.bash"
LOGFILE="$HOME/.i3/logs/output_i3bar.log"
LOGFILE="$LOGDIR/i3/i3log_wrapper.log"
SCRIPTS_SYSINFO="$HOME/.i3/scripts/status.d/sysinfo.bash"
SCRIPTS_WIRELESS="$HOME/.i3/scripts/status.d/wireless.bash"
SCRIPTS_BATTERY="$HOME/.i3/scripts/status.d/battery.bash"
SCRIPTS_PACMAN="$HOME/.i3/scripts/status.d/pacman.bash"
PIDFILE="$HOME/.i3/logs/conky.pid"
PIDFILE="$LOGDIR/i3/conky.pid"
COLOR_FG="#FFFFFF"
COLOR_BG="#222222"
@@ -25,12 +25,15 @@ YAD_PREFIX="GTK2_RC_FILES=$GTK_THEME"
FONT="DejaVu Sans Mono 11"
mkdir -p "$(dirname $LOGFILE)"
echo > "$LOGFILE"
log() {
echo $* >> "$LOGFILE"
echo "[$(date +%FT%T)] $*" >> "$LOGFILE"
}
log "START"
update() {
bash $I3BAR_UPDATE
}
@@ -73,12 +76,16 @@ while read line ; do
# to i3bar and crash it due to wrong formatting.
log "line: $line"
[[ "$line" == "[" ]] && continue
name="$(getval "$line" "name")"
log "name: $name"
case "$name" in
"mpd")
mpc toggle 1>/dev/null 2>%1
;;
"pacman")
width=500
height=700
@@ -198,4 +205,3 @@ while read line ; do
esac
done

View File

@@ -9,6 +9,14 @@ CONF_DIR="$HOME/.i3/config.d"
# file that should be used when no host specific configuration present
DEFAULT_CONF="$CONF_DIR/default"
LOGFILE="$LOGDIR/i3/genconfig.log"
mkdir -p "$(dirname $LOGFILE)"
log() {
echo "[$(date +%FT%T)] $*" >> "$LOGFILE"
}
host="$(hostname)"
host_specific_conf="$CONF_DIR/$host.config"
@@ -19,15 +27,19 @@ host_specific_conf="$CONF_DIR/$host.config"
if [[ ! -f "$host_specific_conf" ]] && [[ ! -f "$DEFAULT_CONF" ]]; then
# if there is no host-specific configuration and no default one, just use
# the main config
log "neither config for host $host nor default config at $DEFAULT_CONF found, using main only"
ln -sf "$MAIN_CONF" "$SESSION_CONF"
else
# either use the host specific config if present, or the default if not
if [[ -f "$host_specific_conf" ]]; then
log "found config for host $host at $host_specific_conf"
conf_to_use="$host_specific_conf"
else
log "no config for host $host found, using default one"
conf_to_use="$DEFAULT_CONF"
fi
cat "$MAIN_CONF" <(echo -e "\n###\n### host-specific configuration for host \"$host\"\n###\n") "$conf_to_use" > "$SESSION_CONF"
log "created session config at $SESSION_CONF"
fi
echo "$SESSION_CONF"
@@ -35,4 +47,7 @@ echo "$SESSION_CONF"
# if we got any parameters, tell i3 to reload the config
# so the script can be used both on startup without reload (as i3 is not even
# running yet) and later when reloading
[[ -n "$1" ]] && i3-msg reload
if [[ -n "$1" ]] ; then
log "telling i3 to reload the config file"
i3-msg reload
fi

View File

@@ -2,16 +2,19 @@
### From http://www.archlinux.org/index.php/i3
LOGFILE="$HOME/.i3/logs/i3exit.log"
LOGFILE="$LOGDIR/i3/i3exit.log"
LOGFILE_MAXSIZE=100000
FALLBACK_COLOR=000000
mkdir -p "$(dirname $LOGFILE)"
touch "$LOGFILE"
[[ $(stat -c%s "$LOGFILE") -gt $LOGFILE_MAXSIZE ]] && >$LOGFILE
log()
{
echo "$(date "+%Y-%m-%d %H:%M:%S") $1" >> "$LOGFILE"
echo "[$(date +%FT%T)] $1" >> "$LOGFILE"
}
lock()

View File

@@ -8,7 +8,23 @@ getvol() {
}
setvol() {
pactl set-sink-volume $SINK $(( $1 * 65536 / 100 ))
if [[ $1 =~ [+-][0-9]+ ]] ; then
oldvol="$(getvol)"
echo "oldvol $oldvol"
delta="$(echo "$1" | cut -c 2-)"
echo "delta $delta"
if [[ "$(echo "$1" | cut -c 1)" == "+" ]] ; then
echo "+"
newvol=$(( $oldvol + $delta ))
else
echo "-"
newvol=$(( $oldvol - $delta ))
fi
echo "newvol $newvol"
else
newvol="$1"
fi
pactl set-sink-volume $SINK $(( $newvol * 65536 / 100 ))
}
ismuted() {
@@ -57,15 +73,19 @@ case "$1" in
else
setvol "$2"
fi
hook="$3"
;;
"mute")
mute
hook="$2"
;;
"unmute")
unmute
hook="$2"
;;
"mute-toggle")
mute-toggle
hook="$2"
;;
"is-muted")
echo $(ismuted)
@@ -74,6 +94,11 @@ case "$1" in
echo $(status)
;;
*)
echo "wrong usage"
usage
;;
esac
if [[ -n "$hook" ]] ; then
echo "volume changed, executing hook: $hook"
$hook
fi

View File

@@ -4,8 +4,10 @@
# creating nice output if you click on the status bar
# what i done depends on the first paramter
PATH_WARN_1="$HOME/.i3/logs/batwarn1"
PATH_WARN_2="$HOME/.i3/logs/batwarn2"
[[ ! -d "$LOGDIR/batwarn" ]] && mkdir -p "$LOGDIR/batwarn"
PATH_WARN_1="$LOGDIR/batwarn/batwarn1"
PATH_WARN_2="$LOGDIR/batwarn/batwarn2"
THRESHOLD1=25
THRESHOLD2=5
@@ -51,12 +53,12 @@ conky() {
if threshold2 ; then
if [[ ! -f "$PATH_WARN_2" ]] ; then
echo > "$PATH_WARN_2"
notify-send --icon dialog-warning "Battery below 5%"
notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%"
fi
elif threshold1 ; then
if [[ ! -f "$PATH_WARN_1" ]] ; then
echo > "$PATH_WARN_1"
notify-send --icon dialog-warning "Battery below 25%"
notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%"
fi
fi
fi

View File

@@ -1,8 +1,10 @@
#!/bin/bash
updates=$(pacman -Quq | wc -l)
if [[ $updates == 0 ]] ; then
if [[ $updates -eq 0 ]] ; then
echo "no updates"
elif [[ $updates -eq 1 ]] ; then
echo "1 update"
else
echo "$updates updates"
fi

View File

@@ -20,7 +20,7 @@ echo "Temp:|$(sensors -u | grep "temp1_input" | cut -d ":" -f 2 | cut -d "." -f
echo "Load:|$(uptime | tr -s " " | cut -d " " -f 10 | tr -d ",")") | columnate
echo ""
echo "MEM:"
echo "${memused}MB / ${memtotal}MB ($(( $memused * 100 / $memtotal ))% used)"
echo "${memused}MB / ${memtotal}MB ($(( $memused * 100 / $memtotal ))%) used"
echo ""
echo "PROCS:"
(echo "x x cpu% mem% x x x x x x command" ; ps aux | sort -nrk 3 | tr -s " " | cut -d " " -f -11 | uniq -uf 10 | head -10) | cut -d " " -f 3,4,11 | column -t

View File

@@ -28,7 +28,10 @@ rxtotal=$(echo "$vnstat_output" | grep "^totalrx;" | cut -d ";" -f 2)
vnstat_created="$(date --date=@$(echo "$vnstat_output" | grep "^created;" | cut -d ";" -f 2) "$TIMEFORMAT")"
vnstat_last_update="$(date --date=@$(echo "$vnstat_output" | grep "^updated;" | cut -d ";" -f 2) "$TIMEFORMAT")"
echo "Interface $INTERFACE:"
txhour=$(( $txhour / 1024 ))
rxhour=$(( $rxhour / 1024 ))
echo -e "Interface $INTERFACE:\n"
(
echo "IP:|$ip"
echo "ESSID:|$essid"
@@ -39,17 +42,14 @@ echo "Quality:|$qual"
echo "Signal level:|$lvl dBm"
echo "Bitrate:|$rate Mb/s"
) | columnize
echo ""
echo "Usage:"
echo -e "\nUsage:\n"
(
echo "Hourly up:|${txhour} KiB"
echo "Hourly down:|${rxhour} KiB"
echo "Daily up:|${txtoday} MiB"
echo "Daily down:|${rxtoday} MiB"
echo "Total up:|${txtotal} MiB"
echo "Total down:|${rxtotal} MiB"
echo "Hourly up:|${txhour}|MiB"
echo "Hourly down:|${rxhour}|MiB"
echo "Daily up:|${txtoday}|MiB"
echo "Daily down:|${rxtoday}|MiB"
echo "Total up:|${txtotal}|MiB"
echo "Total down:|${rxtotal}|MiB"
echo ""
echo "Database created at:|$vnstat_created"
echo "Last update at:|$vnstat_last_update"
) | columnize
echo -e "\nLast update at: $vnstat_last_update"

View File

@@ -1 +1,2 @@
kill -SIGUSR1 $(cat $HOME/.i3/logs/conky.pid)
echo "update" >> ~/test.log
kill -SIGUSR1 $(cat $LOGDIR/i3/conky.pid)