HiveMinds / HiveMinds/tw-install
Automate asking google calendar sync permission
- Dominant language
- Shell
- Stars
- 20
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Currently the user must copy a url from a terminal, open a browser and copy the url and press enter before it can grant taskwarrior access to google calendar synchronisation. This can be automated by:
- Create
name:firstGcalSync.sh
location:Taskwarrior-installation\AutoInstallTaskwarrior\src\main\resources\autoinstalltaskwarrior/
how: Using java classCreateFiles.javaof projectAutoInstallTaskwarrior.
When: during the installation/execution of AutoInstallTaskwarrior.jar
Content:
#!/bin/bash
cd /home/testlinuxname/maintenance/gCal/
sudo /home/testlinuxname/maintenance/gCal/tw_gcal_sync --gcal-calendar "TW Reminders" --taskwarrior-tag remindme
where testlinuxname is replaced with the variable linux user name.
-
then after having installed taskwarrior, install
tw_gcal_sync. -
Then find:
name:GCalSide.py
location:/home//maintenance/gCal/taskw_gcal_sync/` -
Then find the line:
creds = flow.run_local_server()(around line 188) and put the following code above it:
file = open("url.txt","w")
file.write(flow.authorization_url()[0])
file.close()
-
Then copy:
name:firstGCalSync.sh
location:Taskwarrior-installation\AutoInstallTaskwarrior\src\main\resources\autoinstalltaskwarrior/to the place dependending on protocol to make code run once at startup. -
Then, start a background loop script with powershell start process that
Content:
First check if `url.txt` exists, if it does/is found:
copy the url that is in it,
Modify the url by putting the (hardcoded) http redirect url in in it 8080
then pass the url to powershell
In powershell find the favorite browser
open the url in the browser.
Then start checking whether the `url.txt` is deleted. If it takes longer than 2 minutes, restart the ask command, as the user might have accidentally closed the wsl popup window. and restart checking for the `run.txt file`
TODO: Determine whether you can run the command inside powershell, automatically open the browser in the background, this way, you don't run the risk of the user accidentally closing the popup window. It is just the background process that is a limiting factor.
- Then run the vbs that opens an external shell that boots the wsl for the first time, and hence runs the
firstGcalSync.sh.
Name: tbd
location: tbd
Content:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "wsl"
'Dim objIE
' Create an IE object
'Set objIE = CreateObject( "InternetExplorer.Application" )
'objIE.Navigate "about:blank"
' Wait till IE is ready
WScript.Sleep 6000
'WshShell.SendKeys "/home/testlinuxname/maintenance/gCal/./askSync.sh > /mnt/c/temp/output.txt"
'WshShell.SendKeys "/home/testlinuxname/maintenance/gCal/./askSync.sh >> /mnt/c/temp/output.txt"
WshShell.SendKeys "/home/testlinuxname/maintenance/gCal/./askSync.sh"
WshShell.SendKeys "{ENTER}"
' Create an IE object
'Set objIE = CreateObject( "InternetExplorer.Application" )
'objIE.Navigate "about:blank"
' Wait till IE is ready
WScript.Sleep 6000
'WshShell.SendKeys "^(c)"
'WshShell.SendKeys "exit"
'WshShell.SendKeys "{ENTER}"
'WshShell.SendKeys "exit"
'WshShell.SendKeys "{ENTER}"
Without the abruption, that waits, until the user has granted permission. Once the user has granted permission, delete the url.txt file
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.