Coder Social home page Coder Social logo

0xzer0x / statusbar-prayers Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 0.0 476 KB

Bash script to manage and display Islamic prayer times with support for Waybar and desktop notifications.

License: MIT License

Shell 100.00%
bash bspwm dunst dwm i3 muslim muslim-prayer-times polybar prayer-times prayertimes sh shell-script yad sway waybar hyprland

statusbar-prayers's Introduction

๐ŸŒ™ Prayer Times

waybar module
Yad EN Yad AR

A versatile Bash script designed to manage and display Islamic prayer times. It retrieves prayer schedules based on the user's geographical coordinates and provides notifications for each prayer. The script supports multiple languages and integrates seamlessly with notification daemons like dunst and mako.

Inspired by Nofarah Tech's prayer times scripts, this version also includes added support for status bars like Waybar and integrated desktop notifications.

๐Ÿš€ Quick Start

  1. Clone the repo
git clone https://github.com/0xzer0x/statusbar-prayers.git
  1. Run the install script
cd statusbar-prayers
./install.sh

๐Ÿ“ฆ Dependencies

  • jq
  • at
  • yad
  • mpv
  • curl
  • xargs
  • dunst (x11)
  • polybar (x11)
  • mako (wayland)
  • waybar (wayland)
  • Nerd Font (recommended)

๐Ÿ”ง Procedures

  1. Copy files to their corresponding location on your system
  2. Set the parameters for the script
    • lat: latitude
    • long: longitude
    • method: calculation method
    • print_lang: language to print prayer times schedule in (ar/en)
    • notify: notification daemon (mako/dunst)
  3. Activate systemd user unit
  4. Add statusbar module
  5. Add notification daemon rule
  6. Configure Yad dialog to show in floating mode

๐Ÿ”„ Systemd Unit

  • Run one of the following commands to activate the service for your user
    • systemctl --user enable --now prayer-times.service # start on boot
    • systemctl --user enable --now prayer-times.timer # start on boot + every 8 hours

๐Ÿ–ฅ๏ธ Statusbar Module

Polybar

  • Add the following to your polybar config file (~/.config/polybar/config[.ini]) then add the module
  • Modify colors according to your liking (replace #83CAFA)
[module/prayers]
type = custom/script
exec = $HOME/.local/bin/prayer-times status
interval = 60
label = %{A:$HOME/.local/bin/prayer-times yad:}%{F#83CAFA}๓ฑ ง %{F-} %output%%{A}

Waybar (Wayland)

  • Add the following custom module to your waybar config (~/.config/waybar/config)
"custom/prayers": {
  "interval": 60,
  "return-type": "json",
  "exec": "$HOME/.local/bin/prayer-times waybar",
  "on-click": "$HOME/.local/bin/prayer-times yad",
  "format": "๓ฑ ง  {}",
}
  • You can style the module using the class of the next prayer (e.g. Asr)

๐Ÿ”” Notification Athan

Dunst

  • Add the following rule to your dunstrc file (~/.config/dunst/dunstrc)
[play_athan]
summary = "Prayer Times"
script = "$HOME/.local/bin/play-athan"

Mako (Wayland)

  • Add the following criteria/rule to mako config (~/.config/mako/config)
[summary="Prayer Times"]
on-notify=exec $HOME/.local/bin/play-athan
on-button-left=exec bash -c "ps --no-headers -C mpv -o pid:1,args:1 | grep 'qatami' | cut -d' ' -f1 | xargs -r kill -1"

๐Ÿ–ผ๏ธ Yad Dialog

  • Window Title: Prayers
  • Configure your window manager to show the Yad window in floating mode and you're all set!
  • Example window rule for Hyprland
windowrulev2 = float,class:(yad)
windowrulev2 = move cursor -50% 30,title:(Prayers)

๐Ÿ“š References

statusbar-prayers's People

Contributors

0xzer0x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

statusbar-prayers's Issues

prayers.json not created

The module in polybar is displaying

jq: error: Could not open file /home/abdelrahman/.local/share/prayer.json: No such file or directory

so I tried running prayer-times.sh and it gave me this error

./prayer-times.sh: 17: [[: not found
./prayer-times.sh: 23: [[: not found
./prayer-times.sh: 23: !=: not found
Creating at jobs for prayer notification...
/home/abdelrahman/.local/bin/add-prayers-at-jobs.sh: 7: [[: not found
jq: error: Could not open file /home/abdelrahman/.local/share/prayers.json: No such file or directory
jq: error: Could not open file /home/abdelrahman/.local/share/prayers.json: No such file or directory
jq: error: Could not open file /home/abdelrahman/.local/share/prayers.json: No such file or directory
jq: error: Could not open file /home/abdelrahman/.local/share/prayers.json: No such file or directory
jq: error: Could not open file /home/abdelrahman/.local/share/prayers.json: No such file or directory
at: refusing to create job destined in the past
at: refusing to create job destined in the past
at: refusing to create job destined in the past
at: refusing to create job destined in the past
at: refusing to create job destined in the past

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.