Created
October 17, 2010 23:52
-
-
Save fearphage/631467 to your computer and use it in GitHub Desktop.
Prints opera stats. (Used for conky)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#version 0.1 | |
cd ~/browser-installs/profile/ | |
#Opera tab count | |
if [ -e "sessions/autosave.win" ]; then | |
tab_opera_c=`egrep 'window count=([0-9]*)' sessions/autosave.win | awk '{split($2, s, "="); print s[2]}'` | |
window_opera_c=`grep -c 'type=0' sessions/autosave.win` | |
actual_opera_c=$(($tab_opera_c - $window_opera_c)) | |
echo "- "$actual_opera_c" tabs in "$window_opera_c" windows" | |
fi | |
#Opera bookmark count | |
if [ -e "bookmarks.adr" ]; then | |
bkmk_bookmarks_c=`grep -c '#URL' bookmarks.adr` | |
fldr_bookmarks_c=`grep -c '#FOLDER' bookmarks.adr` | |
echo "- "$bkmk_bookmarks_c" bookmarks in "$fldr_bookmarks_c" folders" | |
fi | |
#Opera notes count | |
if [ -e "notes.adr" ]; then | |
nts_notes_c=`grep -c '#NOTE' notes.adr` | |
fldr_notes_c=`grep -c '#FOLDER' notes.adr` | |
echo "- "$nts_notes_c" notes in "$fldr_notes_c" folders" | |
fi | |
#Opera search engine count | |
if [ -e "search.ini" ]; then | |
search_opera_c=`grep -c '\[Search\ Engine' search.ini` | |
echo "- "$search_opera_c" saved search engines" | |
fi | |
#Opera speed dial count | |
if [ -e "speeddial.ini" ]; then | |
spd_opera_c=`grep -c '\[Speed\ Dial' speeddial.ini` | |
spd_x=`egrep 'Rows=([0-9]*)' speeddial.ini | awk '{split($1, s, "="); print s[2]}'` | |
spd_y=`egrep 'Columns=([0-9]*)' speeddial.ini | awk '{split($1, s, "="); print s[2]}'` | |
if [ "$spd_x" != "" ] && [ "$spd_y" != "" ]; then | |
echo "- "$spd_opera_c" saved speed dials ("$spd_x"x"$spd_y")" | |
fi | |
fi | |
#Opera blocked content count | |
if [ -e "urlfilter.ini" ]; then | |
bc_opera_c=$(expr $(sed -n '/\[exclude\]/,/\[/p' urlfilter.ini | sed -e '/./!d' | wc -l) - 1) | |
echo "- "$bc_opera_c" blocked content urls" | |
fi | |
#Opera cache size | |
if [ -d "cache" ]; then | |
cache_opera_c=`du -hs cache/ | awk '{print $1}'` | |
echo "- "$cache_opera_c" in cache" | |
fi | |
#Opera memory size (not perfect) | |
mem_opera_c=`ps aux | egrep 'opera -pd' | awk '{print $5}'` | |
if [ "$mem_opera_c" != "" ]; then | |
mem_opera_c=$(($mem_opera_c / 1024)) | |
echo "- "$mem_opera_c"M in virtual memory" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment