Page 23 of 32 FirstFirst ... 132122232425 ... LastLast
Results 221 to 230 of 313

Thread: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

  1. #221
    Join Date
    Aug 2009
    Location
    East of Atlantic
    Beans
    81
    Distro
    Ubuntu

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Hi all !

    I am an Openbox + Ubuntu user but sometimes, I can't remember some shortcuts. So I wrote a script to display the shorcuts (keyboard+mouse) from rc.xml in a conky window, and this window is called with a shortcut (!) only when I need it. Maybe this kind of script already exist but I didn't find it .

    First I need a conkyrc template . The python script will use this file to create a conkyrc in a new file.
    The only thing to do in this file is to choose yours colors.
    The name of the file is conky_template.

    The python script shortcuts.py read the openbox's rc.xml file.
    There are some parameters to set at the beginning of the script :
    Code:
    #!/usr/bin/env python
    # coding=utf-8
    
    #this script read the file rc.xml for OpenBox configuration
    #and returns the shortcuts for Mouse ou Keyboard in a file called by conky
    #wlourf 07/03/2010  http://u-scripts.blogspot.com/
    
    import sys
    import xml.etree.ElementTree as etree
    
    #full path and name of the rc.xml file
    rc_path_file="/home/ll/.config/openbox/rc.xml"
    #template of conkyrc to use
    conkytemplate_path_file ="/home/ll/scripts/raccourcis/conky_template"
    
    #column width (Ms = souris, Kb= clavier)
    lgColMs=50
    lgColKb=40
    
    #Number of lines per Column (Ms = souris, Kb= clavier)
    nbLnMs=30
    nbLnKb=30
    
    #in "Keyboard" array, "appliFirst" will display application name before shorcut
    appliFirst=True
    
    #END OF THE PARAMETERS !
    Next, a little bash script launcher.sh needed to run the python script and to call conky. Don't forget to make it executable.

    The 3 files are in the attchment.

    In your rc.xml, you have to add two shortcuts to run launcher.sh with parameters

    Code:
        <keybind key="W-r">
          <action name="Execute">
            <name>shortcuts for desktop</name>
            <command>/home/ll/scripts/raccourcis/launcher.sh /tmp/conky_kb k</command>
          </action>
        </keybind>    
        <keybind key="W-s">
          <action name="Execute">
            <name>shortcuts for mouse</name>
            <command>/home/ll/scripts/raccourcis/launcher.sh /tmp/conky_ms m</command>
          </action>
        </keybind>
    And the output, for the keyboard :


    and the output for the mouse :


    Edit : 29/04/2010, v1.1 :
    Keyboard shortcuts without commands are no more displayed.
    Long command lines are shortened in the dispay to fit the column width.
    Edit : 02/05/2010 v1.2 thanks buttate_la _pasta
    In keyboard section, when a command string hold the full path to the executable,
    it keeps only the name of the executable itself
    Attached Files Attached Files
    Last edited by wlourf; May 2nd, 2010 at 09:56 AM.

  2. #222
    Join Date
    Jan 2009
    Location
    Europe-Austria
    Beans
    1,047
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by mobilediesel View Post
    Here's a fairly simple script to display a normal calendar with conky. It shows the last few days of the previous month as well as the first few days of the next month.

    You can have the month/year line a different color and the days of the week line a different color.

    Code:
    #!/bin/bash
    date=$(date '+%F')
    DAY=${date:8:2}
    DAY=${DAY/#0/}
    cal=$(cal)
    prev=$(cal $(date '+%-m %Y' --date="${date:0:7}-15 -1 month")|sed 's/ *$//;/^$/d'|tail -1)
    next=$(cal $(date '+%-m %Y' --date="${date:0:7}-15 +1 month")|sed '/^ *&/d;1,2d;s/^ *//'|head -1)
    if [ ${#next} == 19 ] ;then next=$'\n'"\${color9} $next"
    else next="\${color9}  $next"
    fi
    if [ ${#prev} == 20 ]; then prev="$prev"$'\n '
    else prev="$prev  "
    fi
    echo -e "\${color7}${cal:0:21}\${color4}${cal:21:21}\${color9}$prev\${color}$(echo "${cal:42}" | sed -e '/^ *$/d' -e 's/^/ /' -e 's/$/ /' -e 's/^ *1 / 1 /' -e /" $DAY "/s/" $DAY "/" "'${color3}'"$DAY"'${color}'" "/ -e 's/^ //' -e 's/ *$//')$next"
    Attachment 140669

    I did it this way to limit the number of calls to cal as I was calling it a few times. Now it's just 3.
    According to my problem /to mark all the week days with different color (http://ubuntuforums.org/showthread.php?t=1433914)/ i tried to use this scripts, but output is very odd:
    Attached Images Attached Images
    MacBook Pro7,1, Ubuntu 11.04 64bit

  3. #223
    Join Date
    May 2008
    Beans
    Hidden!

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by vickoxy View Post
    According to my problem /to mark all the week days with different color (http://ubuntuforums.org/showthread.php?t=1433914)/ i tried to use this scripts, but output is very odd:
    The script has to be called with execpi instead of execi.

    The simplest calendar to color the current day different is this one:
    Code:
    cal|sed -e 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    or for starting the week on Monday:
    Code:
    cal -m|sed -e 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    For the making the weekdays different color from weekend, I'm not sure yet how to do that. I might have figured it out using sed but I still have to mess with it.

  4. #224
    Join Date
    Jan 2009
    Location
    Europe-Austria
    Beans
    1,047
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by mobilediesel View Post
    The script has to be called with execpi instead of execi.

    The simplest calendar to color the current day different is this one:
    Code:
    cal|sed -e 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    or for starting the week on Monday:
    Code:
    cal -m|sed -e 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    For the making the weekdays different color from weekend, I'm not sure yet how to do that. I might have figured it out using sed but I still have to mess with it.
    Well, i successfully use one line calendar-having no colored days. So i tried to use one of your scripts (there are weekdays colored with different colors). I saved it in /home/cal.sh and executed it with ${execpi 60 ~/cal.sh}, but i got nothing...
    MacBook Pro7,1, Ubuntu 11.04 64bit

  5. #225
    Join Date
    Jan 2009
    Location
    Europe-Austria
    Beans
    1,047
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    This is sort of bump again. So this is my cal line:

    Code:
    ${voffset -72}${font andale mono:size=7}${color ffffff}${execpi 600 DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/                     /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${alignc -30} /' | sed /" $DJS "/s/" $DJS "/" "'${color 00A9CB}'"$DJS"'${color ffffff}'" "/}${font}
    So, if anyone knows how/where to put/ to mark week days with different color, not default one.

    Thanks
    MacBook Pro7,1, Ubuntu 11.04 64bit

  6. #226
    Join Date
    Mar 2010
    Location
    I'm from the internet
    Beans
    Hidden!

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    I made a simple bash script that shows what filesystems are mounted and details about them. I have it refreshed every 10 seconds in my conky, so if I connect a flash drive to my computer or something, I see it show up pretty quickly in conky. It shows / and it shows stuff that's mounted in /media.

    Code:
    #!/bin/bash
    
    # change this to reflect your mount point
    mountPoint="media"
    
    # root
    rootDrive=`df -h | awk '{print $(NF)}' | grep "/" | grep -v "dev" | head -1`
    drivePercent=`df -h | awk '{print $(NF-1)}' | grep "%" | head -1`
    usedSpace=`df -h | grep "%" | grep -v "Use%" | awk '{print $(NF-3)}' | head -1`
    totalSpace=`df -h | grep "%" | grep -v "Use%" | awk '{print $(NF-4)}' | head -1`
    
    printf "%-16s%5s%-10s%-12s\n" "Filesystems:" "Used" " / Total" "Percent"
    printf "%-16s%5s%-10s%-12s\n" " $rootDrive" $usedSpace " / $totalSpace" "$drivePercent"
    
    # everything that's mounted in the mount point
    for drive in `df -h |grep "/media" | awk '{print $(NF)}' | cut -d"/" -f3 | cut -b -12`
    do
      drivePercent=`df -h |grep "$mountPoint/"$drive | awk '{print $(NF-1)}'`
      usedSpace=`df -h |grep "$mountPoint/"$drive | awk '{print $(NF-3)}'`
      totalSpace=`df -h |grep "$mountPoint/"$drive | awk '{print $(NF-4)}'`
      printf "%-16s%5s%-10s%-12s\n" " $drive" $usedSpace " / $totalSpace" $drivePercent
    done
    I guess there's probably a better way of doing this, but this does what I wanted it to do.
    Attached Images Attached Images

  7. #227
    Join Date
    May 2008
    Beans
    Hidden!

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by vickoxy View Post
    This is sort of bump again. So this is my cal line:

    Code:
    ${voffset -72}${font andale mono:size=7}${color ffffff}${execpi 600 DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/                     /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${alignc -30} /' | sed /" $DJS "/s/" $DJS "/" "'${color 00A9CB}'"$DJS"'${color ffffff}'" "/}${font}
    So, if anyone knows how/where to put/ to mark week days with different color, not default one.

    Thanks
    I was working on it when you first posted. I got distracted with other stuff offline. Here's what I came up with:

    First, that calendar code can be simplified to:
    Code:
    cal | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    To color weekends different from weekdays:
    Code:
    cal | sed '/^ *$/d' | sed -r '2,8s/^(.{18})(.{2})/\1${color red}\2${color}/' | sed -r '2,8s/^(.{0})(.{2})/\1${color red}\2${color}/'
    Add the code for coloring current day:
    Code:
    cal | sed '/^ *$/d' | sed -r '2,8s/^(.{18})(.{2})/\1${color red}\2${color}/' | sed -r '2,8s/^(.{0})(.{2})/\1${color red}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    Or to start the week on Monday instead of Sunday:
    Code:
    cal -m | sed '/^ *$/d' | sed -r '2,8s/^(.{0})(.{5})/\1${color red}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'

  8. #228
    Join Date
    Jan 2009
    Location
    Europe-Austria
    Beans
    1,047
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by mobilediesel View Post
    I was working on it when you first posted. I got distracted with other stuff offline. Here's what I came up with:

    First, that calendar code can be simplified to:
    Code:
    cal | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    To color weekends different from weekdays:
    Code:
    cal | sed '/^ *$/d' | sed -r '2,8s/^(.{18})(.{2})/\1${color red}\2${color}/' | sed -r '2,8s/^(.{0})(.{2})/\1${color red}\2${color}/'
    Add the code for coloring current day:
    Code:
    cal | sed '/^ *$/d' | sed -r '2,8s/^(.{18})(.{2})/\1${color red}\2${color}/' | sed -r '2,8s/^(.{0})(.{2})/\1${color red}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    Or to start the week on Monday instead of Sunday:
    Code:
    cal -m | sed '/^ *$/d' | sed -r '2,8s/^(.{0})(.{5})/\1${color red}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    Thanks for helping. Actually i just want to have week days names (Mo Tu We Th Fr Sa Su) colored and current day.

    The second thing is - i do not need in cal the current month and date above calendar, because i placed it somewhere else.

    So, on picture you can see my cal and i just want these week days names colored.

    Thanks a lot
    Attached Images Attached Images
    MacBook Pro7,1, Ubuntu 11.04 64bit

  9. #229
    Join Date
    May 2008
    Beans
    Hidden!

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by vickoxy View Post
    Thanks for helping. Actually i just want to have week days names (Mo Tu We Th Fr Sa Su) colored and current day.

    The second thing is - i do not need in cal the current month and date above calendar, because i placed it somewhere else.

    So, on picture you can see my cal and i just want these week days names colored.

    Thanks a lot
    You're welcome. This will remove the month/year line and only color the day names:
    Code:
    cal -m | sed '1d' | sed '/^ *$/d' | sed -r '0,/./s/^(.{0})(.{5})/\1${color red}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'

  10. #230
    Join Date
    Jan 2009
    Location
    Europe-Austria
    Beans
    1,047
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by mobilediesel View Post
    You're welcome. This will remove the month/year line and only color the day names:
    Code:
    cal -m | sed '1d' | sed '/^ *$/d' | sed -r '0,/./s/^(.{0})(.{5})/\1${color red}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color white}&${color}/'
    Well, i have some issues-if i add these lines after ${execpi 600
    everything in my conky is dead/invisible after cal line. Other then that-there are only Mo and TU colored, but not the other days (neither current day) ?
    MacBook Pro7,1, Ubuntu 11.04 64bit

Page 23 of 32 FirstFirst ... 132122232425 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •