Code Monkey home page Code Monkey logo

awqat's Introduction

Awqat - Islamic prayer times for Emacs

Awqat is an Emacs package to calculate the five daily Islamic prayer times. It includes also a mode line mode to show the remaining time for the next prayer.

Installation

This package is currently not located on MELPA. To use it you should include the source file awqat.el in your source path.

Installation for Spacemacs

If you are using Spacemacs you can easily install this package by putting the following in the dotspacemacs-additional-packages:

dotspacemacs-additional-packages '((awqat :location (recipe
                                                         :fetcher github
                                                         :repo "zkry/awqat")))

And in dotspacemacs/user-config adding (require 'awqat).

Installation for Doom Emacs

If you are using Doom Emacs, you can declare a custom package in your packages.el file:

(package! awqat
  :recipe (:host github
           :repo "zkry/awqat"))

And then, add a suitable configuration based on your location.

(use-package! awqat
  :commands (awqat-display-prayer-time-mode
             awqat-times-for-day)
  :config
  (setq calendar-latitude 44.2
        calendar-longitude 1.3
        awqat-mode-line-format " 🕌 ${prayer} (${hours}h${minutes}m) "))
  (awqat-set-preset-muslim-world-league))

Setup

You should have your calendar's latitude and longitude variables set up. Evaluate the variables calendar-latitude and calendar-longitude to see if these are set properly.

The prayer times can be configured in the following ways:

Fajr

  • If using an angle-based method, you can set the angle to calculate Fajr with the awqat-fajr-angle variable. (used in conjunction with the awqat-use-angle-based-method function)
  • If using a fixed offset-based method, you can set the hours before sunrise via the awqat-fajr-before-offset variable. (used in conjunction with the awqat-use-time-offset-method function)
  • For people living in higher latitudes (beyond 48.5N, 48.5S), you can use:
    • The awqat-set-preset-midnight preset which uses the function awqat--prayer-fajr-midnight to calculate a prayer time for Fajr based on the midnight method.
    • The awqat-set-preset-one-seventh-of-night preset which uses the function awqat--prayer-fajr-one-seventh-of-night to calculate a prayer time for Fajr based on the one-seventh of night method.

Sunrise

  • The only customizable variable for sunrise is awqat-sunrise-sunset-angle (Defaults to -0.833), which represents the sunrise/sunset zenith angle offset below the horizon. A zero value corresponds to the sun being at zenith=90°, which means that the sun circle is still visible. The apparent radius of the sun at the horizon is 16 arcminutes, and the average refraction is known to be 34 arcminutes, which gives an offset of 50 arcminutes, hence the -0.833° value. You shouldn't change this variable unless you are an astrophysicist!

Dhuhr

Dhuhr time corresponds to noon. It is the base for calculating other times. Dhuhr does not have a specific configuration. However, you can set safety offsets for Dhuhr (see below).

Asr

  • You can set the flag awqat-asr-hanafi to t to follow the Hanafi opinion on Asr time determination. Or set it to nil for the consensus (al-Jomhur) opinion (of Hanbali, Shafii, and Maliki). Defaults to nil.

Maghrib

  • Like the sunrise, only awqat-sunrise-sunset-angle can be set. However, it is highly discouraged to change it, unless you have a very strong and justified argument to do!

Isha

  • Like for Fajr you can set the angle for calculation with the awqat-isha-angle variable (used in conjunction with the awqat-use-angle-based-method function)
  • If using the offset-based method, you can set the hours after sunset via the awqat-isha-after-sunset variable (used in conjunction with the awqat-use-time-offset-method function)
  • For people living in higher latitudes (beyond 48.5N, 48.5S), you can use:
    • The awqat-set-preset-midnight preset which uses the function awqat--prayer-isha-midnight to calculate a prayer time for Isha based on the midnight method.
    • The awqat-set-preset-one-seventh-of-night preset which uses the function awqat--prayer-isha-one-seventh-of-night to calculate a prayer time for Isha based on the one-seventh of night method.
  • For the Moonsighting Committee Worldwide method, an additional parameter can be set for Isha. The awqat-isha-moonsighting-method accepts a symbol which can be 'shafaq-ahmar, 'shafaq-abyad, or 'shafaq (which is a combination of Shafaq Ahmar and Shafaq Abyad for high latitudes).

Safety offsets

You can add a safety offset to all times via the awqat-prayer-safety-offsets variable. For example, to have sunrise be one minute sooner, Dhuhr two minutes later, and Maghrib one minute later you can add (setq awqat-prayer-safety-offsets '(0.0 -1.0 2.0 0.0 1.0 0.0)) to your configuration.

Presets

There are presets with the angles for various organizations. You can call these functions to configure corresponding calculation parameters. The following presets are implemented:

  • awqat-set-preset-muslim-pro
  • awqat-set-preset-muslim-world-league
  • awqat-set-preset-karachi-university-of-islamic-sciences
  • awqat-set-preset-umm-al-qura
  • awqat-set-preset-jakim
  • awqat-set-preset-spiritual-administration-of-musilms-russia
  • awqat-set-preset-french-muslims
  • awqat-set-preset-grande-mosquee-de-paris
  • awqat-set-preset-isna
  • awqat-set-preset-egyptian-general-authority-of-survey
  • awqat-set-preset-kuwait
  • awqat-set-preset-algeria
  • awqat-set-preset-morocco
  • awqat-set-preset-taiwan
  • awqat-set-preset-singapore
  • awqat-set-preset-uae
  • awqat-set-preset-midnight
  • awqat-set-preset-one-seventh-of-night
  • awqat-set-preset-moonsighting-committee-worldwide
  • awqat-set-preset-institute-of-geophysics-university-of-tehran

Configuration example

The following is an example configuration:

(require 'awqat)
(setq calendar-latitude 52.439
      calendar-longitude 13.436)
(setq awqat-asr-hanafi nil)
(setq awqat-fajr-angle -18.0)
(setq awqat-isha-angle -16.0)

Here is another example that makes use of the Muslim World League preset:

(require 'awqat)
(setq calendar-latitude 52.439
      calendar-longitude 13.436)
(setq awqat-asr-hanafi nil)
(awqat-set-preset-muslim-world-league)

Viewing the times

By calling M-x awqat-times-for-day you can see the six times for the day, alongside the remaining time for the next prayer.

Viewing times with Diary/Org-Agenda

The times can be added to the diary view or org-agenda view using the diary functions. In your diary-file, add the following lines:

%%(awqat-diary-fajr)
%%(awqat-diary-sunrise)
%%(awqat-diary-dhuhr)
%%(awqat-diary-asr)
%%(awqat-diary-maghrib)
%%(awqat-diary-isha)

To use times with Org-mode, set org-agenda-include-diary to t:

(setq org-agenda-include-diary t)

Then in an Org file which is part of org-agenda-files, add the following:

* Prayers
  :PROPERTIES:
  :CATEGORY: prayers
  :END:
%%(awqat-diary-fajr)
%%(awqat-diary-sunrise)
%%(awqat-diary-dhuhr)
%%(awqat-diary-asr)
%%(awqat-diary-maghrib)
%%(awqat-diary-isha)

The above snippets are, of course, examples. Feel free to modify your liking.

awqat-display-prayer-time-mode

By running the command awqat-display-prayer-time-mode you can view the upcoming prayer time in the mode-line which is updated in real-time.

Notes on the calculation methods

Please be warned that this package may contain bugs, the times calculated by Awqat may or may not reflect the times of the particular organization that you follow. We encourage you to check the Awqat times against the times of your organization or your local mosque. Please feel free to open an issue if you observe an anomaly in our calculations.

High latitudes

The calculations for Isha and Fajr for high latitudes are implemented through midnight, three portions of the night, one-seventh of the night, and the twilight angle-based methods1; however, these methods have not been heavily tested.

If you live in a high latitude place (beyond 48.5°N and 48.5°S), you should check your organization or mosque to confirm the accepted method. Also, these special methods should only be used when the astronomical signs of twilight (Fajr and Isha) are not visible, this occurs only during a specific period of the year. Currently, the method cannot determine whether the signs are visible or not. So please make sure you are using the alternative method only when the signs are not visible.

Note that, the midnight method tries to resolve the problem of estimating the Fajr time by choosing the Fajr time to be at astronomical midnight. The time between sunset and the astronomical midnight is considered to be the Night. The midnight method does not clearly define the Isha time, hence you need to check with your local organization or mosque to see which time is considered Isha's time. Note that some jurisprudence (al-Fiqh الفقه) opinions adopt grouping Maghrib and Isha prayers (al-Jam'a الجمع) when astronomical signs are not visible (as in high latitudes during some period of time per year).

Moonsighting Committee Worldwide method

Awqat implements the Moonsighting Committee Worldwide (MCW) method2. This method is location and season aware.

For placed between the equator and 55°, this method defines correction functions based on the latitude and the season to calculate variable offsets from the sunset and sunrise. These offsets are then added or subtracted from the sunset/sunrise to get the estimated prayer time. The time estimated using these functions is then compared to the angle-based time calculated using the 18.0 angle, the most favorable is used (for Fajr, the latter of the two; for Isha, the earlier of the two).

For places between 55° and 60°, the MCW uses the one-seventh of night method.

Footnotes

  1. Prayertimes.org

  2. Syed Khalid Shaukat, Fajr and Isha, September 2015

awqat's People

Contributors

abougouffa avatar kennyballou avatar larrasket avatar zkry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

awqat's Issues

Publish on MELPA

Ramadan Mubarak! Thank you for making this package.

I use regular GNU Emacs and not spacemacs, and I'm sure a lot of other people don't use spacemacs. It would make installing this package (as well as finding it) much easier for a lot of people if it were on MELPA.

Incorrect Isha angle in the preset of Umm al-Qura

Hello, first, I would like to thank you for this package.

I want to bring your attention to the preset of Umm al-Qura University

awqat/awqat.el

Lines 128 to 130 in 1664c7e

(defun awqat-set-preset-umm-al-qura ()
"Set the calculation method to be simmilar to umm al qura."
(awqat--preset-with-angles -18.5 -19.0))

In fact, the angle for Isha is not defined, Umm al-Qura do not use an angle based calculation for Isha.

Instead, it adds a fixed amount of time to the Maghrib time as follows:

  • 90 minutes after Maghrib for all months except Ramadan.
  • 120 minutes after Maghrib time during Ramadan.

Improvement suggestion for the documentation

Hi,

Thank you for the package. It's very handy when I don't have my phone nearby.

I have a couple of suggestions to improve the documentation.

I am not sure if it's only on my system, but I need to do the following to make it work.

(setq calendar-latitude 48.093077
      calendar-longitude 11.465853)

Both are originally nil.

The other thing is that awqat-prayer-safety-offsets variable accepts a list of floating point numbers. The documentation gives an impression that they are integers (I am not sure if this is a bug or an overlook in the documentation).

I am a Spacemacs user. To install this package, I only need to put the following to the dotspacemacs-additional-packages:

dotspacemacs-additional-packages '((awqat :location (recipe
                                                         :fetcher github
                                                         :repo "zkry/awqat")))

And somewhere in the dotspacemacs/user-config function, do (require 'awqat).

Is it slow?

Recently installed explain-pause to profile emacs:

image

I'm suffering from freezing every once and a while, not sure if it is from awqat yet, but this profiling indicates that something is wrong, ist that much of processing necessary?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.