This commit is contained in:
2015-09-25 17:14:36 +02:00
parent a989389495
commit 1cdb2bb7f8
18 changed files with 122 additions and 508 deletions

View File

@@ -373,6 +373,6 @@ bar {
}
i3bar_command i3bar
status_command bash ~/.i3/scripts/i3bar_wrapper.bash ~/.i3/conky/statusbar.conkyrc
status_command bash ~/.i3/scripts/i3bar_wrapper.bash ~/.i3/scripts/statusbar.conkyrc
}

View File

@@ -1,3 +0,0 @@
bar {
status_command i3status
}

View File

@@ -1,51 +0,0 @@
# bind some keys
bindsym XF86Sleep exec --no-startup-id $path_i3exit suspend
bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle
bindsym XF86AudioRaiseVolume exec --no-startup-id bash $HOME/.i3/scripts/pa-volume.bash set-vol +5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
bindsym XF86AudioLowerVolume exec --no-startup-id bash $HOME/.i3/scripts/pa-volume.bash set-vol -5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
# keys seemingly switched
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -dec 5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -inc 5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
bindsym XF86AudioPlay exec --no-startup-id mpc toggle
bindsym XF86AudioPrev exec --no-startup-id mpc prev
bindsym XF86AudioNext exec --no-startup-id mpc next
# font for window titles. ISO 10646 = Unicode
font pango:DejaVu Sans Mono 11
bindsym $mod+o exec --no-startup-id "bash -c '~/development/projects/xautorandr/xautorandr ; kill -SIGUSR2 $(cat $HOME/.var/run/wallchanger.pid)'"
bindsym $mod+p exec --no-startup-id "bash -c 'kill -SIGUSR1 $(cat $HOME/.var/run/wallchanger.pid)'"
# start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
# always show at the top of the screen
mode dock
position top
tray_output primary
# show workspace buttons
workspace_buttons yes
id bar-0
font pango:DejaVu Sans, Icons 9
colors {
background #000000
statusline #ffffff
separator #e16b40
focused_workspace #e16b40 #000000 #ffffff
active_workspace #000000 #5f676a #ffffff
inactive_workspace #000000 #000000 #dddddd
urgent_workspace #D00000 #D00000 #000000
}
i3bar_command i3bar
status_command bash ~/.i3/scripts/i3bar_wrapper.bash ~/.i3/conky/netbook.conkyrc
}

View File

@@ -1,50 +0,0 @@
# bind some keys
bindsym XF86Sleep exec --no-startup-id $path_i3exit suspend
bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle
bindsym XF86AudioRaiseVolume exec --no-startup-id bash $HOME/.i3/scripts/pa-volume.bash set-vol +5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
bindsym XF86AudioLowerVolume exec --no-startup-id bash $HOME/.i3/scripts/pa-volume.bash set-vol -5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
# keys seemingly switched
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -dec 5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -inc 5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash"
bindsym XF86AudioPlay exec --no-startup-id mpc toggle
bindsym XF86AudioPrev exec --no-startup-id mpc prev
bindsym XF86AudioNext exec --no-startup-id mpc next
# font for window titles. ISO 10646 = Unicode
font pango:DejaVu Sans Mono 11
bindsym $mod+o exec --no-startup-id "bash -c '~/development/projects/xautorandr/xautorandr ; kill -SIGUSR2 $(cat $HOME/.var/run/wallchanger.pid)'"
bindsym $mod+p exec --no-startup-id "bash -c 'kill -SIGUSR1 $(cat $HOME/.var/run/wallchanger.pid)'"
# start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
# always show at the top of the screen
mode dock
position top
tray_output primary
# show workspace buttons
workspace_buttons yes
id bar-0
font pango:DejaVu Sans, Icons 11
colors {
background #000000
statusline #ffffff
separator #e16b40
focused_workspace #e16b40 #000000 #ffffff
active_workspace #000000 #5f676a #ffffff
inactive_workspace #000000 #000000 #dddddd
urgent_workspace #D00000 #D00000 #000000
}
i3bar_command i3bar
status_command bash ~/.i3/scripts/i3bar_wrapper.bash ~/.i3/conky/notebook.conkyrc
}

