Dig/conky: verschil tussen versies

Uit FOK!wiki
Ga naar: navigatie, zoeken
 
(4 tussenliggende versies door 2 gebruikers niet weergegeven)
Regel 1: Regel 1:
== Shaded background in Conky ==
+
== Shaded transparent background in Conky ==
  
 
Geïnstalleerd op Ubuntu Karmic alpha 4, KDE 4.3
 
Geïnstalleerd op Ubuntu Karmic alpha 4, KDE 4.3
Regel 33: Regel 33:
  
 
<pre>
 
<pre>
 +
 
#!/bin/bash
 
#!/bin/bash
# License: Public domain
 
  
PATH=/usr/bin/:/bin:$HOME/bin
+
PATH=/usr/bin/:/bin
  
## KDE 4.3 code fails http://forum.kde.org/viewtopic.php?f=15&t=6606
+
## KDE 4.3
 
# WALL_PAPER=$(qdbus org.kde.plasma-desktop /MainApplication reparseConfiguration)
 
# WALL_PAPER=$(qdbus org.kde.plasma-desktop /MainApplication reparseConfiguration)
 +
# I don't suspect this line is to portable across KDE users, since I suspect the tail/head commands are tweaked for my env.
 +
WALL_PAPER=$(grep 'wallpaper=' $HOME/.kde/share/config/plasma-desktop-appletsrc | tail -2 | head -1 | awk -F= '{print $NF}')
 
## KDE3:
 
## KDE3:
# WALL_PAPER=$(dcop kdesktop KBackgroundIface currentWallpaper 1)
+
#WALL_PAPER=$(dcop kdesktop KBackgroundIface currentWallpaper 1)
  
WALL_PAPER=$HOME/path/to/wallpaper.jpg
 
 
GRAY_PAPER=$HOME/.conkybg.png
 
GRAY_PAPER=$HOME/.conkybg.png
  
 
# Check md5 to see if we have to run convert
 
# Check md5 to see if we have to run convert
F_MD5SUM=${GRAY_PAPER}.md5sum
+
F_MD5SUM=$GRAY_PAPER.md5
 
MD5SUM=$(cat $F_MD5SUM 2>/dev/null)
 
MD5SUM=$(cat $F_MD5SUM 2>/dev/null)
 
NEW_MD5=$(md5sum "$WALL_PAPER" | awk '{print $1}')
 
NEW_MD5=$(md5sum "$WALL_PAPER" | awk '{print $1}')
  
# Takes of 7 seconds if we don't need to run convert
 
 
if [ "$MD5SUM" != "$NEW_MD5" ] || [ ! -e "$GRAY_PAPER" ] ; then
 
if [ "$MD5SUM" != "$NEW_MD5" ] || [ ! -e "$GRAY_PAPER" ] ; then
     convert-wallpaper.rb "$WALL_PAPER" "$GRAY_PAPER"
+
     $HOME/bin/convert-wallpaper.rb "$WALL_PAPER" "$GRAY_PAPER"
 
     echo "$NEW_MD5" > $F_MD5SUM
 
     echo "$NEW_MD5" > $F_MD5SUM
 +
    cat $F_MD5SUM
 
fi
 
fi
  
feh --bg-scale "$GRAY_PAPER"
+
# DISPLAY=:0.0 is so we can run from crontabs and still be able to set the
conky
+
# wallpaper
 +
[ -r "$GRAY_PAPER" ] && DISPLAY=:0.0 feh --bg-scale "$GRAY_PAPER"
 +
 
 +
pgrep -x conky &>/dev/null
 +
[ $? -ne 0 ] && conky
 
</pre>
 
</pre>
  
Regel 151: Regel 156:
  
 
Dit alles ziet er zo uit: http://opperschaap.net/~wesleys/conky_kde_karmic.png
 
Dit alles ziet er zo uit: http://opperschaap.net/~wesleys/conky_kde_karmic.png
 +
 +
[[categorie:DIG]] [[categorie:conky]] [[categorie:linux]]

Huidige versie van 3 sep 2009 om 09:58

Shaded transparent background in Conky[bewerken]

Geïnstalleerd op Ubuntu Karmic alpha 4, KDE 4.3

  • Installeer alle benodigdheden.
sudo aptitude install feh librmagick-ruby rubygems ruby1.8-dev libmagickcore-dev libmagickwand-dev
sudo gem install --remote rmagick
  • Maak de file $HOME/bin/convert-wallpaper.rb aan
#!/usr/bin/env ruby
#
# Original author:
# http://www.kde-look.org/content/show.php/Transparent+Conky+Theme?content=99696
# License: GPL

require 'rubygems'
require 'RMagick'

# TODO: if ARGV's are not set, abort

src_image = Magick::Image.read(ARGV[0]).first
# The higher the value, the lighter the image gets
dst_image = src_image.quantize(Magick::QuantumRange,Magick::GRAYColorspace).modulate(0.40)
dst_image.write(ARGV[1])
  • Maak de file ~/.kde/Autostart/conky.sh aan

#!/bin/bash

PATH=/usr/bin/:/bin

