Changes.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
host="$(hostname --short)"
|
||||
|
||||
# main configuration file that is always used
|
||||
MAIN_CONF="$HOME/.i3/config"
|
||||
# temporary configuration file used for this session
|
||||
SESSION_CONF="$HOME/.i3/session.config"
|
||||
SESSION_CONF="$HOME/.i3/session.${host}.config"
|
||||
# directory that contains host specific configuration
|
||||
CONF_DIR="$HOME/.i3/config.d"
|
||||
# file that should be used when no host specific configuration present
|
||||
@@ -11,21 +13,19 @@ DEFAULT_CONF="$CONF_DIR/default"
|
||||
|
||||
LOGFILE="$LOGDIR/i3/genconfig.log"
|
||||
|
||||
host_specific_conf="$CONF_DIR/$host.config"
|
||||
|
||||
log() {
|
||||
echo "[$(date +%FT%T)] $*" >> "$LOGFILE"
|
||||
}
|
||||
|
||||
host="$(hostname)"
|
||||
|
||||
host_specific_conf="$CONF_DIR/$host.config"
|
||||
|
||||
# if it's a symlink to $MAIN_CONF, cat will fail
|
||||
[[ -f "$SESSION_CONF" ]] && rm "$SESSION_CONF"
|
||||
|
||||
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"
|
||||
log "neither config for host $host at $host_specific_conf 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
|
||||
|
||||
@@ -28,6 +28,10 @@ setvol() {
|
||||
echo "capping at 100 percent"
|
||||
newvol=100
|
||||
fi
|
||||
if [[ $newvol -lt 0 ]]; then
|
||||
echo "capping at 0 percent"
|
||||
newvol=0
|
||||
fi
|
||||
echo "newvol $newvol"
|
||||
else
|
||||
newvol="$1"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
updates=$(pacman -Quq | wc -l)
|
||||
if [[ $updates -eq 0 ]] ; then
|
||||
echo "no updates"
|
||||
echo "up to date"
|
||||
elif [[ $updates -eq 1 ]] ; then
|
||||
echo "1 update"
|
||||
else
|
||||
|
||||
21
i3/i3/scripts/weather.sh
Executable file
21
i3/i3/scripts/weather.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
#AccuWeather (r) RSS weather tool for conky
|
||||
#
|
||||
#USAGE: weather.sh <locationcode>
|
||||
#
|
||||
#(c) Michael Seiler 2007
|
||||
|
||||
METRIC=1 #Should be 0 or 1; 0 for F, 1 for C
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo
|
||||
echo "USAGE: weather.sh <locationcode>"
|
||||
echo
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 | grep "Currently" | head -1 | grep -o 'Currently:[^<]*' | cut -d ' ' -f 2- | tr ':' ','
|
||||
# | perl -ne 'if (/Currently/) {chomp;/\<title\>Currently: (.*)?\<\/title\>/; print "$1"; }' |sed s/\:// |tr [A-Z] [a-z]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user