aesophor / py-todo

📋 Lightweight reminder / todo-list in cli
https://www.reddit.com/r/unixporn/comments/9qy35q/oc_pytodo_a_lightweight_reminder_in_cli/
MIT License
106 stars 22 forks source link

Add Polybar script? #14

Open jolupa opened 5 years ago

jolupa commented 5 years ago

Sorry I'm not a programer but I fell in love with the program and I'm thinking is any possibilities to add it to polybar? Thanks a lot and thanks for the program!

RewoundVHS commented 5 years ago

What kind of functionality are you looking for?

jolupa commented 5 years ago

Well I was thinking only displaying the most old one, or the most urgent (it's going to finish in 1 or 2 days). Maybe a button to mark as done or add a new task.

aesophor commented 5 years ago

Well I was thinking only displaying the most old one, or the most urgent (it's going to finish in 1 or 2 days). Maybe a button to mark as done or add a new task.

I'm glad you find it helpful!:laughing:
I use polybar too. This would be a nice feature. I'll look into this part once my midterm is over! (Sorry I have to keep you waiting)

Perhaps I'll let it display a little popup window near the module when it is clicked. A quick sketch up I made (probably not easy to implement something like this though) Imgur

If you have any idea, please let me know! Thanks

jolupa commented 5 years ago

Wow that's amazing (I was just thinking just in a line showing my most urgent or the oldest task) but that is just so cool! It's very helpful, for me at least, I just wants something easy not bloated with a lot of things I just don't use. Your program is just... What are my dutties! :smiley: No problem to make me wait, I'm patient! :smile:

aesophor commented 5 years ago

Wow that's amazing (I was just thinking just in a line showing my most urgent or the oldest task) but that is just so cool! It's very helpful, for me at least, I just wants something easy not bloated with a lot of things I just don't use

Not sure if I'm able to pull this off :laughing: But I do remember someone on unixporn successfully implemented this kind of popup.

I'll let you know if I have good luck with this one. Thanks for your great idea!

Steampunkery commented 5 years ago

Hey, I don't know if this will help, but I saw that polybar can execute arbitrary scripts like in the calendar module (I don't use polybar, but I did my research). I wrote this super quick, dirty, python script to interface with todo on a basic level, just viewing and deleting todos. You could execute this in polybar, I'm fairly sure. Here's the script I wrote: https://gist.github.com/Steampunkery/fedc80d899e286e33b9fb24eb6cfdf7a

It just makes a border-less window and fills it with labels and buttons corresponding to the current todo items. The window just appears right around where the mouse is. The exact formula for spawning the window is: y=height+20 and x=int(width/2)

You can always style the GUI to look better, as well.

aesophor commented 5 years ago

Hey, I don't know if this will help, but I saw that polybar can execute arbitrary scripts like in the calendar module (I don't use polybar, but I did my research). I wrote this super quick, dirty, python script to interface with todo on a basic level, just viewing and deleting todos. You could execute this in polybar, I'm fairly sure. Here's the script I wrote: https://gist.github.com/Steampunkery/fedc80d899e286e33b9fb24eb6cfdf7a

It just makes a border-less window and fills it with labels and buttons corresponding to the current todo items. The window just appears right around where the mouse is. The exact formula for spawning the window is: y=height+20 and x=int(width/2)

You can always style the GUI to look better, as well.

Wow that's amazing! Thank you so much for your help! I'm currently going all out for my midterm currently, I'll be back soon!

jolupa commented 5 years ago

sorry for the question but, what's the code to put in the polybar I'm calling the script with: [module/todo] type = custom/script interval = 90 exec = ~/.config/polybar/todo -todo label = %output% format-background = #8C6292 format-foreground = #cbd8d4 format-padding = 2 But the only thing I can see in the bar is: Traceback (most recent call last): :cry:

aesophor commented 5 years ago

sorry for the question but, what's the code to put in the polybar I'm calling the script with: [module/todo] type = custom/script interval = 90 exec = ~/.config/polybar/todo -todo label = %output% format-background = #8C6292 format-foreground = #cbd8d4 format-padding = 2 But the only thing I can see in the bar is: Traceback (most recent call last): cry

I'll look into this as soon as the midterm ends! Sorry to keep you waiting so long

jcstill commented 4 years ago

Couldn't help but comment here as I use polybar.

My polybar module: [module/tasks] type = custom/script interval = 15 format-foreground = ${colors.foreground} exec = ~/.config/scripts/todobar.sh

todobar.sh: #!/bin/bash TASKS="$(todo | head -1 | awk '{print $3}')" if [ "$TASKS" == "left" ];then TASKS="0" fi echo "Todo: $TASKS" PolybarTodo

Thats all I need for my purposes but displaying the most recent one, you could do something along the lines of: TASKS="$(todo -s | head -2 | tail -1)" if [ "$TASKS" == "No items left on the reminder." ];then TASKS="Done!" fi echo "$TASKS" The downside is that this sorts the list, which may not be ideal, and requires that color is disabled in the config otherwise it will print the escape chars (also not ideal). PolybarTodo2

you can definetly do more scripting to clean up the output, but just an example