py-todo icon indicating copy to clipboard operation
py-todo copied to clipboard

Add Polybar script?

Open jolupa opened this issue 7 years ago • 10 comments

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!

jolupa avatar Oct 27 '18 01:10 jolupa

What kind of functionality are you looking for?

RewoundVHS avatar Oct 27 '18 02:10 RewoundVHS

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.

jolupa avatar Oct 27 '18 09:10 jolupa

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

aesophor avatar Oct 27 '18 13:10 aesophor

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:

jolupa avatar Oct 27 '18 14:10 jolupa

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!

aesophor avatar Oct 27 '18 14:10 aesophor

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.

Steampunkery avatar Nov 02 '18 08:11 Steampunkery

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!

aesophor avatar Nov 02 '18 16:11 aesophor

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:

jolupa avatar Nov 03 '18 00:11 jolupa

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

aesophor avatar Nov 03 '18 15:11 aesophor

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

jcstill avatar Sep 26 '19 07:09 jcstill