insanum / gcalcli

Google Calendar Command Line Interface
MIT License
3.3k stars 311 forks source link

Distinguish various calendars in Conky #254

Closed Walt1256 closed 8 years ago

Walt1256 commented 8 years ago

I know something along these lines was asked several months ago, but it was suggested I ask, so here goes.

Pulling gcalcli agenda into Conky, I am able to use two of my Conky-defined colors. However, I have four calendars that I have access to read (three of which I can also write to). It appears they are all read by gcalcli (at least the three with any events this week pulled into Conky). I tried the color command that Eric Davis sent me ('--calendar = my_calendar_name#red' - does it go in the def SetConkyColors(): section?), but it did not seem to work.

I have a few questions: 1) where should those color commands go in the gcalcli file; 2) if a calendar name has two (or more) words in it, should there be a space or an underscore (or something else) between those words, or should it have a different command (such as CLR_calendar_name.color = "$(color red)"; 3) in defining those colors, is it possible yet to use HTML color codes (e.g., ff0000)?

I'm afraid I don't know much at all about coding and even less about how gcalcli works, so I apologize if my questions are simplistic. Thanks.

tresni commented 8 years ago

This should require 0 knowledge of coding and just adding stuff to your .gcalclirc

1) Those commands go either on the command line or into you .gcalclirc in your $HOME directory. If you are putting them in the gcalclirc, make sure to put 1 option per line.

2) Quote the calendar name. --calendar="A Calendar With Spaces"

3) No. Colors are fixed strings that are interpreted into the appropriate color. You can use:

Or any of those preceded by "bright" (e.g. brightblue) For Conky, bright doesn't do anything.

Walt1256 commented 8 years ago

So what does a full line look like? Does it look something like --calendar "Walt Huntsman = {color red}" for instance?

I don't have a .gcalclirc file and I am not sure how to create one. Do I just copy gcalcli into my home directory with the new name (.gcalclirc) and then call it from within Conky?

I'm sorry, but it just isn't clear to me. I had this in the def SetConkyColors(): section of the gcalcli file: '--calendar = calendar name#white'. Is that not correct? (Is that the correct location for the commands even if my syntax is wrong?) I'm not running gcalcli from the command line but am calling it from within Conky.

On Wed, Aug 24, 2016 at 4:19 PM, Brian Hartvigsen notifications@github.com wrote:

This should require 0 knowledge of coding and just adding stuff to your .gcalclirc

1) Those commands go either on the command line or into you .gcalclirc in your $HOME directory. If you are putting them in the gcalclirc, make sure to put 1 option per line.

2) Quote the calendar name. --calendar="A Calendar With Spaces"

3) No. Colors are fixed strings that are interpreted into the appropriate color. You can use:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

Or any of those preceded by "bright" (e.g. brightblue) For Conky, bright doesn't do anything.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/insanum/gcalcli/issues/254#issuecomment-242226413, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPmGsgWZMDm4pWYGSFCoRCx4TPy1Zdxks5qjMN2gaJpZM4JsYUW .

Walt Huntsman From Out of Left Field http://fromoutofleftfield.blogspot.com/ My Wordsmithing http://mywordsmithing.wordpress.com/

insanum commented 8 years ago

I think there is a bug here in the config stuff.

This works for me:

gcalcli --calendar="Kids Activities"#red agenda

This does not (spits out No Events Found...):

cat '--calendar="Kids Activities"#red' > ~/.gcalclirc
gcalcli agenda
Walt1256 commented 8 years ago

Do I put that in a .gcalclirc file then? And would it just look like what you specify for each calendar, or would there be something else I would need to put in there as well or somewhere else I would need to put this?

On Thu, Aug 25, 2016 at 3:18 PM, Eric Davis notifications@github.com wrote:

I think there is a bug here in the config stuff.

This works for me: gcalcli --calendar="Kids Activities"#red agenda

This does not (spits out "No Events Found..."): cat '--calendar="Kids Activities"#red' > ~/.gcalclirc gcalcli agenda

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/insanum/gcalcli/issues/254#issuecomment-242543694, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPmGgplBRDP-1x_OJb3tBh6taK5ec45ks5qjgaYgaJpZM4JsYUW .

Walt Huntsman From Out of Left Field http://fromoutofleftfield.blogspot.com/ My Wordsmithing http://mywordsmithing.wordpress.com/

tresni commented 8 years ago

@insanum seems to work fine for me from both .gcalclirc and command line... (at least on argparse_over_gflags branch :) )

Walt1256 commented 8 years ago

I'm sorry to be stupid about this, but can you give me a gcalclirc file to work with. I've tried creating one using any of the various ways I've been given to achieve the different colors for the different calendars, and I could not make it work when gcalcli is pulled into Conky.

If I need to edit something in gcalcli itself, it would be nice to know specifically what section I need to go to and what I need change, and what I need to put in, because I've looked at it and looked at, and all that has happened is that I've become more and more confused.

I have been able to change colors in the SetConkyColors section to use some of my defined colors, but it only changes two of the colors, even though I have four calendars I pull from. (I think this goes back to the default config of gcalcli of OWNER, WRITER, READER, WHATEVER THE FOURTH CLASS IS.)

On Fri, Aug 26, 2016 at 2:56 PM, Brian Hartvigsen notifications@github.com wrote:

@insanum https://github.com/insanum seems to work fine for me from both .gcalclirc and command line... (at least on argparse_over_gflags branch :) )

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/insanum/gcalcli/issues/254#issuecomment-242849427, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPmGoRvxj5EQUCCM8HHmeSJsK59dDykks5qj1LwgaJpZM4JsYUW .

Walt Huntsman From Out of Left Field http://fromoutofleftfield.blogspot.com/ My Wordsmithing http://mywordsmithing.wordpress.com/

tresni commented 8 years ago

$EDITOR ~/.gcalclirc

--calendar=bhartvigsen#blue
--calendar=brian.andrew#red
--conky

That works for me. My calendars are named:

Projects/gcalcli ●» gcalcli list
 Access  Title
 ------  -----
  owner  bhartvigsen@opendns.com
 reader  brian.andrew@brianandjenny.com

In the gcalclirc I've shortened the calendar name as it will use any matching string. I could have spelled it out to --calendar=bhartvigsen@opendns.com#red but didn't want to.

Walt1256 commented 8 years ago

Okay. I'm sorry if this is obvious to others, but I just want to make sure I have this right. This is what I have put into a .gcalclirc file:

--calendar=Walt Huntsman#blue --calendar=Music#red --calendar=Christopher Activities#white --calendar=thuntsma#black --conky

That is the entire file at the moment. (I have four calendars, and those are the actual names.) I am the owner of the Walt Huntsman and Christopher Activities calendars, and my wife created the Music and thuntsma calendars, althought I can write to the Music calendar and read the thuntsma calendar.

I tried putting [gcalcli] at the top of this file and [gcalcli agenda] and neither worked, returning an error. (The music calendar pulled using this, but the calendars with two separate words in the name did not. My wife's calendar doesn't have anything on it for a while, so I don't know if it will work.)

Any chance there will eventually be a way to use specific Conky colors when pulling this into Conky? As I mentioned earlier, I was able to change some of the colors in gcalcli to use two of my Conky colors, but it won't use more than that (plus a third for the time).

Walt1256 commented 8 years ago

Okay, it's getting closer. I discovered that the .gcalclirc file does not like calendars with two words in the name (e.g., my Walt Huntsman and Christopher Activities calendars) regardless of whether you put the two words in quotes or put an underscore in-between the two words. At least Conky will not pull the items in. However, if you only use the first word of the calendar name (e.g., Walt or Christopher), then it works. Furthermore, by tweaking the SetConkyColors section in gcalcli, I am able to make gcalcli use my user-defined colors when it pulls the data into Conky (e.g., CLR_GRN.color = "${color3}" instead of CLR_GRN.COLOR="${color green}" when color3 is a color I specified in my .conkyrc file. By using different combinations (using color3 to replace white, then trying it to replace cyan, etc.), I've been able to get a lot closer to what I've been trying to achieve. My .gcalclirc file uses the original syntax of green, red, white, and black. (The last color will likely be tweaked once my wife's calendar pulls somthing, and I know what color actually displays, but that won't be for another couple of weeks.)

tresni commented 8 years ago

@insanum So I did find the issue. In the .gcalclirc you don't use quotes. Since each command line option is exactly one line, quotes are unnecessary.

Projects/gcalcli ●» ./gcalcli --calendar="Holidays in United States"#blue calm 09/01/2016

┌────────────────────────────────────────────────────────────────────────────┐
│September 2016                                                              │
├──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┤
│Sunday    │Monday    │Tuesday   │Wednesday │Thursday  │Friday    │Saturday  │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ **       │          │          │          │01        │02        │03        │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│04        │05        │06        │07        │08        │09        │10        │
│          │          │          │          │          │          │          │
│          │Labor Day │          │          │          │          │          │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│11        │12        │13        │14        │15        │16        │17        │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│18        │19        │20        │21        │22        │23        │24        │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│25        │26        │27        │28        │29        │30        │          │
└──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┘

Projects/gcalcli ●» cat ~/.gcalclirc                                                      « [master]
--defaultCalendar=Holidays in United States#blue
Projects/gcalcli ●» ./gcalcli calm 09/01/2016                                             « [master]

┌────────────────────────────────────────────────────────────────────────────┐
│September 2016                                                              │
├──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────┤
│Sunday    │Monday    │Tuesday   │Wednesday │Thursday  │Friday    │Saturday  │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ **       │          │          │          │01        │02        │03        │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│04        │05        │06        │07        │08        │09        │10        │
│          │          │          │          │          │          │          │
│          │Labor Day │          │          │          │          │          │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│11        │12        │13        │14        │15        │16        │17        │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│18        │19        │20        │21        │22        │23        │24        │
├──────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│25        │26        │27        │28        │29        │30        │          │
└──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┘

@walt1256 The only thing I see is that it looks like you are trying to put all the options on a single line. Each option needs to be on their own line.

--defaultCalendar=Walt Huntsman#blue
--defaultCalendar=Music#red
--defaultCalendar=Christopher Activities#white
--defaultCalendar=thuntsma#black

I would recommend not putting --conky in the .gcalclirc file itself, but using that in the command options from conky. If you want colors other then the normal colors we allow, you'll have to edit the source, no other option around that. Edit the lines that define colors.

insanum commented 8 years ago

Hey @tresni . The quotes around calendar names in .gcalcli was the issue. Nothing is obvious is guess. :-)

Walt1256 commented 8 years ago

I'm not running version 4.0.0a1. I have a version labeled as 3.3.2-1ubuntu1 installed in my system. For whatever reason, my .gcalclirc file did not like quotes around the calendar names. (Either that, or I still don't know the correct syntax.) Shortening the various calendar names to the first word did seem to work.

On Mon, Aug 29, 2016 at 10:47 AM, Eric Davis notifications@github.com wrote:

Hey @tresni https://github.com/tresni . The quotes around calendar names in .gcalcli was the issue. Nothing is obvious is guess. :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/insanum/gcalcli/issues/254#issuecomment-243181375, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPmGsoPShlXLhqpW1NEZUIPI27u3vQqks5qkw0ngaJpZM4JsYUW .

Walt Huntsman From Out of Left Field http://fromoutofleftfield.blogspot.com/ My Wordsmithing http://mywordsmithing.wordpress.com/

tresni commented 8 years ago

Quotes are literal in the .gcalclirc. So if you put "This is My Calendar" it's looking for a calendar that has the quotes in the name vs This is My Calendar. Just remove the quotes and you should be able to use the full calendar name.

Walt1256 commented 8 years ago

Got it, I think. Thanks.

On Aug 29, 2016 11:48 AM, "Brian Hartvigsen" notifications@github.com wrote:

Quotes are literal in the .gcalclirc. So if you put "This is My Calendar"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/insanum/gcalcli/issues/254#issuecomment-243199083, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPmGjbrDQ3xsd_TjOPM5iAcej3N9tVLks5qkxuJgaJpZM4JsYUW .