## KDE 4.3
# WALL_PAPER=$(qdbus org.kde.plasma-desktop /MainApplication reparseConfiguration)
# I don't suspect this line is to portable across KDE users, since I suspect the tail/head commands are tweaked for my env.
WALL_PAPER=$(grep 'wallpaper=' $HOME/.kde/share/config/plasma-desktop-appletsrc | tail -2 | head -1 | awk -F= '{print $NF}')
## KDE3:
#WALL_PAPER=$(dcop kdesktop KBackgroundIface currentWallpaper 1)

GRAY_PAPER=$HOME/.conkybg.png

# Check md5 to see if we have to run convert
F_MD5SUM=$GRAY_PAPER.md5
MD5SUM=$(cat $F_MD5SUM 2>/dev/null)
NEW_MD5=$(md5sum "$WALL_PAPER" | awk '{print $1}')

if [ "$MD5SUM" != "$NEW_MD5" ] || [ ! -e "$GRAY_PAPER" ] ; then
    $HOME/bin/convert-wallpaper.rb "$WALL_PAPER" "$GRAY_PAPER"
    echo "$NEW_MD5" > $F_MD5SUM
    cat $F_MD5SUM
fi

# DISPLAY=:0.0 is so we can run from crontabs and still be able to set the 
# wallpaper
[ -r "$GRAY_PAPER" ] && DISPLAY=:0.0 feh --bg-scale "$GRAY_PAPER"

pgrep -x conky &>/dev/null
[ $? -ne 0 ] && conky
  • Maak de file $HOME/.conkyrc aan
background yes
use_xft yes
xftfont HandelGotDLig:size=8
xftalpha 2.8
update_interval 1.0
total_run_times 0
own_window yes
own_window_type normal
#own_window_type widget
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 300 700
maximum_width 300
draw_shades yes
draw_outline no
draw_borders yes
draw_graph_borders yes
default_color green
default_shade_color black
default_outline_color green
alignment top_right
gap_x 7
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

# Alles onder TEXT is hetgeen wat je laat zien in Conky
TEXT
${font OpenLogos:size=10}u${font} $nodename ${alignr}${kernel}
${hr 2}
$uptime_short, $alignc $user_number users, $alignr load avg $loadavg
$processes processes ($running_processes running)
$mem / $memmax $alignr $memperc% ${membar 5,150}
swap $alignc $swap / $swapmax $alignr $swapperc%
${swapbar}

${font StyleBats:size=10}A${font} CPU $freq MHz${hr 2}
cpu0 $alignc ${cpu cpu0}% $alignr ${cpugraph cpu0 10,180}
cpu1 $alignc ${cpu cpu1}% $alignr ${cpubar cpu1 5,210}
cpu2 $alignc ${cpu cpu2}% $alignr ${cpubar cpu2 5,210}
${font Pie charts for maps:size=10}7${font} HDD TEMP ${hddtemp /dev/sda}C ${hr 2}
/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}
/var/log $alignc ${fs_used /var/log} / ${fs_size /var/log} $alignr ${fs_used_perc /var/log}%
${fs_bar /var/log}
/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_used_perc /home}%
${fs_bar /home}

${font Pie charts for maps:size=10}7${font} REMOTE MOUNTS ${hr 2}
${if_mounted /mnt/samba/home} /mnt/samba/home $alignc ${fs_used /mnt/samba/home} / ${fs_size /mnt/samba/home} $alignr ${fs_used_perc /mnt/samba/home}%
${fs_bar /mnt/samba/home} $else /mnt/samba/home not mounted $endif
${if_mounted /mnt/samba/public} /mnt/samba/public $alignc ${fs_used /mnt/samba/public} / ${fs_size /mnt/samba/public} $alignr ${fs_used_perc /mnt/samba/public}%
${fs_bar /mnt/samba/public} $else /mnt/samba/public not mounted $endif

${font StyleBats:size=10}q${font} NETWORKING ${hr 2}
eth0 $alignr ${addrs eth0}
${font PizzaDude Bullets:size=6}N${font} ${totalup eth0} / ${upspeed eth0} $alignr ${upspeedgraph eth0 10,100}
${font PizzaDude Bullets:size=6}T${font} ${totaldown eth0} / ${downspeed eth0} $alignr ${downspeedgraph eth0 10,100}
wlan0 $alignc ${wireless_bitrate wlan0} $alignc ${wireless_ap wlan0} $alignr ${addrs wlan0}
${wireless_essid wlan0} (${wireless_mode wlan0}) $alignr ${wireless_link_qual wlan0}/${wireless_link_qual_max wlan0} ${wireless_link_qual_perc wlan0}%
${wireless_link_bar wlan0}
${font PizzaDude Bullets:size=7}N${font} ${totalup wlan0} ${upspeed wlan0} $alignr ${upspeedgraph wlan0 10,100}
${font PizzaDude Bullets:size=7}T${font} ${totaldown wlan0} ${downspeed wlan0} $alignr ${downspeedgraph wlan0 10,100}

BATTERY $battery_short ${battery_time}
$battery_bar

DATE ${hr 2}
${time %H:%M:%S}${font} ${alignr} ${time %A %d %Y}
  • Maak beide files executable
chmod +x $HOME/bin/convert-wallpaper.rb $HOME/.kde/Autostart/conky.sh
  • Start conky
$HOME/.kde/Autostart/conky.sh
# Of logout/login

Dit alles ziet er zo uit: http://opperschaap.net/~wesleys/conky_kde_karmic.png