You are not logged in.

#1 2019-08-07 08:26:58

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

tint2 and conky utilities

EDIT: split off from the "decided" checklist thread: https://forums.bunsenlabs.org/viewtopic.php?id=5614

damo wrote:
johnraff wrote:

...
bl-tint2zen: resize:
    it may be better to increase the default size, eg Change line #126 to
    --checklist --width=400 --height=600 \

the Conky and Tint2 choosers should remain open after choosing the theme(s), until closed with a Close button, especially useful when testing.
....

I've done bl-tint2zen, but someone needs to check the unsetting of vars, and declaring arrays  8o
The dialog stays open until the cancel button is clicked (actually it reloads, since I don't think yad will reload the arrays using the same instance) - this is more convenient for trying things out.

And the name could (should?) be changed. The "zen" came from Sector11, because the original idea used zenity. bl-tint2-manager?

#!/bin/bash
#
#    bl-tint2zen: a BunsenLabs tint2 selection and switcher script
#    Copyright (C) 2015/2019 damo    <damo@bunsenlabs.org>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
#
#   Tint2 config files must be in $TINT2PATH
#
#   When the dialog opens, any running tint2s will be checkmarked.
#
#   Click "OK" and all running tint2s are stopped, and all checkmarked
#   tint2s are started
#
#   To stop a tint2 just uncheck it, and "OK"
#
#   Running tint2s are saved to a session file, and can be run with
#   the "tint2-session" script. To start them at login, add the
#   following line to autostart:
#
#           bl-tint2-session
#
########################################################################
TINT2PATH="$HOME/.config/tint2"
SESSIONFILE="$TINT2PATH/tint2-sessionfile"
USAGE='
	USAGE:
	With no command argument, the script uses the chosen
	Tint2 session file "$TINT2PATH/tint2-sessionfile",
	if it exists, otherwise the default tint2rc is used.

	To start them at login, add the following line to autostart:

		(sleep 2s && bl-tint2-session) &
'

### DIALOG VARIABLES
DLGDEC="yad --center --borders=20 "
TITLE="BunsenLabs Tint2 Manager"
WINICON="--window-icon=distributor-logo-bunsenlabs"
OK="--button=OK:0"
CANCEL="--button=gtk-cancel:1"
CLOSE="--button=Close:1"
########################################################################

tintRunning(){
    # make blank tempfile, to save running tint2 paths
    TEMPFILE=$(mktemp --tmpdir tint2.XXXX)
    pgrep -a tint2 | while read pid cmd; do
        if [[ ${cmd%% *} = tint2 ]]; then
            TPATH=$(echo $cmd | awk '{print $NF}')
            if echo "$TPATH" | grep -v "$HOME";then	# in case started without full path
				TPATH="$HOME/$TPATH"
			fi
         echo "$TPATH"
            echo "$TPATH" >> $TEMPFILE
        fi
    done
}

fillArrays(){
    num="$1"
    tintsPath[$num]="$2"   # full filepath to the tint2
    tintsArr[$num]="$3"    # displayed name
    # see if name matches one of the running tints
    if grep -qx "$2" "$TEMPFILE";then # if tint2 is running (read from tempfile)
        checkArr[$num]="TRUE"       # make checkmark in dialog
    else
        checkArr[$num]="FALSE"
    fi
}

findTint(){
# search dirs for tint2 config files
	unset x
    num=0
    for x in $(find $TINT2PATH -type f );do
        # check if likely tint2 config file
        pm=$(grep  "panel_monitor" "$x")
        if [[ $pm ]];then
            TINT2=$( echo $x | awk -F"/" '{print $(NF-1)"/"$NF}')
            fillArrays $num $x $TINT2
            num=$(($num+1))
        fi
    done
}

loadDialog() {
	LISTTINT="$1"
	declare -a retTint
## Populate dialog from array, get return value(s)
	RET=$($DLGDEC $WINICON --list --title="$TITLE" \
	    --text="Select Tint2s from the list:" \
	    --checklist --width=400 --height=500 \
	    --column="Select" --column="tint2 Name" $LISTTINT --separator=":" \
	    $OK $CLOSE \
	    )
	if (( $? == 1 )); then # cancel button pressed
		rm -r "$TEMPFILE"
	    exit 0
	else
	    > $SESSIONFILE    # Create new session file
	    
	    # loop through returned choices, add to array
	    i=0
	    OIFS=$IFS   # copy original IFS
	    IFS=":"     # separator is ":" in returned choices
	    for name in $RET; do
	        retTint[$i]=$name
	        i=$(($i+1))
	    done
	    IFS=$OIFS    # reset IFS
	
	    # kill all tint2s
	    pgrep -a tint2 | while read pid cmd; do
	        if [[ ${cmd%% *} = tint2 ]]; then
	            kill "$pid"
	        fi
	    done
	
	    for name in ${retTint[*]};do       # loop through checkmarked tint2 names
	        for ((j=0; j<${#tintsPath[*]}; j++));do  # traverse through elements
	            for f in ${tintsPath[j]};do
	                display=$( echo $f | awk -F"/" '{print $(NF-1)"/"$NF}')
	                # see if it matches the returned name
	                if [[ $display = $name ]];then
	                    echo -e "$f" >> $SESSIONFILE
	                    tint2 -c "$f" &  #start the tint2
	                    sleep 1s
	                fi
	            done
	        done
	    done
	#    bl-compositor --restart &   # restart compositor
	fi
}

# get any commandline arguments
if ! (( $# == 0 ));then
    for arg in "$@";do
        if [[ $1 = "-h" ]] || [[ $1 = "--help" ]];then
            echo -e "$USAGE"
            exit 0
        else
            echo -e "\tERROR: sorry I don't understand the input"
            echo -e "$USAGE"
            exit 0
        fi
    done
fi

while true;do
	unset LISTTINT
	declare -a tintsArr
	declare -a checkArr
	# get tint2 directories in .tint2, add to array
	tintRunning
	findTint
	
	# loop through arrays, and build msg text for yad dialog
	for ((j=0; j<${#tintsArr[*]}; j++));do
	    LISTTINT="$LISTTINT ${checkArr[j]} ${tintsArr[j]}"
	done
	loadDialog "$LISTTINT"
	rm -r "$TEMPFILE"

done

exit 0

NB I don't feel confident in pushing on github - the risk of messing-up is high  :8

damo wrote:

Done the same for bl-conkyzen. Also I think that "Close" rather than "Cancel" is better for the main dialog window?

#!/bin/bash
#
#    bl-conkyzen: BunsenLabs Conky selection and switcher script
#    Copyright (C) 2015/2019 damo    <damo@bunsenlabs.org>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
#
#   Written by damo <damo@bunsenlabs.org> for BunsenLabs Linux, April 2015
#   Beta tested and stamped "zen" by <Sector11>
#
########################################################################
#
#   Conkys must be in $CONKYPATH
#   The name must end with "conky" or "conkyrc"
#
#   When the dialog opens, any running conkys will be checkmarked.
#
#   Click "OK" and all running conkys are stopped, and all checkmarked
#   conkys are started
#
#   To stop a conky just uncheck it, and "OK"
#
#   Running conkys are saved to a session file, and can be run with
#   the "bl-conky-session" script. To start the default conky session at
#   login, add the following line to autostart:
#
#     bl-conky-session --autostart &
#
#   Different saved-session files can be used by running the script with:
#
#           bl-conkyzen -f /path/to/sessionfile &
#           bl-conkyzen -z (opens gui entry dialog for filepath)
#
########################################################################

CONKYPATH="$HOME/.config/conky"
SESSIONFILE="$CONKYPATH/conky-sessionfile"
SESSIONS="$CONKYPATH/saved-sessions"    # to be used by a pipemenu
CRC="$HOME/.conkyrc"
BLDEFAULT="$CONKYPATH/BL-Default.conkyrc"

USAGE1='
	USAGE:	bl-conkyzen [OPTION]...FILES

	With no command option the script runs the gui

	-h,--help   : This USAGE help
	-f,--file   : FILEPATH : specify file to save session to
	-z          : Run gui filename entry dialog for new saved session
'
USAGE2='
	USAGE:	bl-conkyzen [OPTION]...FILES

	With no command option the script runs the gui

	-h,--help   : This USAGE help
	-f,--file   : FILEPATH : specify file to save session to
	-z          : Run gui filename entry dialog for new saved session

	When the dialog opens, any running conkys will be checkmarked.
	Click "OK" and all running conkys are stopped, and all
	checkmarked conkys are started.

	To stop a conky just uncheck it, and click "OK"

	EXAMPLES:
	Save session to a new saved-session file with:

		bl-conkyzen -f sessionfile-name

	To start the default conky session at login, add the
	following line to autostart:

		bl-conky-session --autostart &
'

### DIALOG VARIABLES
DLG="yad --center --undecorated --borders=20 "
DLGDEC="yad --center  --borders=20 "
TITLE="BunsenLabs Conky Manager"
WINICON="--window-icon=distributor-logo-bunsenlabs"
OK="--button=OK:0"
CANCEL="--button=gtk-cancel:1"
CLOSE="--button=Close:1"

########## FUNCTIONS ###################################################
conkyRunning(){    # find running conkys
    # make blank tempfile, to save running conky paths
    TEMPFILE=$(mktemp --tmpdir conky.XXXX)
    if [[ $(pidof conky) ]];then
        # test if default conky was started
        for ARG in $(ps aux | grep  [c]onky | awk '{print $(NF-1)}');do
            if [[ $ARG = "conky" ]]; then
                echo "$CRC" >> "$TEMPFILE"  # 'conky -q' probably used
            else                            # send conky filepath to tempfile
                for ARG in $(ps aux | grep  [c]onkyrc | awk '{print $(NF)}');do
                    if [[ $ARG != "-q" ]];then
                        if echo "$ARG" | grep -v "$HOME";then	# in case started without full path
							ARG="$HOME/$ARG"
						fi
                        echo "$ARG" >> "$TEMPFILE"
                    fi
                done
            fi
        done
    fi
    # remove any duplicates in tempfile
    TEMPFILE2=$(mktemp --tmpdir conky.XXXX)
    awk '!x[$0]++' "$TEMPFILE" > "$TEMPFILE2" && mv "$TEMPFILE2" "$TEMPFILE"
}

fillArrays(){
    if (( $1 != 0 ));then
        num="$1"    # 1st arg: array index
    else
        num=0   # '~/.conkyrc' added to array
    fi

    if (( $num == 0 ));then
        cPATH="$CRC"
        cARR="$USER/.conkyrc"
    else
        cPATH="$2"   # 2nd arg: full filepath to conky
        cARR="$3"    # 3rd arg: displayed name: "directory/*conky(rc)"
    fi

    conkysPath[$num]="$cPATH"
    conkysArr[$num]="$cARR"
    if grep -qx "$cPATH" "$TEMPFILE";then # if conky is running (read from tempfile)
        checkArr[$num]="TRUE"       # make checkmark in dialog
    else
        checkArr[$num]="FALSE"
    fi
}

findConky(){
# search dirs for conkys files - looking for "conky" in the name
# if "*conky(rc)" then display it
    num=0   # added default .conkyrc
    fillArrays $num "$CRC" "$USER/.conkyrc"
    num=1
    # find files in CONKYPATH with conky in the name
    for x in $(find "$CONKYPATH" -type f );do
        f=$(basename "$x")    # filename from filepath
        if [[ $f = *conkyrc ]] || [[ $f = *conky ]];then    # filename ends with *conky or *conkyrc
            # get directory/conkyname to display in list
            CONKY=$( echo "$x" | awk -F"/" '{print $(NF-1)"/"$NF}')
            fillArrays $num "$x" "$CONKY"
            num=$(($num+1))
        fi
    done
}

writeSessions(){    # save a new sessionfile name for use by a menu
    SESSIONFILE="$CONKYPATH/$1"
    echo "sessionfile= $SESSIONFILE"
    if ! [[ -f $SESSIONS ]];then
        > "$SESSIONS"
    fi
    if grep -qx "$SESSIONFILE" "$SESSIONS";then # session was previously saved
        if [[ $2 = "-z" ]];then    # input was from input dialog, so ask OK?
            $DLG $WINICON --title="Conky sessionfile" --text="Filename already in use\n\nOverwrite it?" $CANCEL $OK
            if (( $? == 1 ));then
                exit 0
            fi
        else    # commandline is being used
            echo "Session was previously saved with the same name. Overwrite it? (y|N)"
            read ans
            case "$ans" in
                y|Y )   break
                        ;;
                *   )   exit 0
                        ;;
            esac
        fi
    else
        cp "$SESSIONS" "$SESSIONS.bkp"
        echo "$SESSIONFILE" >> "$SESSIONS"
    fi
}

loadDialog() {
	declare -a retConky
    ## Populate dialog from array, get return value(s)
    RET=$($DLGDEC $WINICON --list --title="$TITLE" \
        --text="Session will be saved to:\n <b>$SESSIONFILE</b>" \
        --checklist --width=400 --height=500 --multiple \
        --column="Select:CHK" --column="Conky Name:TXT" $LISTCONKY \
        --separator=":" \
        $OK $CLOSE \
        )

    if [[ $? == 1 ]]; then # cancel button pressed
        # restore previous saved-sessions file
        [[ -f $SESSIONS.bkp ]] && mv "$SESSIONS.bkp" "$SESSIONS"
        rm "$TEMPFILE"
        exit 0
    fi
    if ! [[ $RET ]];then  # No conkys chosen
        MSG="Nothing chosen.\n\nKill any running Conkys\nand exit?"
        $DLG $WINICON --title="Conky Chooser" --text="$MSG" $OK $CANCEL
        if [[ $? = 1 ]];then
            # restore previous saved-sessions file
            [[ -f $SESSIONS.bkp ]] && mv "$SESSIONS.bkp" "$SESSIONS"
            return
        else
            killall conky
            rm "$TEMPFILE"
            exit 0
        fi
    else
        > "$SESSIONFILE"    # Create new session file
        # loop through returned choices, add to array
        i=0
        OIFS=$IFS   # save Internal Field Separator
        IFS=":"     # separator is ":" in returned choices
        for name in $RET; do
            retConky[$i]="$name"
            i=$(($i+1))
        done
        IFS=$OIFS   # reset IFS back to default

        # kill all conkys
        if [[ $(pidof conky) ]];then
            killall conky
        fi

        # Find the chosen conkys and start them
        for name in ${retConky[*]};do       # loop through checkmarked conky names
            for ((j=0; j<${#conkysPath[*]}; j++));do  # traverse through elements
                for f in ${conkysPath[j]};do    # compare with choice from dialog
                    display=$( echo "$f" | awk -F"/" '{print $(NF-1)"/"$NF}')
                    if [[ $display = $name ]];then
                        echo -e "conky -c $f & sleep 1s" >> "$SESSIONFILE"
                        #start the conky (adjust the sleep time if required)
                        conky -c "$f" & sleep 1s
                    fi
                done
            done
        done
    fi
}
######## END FUNCTIONS #################################################

# get args passed to script (session can be saved to a different file)
for arg in "$@";do
    case "$arg" in
        -h|--help   ) echo -e "$USAGE2"
                      echo
                      exit 0
                      ;;
        -f|--files  ) if [[ $2 ]];then
                        SESSIONFILE="$2"    # sessionfile has been specified
                        writeSessions "$SESSIONFILE"    # if sessionfile is new, write name to saved-sessions
                        break
                      else
                        echo
                        echo -e "\tNo saved-session file specified!"
                        echo -e "$USAGE1"
                        echo
                        exit 1
                      fi
                      ;;
        -z          ) SPATH=$($DLGDEC $WINICON --entry \
                        --title="Save Conky sessionfile" \
                        --entry-label="New saved session file:" \
                        --text="File to be saved in <b>$CONKYPATH/</b>\n\n" \
                        $OK $CANCEL \
                        )
                      (( $? == 1 )) && exit 0
                      if [[ -z $SPATH ]];then     # entry was empty
                          $DLG $WINICON --title="Conky sessionfile" --text="No file specified for new saved session\n\nExiting..." $OK
                          exit 1
                      else
                          writeSessions "$SPATH" "-z"   # saved session file from input dialog
                      fi
                      ;;
                 *  ) if ! [[ $arg ]];then
                        SESSIONFILE="$SESSIONFILE" # sessionfile is default
                        break
                      else
                        echo -e "$USAGE1"
                        exit 1
                      fi
                      ;;
    esac
done

# test for ~/.conkyrc, create a link to the default conky if necessary
if ! [[ -e $CRC ]];then
    if [[ -e $BLDEFAULT ]];then
        ln -s "$BLDEFAULT" "$CRC"
    else
        echo "Default conkyrc not found"
    fi
fi

while true;do
	declare -a conkysArr
	declare -a checkArr

	# get conky directories in .conky, add to array
	conkyRunning
	findConky
	
	# loop through arrays, and build list text for yad dialog
	unset LISTCONKY
	for ((j=0; j<${#conkysArr[*]}; j++));do
	  LISTCONKY="$LISTCONKY${checkArr[j]} ${conkysArr[j]} "
	done
	
	loadDialog "$LISTCONKY"
	
	rm "$TEMPFILE"
done

exit 0

Sorry Damo, I let this go so long. Just tested bl-tint2zen and it does the job fine. Shellcheck had a few things to say which I might try and look into, but a more general question:
What should we do if a tint2 (or conky) is launched without any config file - ie using the default file? Should it be ignored, or considered to be using ~/.config/tint2/tint2rc and displayed as such?

Last edited by johnraff (2019-08-19 07:22:14)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#2 2019-08-07 15:18:54

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: tint2 and conky utilities

johnraff wrote:

....
What should we do if a tint2 (or conky) is launched without any config file - ie using the default file? Should it be ignored, or considered to be using ~/.config/tint2/tint2rc and displayed as such?

Display the actual (default) path I think.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2019-08-08 03:35:58

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

^That sounds reasonable.

damo wrote:

I think that "Close" rather than "Cancel" is better for the main dialog window?

Agreed. What would you think of "Set" "Apply" instead of "OK"? People might expect OK to exit the app?

Other question: what should these utilities do about tint2 or conky instances which have been launched with config files in some non-standard location? In particular, when applying the set in the dialogue window, all current running instances are killed. Is that OK? Should the utilities look at the array and only kill instances which are listed there? More work and not worth it?

Last edited by johnraff (2019-08-08 03:43:07)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#4 2019-08-08 08:03:00

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: tint2 and conky utilities

I remember wrestling with that originally, and decided that if someone wants a "non-standard" location for their configs, then they can deal with the consequences themselves! It is people like Sector11, who have collections of conkys, who don't use the utility for that reason.

"Apply" sounds "OK"(!)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2019-08-08 17:03:07

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: tint2 and conky utilities

damo wrote:

I remember wrestling with that originally, and decided that if someone wants a "non-standard" location
Nice play on words damo.for their configs, then they can deal with the consequences themselves! It is people like Sector11, who have collections of conkys, who don't use the utility for that reason.

Which really bothered me because in order to use "my conkys" with BL it was a bit of a problem.

"conky" the program should not be "dependent" on any BL script.

There is no such thing as a "non-standard" location for conky.  It defaults to one these:
1a. - /etc/conky/conky.conf
1b. - /etc/conky/conky_no_x11.conf
- - - depending on the conky installed and
2. - the default, that takes precedence over those two at 1a and 1b, "IF" a user creates it: ~/.conkyrc
- - - my ~/.conkyrc was made for ARCHLABS

The man pages states:

       -c | --config= FILE
              Config file to load instead of $HOME/.conkyrc

So my "conky -c /media/5/Conky/config-files" is within the bounds of "conky standards" and BL should honour a users choice.  Also by having them here they can all be used by all three of my systems -- and are.  Mind you I don't think you script would work well with the 376 conky there or the 77 subfolders.

And then I have /media/5/conky as well with 774 conky and another 199.

Easily I have over 2000 conkys.  And a TON of them need tweaking as themes change, default font sizes change to accommodate aging eyes and glasses.  big_smile

OH and yes I also have some conky v1.10 conkys here I still test and play with it ... don't like it but maybe some day there will be no choice.

### conky 9 to 10
alias c9-10='sudo apt-get autoremove --purge conky-all -y && sudo aptget conky-all --no-install-recommends'
### conky 10 to 9
alias c10-9='sudo apt-get autoremove --purge conky-all -y && sudo gdebi /media/10/DEBIAN-files/conky-all_1:1.9.0-6_amd64.deb --n'

Installs:

Preparing to unpack .../conky-all_1:1.9.0-6_amd64.deb ...
Unpacking conky-all (1:1.9.0-6) over (1:1.9.0-6) ...
Setting up conky-all (1:1.9.0-6) ...

So now I am curious as to what you consider the "standard location" as opposed to "non-standard location" for conkys?

I still use my yad script that we started with damo.  And my conkys are not dependent on it nor it on conky.  They are two programs that are not dependent on each other.

damo wrote:

"Apply" sounds "OK"(!)

Nice play on words damo.
I like "Apply" as well.

@ damo specifically
Keep in mind these questions and ideas I express here are all with respect for your work, which IMHO is brilliant a is a HUGE part of what makes BL what it is and standout with other distros.

I also like the way you made conkys movable and permanent over reboots as it suits conky v1.10 as well.

[Alt}+click - move doesn't do that.   But then I only ever move a few conkys and none of them run automatically.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2019-08-08 18:28:44

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: tint2 and conky utilities

conky -v
conky 1.10.8 compiled Tue May 15 07:41:15 UTC 2018 for Linux 4.9.0-6-amd64 x86_64

From this man conky:

 -c | --config= FILE
              Config file to load instead of $HOME/.config/conky/conky.conf

Default configuration file location is $HOME/.config/conky/conky.conf or ${sysconfdir}/conky/conky.conf.  On  most  systems,  sysconfdir is /etc, and you can find the sample config file there (/etc/conky/conky.conf).

IIRC this is why BL started to use $HOME/.config/conky/ as the default location. Maybe we could have a config file where the $USER could add other file paths for the script to search?

And perhaps the script's findConky() should also test for .conf filenames, since .conkyrc seems to be a legacy style?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#7 2019-08-08 20:01:00

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: tint2 and conky utilities

{hanging head in shame}

Actually from the very beginning I realized that conky can be called anything and put anywhere so:
/media/10/Bob/thisismyconky.txt is a legit conky file.

However in my stead, BL started using  $HOME/.config/conky/ before v1.10 I believe. Does not matter, just a question and talking.

TEST RUN: with a ".txt"  file ending:

 08 Aug 19 @ 15:45:05 ~
   $ conky -c /home/sector11/.conkyrc1.txt
Conky: can't open '/sys/bus/platform/devices/f71882fg.2560/temp1_input': No such file or directory
please check your device or remove this var from Conky
Conky: can't open '/sys/bus/platform/devices/f71882fg.2560/temp2_input': No such file or directory
please check your device or remove this var from Conky
Conky: can't open '/sys/bus/platform/devices/f71882fg.2560/fan1_input': No such file or directory
please check your device or remove this var from Conky
Conky: forked to background, pid is 11316
 
 08 Aug 19 @ 15:45:17 ~
   $ 
Conky: desktop window (d4) is root window
Conky: window type - normal
Conky: drawing to created window (0x5000001)
Conky: drawing to double buffer
Conky: curl: could not retrieve data from server
Conky: curl: could not retrieve data from server

Errors due to change in Mobo (AMD to Intel) and No NVIDIA card onboard Intel Graphics (bad must get card).

But it is running and $ conky -c /home/sector11/.conkyrc2.doc as well.

Take a look at Teo's weather thread start at 100 and work backwards - 99% of them are conky v1.10 and use "personalized" names or like loutch = conyrc, ragamatrix = conky-meteo-V2, and yours truly = S11_accu_tm_BAR_2016-full.conky & S11_accu_UVI.conky

BTW, I use the .conky ending to get the colour coding to work in medit, it was designed that way originally.

And perhaps the script's findConky() should also test for .conf filenames, since .conkyrc seems to be a legacy style?

Sounds good to me or even better if you can search "in" files look for:

conky.config = {

since ALL conky v1.10 start with that on the first line, some script-foo required for the spaces and 'control characters'.

Since BL is dealing with v1.10 and that's a guaranteed find on Bunsen systems.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#8 2019-08-08 21:41:16

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: tint2 and conky utilities

Sector11 wrote:

...
since ALL conky v1.10 start with that on the first line, some script-foo required for the spaces and 'control characters'.

Since BL is dealing with v1.10 and that's a guaranteed find on Bunsen systems.

Something like that would be a good test, since as you say conkys can be any sort of text file.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2019-08-08 23:33:57

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: tint2 and conky utilities

WoW!   My count with conky.config = {

~/ = 147
/media/5/Conky = 103
/media/5/conky = 3


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#10 2019-08-09 02:21:26

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

damo wrote:

...perhaps the script's findConky() should also test for .conf filenames, since .conkyrc seems to be a legacy style?

It already does https://github.com/BunsenLabs/bunsen-ut … kyzen#L167

But Sector11's suggestion of grepping inside the file is even better.
Since conky 1.10 still handles the old syntax (I still have a couple of oldstyle conky files in use that I haven't got round to upgrading) is there something we could grep for in a 1.9 style file?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#11 2019-08-09 03:01:47

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,010

Re: tint2 and conky utilities

Not really John since just about everything above TEXT is optional and there is nothing that I know of that is a "must use" like 10 uses " conky.config = { " that would be unique to "conky" let alone just conky v1.9.

Sorry.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#12 2019-08-15 07:46:23

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

Still on bl-tint2zen here.

1) Name: The menu calls it "Tint2 Chooser". Would bl-tint2-chooser be a reasonable name for the script?

1a) Also bl-conky-chooser?

2) Session files: The Conky utilities allow multiple session files to be saved and restored. Would it be worth extending the Tint2 scripts that way too? Maybe a lot of the code could be copied.

Last edited by johnraff (2019-08-15 08:36:51)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#13 2019-08-15 09:12:01

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

@damo I made some changes to bl-conkyzen in June, having competely forgotten about your February improvements, which are now being merged in. Most of them were here: https://github.com/BunsenLabs/bunsen-ut … 2f0955c853

I don't think there will be any clashes (after a little massaging) but the logic flow in writeSessions() changed slightly wrt whether to overwrite $CONKYPATH/saved-sessions. I think it's OK now, but if you'd like a look...

EDIT: Merged (both my and your changes) bl-conkyzen on GitHub: https://github.com/BunsenLabs/bunsen-ut … l-conkyzen
and bl-tint2zen: https://github.com/BunsenLabs/bunsen-ut … l-tint2zen
They both seem to be working OK, but more (eg Bruces' conkyfile check) remains to be done.

Last edited by johnraff (2019-08-15 13:32:39)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#14 2019-08-19 07:45:05

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

damo wrote:

BL started to use $HOME/.config/conky/ as the default location. Maybe we could have a config file where the $USER could add other file paths for the script to search?

I wondered about a ~/.config/bunsen/variables file (and one in /etc) to hold things like that, but also wondered if it might be overkill? Users have another option of copying the utility (or anything else) from /usr/bin to ~/bin and editing variables to taste there.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#15 2019-08-20 03:27:22

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

johnraff wrote:

the logic flow in writeSessions() changed slightly wrt whether to overwrite $CONKYPATH/saved-sessions. I think it's OK now, but if you'd like a look...

Sorry Damo I was wrong about the logic in writeSessions() and it was fine the way it was.  :8
Now restored in GitHub (it never went out in a package upgrade anyway).

However, because loadDialog() is now run in an endless loop there were a couple of minor issues related to the sessionfile and saved-sessions files, so sometimes one was empty or missing. I think it might be OK now - I've tried both bl-conkyzen and 'bl-conkyzen -z' and they seem to be doing what they should.
https://github.com/BunsenLabs/bunsen-ut … l-conkyzen

TODO:
1) Implement Sector11's improved grep check for conky files, instead of using filenames.
2) Kill only conkys and tint2s which are listed in the dialog window.
3) Get plain 'conky' or 'tint2' command associated with the default config file.
4) Get the config files listed in alphabetical order. (Find and grep both return file lists in some random order.)
5) Rename *zen > *-chooser ?

Last edited by johnraff (2019-08-20 04:30:21)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#16 2020-03-26 08:46:00

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

johnraff wrote:

Rename *zen > *-chooser ?

Of course:

damo wrote:

And the name could (should?) be changed... bl-tint2-manager?

And both the tint2 and conky utilities were renamed *-manager quite a while ago. smile

---
But, just now checking out some oddness* with bl-tint2-manager's filelist, I realised the help message was a bit odd. It looks as if it came from bl-tint2-session?

USAGE='
        USAGE:
        With no command argument, the script uses the chosen
        Tint2 session file "$TINT2PATH/tint2-sessionfile",
        if it exists, otherwise the default tint2rc is used.

        To start them at login, add the following line to autostart:

                (sleep 2s && bl-tint2-session) &
'

@damo, feel like having a look at that?

---
* Trouble with handling of filenames with spaces.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#17 2020-04-04 06:27:46

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,557
Website

Re: tint2 and conky utilities

^@damo?

---
One more:
Both tint2-manager and conky-manager display the config files prefixed by the name of the config directory, either tint2/ or conky/. Since this is the prefix in every case, does it add any useful information for the user? Sub-directories, of course, would be meaningful, but could eg:

tint2/tint2rc-bottom-minimal
tint2/tint2rc-bottom
tint2/tint2rc-grey
tint2/tint2rc-crunchbang
tint2/tint2rc-minimal
tint2/sub/subfile

be replaced with:

tint2rc-bottom-minimal
tint2rc-bottom
tint2rc-grey
tint2rc-crunchbang
tint2rc-minimal
sub/subfile

It would simplify the code a bit - making the awk call unnecessary.

eg for the findTint() function:

findTint(){
# search dirs for tint2 config files
    local x
    num=0

    shopt -s globstar
    for x in "$TINT2PATH"/**;do
        [[ -f $x ]] || continue
        [[ $x = *~ ]] && continue # ignore backups
        grep -q "panel_monitor" "$x" || continue
        TINT2=${x#$TINT2PATH/}
        fillArrays $num "$x" "$TINT2"
        num=$((num+1))
    done
    shopt -u globstar
}

Last edited by johnraff (2020-04-04 07:19:24)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#18 2020-04-04 14:18:28

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: tint2 and conky utilities

Sorry John, I missed that question to me.

TBH, I think you should just go ahead with whatever you think is reasonable. I'm not able to contribute to development stuff right now.

Last edited by johnraff-admin (2022-07-03 04:54:16)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#19 2020-04-04 15:43:57

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,036
Website

Re: tint2 and conky utilities

johnraff wrote:

Both tint2-manager and conky-manager display the config files prefixed by the name of the config directory, either tint2/ or conky/. Since this is the prefix in every case, does it add any useful information for the user? Sub-directories, of course, would be meaningful, but could eg:

tint2/tint2rc-bottom-minimal
tint2/tint2rc-bottom
tint2/tint2rc-grey
tint2/tint2rc-crunchbang
tint2/tint2rc-minimal
tint2/sub/subfile

be replaced with:

tint2rc-bottom-minimal
tint2rc-bottom
tint2rc-grey
tint2rc-crunchbang
tint2rc-minimal
sub/subfile

It would simplify the code a bit - making the awk call unnecessary.

+1, do it.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#20 2020-04-04 21:13:24

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: tint2 and conky utilities

I think the original reason is that default rc files were in $HOME/


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB