bash-07-conky.sh 1.14 KB
Newer Older
epsi sayidina's avatar
epsi sayidina committed
1 2
#!/usr/bin/env bash

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
function get_dzen2_parameters() { 
    xpos=0
    ypos=0
    width=640
    height=24

    fgcolor="#000000"
    bgcolor="#ffffff"
    font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"

    parameters="  -x $xpos -y $ypos -w $width -h $height" 
    parameters+=" -fn $font"
    parameters+=" -ta c -bg $bgcolor -fg $fgcolor"
    parameters+=" -title-name dzentop"
}

function generated_output() {
epsi sayidina's avatar
epsi sayidina committed
20 21 22 23 24
    dirname=$(dirname $(readlink -f "$0"))
    path="$dirname/../assets"
    conky -c "$path/conky.lua"
}

25 26 27 28 29 30 31 32
function run_dzen2() {
    get_dzen2_parameters    
    command_out="dzen2 $parameters"
    
    {
        generated_output 
    } | $command_out
}
epsi sayidina's avatar
epsi sayidina committed
33

34 35 36
function detach_dzen2() {    
    run_dzen2 &
}
epsi sayidina's avatar
epsi sayidina committed
37

38 39 40 41 42 43 44 45 46
function detach_transset() { 
    {
        sleep 1
    
        # you may use either xorg-transset or transset-df instead
        # https://github.com/wildefyr/transset-df    
        exec `(transset .8 -n dzentop >/dev/null)`
    } &
}
epsi sayidina's avatar
epsi sayidina committed
47 48 49 50 51 52 53

# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# main

# remove all dzen2 instance
pkill dzen2

54 55
# run process in the background
detach_dzen2
epsi sayidina's avatar
epsi sayidina committed
56 57

# optional transparency
58
detach_transset