Friday, January 26, 2018

Using Office365 Mail and Calendar in Linux

For some reason, if your school or workplace is using Microsoft Office365/Outlook for all communication, you can configure your Linux e-mail client to support most of those features such as e-mail, calendar, and contacts working. Sometime back, support for Microsoft Exchange-based services was very buggy in open-source e-mail clients like Thunderbird and Evolution. But they have come a long way since then. Here are the steps I followed to get my University e-mail working in Evolution.

Step 1: First install the software needed.
sudo apt-get install evolution evolution-ews 

Step 2: (Optional) If you are not using a GNOME-based Desktop Enivronment you need to install following dependencies as well. (For example, I'm using XFCE with i3WM)
sudo apt-get install gnome-online-accounts gnome-control-center

Step 3: Then start the gnome-contol-center. If you're not on GNOME, you might have to trick the Desktop to make it believe you're on GNOME like this:
env XDG_CURRENT_DESKTOP=GNOME gnome-control-center
 

 Step 4: Click on Online Accounts and add your Microsoft Exchange details. (Here use outlook.office365.com as the server.)

Step 5: Go to Evolution. Add an identity.

Step 6: In Receiving e-mail section, use https://outlook.office365.com/EWS/Exchange.asmx as the Host URL. Then when you click the Fetch URL button, OAB URL should be auto-completed.

Step 7: Once you restart, everything should be synced.
 

Thursday, January 11, 2018

Weather info in i3bar with i3status

Update: wttr.in now has a new one line format. So some of the below logic for parsing the output is no longer required.

I recently started using i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.  I customized i3bar and i3status (which came installed with i3) to show system information and date/time. But there was no out-of-the-box feature to get weather information from i3 status.

I wanted a simple solution that does not require installing an external program like i3blocks, conky, dzen2, xmobar or lemonbar. It had to also preserve colors I had configured for the i3bar output. So I came up with this simple solution.

Step 1: Setup a cron job to retrieve weather information every 5 minutes and store it in a temporary file. (This is because wttr.in only allows 1000 API calls per day and the weather information is not frequently updated in the server.)

*/5 * * * * curl -s wttr.in/montreal?T | head -n 7 > ~/.weather.cache

Step 2: Write a shell script to add this information to i3status data.

Step 3: The ~/.config/i3/config file needs to be updated for the status_command to pipe through this script, as follows.

bar {
        status_command .config/i3/weather.sh
        tray_output primary
}


Step 4: The ~/.i3status.conf file should also be updated to change the output to the JSON format.

general {
        output_format = "i3bar"
        colors = true
        interval = 5
}


This is how it looks like in the end.

 You can find more information from the following links.