View File

@@ -1,73 +0,0 @@
# vim:set filetype=conkyrc:
out_to_console yes
out_to_ncurses no
out_to_stderr no
out_to_x no
short_units yes
double_buffer yes
update_interval 1.0
update_interval_on_battery 1.0
mpd_host 10.11.11.190
mpd_port 6600
# pad_percents is useless without use_spacer, but the latter leads to some ugly gaps
#pad_percents 2
#use_spacer left
#${mpd_artist} - ${mpd_title} ${mpd_elapsed}/${mpd_length}\
TEXT
[\
{ "full_text" : "\
${if_mpd_playing}\
${if_match "${mpd_status}" == "Paused"}\
 \
${else}\
 \
${endif}\
${mpd_title} ${mpd_elapsed}/${mpd_length}\
${else}\
 stopped\
${endif}\
" , "name" : "mpd_toggle" },\
\
\
\
{ "full_text" : "  \
${texeci 5 bash $HOME/.i3/scripts/pa-volume.bash status} " , "color" : "\#FFFFFF" , "name" : "volume" },\
\
\
\
${if_existing /sys/class/power_supply/BAT1}\
${texeci 10 bash $HOME/.i3/scripts/status.d/battery.bash conky}\
${endif}\
\
\
\
{ "full_text" : "  ${kernel} " , "color" : "\#FFFFFF" , "name" : "sysinfo" },\
\
\
\
{ "full_text" : "  ${texeci 60 bash ~/.i3/scripts/status.d/conky_pacman.bash} " , "color" : "\#FFFFFF" , "name" : "pacman" },\
\
\
\
{ "full_text" : "  ${texeci 60 /usr/local/bin/backlight.sh get-current-perc}% " , "color" : "\#FFFFFF" , "name" : "backlight" },\
\
\
\
{ "full_text" : "  $uptime_short " , "color" : "\#FFFFFF" , "name" : "sysinfo" },\
\
\
\
{ "full_text" : "  ${time %a %F %T} " , "color" : "\#FFFFFF" , "name" : "time" },\
\
\
\
{ "full_text" : "" }\
],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -1 +0,0 @@
lockscreen

120
i3/i3/scripts/battery.bash Normal file
View File

@@ -0,0 +1,120 @@
#!/bin/bash
# shitty. this is used for both creating a part of the status conkyrc AND for
# creating nice output if you click on the status bar
# what i done depends on the first paramter
rundir="$RUNDIR/batwarn"
logfile="$LOGDIR/batwarn.log"
[[ ! -d "$rundir" ]] && mkdir -p "$rundir"
PATH_WARN_1="$rundir/batwarn1"
PATH_WARN_2="$rundir/batwarn2"
THRESHOLD1=25
THRESHOLD2=5
acpi_output=$(acpi -b)
if [[ -n "$acpi_output" ]] ; then
has_battery=1
percent="$(echo "$acpi_output" | cut -d "," -f 2 | cut -d " " -f 2 | cut -d "%" -f 1)"
if [[ $percent == 100 ]] ; then
status="Full"
else
status="$(echo "$acpi_output" | cut -d "," -f 1 | cut -d " " -f 3)"
fi
time="$(echo "$acpi_output" | cut -d "," -f 3 | cut -d " " -f 2)"
shortstatus="$(echo $status | cut -c 1)"
else
has_battery=0
fi
log() {
echo [$(date +%FT%T)] "$*" >> $logfile
}
pretty() {
if (( has_battery )) ; then
(
echo "Status:|$status"
echo "Charge:|${percent}%"
if [[ $percent != 100 ]] ; then
echo "Time left:|$time"
fi
) | column -t --separator="|"
fi
}
charging() {
[[ "$shortstatus" == "C" ]]
}
discharging() {
[[ "$shortstatus" == "D" ]]
}
threshold1() {
[[ $percent -le $THRESHOLD1 ]]
}
threshold2() {
[[ $percent -le $THRESHOLD2 ]]
}
conky() {
if (( has_battery )) ; then
if discharging ; then
if threshold2 ; then
if [[ ! -f "$PATH_WARN_2" ]] ; then
log "battery fell below $THRESHOLD2 percent. issuing warning."
echo > "$PATH_WARN_2"
notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%" --expire-time 0
fi
elif threshold1 ; then
if [[ ! -f "$PATH_WARN_1" ]] ; then
log "battery fell below $THRESHOLD1 percent. issuing warning."
echo > "$PATH_WARN_1"
notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%" --expire-time 30000
fi
fi
fi
if charging ; then
if [[ -f "$PATH_WARN_1" ]] ; then
log "charging now. resetting warnings."
rm "$PATH_WARN_1"
fi
[[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
#if [[ $percent -gt 25 ]] ; then
# [[ -f "$PATH_WARN_1" ]] && rm "$PATH_WARN_1"
#elif [[ $percent -gt 5 ]] ; then
# [[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
#fi
fi
if threshold2 ; then
color="#FF0000" # red
elif threshold1 ; then
color="#FFFF00" # yellow
else
color="#FFFFFF" # white
fi
echo "{ \"full_text\" : \"  ${shortstatus} ${percent}% \" , \"color\" : \"$color\" , \"name\" : \"battery\" },"
else
echo "{ \"full_text\" : \"  no battery \" , \"color\" : \"#FFFFFF\" , \"name\" : \"battery\" },"
fi
}
if [[ "$1" == "conky" ]] ; then
conky
else
pretty
fi

View File

@@ -1,55 +0,0 @@
#!/bin/bash
host="$(hostname --short)"
# main configuration file that is always used
MAIN_CONF="$HOME/.i3/config"
# user-specific /var
VARDIR="$HOME/.var"
# user-specific /var/run
RUNDIR="$VARDIR/run"
# temporary configuration file used for this session
SESSION_CONF="$RUNDIR/i3/${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
DEFAULT_CONF="$CONF_DIR/default.config"
LOGFILE="$LOGDIR/i3/genconfig.log"
host_specific_conf="$CONF_DIR/$host.config"
log() {
echo "[$(date +%FT%T)] $*" >> "$LOGFILE"
}
# 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 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
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"
# 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
if [[ -n "$1" ]] ; then
log "telling i3 to reload the config file"
i3-msg reload
fi

0
i3/i3/scripts/i3bar_wrapper.bash Normal file → Executable file
View File

View File

@@ -1,109 +0,0 @@
#!/bin/bash
# shitty. this is used for both creating a part of the status conkyrc AND for
# creating nice output if you click on the status bar
# what i done depends on the first paramter
rundir="$RUNDIR/batwarn"
logfile="$LOGDIR/batwarn.log"
[[ ! -d "$rundir" ]] && mkdir -p "$rundir"
PATH_WARN_1="$rundir/batwarn1"
PATH_WARN_2="$rundir/batwarn2"
THRESHOLD1=25
THRESHOLD2=5
acpi_output=$(acpi -b)
percent="$(echo "$acpi_output" | cut -d "," -f 2 | cut -d " " -f 2 | cut -d "%" -f 1)"
if [[ $percent == 100 ]] ; then
status="Full"
else
status="$(echo "$acpi_output" | cut -d "," -f 1 | cut -d " " -f 3)"
fi
time="$(echo "$acpi_output" | cut -d "," -f 3 | cut -d " " -f 2)"
shortstatus="$(echo $status | cut -c 1)"
log() {
echo [$(date +%FT%T)] "$*" >> $logfile
}
pretty() {
(
echo "Status:|$status"
echo "Charge:|${percent}%"
if [[ $percent != 100 ]] ; then
echo "Time left:|$time"
fi
) | column -t --separator="|"
}
charging() {
[[ "$shortstatus" == "C" ]]
}
discharging() {
[[ "$shortstatus" == "D" ]]
}
threshold1() {
[[ $percent -le $THRESHOLD1 ]]
}
threshold2() {
[[ $percent -le $THRESHOLD2 ]]
}
conky() {
if discharging ; then
if threshold2 ; then
if [[ ! -f "$PATH_WARN_2" ]] ; then
log "battery fell below $THRESHOLD2 percent. issuing warning."
echo > "$PATH_WARN_2"
notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%" --expire-time 0
fi
elif threshold1 ; then
if [[ ! -f "$PATH_WARN_1" ]] ; then
log "battery fell below $THRESHOLD1 percent. issuing warning."
echo > "$PATH_WARN_1"
notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%" --expire-time 30000
fi
fi
fi
if charging ; then
if [[ -f "$PATH_WARN_1" ]] ; then
log "charging now. resetting warnings."
rm "$PATH_WARN_1"
fi
[[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
#if [[ $percent -gt 25 ]] ; then
# [[ -f "$PATH_WARN_1" ]] && rm "$PATH_WARN_1"
#elif [[ $percent -gt 5 ]] ; then
# [[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
#fi
fi
if threshold2 ; then
color="#FF0000" # red
elif threshold1 ; then
color="#FFFF00" # yellow
else
color="#FFFFFF" # white
fi
echo "{ \"full_text\" : \"  "${shortstatus} ${percent}% \" , \"color\" : \"$color\" , \"name\" : \"battery\" },
}
if [[ "$1" == "conky" ]] ; then
conky
else
pretty
fi

View File

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

View File

@@ -1,9 +0,0 @@
#!/bin/bash
echo "Total packages: $(pacman -Qq | wc -l)"
echo
if ! pacman -Qu >/dev/null 2>&1; then
echo "Up to date."
else
echo "Available updates:"
echo "$(pacman -Qu | column -t)"
fi

View File

@@ -1,44 +0,0 @@
columnate() {
column -t --separator="|"
}
freeoutput="$(free -m)"
memtotal=$(echo "$freeoutput" | head -2 | tail -1 | tr -s " " | cut -d " " -f 2)
memused=$(echo "$freeoutput" | head -3 | tail -1 | tr -s " " | cut -d " " -f 3)
(echo "Current user:|$(whoami)"
echo "Hostname:|$(hostname)"
echo "Uptime:|$(uptime --pretty | cut -d " " -f 2-)"
echo "Kernel:|$(uname -r)"
echo "Packages:|$(pacman -Qq | wc -l)") | columnate
echo ""
echo "CPU:"
(echo "Name:|$(lscpu | grep "Model name:" | tr -s " " | cut -d " " -f 3-)"
echo "Architecture:|$(uname -m)"
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 ""
echo "PROCS:"
(echo "x x CPU% MEM% x x x x x x COMMAND" ; ps aux | grep -v '^USER' | sort -nrk 3 | tr -s " " | cut -d " " -f -11 | uniq -uf 10 | head -10) | cut -d " " -f 3,4,11 | column -t
echo ""
echo "STORAGE:"
df -hT --type=btrfs --type=ext4 --total
echo ""
echo "SWAP:"
if [[ -z "$(swapon)" ]] ; then
echo "none"
else
i=0
swapon | (while read line; do
[[ $i == 0 ]] && { i=1 ; continue ; }
swappath=$(echo $line | cut -d ' ' -f 1)
swapused=$(echo $line | cut -d ' ' -f 4)
swaptotal=$(echo $line | cut -d ' ' -f 3)
echo "${swappath}:|${swapused}/${swaptotal}"
done) | columnate
fi

View File

@@ -1,55 +0,0 @@
#!/bin/bash
INTERFACE="wlp2s0"
TIMEFORMAT="+%F %R"
iwconfig_output="$(iwconfig $INTERFACE)"
columnize() {
column -t --separator="|"
}
essid=$(echo "$iwconfig_output" | sed -n "1p" | awk -F '"' '{print $2}')
mode=$(echo "$iwconfig_output" | sed -n "1p" | awk -F " " '{print $3}')
freq=$(echo "$iwconfig_output" | sed -n "2p" | awk -F " " '{print $2}' | cut -d":" -f2)
mac=$(echo "$iwconfig_output" | sed -n "2p" | awk -F " " '{print $6}')
qual=$(echo "$iwconfig_output" | sed -n "6p" | awk -F " " '{print $2}' | cut -d"=" -f2)
lvl=$(echo "$iwconfig_output" | sed -n "6p" | awk -F " " '{print $4}' | cut -d"=" -f2)
rate=$(echo "$iwconfig_output" | sed -n "3p" | awk -F "=" '{print $2}' | cut -d" " -f1)
ip=$(ip addr show $INTERFACE | grep "[[:space:]]*inet" | head -n 1 | tr -s " " | cut -d " " -f 3 | cut -d "/" -f 1)
vnstat_output="$(vnstat --dumpdb)"
txhour=$(echo "$vnstat_output" | grep "^h;0;" | cut -d ";" -f 5)
rxhour=$(echo "$vnstat_output" | grep "^h;0;" | cut -d ";" -f 4)
txtoday=$(echo "$vnstat_output" | grep "^d;0;" | cut -d ";" -f 5)
rxtoday=$(echo "$vnstat_output" | grep "^d;0;" | cut -d ";" -f 4)
txtotal=$(echo "$vnstat_output" | grep "^totaltx;" | cut -d ";" -f 2)
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")"
txhour=$(( $txhour / 1024 ))
rxhour=$(( $rxhour / 1024 ))
echo -e "Interface $INTERFACE:\n"
(
echo "IP:|$ip"
echo "ESSID:|$essid"
echo "Mode:|$mode"
echo "Frequency:|$freq"
echo "MAC address:|$mac"
echo "Quality:|$qual"
echo "Signal level:|$lvl dBm"
echo "Bitrate:|$rate Mb/s"
) | columnize
echo -e "\nUsage:\n"
(
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 ""
) | columnize
echo -e "\nLast update at: $vnstat_last_update"

View File

@@ -11,10 +11,6 @@ double_buffer yes
update_interval 1.0
update_interval_on_battery 1.0
mpd_host 10.11.11.190
mpd_port 6600
# pad_percents is useless without use_spacer, but the latter leads to some ugly gaps
#pad_percents 2
#use_spacer left
@@ -22,29 +18,12 @@ mpd_port 6600
#${mpd_artist} - ${mpd_title} ${mpd_elapsed}/${mpd_length}\
TEXT
[\
{ "full_text" : "\
${if_mpd_playing}\
${if_match "${mpd_status}" == "Paused"}\
 \
${else}\
 \
${endif}\
${mpd_title} ${mpd_elapsed}/${mpd_length}\
${else}\
 stopped\
${endif}\
" , "name" : "mpd_toggle" },\
\
\
\
{ "full_text" : "  \
${texeci 5 bash $HOME/.i3/scripts/pa-volume.bash status} " , "color" : "\#FFFFFF" , "name" : "volume" },\
\
\
\
${if_existing /sys/class/power_supply/BAT1}\
${texeci 10 bash $HOME/.i3/scripts/status.d/battery.bash conky}\
${endif}\
${texeci 10 bash $HOME/.i3/scripts/battery.bash conky}\
\
\
\
@@ -52,10 +31,6 @@ ${endif}\
\
\
\
{ "full_text" : "  ${texeci 60 bash ~/.i3/scripts/status.d/conky_pacman.bash} " , "color" : "\#FFFFFF" , "name" : "pacman" },\
\
\
\
{ "full_text" : "  $uptime_short " , "color" : "\#FFFFFF" , "name" : "sysinfo" },\
\
\

View File

@@ -1,21 +0,0 @@
#!/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]