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 multi-account support #35

Closed
kamushadenes opened this issue Apr 28, 2020 · 5 comments
Closed

Add multi-account support #35

kamushadenes opened this issue Apr 28, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@kamushadenes
Copy link

I would like to use this with my personal and work accounts, how can I do that?

@rosenpin rosenpin added the enhancement New feature or request label Apr 28, 2020
@rosenpin
Copy link
Owner

Currently this script only supports a single account, you could add your work account calendar to your personal account calendar, then sync your personal calendar. This will make the script go through both calendars

@rosenpin rosenpin added the question Further information is requested label Apr 28, 2020
@ungarida
Copy link

This is not going to be good enough workaround. In case of a Google Account managed by an organization you can share with your personal account only with permission to see busy / free events 😞

@rosenpin
Copy link
Owner

we could add an option to provide the script with multiple credentials file (using the -c flag)
This will require users to download 2 files, one for each account, then the script will simply fetch n times for each credentials file provided, it will then just merge the resulting lists and from there it's business as usual.

TODO:

  1. Change the get_events call to be called for each credential file provided
    https://github.com/rosenpin/i3-agenda/blob/master/i3_agenda/__init__.py#L33

  2. Add support for multiple credentials file command line argument
    https://github.com/rosenpin/i3-agenda/blob/master/i3_agenda/config.py#L14

@rosenpin rosenpin changed the title How to use with multiple accounts? Add multi-account support Sep 21, 2021
@rosenpin rosenpin removed the question Further information is requested label Sep 21, 2021
@ungarida
Copy link

Just out of curiosity, why is not possible to run the same command with different permission files? Because if that would have been possible, a user could render it in separated blocks with different styles. It would have been a bit more flexible.

@rosenpin
Copy link
Owner

rosenpin commented Sep 21, 2021

It's now possible since @notdodo commit

Previously if you did it, both blocks would have pulled from the same cache.
Now you can set a different config dir for each block and let them run simultaneously

You would need something like this

Step 1

You will have to create both directories first
mkdir -p ~/.config/i3agenda/work && mkdir -p ~/.config/i3agenda/personal

Step 2

You will need to download both google credential files for both accounts and place them in the appropriate directories.
More information here

Step 3

Configure your bar
Polybar example

modules-center = agenda-personal agenda-work
....
[module/agenda-personal]
type = custom/script
; Show the next event and forget cache automatically every 60 minutes. Save cache in personal config dir
exec = i3-agenda -c ~/.config/i3agenda/personal/google_credentials.json -ttl 60 --conf ~/.config/i3agenda/personal
interval = 60
....

[module/agenda-work]
type = custom/script
; Show the next event and forget cache automatically every 60 minutes. Save cache in work config dir
exec = i3-agenda -c ~/.config/i3agenda/work/google_credentials.json -ttl 60 --conf ~/.config/i3agenda/work
interval = 60

Edit:
Added this workaround to the README

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

3 participants