Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Polybar script? #14

Open
jolupa opened this issue Oct 27, 2018 · 10 comments
Open

Add Polybar script? #14

jolupa opened this issue Oct 27, 2018 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@jolupa
Copy link

jolupa commented Oct 27, 2018

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
Copy link
Contributor

What kind of functionality are you looking for?

@jolupa
Copy link
Author

jolupa commented Oct 27, 2018

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
Copy link
Owner

aesophor commented Oct 27, 2018

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
Copy link
Author

jolupa commented Oct 27, 2018

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! 😃
No problem to make me wait, I'm patient! 😄

@aesophor
Copy link
Owner

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 😆 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 aesophor self-assigned this Oct 27, 2018
@aesophor aesophor added the enhancement New feature or request label Oct 27, 2018
@Steampunkery
Copy link
Contributor

Steampunkery commented Nov 2, 2018

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
Copy link
Owner

aesophor commented Nov 2, 2018

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
Copy link
Author

jolupa commented Nov 3, 2018

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):
😢

@aesophor
Copy link
Owner

aesophor commented Nov 3, 2018

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
Copy link
Contributor

jcstill commented Sep 26, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants