Closed johnraff closed 9 years ago
Immediate fix is
loadTEditmenu(){
menuSeparator
menuItem "Default tint2rc" "bl-text-editor $TINT2RC"
if [ "$(pidof tint2)" ];then
menuSubmenu "RunningTint2" "Running Tint2s"
pgrep -a tint2 | while read pid cmd; do
if [[ ${cmd%% *} = tint2 ]]; then
TINT2=$(echo $cmd | awk -F"/" '{print $(NF-1)"/"$NF}')
TINT=$(echo $cmd | awk '{print $NF}')
if [[ $TINT2 = "tint2/tint2" ]];then
TINT="$TINT2RC"
TINT2="Default tint2rc"
fi
menuItem "$TINT2" "bl-text-editor $TINT"
fi
done
menuSubmenuEnd
fi
}
A sessionfile only has the paths to the chosen tint2's, so a default tint2-sessionfile would just contain the line
/home/user/.config/tint2/tint2rc
btw it's possible to get rid of the awk calls:
TINT=${cmd##* }
TINT2=${TINT#$HOME/.config/}
if [[ $TINT = tint2 ]]; then...
btw it's possible to get rid of the awk calls:
...but I find it difficult getting my head around those bash substitutions!
Much nicer looking though - and faster too, if that matters. Easy enough once you get the hang of it: http://wiki.bash-hackers.org/syntax/pe#substring_removal
Edited bl-tint2-pipemenu and pushed changes.
When running a new install, the command in ~/.config/openbox/autostart to launch tint2 is
(sleep 2s && bl-tint2-session) &
If there is no session file, then bl-tint2-session runs the commandtint2
with no config file defined. tint2 will then load the default ~/.config/tint2/tint2rc.Now, on the menu Settings > Tint2>Edit Tint2s > Running Tint2s offers to edit the file tint2/tint2 Clicking this opens the non-existent file ~/tint2
The problem comes from loadTEditmenu() in bl-tint2-pipemenu:
pgrep -a tint2
returns:The awk lines above are returning
tint2/tint2
andtint2
respectively, while what is desired in this case is something likedefault tint2rc' and
~/.config/tint2/tint2rc`.SUGGEST: either amend loadTEditmenu() to set the default tint2rc when no config file is in the command line, or perhaps ship a default tint2 session file (although the problem with loadTEditmenu() would remain in that case).