diff --git a/bin/TODOlist b/bin/TODOlist index 28e900e..8ab7f28 100755 --- a/bin/TODOlist +++ b/bin/TODOlist @@ -10,15 +10,96 @@ source <(grep = $CFG_FILE) sleep .1 #notify-send.sh aaa "${0} ${1} ${me}" # LANG -#case "$LANG" in -# pl*):;; -# es*):;; -# *):;; -#esac +case "$LANG" in + pl*) + _TODOLIST="Lista zadań" + _ADD_NEWTASK="Dodaj nowe zadanie..." + _TASK="zadanie" + _DEPRIORITIZE="Usuń priorytet" + _PRIA="priorytet (A)" + _PRIB="priorytet (B)" + _PRIC="priorytet (C)" + _MARK_DONE="Oznacz jako zrobione" + _EDIT="Edytuj" + _MOVE_TO="Przenieś do..." + _MOVE_TASK_TO="Przenieś zadanie do..." + _DEL_TASK="Usuń zadanie" + _ARCHIVE="Archiwizuj (usuń wszystkie wykonane zadania)" + _NOTES_FOR="Notatki dla" + _SWITCHTO="Przełącz do listy zadań" + _TASKS="zadania" + _NEW_TODOLIST="Utwórz nową Listę zadań..." + _IN_TEXTEDITOR="w edytorze tekstu" + _ADD_NOTES="Dodaj notatki (cherrytree) do" + _NEED_NOTES="Potrzebujesz notatek do listy zadań? Zainstaluj Cherrytree" + _ADD_MENU="Dodaj własne menu do" + _EDIT_MENU="Edytuj własne menu do" + _DELETE_MENU="Usuń własne menu do" + _DANGERZONE="Niebezpieczna strefa" + _DELETE="Usuń" + _LIST_AND_ALL=" i powiązane pliki" + _AREYOU_SURE="Czy aby na pewno?" + _YES_DELETE="Tak, usuń" + _CONKY_SETTINGS_LONG="Ustawienia Widżetu Conky" + _CONKY_SETTINGS="Ustawienia widżetu Conky" + _CLEAR_FILTER="Wyczyśc filtr" + _FILTERBY="Filtruj" + _SH_CONKY="Pokaż/ukryj elementy w Conky" + _SH_DONE="Pokaż zakończone zadania" + _SH_PRIO="(A-C) priorytety" + _SH_PROJ="+projekt" + _SH_CONTEXT="@kontekst" + _START_CONKY="Uruchom widżet Conky TODOList" + _COMMANDS_FOR="Komendy dla" + ;; + + *) + _TODOLIST="TODO List" + _ADD_NEWTASK="Add new task..." + _TASK="task" + _DEPRIORITIZE="Deprioritize" + _PRIA="(A) priority" + _PRIB="(B) priority" + _PRIC="(C) priority" + _MARK_DONE="Mark as done" + _EDIT="Edit" + _MOVE_TO="Move to..." + _MOVE_TASK_TO="Move task to..." + _DEL_TASK="Delete task" + _ARCHIVE="Archive (remove all done tasks)" + _NOTES_FOR="Notes for" + _SWITCHTO="Switch to todolist" + _TASKS="tasks" + _NEW_TODOLIST="Create New TODO List..." + _IN_TEXTEDITOR="in Text editor" + _ADD_NOTES="Add hierarchical notes (cherrytree) to" + _NEED_NOTES="Need notes for todolist? Install Cherrytree" + _ADD_MENU="Add custom menu for" + _EDIT_MENU="Edit custom menu for" + _DELETE_MENU="Delete custom menu for" + _DANGERZONE="Danger Zone" + _DELETE="Delete" + _LIST_AND_ALL="and all related files" + _AREYOU_SURE="Are you sure?" + _YES_DELETE="Yes, delete" + _CONKY_SETTINGS_LONG="Conky display settings/filter" + _CONKY_SETTINGS="Conky widget settings" + _CLEAR_FILTER="Clear filter" + _FILTERBY="Filter by" + _SH_CONKY="Show/hide some elements in Conky" + _SH_DONE="Show done tasks" + _SH_PRIO="(A-C) priority" + _SH_PROJ="+project" + _SH_CONTEXT="@context" + _START_CONKY="Start TODOList conky widget" + _COMMANDS_FOR="Custom commands for" + ;; +esac + #MENU prettyname=${filename//_/ } -out+=("^sep(TODO list: ${prettyname})") -out+=(" Add new task...,mabox-todo.sh addtask && ${0} center") +out+=("^sep($_TODOLIST: ${prettyname})") +out+=(" $_ADD_NEWTASK,mabox-todo.sh addtask && ${0} center") out+=("^sep()") @@ -61,28 +142,28 @@ iks=${iks%%<*} # i reszty [[ "${dirty}" == "1" ]] && out+=("^sep(done tasks)") out+=("\"\"\"${line}\"\"\",^checkout(${i})") out2+=("^tag(${i})") -out2+=("^sep(TODO: ${prettyname})") -out2+=("^sep(Task: ${number})") +out2+=("^sep($_TODOLIST: ${prettyname})") +out2+=("^sep($_TASK: ${number})") #out2+=("    back to list,^back()") out2+=("^sep()") out2+=("\"\"\"${line}\"\"\",geany -l ${number:-1} ${TODO_DIR}/${filename}.txt") out2+=("^sep()") if [ "$dirty" = "0" ];then if [ -z "${line##*$pri*}" ]; then - out2+=(" Deprioritize,mabox-todo.sh dp ${number};${0} center") + out2+=(" $_DEPRIORITIZE,mabox-todo.sh dp ${number};${0} center") fi - out2+=(" (A) priority,mabox-todo.sh p ${number} A;${0} center") - out2+=(" (B) priority,mabox-todo.sh p ${number} B;${0} center") - out2+=(" (C) priority,mabox-todo.sh p ${number} C;${0} center") + out2+=(" $_PRIA,mabox-todo.sh p ${number} A;${0} center") + out2+=(" $_PRIB,mabox-todo.sh p ${number} B;${0} center") + out2+=(" $_PRIC,mabox-todo.sh p ${number} C;${0} center") out2+=("^sep()") -out2+=(" Mark as done,mabox-todo.sh -a -f -n done ${number};${0} center" "^sep()") +out2+=(" $_MARK_DONE,mabox-todo.sh -a -f -n done ${number};${0} center" "^sep()") fi -out2+=(" Edit task,geany -l ${number:-1} ${TODO_DIR}/${filename}.txt") +out2+=(" $_EDIT $_TASK,geany -l ${number:-1} ${TODO_DIR}/${filename}.txt") if [ "${#files[@]}" -gt "1" ];then - out2+=("󱉆 Move to...,^checkout(file${number})") + out2+=("󱉆 $_MOVE_TO,^checkout(file${number})") out3+=("^tag(file${number})") - out3+=("^sep(Move task to...)") + out3+=("^sep($_MOVE_TASK_TO)") for file in "${files[@]}" do prettyfile=${file//_/ } @@ -92,33 +173,33 @@ fi #out2+=("    back to list,^back()") out2+=("^sep()") -out2+=(" Delete task,mabox-todo.sh -f -n del ${number};${0} center") +out2+=(" $_DEL_TASK,mabox-todo.sh -f -n del ${number};${0} center") fi done <<< $(mabox-todo.sh -d ~/.config/todo/config-jgmenu ls) -[[ "$dirty" > "0" ]] && out+=("󱝧 Archive (remove all done tasks),mabox-todo.sh -f archive; ${0} center" "^sep()") +[[ "$dirty" > "0" ]] && out+=("󱝧 $_ARCHIVE,mabox-todo.sh -f archive; ${0} center" "^sep()") -out+=(" TODO List: ${prettyname}...,^checkout(files)") -[[ -f "${TODO_DIR}/${filename}.ctb" ]] && out+=("^sep()" "󱁂 Notes for ${prettyname},cherrytree ${TODO_DIR}/${filename}.ctb") +out+=(" $_TODOLIST: ${prettyname}...,^checkout(files)") +[[ -f "${TODO_DIR}/${filename}.ctb" ]] && out+=("^sep()" "󱁂 $_NOTES_FOR ${prettyname},cherrytree ${TODO_DIR}/${filename}.ctb") out2+=("^tag(files)") if [ "${#files[@]}" -gt "1" ];then - out2+=("^sep(Switch to todolist:)") + out2+=("^sep($_SWITCHTO:)") while read -r line do prettyline=${line//_/ } tasks=$(cat ~/.todo/${line}.txt |wc -l) if [ "$line" = "${filename}" ];then - out2+=(" ${prettyline} (${tasks} tasks) ,${0} center") + out2+=(" ${prettyline} ($_TASKS ${tasks}) ,${0} center") else - out2+=(" ${prettyline} (${tasks} tasks) ,mabox-todo.sh s $line;${0} center") + out2+=(" ${prettyline} ($_TASKS ${tasks}) ,mabox-todo.sh s $line;${0} center") fi done <<< $(mabox-todo.sh listfiles) fi out2+=("^sep()") -out2+=(" Create New TODO List (file)...,mabox-todo.sh addfile && ${0} center") -out2+=("^sep(TODO List: ${prettyname})") -out2+=(" Edit ${prettyname}.txt in Text editor,xdg-open ${TODO_DIR}/${filename}.txt") +out2+=(" $_NEW_TODOLIST,mabox-todo.sh addfile && ${0} center") +out2+=("^sep($_TODOLIST: ${prettyname})") +out2+=(" $_EDIT ${prettyname}.txt $_IN_TEXTEDITOR,xdg-open ${TODO_DIR}/${filename}.txt") ### Cherrytree @@ -128,39 +209,39 @@ then : #out2+=("Edit notes,cherrytree ${TODO_DIR}/${filename}.ctb") else - out2+=(" Add hierarchical notes to ${prettyname} todolist (Cherrytree),mabox-todo.sh addnotes ${filename};${0}") + out2+=(" $_ADD_NOTES ${prettyname},mabox-todo.sh addnotes ${filename};${0}") fi else -out2+=("󱁂 Need notes for todolist? Install Cherrytree,pamac-installer cherrytree") +out2+=("󱁂 $_NEED_NOTES,pamac-installer cherrytree") fi ## Custom Menu if [[ -f "${TODO_DIR}/${filename}.csv" ]];then -out2+=("Edit ${prettyname} todolist custom menu,xdg-open ${TODO_DIR}/${filename}.csv") -out2+=("Delete ${prettyname} todolist custom menu,rm -f ${TODO_DIR}/${filename}.csv;${0} center") +out2+=("$_EDIT_MENU ${prettyname},xdg-open ${TODO_DIR}/${filename}.csv") +out2+=("$_DELETE_MENU ${prettyname},rm -f ${TODO_DIR}/${filename}.csv;${0} center") else -out2+=("󰍜 Add custom menu for ${prettyname} todolist,mabox-todo.sh addmenu ${filename}") +out2+=("󰍜 $_ADD_MENU ${prettyname},mabox-todo.sh addmenu ${filename}") fi #out2+=("   ,^back()") -out2+=("^sep(Danger Zone)") -out2+=(" Delete ${prettyname} todolist and all related files,^checkout(delproj)") +out2+=("^sep($_DANGERZONE)") +out2+=(" $_DELETE ${prettyname} $_LIST_AND_ALL,^checkout(delproj)") out3+=("^tag(delproj)") -out3+=("^sep(Are you sure?)") -out3+=("\"\"\"Yes, delete ${prettyname} todolist and all files\"\"\",mabox-todo.sh removeproject ${filename};${0} center") +out3+=("^sep($_AREYOU_SURE)") +out3+=("\"\"\"$_YES_DELETE ${prettyname} $_LIST_AND_ALL\"\"\",mabox-todo.sh removeproject ${filename};${0} center") ### for Conky only if running out+=("^sep()") if pgrep -f 'conky.*conky/TODOlist' 2> /dev/null;then -out+=(" Conky display settings/filter,^checkout(display)") +out+=(" $_CONKY_SETTINGS_LONG,^checkout(display)") # DISPLAY SETTINGS SUBMENU out2+=("^tag(display)") -out2+=("^sep(Conky settings)") -[[ "$filter" != "" ]] && out2+=(" Clear filter ($filter),mb-setvar filter= ${CFG_FILE};${0} center") -out2+=("^sep(Filter by)") +out2+=("^sep($_CONKY_SETTINGS)") +[[ "$filter" != "" ]] && out2+=(" $_CLEAR_FILTER ($filter),mb-setvar filter= ${CFG_FILE};${0} center") +out2+=("^sep($_FILTERBY)") # Projects if (( ${#projects[@]} == 0 )); then @@ -182,14 +263,14 @@ else done fi -out2+=("^sep(Show/hide some elements in Conky)") -[[ "$hide_done" = "y" ]] && out2+=(" Show done tasks ,mb-setvar hide_done=n ${CFG_FILE}; ${0} center") || out2+=(" Show done tasks ,mb-setvar hide_done=y ${CFG_FILE}; ${0} center") -[[ "$hide_priority" = "y" ]] && out2+=(" (A-C) priority ,mb-setvar hide_priority=n ${CFG_FILE}; ${0} center") || out2+=(" (A-C) priority ,mb-setvar hide_priority=y ${CFG_FILE}; ${0} center") -[[ "$hide_project" = "y" ]] && out2+=(" +project,mb-setvar hide_project=n ${CFG_FILE}; ${0} center") || out2+=(" +project,mb-setvar hide_project=y ${CFG_FILE}; ${0} center") -[[ "$hide_context" = "y" ]] && out2+=(" @context,mb-setvar hide_context=n ${CFG_FILE}; ${0} center") || out2+=(" @context,mb-setvar hide_context=y ${CFG_FILE}; ${0} center") +out2+=("^sep($_SH_CONKY)") +[[ "$hide_done" = "y" ]] && out2+=(" $_SH_DONE,mb-setvar hide_done=n ${CFG_FILE}; ${0} center") || out2+=(" $_SH_DONE,mb-setvar hide_done=y ${CFG_FILE}; ${0} center") +[[ "$hide_priority" = "y" ]] && out2+=(" $_SH_PRIO,mb-setvar hide_priority=n ${CFG_FILE}; ${0} center") || out2+=(" $_SH_PRIO ,mb-setvar hide_priority=y ${CFG_FILE}; ${0} center") +[[ "$hide_project" = "y" ]] && out2+=(" $_SH_PROJ,mb-setvar hide_project=n ${CFG_FILE}; ${0} center") || out2+=(" $_SH_PROJ,mb-setvar hide_project=y ${CFG_FILE}; ${0} center") +[[ "$hide_context" = "y" ]] && out2+=(" $_SH_CONTEXT,mb-setvar hide_context=n ${CFG_FILE}; ${0} center") || out2+=(" $_SH_CONTEXT,mb-setvar hide_context=y ${CFG_FILE}; ${0} center") else -out+=("Start TODOList conky widget,conkyctl startone ${HOME}/.config/conky/TODOlist_mbcolor.conkyrc;${0}") +out+=("$_START_CONKY,conkyctl startone ${HOME}/.config/conky/TODOlist_mbcolor.conkyrc;${0}") fi @@ -204,7 +285,7 @@ fi if [ -f ${TODO_DIR}/${filename}.csv ]; then LINES=$(grep -Ev "^#|^$" ${TODO_DIR}/${filename}.csv|wc -l) if [ ${LINES} != 0 ]; then -out+=("^sep(Custom commands for ${prettyname} todolist)") +out+=("^sep($_COMMANDS_FOR ${prettyname})") fi fi diff --git a/bin/mabox-todo.sh b/bin/mabox-todo.sh index 78b1554..dbbbee7 100755 --- a/bin/mabox-todo.sh +++ b/bin/mabox-todo.sh @@ -3,6 +3,26 @@ # mabox-todo.sh - conky widget + menus to interact with todo.sh +case "$LANG" in + pl*) + _ADD_NEWTASK="Dodaj nowe zadanie..." + _ADD="dodaj" + _ABORT="anuluj" + _TASKDESC="Zadanie +projekt @kontekst" + _ADD_NEWTODOLIST="Nowa lista zadan..." + _TODONAME="Nazwa Listy" + ;; + *) + _ADD_NEWTASK="Add new task..." + _ADD="add" + _ABORT="abort" + _TASKDESC="Task description +Project @Context" + _ADD_NEWTODOLIST="Add new TODO list..." + _TODONAME="TODO List name" + ;; +esac + + # Config file CFG_FILE=~/.config/mabox/mabox-todo.conf if [ ! -f "$CFG_FILE" ];then @@ -38,8 +58,8 @@ prettyname=${filename//_/ } [[ "$hide_priority" == "y" ]] && options+=("-P") #header="Project:$filename \${alignc}TODO.txt (click me!)\${alignr}Filter:\${voffset 8}" -header="\${color0}\${alignc}TODO List -\${alignc}${prettyname}\${alignr}#[filter: $filterlabel] +header="#\${color0}\${alignc}TODO List +\${color0}\${alignc}${prettyname}\${alignr}#[filter: $filterlabel] \${voffset 8}" #declare -a cmd=(todo.sh ${options[@]} -d ~/.config/todo/config-conky ${action} ${filter}) #out+=$(${cmd[@]}) @@ -85,7 +105,7 @@ clearfilter(){ sd "filter.*$" "filter=" ${CFG_FILE} } addtask(){ -task=$(yad --width=400 --center --border=40 --undecorated --no-buttons --close-on-unfocus --text-align=center --text "Add new task...\n Enter - add | Esc - abort" --entry --entry-text="Task description +Project @Context" --ricon=gtk-clear) +task=$(yad --width=400 --center --border=40 --undecorated --no-buttons --close-on-unfocus --text-align=center --text "$_ADD_NEWTASK\n Enter - $_ADD | Esc - $_ABORT" --entry --entry-text="$_TASKDESC" --ricon=gtk-clear) if [ ! -z "${task}" ];then #notify-send.sh "okej" "${task}" pass_to_todo_sh add "${task}" @@ -94,7 +114,7 @@ else fi } addfile(){ -file=$(yad --skip-taskbar --width=400 --center --border=40 --undecorated --no-buttons --text-align=center --text "Add new TODO list..." --entry --entry-text="List name" --ricon=gtk-clear) +file=$(yad --skip-taskbar --width=400 --center --border=40 --undecorated --no-buttons --text-align=center --text "$_ADD_NEWTODOLIST" --entry --entry-text="$_TODONAME" --ricon=gtk-clear) if [ ! -z "${file}" ];then #Remove spaces file=${file// /_} @@ -153,8 +173,8 @@ conkyctl startone $HOME/.config/conky/TODOlist_mbcolor.conkyrc case "$1" in -c) to_conky;; init|-i)init;; - listfiles|l)listfiles;; #list task files - switchfile|s)switchfile "$2";; #switch to tasks file + listfiles|l|-l)listfiles;; #list task files + switchfile|s|-s)switchfile "$2";; #switch to tasks file filter)filter "$2";; clearfilter) clearfilter;; addtask)addtask;; diff --git a/share/mabox-todolist/TODOlist_mbcolor.conkyrc b/share/mabox-todolist/TODOlist_mbcolor.conkyrc index 0c8f06e..994fc83 100644 --- a/share/mabox-todolist/TODOlist_mbcolor.conkyrc +++ b/share/mabox-todolist/TODOlist_mbcolor.conkyrc @@ -8,8 +8,8 @@ conky.config = { own_window_class = 'Conky', own_window_title = 'Conky', - alignment = 'middle_left', - gap_x = 30, + alignment = 'middle_middle', + gap_x = 0, gap_y = 0, minimum_width = 200, @@ -20,17 +20,14 @@ conky.config = { override_utf8_locale = true, -- COLORS - draw_shades = true, + draw_shades = false, default_shade_color = '#000000', draw_outline = false, default_outline_color = '#222222', - default_color = '#F8F8FF', + default_color = '#d3d4bf', color0 = '#accdc7', - color1 = '#309552', - color2 = '#E8CB2D', - - + -- BORDERS draw_borders = true, -- Stippled borders? @@ -66,7 +63,7 @@ conky.config = { conky.text = [[ #${execpi 30 todo.sh -d ~/.config/todo/config-conky ls} -${execpi 3 mabox-todo.sh -c} +${execpi 5 mabox-todo.sh -c} #${image ~/.config/conky/images/test.png -p 0,0} #${image ~/.config/conky/images/test.png -p 400,0} ]];