Changed lots of things, too lazy to comment it all.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
kill -SIGUSR1 $(cat $HOME/.i3/logs/conky.pid)
|
||||
echo "update" >> ~/test.log
|
||||
kill -SIGUSR1 $(cat $LOGDIR/i3/conky.pid)
|
||||
|
||||
Reference in New Issue
Block a user