├── .gitignore ├── vsadhkar.png ├── media ├── palestine.png ├── script.js ├── style.css ├── vscode.css └── dua.json ├── src ├── interfaces │ └── index.ts ├── lib │ └── fetchDua.ts ├── test │ └── extension.test.ts └── extension.ts ├── .vscode-test.mjs ├── .vscodeignore ├── .vscode ├── extensions.json ├── tasks.json ├── settings.json └── launch.json ├── CHANGELOG.md ├── README.md ├── tsconfig.json ├── .eslintrc.json ├── LICENSE ├── package.json └── vsc-extension-quickstart.md /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | dist 3 | node_modules 4 | .vscode-test/ 5 | *.vsix 6 | .env -------------------------------------------------------------------------------- /vsadhkar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azizbecha/vsadhkar/HEAD/vsadhkar.png -------------------------------------------------------------------------------- /media/palestine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azizbecha/vsadhkar/HEAD/media/palestine.png -------------------------------------------------------------------------------- /src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export interface Dua { 2 | arabic: string; 3 | transliteration: string; 4 | translation: string; 5 | } -------------------------------------------------------------------------------- /.vscode-test.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@vscode/test-cli'; 2 | 3 | export default defineConfig({ 4 | files: 'out/test/**/*.test.js', 5 | }); 6 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | src/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/.eslintrc.json 9 | **/*.map 10 | **/*.ts 11 | **/.vscode-test.* 12 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "ms-vscode.extension-test-runner" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "vsadhkar" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VSAdhkar 2 | VSAdhkar is a Visual Studio Code extension that brings daily adhkar (Islamic remembrances) and dua (supplications) directly into your coding environment. Stay spiritually connected while you work with timely notifications featuring essential adhkar and duas. 3 | -------------------------------------------------------------------------------- /media/script.js: -------------------------------------------------------------------------------- 1 | const vscode = acquireVsCodeApi(); 2 | 3 | document.getElementById('settingsForm').addEventListener('submit', event => { 4 | event.preventDefault(); 5 | const timeInterval = document.getElementById('timeInterval').value; 6 | vscode.postMessage({ 7 | command: 'saveSettings', 8 | timeInterval: timeInterval 9 | }); 10 | }); -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 10 | "typescript.tsc.autoDetect": "off" 11 | } 12 | -------------------------------------------------------------------------------- /src/lib/fetchDua.ts: -------------------------------------------------------------------------------- 1 | import { Dua } from "../interfaces"; 2 | const fs = require("fs"); 3 | const path = require("path"); 4 | import * as vscode from 'vscode'; 5 | 6 | export const fetchDua = (context: vscode.ExtensionContext): Dua => { 7 | const filePath = path.join(context.extensionPath, "media", "dua.json"); 8 | 9 | const content: Dua[] = JSON.parse(fs.readFileSync(filePath, "utf8")); 10 | const randomIndex = Math.floor(Math.random() * content.length); 11 | return content[randomIndex]; 12 | }; 13 | -------------------------------------------------------------------------------- /src/test/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2022", 5 | "outDir": "out", 6 | "lib": [ 7 | "ES2022" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ], 15 | "outFiles": [ 16 | "${workspaceFolder}/out/**/*.js" 17 | ], 18 | "preLaunchTask": "${defaultBuildTask}" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": [ 13 | "warn", 14 | { 15 | "selector": "import", 16 | "format": [ "camelCase", "PascalCase" ] 17 | } 18 | ], 19 | "@typescript-eslint/semi": "warn", 20 | "curly": "warn", 21 | "eqeqeq": "warn", 22 | "no-throw-literal": "warn", 23 | "semi": "off" 24 | }, 25 | "ignorePatterns": [ 26 | "out", 27 | "dist", 28 | "**/*.d.ts" 29 | ] 30 | } -------------------------------------------------------------------------------- /media/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | height: 100%; 3 | margin-top: 20px; 4 | border-right: 1px solid #fff; 5 | } 6 | 7 | hr { 8 | margin-top: 20px; 9 | margin-bottom: 20px; 10 | border-top: 1px; 11 | } 12 | 13 | h1 { 14 | font-weight: bold; 15 | } 16 | 17 | select { 18 | padding: 5px 15px; 19 | color: #fff; 20 | background-color: #3c3c3c; 21 | border-color: #3c3c3c; 22 | width: 100%; 23 | } 24 | 25 | a { 26 | text-decoration: none; 27 | } 28 | 29 | .flex { 30 | display: flex; 31 | justify-content: space-around; 32 | } 33 | 34 | 35 | .w-100 { 36 | width: 100%; 37 | } 38 | 39 | .w-50 { 40 | width: 50%; 41 | } 42 | 43 | .mt-1 { 44 | margin-top: 10px; 45 | } 46 | 47 | .mb-1 { 48 | margin-bottom: 10px; 49 | } 50 | 51 | .ml-1 { 52 | margin-left: 10px; 53 | } 54 | 55 | .mr-1 { 56 | margin-right: 10px; 57 | } 58 | 59 | .m-1 { 60 | margin: 10px; 61 | } 62 | 63 | .prayer-time { 64 | font-size: medium; 65 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Aziz Becha 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vsadhkar", 3 | "displayName": "VSAdhkar", 4 | "description": "VSAdhkar is a Visual Studio Code extension that brings daily adhkar (Islamic remembrances) and dua (supplications) directly into your coding environment. Stay spiritually connected while you work with timely notifications featuring essential adhkar and duas.", 5 | "version": "0.3.0", 6 | "repository": "https://github.com/azizbecha/vsadhkar", 7 | "icon": "vsadhkar.png", 8 | "publisher": "azizbecha", 9 | "engines": { 10 | "vscode": "^1.90.0" 11 | }, 12 | "categories": [ 13 | "Other" 14 | ], 15 | "activationEvents": [ 16 | "onStartupFinished" 17 | ], 18 | "main": "./out/extension.js", 19 | "contributes": { 20 | "viewsContainers": { 21 | "activitybar": [ 22 | { 23 | "id": "exampleSidebar", 24 | "title": "VSAdhkar Settings", 25 | "icon": "$(heart)" 26 | } 27 | ] 28 | }, 29 | "views": { 30 | "exampleSidebar": [ 31 | { 32 | "type": "webview", 33 | "id": "vsadhkar.exampleWebview", 34 | "name": "VSAdhkar Settings" 35 | } 36 | ] 37 | }, 38 | "commands": [ 39 | { 40 | "command": "vsadhkar.getDhikr", 41 | "title": "Get Dhikr" 42 | }, 43 | { 44 | "command": "vsadhkar.openSettings", 45 | "title": "Open VSAdhkar Settings Panel" 46 | }, 47 | { 48 | "command": "vsadhkar.selectLocation", 49 | "title": "Select location" 50 | } 51 | ] 52 | }, 53 | "scripts": { 54 | "vscode:prepublish": "npm run compile", 55 | "compile": "tsc -p ./", 56 | "watch": "tsc -watch -p ./", 57 | "pretest": "npm run compile && npm run lint", 58 | "lint": "eslint src --ext ts", 59 | "test": "vscode-test" 60 | }, 61 | "devDependencies": { 62 | "@types/mocha": "^10.0.6", 63 | "@types/node": "18.x", 64 | "@types/vscode": "^1.90.0", 65 | "@typescript-eslint/eslint-plugin": "^7.11.0", 66 | "@typescript-eslint/parser": "^7.11.0", 67 | "@vscode/test-cli": "^0.0.9", 68 | "@vscode/test-electron": "^2.4.0", 69 | "eslint": "^8.57.0", 70 | "typescript": "^5.4.5" 71 | }, 72 | "dependencies": { 73 | "dotenv": "^16.4.5", 74 | "fs": "^0.0.1-security", 75 | "moment": "^2.30.1", 76 | "path": "^0.12.7" 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /media/vscode.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --container-paddding: 20px; 3 | --input-padding-vertical: 6px; 4 | --input-padding-horizontal: 4px; 5 | --input-margin-vertical: 4px; 6 | --input-margin-horizontal: 0; 7 | } 8 | 9 | body { 10 | padding: 0 var(--container-paddding); 11 | color: var(--vscode-foreground); 12 | font-size: var(--vscode-font-size); 13 | font-weight: var(--vscode-font-weight); 14 | font-family: var(--vscode-font-family); 15 | background-color: var(--vscode-editor-background); 16 | height: 100%; 17 | } 18 | 19 | ol, 20 | ul { 21 | padding-left: var(--container-paddding); 22 | } 23 | 24 | body>*, 25 | form>* { 26 | margin-block-start: var(--input-margin-vertical); 27 | margin-block-end: var(--input-margin-vertical); 28 | } 29 | 30 | *:focus { 31 | outline-color: var(--vscode-focusBorder) !important; 32 | } 33 | 34 | a { 35 | color: var(--vscode-textLink-foreground); 36 | } 37 | 38 | a:hover, 39 | a:active { 40 | color: var(--vscode-textLink-activeForeground); 41 | } 42 | 43 | code { 44 | font-size: var(--vscode-editor-font-size); 45 | font-family: var(--vscode-editor-font-family); 46 | } 47 | 48 | button { 49 | border: none; 50 | padding: var(--input-padding-vertical) var(--input-padding-horizontal); 51 | width: 100%; 52 | text-align: center; 53 | outline: 1px solid transparent; 54 | outline-offset: 2px !important; 55 | color: var(--vscode-button-foreground); 56 | background: var(--vscode-button-background); 57 | } 58 | 59 | button:hover { 60 | cursor: pointer; 61 | background: var(--vscode-button-hoverBackground); 62 | } 63 | 64 | button:focus { 65 | outline-color: var(--vscode-focusBorder); 66 | } 67 | 68 | button.secondary { 69 | color: var(--vscode-button-secondaryForeground); 70 | background: var(--vscode-button-secondaryBackground); 71 | } 72 | 73 | button.secondary:hover { 74 | background: var(--vscode-button-secondaryHoverBackground); 75 | } 76 | 77 | input:not([type='checkbox']), 78 | textarea { 79 | display: block; 80 | width: 100%; 81 | border: none; 82 | font-family: var(--vscode-font-family); 83 | padding: var(--input-padding-vertical) var(--input-padding-horizontal); 84 | color: var(--vscode-input-foreground); 85 | outline-color: var(--vscode-input-border); 86 | background-color: var(--vscode-input-background); 87 | } 88 | 89 | input::placeholder, 90 | textarea::placeholder { 91 | color: var(--vscode-input-placeholderForeground); 92 | } -------------------------------------------------------------------------------- /vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your VS Code Extension 2 | 3 | ## What's in the folder 4 | 5 | * This folder contains all of the files necessary for your extension. 6 | * `package.json` - this is the manifest file in which you declare your extension and command. 7 | * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin. 8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command. 9 | * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`. 10 | * We pass the function containing the implementation of the command as the second parameter to `registerCommand`. 11 | 12 | ## Get up and running straight away 13 | 14 | * Press `F5` to open a new window with your extension loaded. 15 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`. 16 | * Set breakpoints in your code inside `src/extension.ts` to debug your extension. 17 | * Find output from your extension in the debug console. 18 | 19 | ## Make changes 20 | 21 | * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`. 22 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 23 | 24 | ## Explore the API 25 | 26 | * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`. 27 | 28 | ## Run tests 29 | 30 | * Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner) 31 | * Run the "watch" task via the **Tasks: Run Task** command. Make sure this is running, or tests might not be discovered. 32 | * Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A` 33 | * See the output of the test result in the Test Results view. 34 | * Make changes to `src/test/extension.test.ts` or create new test files inside the `test` folder. 35 | * The provided test runner will only consider files matching the name pattern `**.test.ts`. 36 | * You can create folders inside the `test` folder to structure your tests any way you want. 37 | 38 | ## Go further 39 | 40 | * [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns. 41 | * Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension). 42 | * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace. 43 | * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration). 44 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | import moment from 'moment'; 4 | import * as dotenv from 'dotenv'; 5 | import * as path from 'path'; 6 | 7 | import { fetchDua } from './lib/fetchDua'; 8 | import { Dua } from './interfaces'; 9 | 10 | interface Country { 11 | id: number; 12 | name: string; 13 | iso2: string; 14 | iso3: string; 15 | phonecode: string; 16 | capital: string; 17 | currency: string; 18 | native: string; 19 | emoji: string; 20 | } 21 | 22 | interface State { 23 | type: string | null; 24 | id: number; 25 | name: string; 26 | iso2: string; 27 | } 28 | 29 | interface City { 30 | id: number; 31 | name: string; 32 | } 33 | 34 | let getDhikrStatusBarButton: vscode.StatusBarItem; 35 | let intervalId: NodeJS.Timeout; 36 | let updateIntervalId: NodeJS.Timeout; 37 | 38 | let timeInterval: number; 39 | let country: string | undefined; 40 | let state: string | undefined; 41 | let city: string | undefined; 42 | 43 | let prayerTimes: { [key: string]: string } | undefined; 44 | let sunTimings: { [key: string]: string } | undefined; 45 | 46 | let nextPrayerItem: vscode.StatusBarItem; 47 | let provider: ExampleSidebarProvider; 48 | 49 | // Load environment variables from .env file 50 | dotenv.config({ path: path.resolve(__dirname, '..', '.env') }); 51 | 52 | const API_KEY = process.env.API_KEY; 53 | 54 | if (!API_KEY) { 55 | vscode.window.showErrorMessage('API Key is missing. Please set it in the .env file.'); 56 | throw new Error('API Key is missing'); 57 | } 58 | 59 | const timeIntervals = [ 60 | { 61 | label: "30 seconds", 62 | value: 30000 63 | }, 64 | { 65 | label: "1 minute", 66 | value: 60000 67 | }, 68 | { 69 | label: "2 minutes", 70 | value: 120000 71 | }, 72 | { 73 | label: "3 minutes", 74 | value: 180000 75 | }, 76 | { 77 | label: "5 minutes", 78 | value: 300000 79 | }, 80 | { 81 | label: "10 minutes", 82 | value: 600000 83 | } 84 | ]; 85 | 86 | const showDua = (context: vscode.ExtensionContext) => { 87 | let dua: Dua = fetchDua(context); 88 | vscode.window.showInformationMessage(dua.arabic); 89 | }; 90 | 91 | const setupInterval = (context: vscode.ExtensionContext) => { 92 | clearInterval(intervalId); 93 | intervalId = setInterval(() => showDua(context), timeInterval); 94 | }; 95 | 96 | function verboseMs(msValue: number) { 97 | const duration = moment.duration(msValue); 98 | const hours = duration.hours(); 99 | const minutes = duration.minutes(); 100 | const seconds = duration.seconds(); 101 | 102 | return [ 103 | hours ? `${hours} hour${hours > 1 ? 's' : ''}` : '', 104 | minutes ? `${minutes} minute${minutes > 1 ? 's' : ''}` : '', 105 | seconds ? `${seconds} second${seconds > 1 ? 's' : ''}` : '' 106 | ].filter(Boolean).join(' '); 107 | } 108 | 109 | const saveTimings = (context: vscode.ExtensionContext, timings: { [x: string]: string; }) => { 110 | // Define the fields for prayer times and sun timings 111 | const prayerFields: string[] = ['Fajr', 'Dhuhr', 'Asr', 'Maghrib', 'Isha']; 112 | const sunFields: string[] = ['Sunrise', 'Sunset', 'Imsak', 'Midnight', 'Firstthird', 'Lastthird']; 113 | 114 | // Create objects for prayer times and sun timings 115 | const prayerTimes: { [key: string]: string } = {}; 116 | const sunTimings: { [key: string]: string } = {}; 117 | 118 | // Populate the prayer times object 119 | prayerFields.forEach(field => { 120 | if (timings[field]) { 121 | prayerTimes[field] = timings[field]; 122 | } 123 | }); 124 | 125 | // Populate the sun timings object 126 | sunFields.forEach(field => { 127 | if (timings[field]) { 128 | sunTimings[field] = timings[field]; 129 | } 130 | }); 131 | 132 | // Update the global state 133 | context.globalState.update("prayerTimes", prayerTimes); 134 | context.globalState.update("sunTimings", sunTimings); 135 | }; 136 | 137 | function getNextPrayerTime(prayerTimes: { [key: string]: string }): string { 138 | const now = new Date(); 139 | const times = Object.entries(prayerTimes).map(([prayer, time]) => { 140 | const [hours, minutes] = time.split(':').map(Number); 141 | const prayerTime = new Date(); 142 | prayerTime.setHours(hours, minutes, 0, 0); 143 | return { prayer, time: prayerTime }; 144 | }); 145 | 146 | const upcomingPrayer = times.find(({ time }) => time > now); 147 | if (upcomingPrayer) { 148 | const diff = upcomingPrayer.time.getTime() - now.getTime(); 149 | const minutes = Math.floor((diff / 1000 / 60) % 60); 150 | const hours = Math.floor((diff / 1000 / 60 / 60) % 24); 151 | return `${upcomingPrayer.prayer} in ${hours}h ${minutes}m`; 152 | } 153 | 154 | // If no future time found, return time till the first prayer of the next day 155 | const firstPrayerTime = times[0].time; 156 | const diff = firstPrayerTime.getTime() + 24 * 60 * 60 * 1000 - now.getTime(); 157 | const minutes = Math.floor((diff / 1000 / 60) % 60); 158 | const hours = Math.floor((diff / 1000 / 60 / 60) % 24); 159 | 160 | const message = `${times[0].prayer} in ${hours}h ${minutes}m`; 161 | 162 | if (5 >= minutes) { 163 | vscode.window.showInformationMessage(message); 164 | } 165 | 166 | return message; 167 | } 168 | 169 | const fetchCountries = async (): Promise => { 170 | const headers = new Headers(); 171 | headers.append("X-CSCAPI-KEY", API_KEY); 172 | 173 | const response = await fetch("https://api.countrystatecity.in/v1/countries", { 174 | method: 'GET', 175 | headers: headers, 176 | redirect: 'follow' 177 | }); 178 | return response.json() as Promise; 179 | }; 180 | 181 | const fetchStates = async (countryIso: string): Promise => { 182 | const headers = new Headers(); 183 | headers.append("X-CSCAPI-KEY", API_KEY); 184 | 185 | const response = await fetch(`https://api.countrystatecity.in/v1/countries/${countryIso}/states`, { 186 | method: 'GET', 187 | headers: headers, 188 | redirect: 'follow' 189 | }); 190 | return response.json() as Promise; 191 | }; 192 | 193 | const fetchCities = async (countryIso: string, stateIso: string): Promise => { 194 | const headers = new Headers(); 195 | headers.append("X-CSCAPI-KEY", API_KEY); 196 | 197 | const response = await fetch(`https://api.countrystatecity.in/v1/countries/${countryIso}/states/${stateIso}/cities`, { 198 | method: 'GET', 199 | headers: headers, 200 | redirect: 'follow' 201 | }); 202 | return response.json() as Promise; 203 | }; 204 | 205 | const fetchPrayerTimes = (country: string, state: string, city: string, context: vscode.ExtensionContext, callback: () => void) => { 206 | fetch(`http://api.aladhan.com/v1/timingsByCity?country=${country}&state=${state}&city=${city}`) 207 | .then(response => response.json()) 208 | .then((data: any) => { 209 | const timings = data.data.timings; 210 | saveTimings(context, timings); 211 | callback(); // Call the callback to update the webview 212 | }) 213 | .catch(error => { 214 | vscode.window.showErrorMessage(`Error fetching prayer times: ${error}`); 215 | }); 216 | }; 217 | 218 | const selectLocation = async (context: vscode.ExtensionContext) => { 219 | try { 220 | // Select Country 221 | const countries = await fetchCountries(); 222 | const countryItems = countries.map(country => ({ label: country.name, description: country.iso2 })); 223 | const selectedCountry = await vscode.window.showQuickPick(countryItems, { placeHolder: 'Select a country' }); 224 | if (!selectedCountry) { return; } 225 | 226 | // Select State 227 | const states = await fetchStates(selectedCountry.description!); 228 | const stateItems = states.map(state => ({ label: state.name, description: state.iso2, type: state.type })); 229 | const selectedState = await vscode.window.showQuickPick(stateItems, { placeHolder: `Select a state in ${selectedCountry.label}` }); 230 | if (!selectedState) { return; } 231 | 232 | let cityLabel: string | undefined; 233 | 234 | // Fetch cities only if state type is not null 235 | if (selectedState.type !== null) { 236 | const cities = await fetchCities(selectedCountry.description!, selectedState.description!); 237 | if (cities.length > 0) { 238 | const cityItems = cities.map(city => ({ label: city.name })); 239 | const selectedCity = await vscode.window.showQuickPick(cityItems, { placeHolder: `Select a city in ${selectedState.label}, ${selectedCountry.label}` }); 240 | if (!selectedCity) { return; } 241 | cityLabel = selectedCity.label; 242 | } 243 | } 244 | 245 | // If no city is selected, use the state as the city label 246 | if (!cityLabel) { 247 | cityLabel = selectedState.label; 248 | } 249 | 250 | // Save selected location to global state 251 | vscode.window.showInformationMessage(`Selected Location: ${cityLabel}, ${selectedState.label}, ${selectedCountry.label}`); 252 | context.globalState.update("country", selectedCountry.label); 253 | context.globalState.update("state", selectedState.label); 254 | context.globalState.update("city", cityLabel); 255 | 256 | fetchPrayerTimes(selectedCountry.label, selectedState.label, cityLabel, context, () => { 257 | provider.updateWebview(); // Update the webview content when location is selected and prayer times are fetched 258 | }); 259 | } catch (error) { 260 | vscode.window.showErrorMessage(`Error fetching location data: ${error}`); 261 | } 262 | }; 263 | 264 | const updateLocationAndPrayerTimes = (context: vscode.ExtensionContext) => { 265 | timeInterval = context.globalState.get('vsadhkar.timeInterval', 30000); 266 | country = context.globalState.get("country"); 267 | state = context.globalState.get("state"); 268 | city = context.globalState.get("city"); 269 | prayerTimes = context.globalState.get("prayerTimes"); 270 | if (prayerTimes !== undefined) { 271 | nextPrayerItem.text = `Next prayer: ${getNextPrayerTime(prayerTimes)}`; 272 | } 273 | console.log(timeInterval); 274 | }; 275 | 276 | export function activate(context: vscode.ExtensionContext) { 277 | 278 | // Status Bar Button to get Dhikr and Dua 279 | getDhikrStatusBarButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100); 280 | getDhikrStatusBarButton.command = 'vsadhkar.getDhikr'; 281 | getDhikrStatusBarButton.text = `$(heart) Get Dhikr`; 282 | getDhikrStatusBarButton.tooltip = "Click to Get a Dhikr"; 283 | context.subscriptions.push(getDhikrStatusBarButton); 284 | getDhikrStatusBarButton.show(); 285 | 286 | // Show "Free Palestine" message at starting 287 | vscode.window.showInformationMessage("Free Palestine !"); 288 | 289 | // Retrieve saved time interval or use default (30s) 290 | timeInterval = context.globalState.get('vsadhkar.timeInterval', 30000); 291 | console.log(timeInterval); 292 | 293 | // Get stored settings 294 | country = context.globalState.get("country"); 295 | state = context.globalState.get("state"); 296 | city = context.globalState.get("city"); 297 | prayerTimes = context.globalState.get("prayerTimes"); 298 | 299 | if (country === undefined || state === undefined || city === undefined || prayerTimes === undefined) { 300 | vscode.window.showErrorMessage("Geolocation is missing to fetch prayer times, please select your location from the dropdown"); 301 | selectLocation(context); 302 | } else { 303 | fetchPrayerTimes(country, state, city, context, () => null); 304 | } 305 | 306 | if (prayerTimes === undefined) { return; } 307 | 308 | nextPrayerItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100); 309 | nextPrayerItem.text = `Next prayer: ${getNextPrayerTime(prayerTimes)}`; 310 | nextPrayerItem.show(); 311 | 312 | setInterval(() => { 313 | updateLocationAndPrayerTimes(context); 314 | if (prayerTimes !== undefined) { 315 | nextPrayerItem.text = `Next prayer: ${getNextPrayerTime(prayerTimes)}`; 316 | } 317 | }, 60000); // Update every minute 318 | 319 | context.subscriptions.push(nextPrayerItem); 320 | 321 | setupInterval(context); 322 | 323 | updateIntervalId = setInterval(() => updateLocationAndPrayerTimes(context), 1000); 324 | 325 | context.subscriptions.push( 326 | vscode.commands.registerCommand('vsadhkar.getDhikr', () => { 327 | showDua(context); 328 | }) 329 | ); 330 | 331 | provider = new ExampleSidebarProvider(context.extensionUri, context); 332 | context.subscriptions.push( 333 | vscode.window.registerWebviewViewProvider(ExampleSidebarProvider.viewType, provider) 334 | ); 335 | 336 | context.subscriptions.push( 337 | vscode.commands.registerCommand('vsadhkar.openSettings', () => { 338 | vscode.commands.executeCommand('workbench.view.vsadhkar.exampleSidebar'); 339 | }) 340 | ); 341 | 342 | context.subscriptions.push( 343 | vscode.commands.registerCommand('vsadhkar.selectLocation', () => { 344 | selectLocation(context); 345 | }) 346 | ); 347 | } 348 | 349 | class ExampleSidebarProvider implements vscode.WebviewViewProvider { 350 | public static readonly viewType = 'vsadhkar.exampleWebview'; 351 | private _view?: vscode.WebviewView; 352 | 353 | constructor(private readonly _extensionUri: vscode.Uri, private readonly _context: vscode.ExtensionContext) { } 354 | 355 | public async resolveWebviewView( 356 | webviewView: vscode.WebviewView, 357 | _context: vscode.WebviewViewResolveContext, 358 | _token: vscode.CancellationToken 359 | ) { 360 | this._view = webviewView; 361 | 362 | webviewView.webview.options = { 363 | enableScripts: true, 364 | localResourceRoots: [this._extensionUri] 365 | }; 366 | 367 | // Set initial HTML content 368 | webviewView.webview.html = this.getHtmlForWebview(webviewView.webview); 369 | 370 | webviewView.webview.onDidReceiveMessage(message => { 371 | switch (message.command) { 372 | case 'saveSettings': 373 | var t = parseInt(message.t); 374 | this._context.globalState.update("vsadhkar.timeInterval", t); 375 | vscode.window.showInformationMessage(`Settings saved: Show Dua every ${verboseMs(t)}`); 376 | setupInterval(this._context); 377 | provider.updateWebview(); 378 | break; 379 | case 'selectLocation': 380 | vscode.commands.executeCommand('vsadhkar.selectLocation'); 381 | break; 382 | } 383 | }); 384 | } 385 | 386 | public updateWebview() { 387 | if (this._view) { 388 | updateLocationAndPrayerTimes(this._context); 389 | timeInterval = this._context.globalState.get('vsadhkar.timeInterval', 30000); 390 | console.log(timeInterval); 391 | this._view.webview.html = this.getHtmlForWebview(this._view.webview); 392 | } 393 | } 394 | 395 | private getHtmlForWebview(webview: vscode.Webview): string { 396 | const styleUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'style.css')); 397 | const vscodeStyleUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'vscode.css')); 398 | const palestineFlag = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'media', 'palestine.png')); 399 | const prayerTimes: { [key: string]: string } | undefined = this._context.globalState.get("prayerTimes"); 400 | 401 | return ` 402 | 403 | 404 | 405 | 406 | 407 | 408 | VSAdhkar Settings 409 | 410 | 411 |

☪️ VSAdhkar Settings

412 |

🍉Free Palestine

413 | 414 | 415 | 416 | 419 | 420 |
421 | ${country === undefined || state === undefined || city === undefined || prayerTimes === undefined ? 422 | ("No location data found. Please select your location.") : (` 423 |

📌 ${city}, ${state}, ${country}

424 |

🕌 Prayer times

425 |
    426 | ${prayerTimes && Object.keys(prayerTimes).map(prayer => `
  • ${prayer}: ${prayerTimes[prayer]}
  • `).join('')} 427 |
428 | 429 | 430 |
431 |

🤲 Showing Dua every ${verboseMs(timeInterval)}

432 | 438 |
` 439 | ) 440 | } 441 | 442 | 443 | 458 | 459 | `; 460 | } 461 | } 462 | 463 | export function deactivate() { 464 | clearInterval(intervalId); 465 | clearInterval(updateIntervalId); 466 | } -------------------------------------------------------------------------------- /media/dua.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "arabic": "بِسْمِ اللَّهِ", 4 | "transliteration": "Bismillah", 5 | "translation": "In the name of Allah" 6 | }, 7 | { 8 | "arabic": "الْحَمْدُ لِلَّهِ", 9 | "transliteration": "Alhamdulillah", 10 | "translation": "All praise is for Allah" 11 | }, 12 | { 13 | "arabic": "سُبْحَانَ اللَّهِ", 14 | "transliteration": "Subhanallah", 15 | "translation": "Glory be to Allah" 16 | }, 17 | { 18 | "arabic": "اللَّهُ أَكْبَرُ", 19 | "transliteration": "Allahu Akbar", 20 | "translation": "Allah is the Greatest" 21 | }, 22 | { 23 | "arabic": "لَا إِلَهَ إِلَّا اللَّهُ", 24 | "transliteration": "La ilaha illallah", 25 | "translation": "There is no god but Allah" 26 | }, 27 | { 28 | "arabic": "أَسْتَغْفِرُ اللَّهَ", 29 | "transliteration": "Astaghfirullah", 30 | "translation": "I seek forgiveness from Allah" 31 | }, 32 | { 33 | "arabic": "سُبْحَانَ اللَّهِ وَبِحَمْدِهِ", 34 | "transliteration": "Subhanallahi wa bihamdihi", 35 | "translation": "Glory be to Allah and all praise is due to Him" 36 | }, 37 | { 38 | "arabic": "سُبْحَانَ اللَّهِ الْعَظِيمِ", 39 | "transliteration": "Subhanallahil azeem", 40 | "translation": "Glory is to Allah, the Great" 41 | }, 42 | { 43 | "arabic": "لَا حَوْلَ وَلَا قُوَّةَ إِلَّا بِاللَّهِ", 44 | "transliteration": "La hawla wa la quwwata illa billah", 45 | "translation": "There is no power nor strength except with Allah" 46 | }, 47 | { 48 | "arabic": "اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ", 49 | "transliteration": "Allahumma salli ala Muhammad", 50 | "translation": "O Allah, send peace and blessings upon Muhammad" 51 | }, 52 | { 53 | "arabic": "رَبِّ زِدْنِي عِلْمًا", 54 | "transliteration": "Rabbi zidni ilma", 55 | "translation": "My Lord, increase me in knowledge" 56 | }, 57 | { 58 | "arabic": "رَبَّنَا آتِنَا فِي الدُّنْيَا حَسَنَةً وَفِي الْآخِرَةِ حَسَنَةً وَقِنَا عَذَابَ النَّارِ", 59 | "transliteration": "Rabbana atina fid-dunya hasanatan wa fil-akhirati hasanatan waqina athab an-nar", 60 | "translation": "Our Lord, give us in this world that which is good and in the Hereafter that which is good, and protect us from the punishment of the Fire" 61 | }, 62 | { 63 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ عَذَابِ جَهَنَّمَ", 64 | "transliteration": "Allahumma inni a'udhu bika min 'adhabi jahannam", 65 | "translation": "O Allah, I seek refuge in You from the punishment of Hellfire" 66 | }, 67 | { 68 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْكُفْرِ وَالْفَقْرِ", 69 | "transliteration": "Allahumma inni a'udhu bika minal kufri wal faqr", 70 | "translation": "O Allah, I seek refuge in You from disbelief and poverty" 71 | }, 72 | { 73 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ شَرِّ مَا عَمِلْتُ", 74 | "transliteration": "Allahumma inni a'udhu bika min sharri ma 'amiltu", 75 | "translation": "O Allah, I seek refuge in You from the evil of what I have done" 76 | }, 77 | { 78 | "arabic": "اللَّهُمَّ أَنْتَ رَبِّي لَا إِلَٰهَ إِلَّا أَنْتَ", 79 | "transliteration": "Allahumma anta Rabbi la ilaha illa ant", 80 | "translation": "O Allah, You are my Lord, there is no deity but You" 81 | }, 82 | { 83 | "arabic": "اللَّهُمَّ اغْفِرْ لِي وَارْحَمْنِي وَاهْدِنِي وَعَافِنِي وَارْزُقْنِي", 84 | "transliteration": "Allahumma ighfir li warhamni wahdini wa'afini warzuqni", 85 | "translation": "O Allah, forgive me, have mercy on me, guide me, heal me, and provide for me" 86 | }, 87 | { 88 | "arabic": "اللَّهُمَّ اجْعَلْنِي مِنَ التَّوَّابِينَ وَاجْعَلْنِي مِنَ الْمُتَطَهِّرِينَ", 89 | "transliteration": "Allahumma aj'alni min at-tawwabin wa aj'alni min al-mutatahirin", 90 | "translation": "O Allah, make me among those who repent and purify themselves" 91 | }, 92 | { 93 | "arabic": "اللَّهُمَّ أَعِنِّي عَلَى ذِكْرِكَ وَشُكْرِكَ وَحُسْنِ عِبَادَتِكَ", 94 | "transliteration": "Allahumma a'inni ala dhikrika wa shukrika wa husni ibadatik", 95 | "translation": "O Allah, help me to remember You, to thank You, and to worship You in the best manner" 96 | }, 97 | { 98 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْفَقْرِ وَالْمَأْثَمِ وَالْمَغْرَمِ", 99 | "transliteration": "Allahumma inni a'udhu bika minal faqri wal ma'thami wal maghram", 100 | "translation": "O Allah, I seek refuge in You from poverty, sin, and debt" 101 | }, 102 | { 103 | "arabic": "اللَّهُمَّ أَحْسِنْ عَاقِبَتَنَا فِي الْأُمُورِ كُلِّهَا", 104 | "transliteration": "Allahumma ahsin aqibatana fil umur kulliha", 105 | "translation": "O Allah, make the best outcome of all our affairs" 106 | }, 107 | { 108 | "arabic": "اللَّهُمَّ ارْزُقْنِي رِزْقًا حَلَالًا طَيِّبًا", 109 | "transliteration": "Allahumma arzuqni rizqan halal an tayyiban", 110 | "translation": "O Allah, grant me lawful and pure provision" 111 | }, 112 | { 113 | "arabic": "اللَّهُمَّ ارْزُقْنِي وُدَّ أَزْوَاجِي وَذُرِّيَّتِي", 114 | "transliteration": "Allahumma arzuqni wudda azwaji wa dhurriyyati", 115 | "translation": "O Allah, grant me the love of my spouses and offspring" 116 | }, 117 | { 118 | "arabic": "رَبِّ هَبْ لِي مِنْ لَدُنْكَ ذُرِّيَّةً طَيِّبَةً", 119 | "transliteration": "Rabbi hab li min ladunka dhurriyyatan tayyibah", 120 | "translation": "My Lord, grant me from Yourself good offspring" 121 | }, 122 | { 123 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ زَوَالِ نِعْمَتِكَ", 124 | "transliteration": "Allahumma inni a'udhu bika min zawali ni'matik", 125 | "translation": "O Allah, I seek refuge in You from the removal of Your blessing" 126 | }, 127 | { 128 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ التَّحَوُّلِ فِي عَافِيَتِكَ", 129 | "transliteration": "Allahumma inni a'udhu bika min tahawwuli fi 'afiyatika", 130 | "translation": "O Allah, I seek refuge in You from the change in Your protection" 131 | }, 132 | { 133 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ فُجَاءَةِ نِقْمَتِكَ", 134 | "transliteration": "Allahumma inni a'udhu bika min fuja'ati niqmatika", 135 | "translation": "O Allah, I seek refuge in You from the suddenness of Your punishment" 136 | }, 137 | { 138 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ جَمِيعِ سَخَطِكَ", 139 | "transliteration": "Allahumma inni a'udhu bika min jami'i sakhatika", 140 | "translation": "O Allah, I seek refuge in You from all of Your displeasure" 141 | }, 142 | { 143 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ جَهْدِ الْبَلَاءِ", 144 | "transliteration": "Allahumma inni a'udhu bika min jahdi al-bala'i", 145 | "translation": "O Allah, I seek refuge in You from the hardship of affliction" 146 | }, 147 | { 148 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ شَمَاتَةِ الْأَعْدَاءِ", 149 | "transliteration": "Allahumma inni a'udhu bika min shamatati al-a'da'i", 150 | "translation": "O Allah, I seek refuge in You from the gloating of enemies" 151 | }, 152 | { 153 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ سُوءِ الْكِبَرِ", 154 | "transliteration": "Allahumma inni a'udhu bika min su'i al-kibari", 155 | "translation": "O Allah, I seek refuge in You from the evil of old age" 156 | }, 157 | { 158 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ أَنْ أَضِلَّ أَوْ أُضَلَّ", 159 | "transliteration": "Allahumma inni a'udhu bika min an adilla aw udal", 160 | "translation": "O Allah, I seek refuge in You from leading others astray or being led astray" 161 | }, 162 | { 163 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ أَنْ أَزِلَّ أَوْ أُزَلَّ", 164 | "transliteration": "Allahumma inni a'udhu bika min an azilla aw uzal", 165 | "translation": "O Allah, I seek refuge in You from slipping or causing others to slip" 166 | }, 167 | { 168 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ أَنْ أَظْلِمَ أَوْ أُظْلَمَ", 169 | "transliteration": "Allahumma inni a'udhu bika min an azlima aw uzlam", 170 | "translation": "O Allah, I seek refuge in You from oppressing or being oppressed" 171 | }, 172 | { 173 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ أَنْ أَجْهَلَ أَوْ يُجْهَلَ عَلَيَّ", 174 | "transliteration": "Allahumma inni a'udhu bika min an ajhala aw yujhala 'alayya", 175 | "translation": "O Allah, I seek refuge in You from acting ignorantly or being treated ignorantly" 176 | }, 177 | { 178 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ غَلَبَةِ الدَّيْنِ وَقَهْرِ الرِّجَالِ", 179 | "transliteration": "Allahumma inni a'udhu bika min ghalabati d-dayni wa qahri r-rijal", 180 | "translation": "O Allah, I seek refuge in You from the burden of debt and the tyranny of men" 181 | }, 182 | { 183 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْهَمِّ وَالْحَزَنِ", 184 | "transliteration": "Allahumma inni a'udhu bika minal hammi wal hazan", 185 | "translation": "O Allah, I seek refuge in You from anxiety and sorrow" 186 | }, 187 | { 188 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْعَجْزِ وَالْكَسَلِ", 189 | "transliteration": "Allahumma inni a'udhu bika minal 'ajzi wal kasal", 190 | "translation": "O Allah, I seek refuge in You from incapacity and laziness" 191 | }, 192 | { 193 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْجُبْنِ وَالْبُخْلِ", 194 | "transliteration": "Allahumma inni a'udhu bika minal jubni wal bukhl", 195 | "translation": "O Allah, I seek refuge in You from cowardice and miserliness" 196 | }, 197 | { 198 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ أَنْ يُرَدَّ إِلَى أَرْذَلِ الْعُمُرِ", 199 | "transliteration": "Allahumma inni a'udhu bika min an yuradda ila ardhalil 'umur", 200 | "translation": "O Allah, I seek refuge in You from being returned to the worst part of life" 201 | }, 202 | { 203 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ فِتْنَةِ الْمَحْيَا وَالْمَمَاتِ", 204 | "transliteration": "Allahumma inni a'udhu bika min fitnati al-mahya wal-mamat", 205 | "translation": "O Allah, I seek refuge in You from the trials of life and death" 206 | }, 207 | { 208 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ النَّارِ وَمَا قَرَّبَ إِلَيْهَا مِنْ قَوْلٍ أَوْ عَمَلٍ", 209 | "transliteration": "Allahumma inni a'udhu bika min an-nari wa ma qarraba ilayha min qawlin aw 'amal", 210 | "translation": "O Allah, I seek refuge in You from the Fire and from any word or deed that brings one closer to it" 211 | }, 212 | { 213 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْفِتَنِ مَا ظَهَرَ مِنْهَا وَمَا بَطَنَ", 214 | "transliteration": "Allahumma inni a'udhu bika minal fitani ma zahara minha wa ma batan", 215 | "translation": "O Allah, I seek refuge in You from trials, those that are apparent and those that are hidden" 216 | }, 217 | { 218 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْبَرَصِ وَالْجُنُونِ وَالْجُذَامِ وَسَيِّئِ الْأَسْقَامِ", 219 | "transliteration": "Allahumma inni a'udhu bika minal barasi wal jununi wal judhami wa sayyi'il asqam", 220 | "translation": "O Allah, I seek refuge in You from leprosy, madness, mutilation, and from evil diseases" 221 | }, 222 | { 223 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ غَلَبَةِ الدَّيْنِ وَغَلَبَةِ الْعَدُوِّ وَشَمَاتَةِ الْأَعْدَاءِ", 224 | "transliteration": "Allahumma inni a'udhu bika min ghalabati d-dayni wa ghalabati al-'aduwwi wa shamatati al-a'da'", 225 | "translation": "O Allah, I seek refuge in You from the burden of debt, the overpowering of enemies, and the gloating of adversaries" 226 | }, 227 | { 228 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ دَعْوَةِ لَا يُسْتَجَابُ لَهَا", 229 | "transliteration": "Allahumma inni a'udhu bika min da'watin la yustajabu laha", 230 | "translation": "O Allah, I seek refuge in You from a supplication that is not answered" 231 | }, 232 | { 233 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ دُعَاءِ السُّوءِ وَمِنْ ضِيقِ الدُّنْيَا وَضِيقِ يَوْمِ الْقِيَامَةِ", 234 | "transliteration": "Allahumma inni a'udhu bika min du'ai as-su'i wa min dayqi d-dunya wa dayqi yawmil qiyamah", 235 | "translation": "O Allah, I seek refuge in You from the evil of supplication, and from the tightness of the world and the tightness of the Day of Resurrection" 236 | }, 237 | { 238 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ شَرِّ سَمْعِي وَشَرِّ بَصَرِي وَشَرِّ لِسَانِي وَشَرِّ قَلْبِي وَشَرِّ مَنِيِّي", 239 | "transliteration": "Allahumma inni a'udhu bika min sharri sam'i wa sharri basari wa sharri lisani wa sharri qalbi wa sharri maniyyi", 240 | "translation": "O Allah, I seek refuge in You from the evil of my hearing, the evil of my seeing, the evil of my tongue, the evil of my heart, and the evil of my desires" 241 | }, 242 | { 243 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْبُخْلِ وَأَعُوذُ بِكَ مِنَ الْجُبْنِ وَأَعُوذُ بِكَ أَنْ أُرَدَّ إِلَى أَرْذَلِ الْعُمُرِ", 244 | "transliteration": "Allahumma inni a'udhu bika minal bukhl wa a'udhu bika minal jubn wa a'udhu bika an uradda ila ardhalil 'umur", 245 | "translation": "O Allah, I seek refuge in You from miserliness, I seek refuge in You from cowardice, and I seek refuge in You from being returned to the worst part of life" 246 | }, 247 | { 248 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ فِتْنَةِ الْمَحْيَا وَالْمَمَاتِ وَمِنْ شَرِّ الْمَسِيحِ الدَّجَّالِ", 249 | "transliteration": "Allahumma inni a'udhu bika min fitnati al-mahya wal-mamat wa min sharri al-Masih ad-Dajjal", 250 | "translation": "O Allah, I seek refuge in You from the trials of life and death and from the evil of the false Messiah" 251 | }, 252 | { 253 | "arabic": "اللَّهُمَّ إِنِّي أَسْأَلُكَ الْعَفْوَ وَالْعَافِيَةَ فِي دِينِي وَدُنْيَايَ وَأَهْلِي وَمَالِي", 254 | "transliteration": "Allahumma inni as'aluka al-'afwa wal 'afiyah fi dini wa dunyaya wa ahli wa mali", 255 | "translation": "O Allah, I ask You for forgiveness and well-being in my religion, my world, my family, and my wealth" 256 | }, 257 | { 258 | "arabic": "اللَّهُمَّ اسْتُرْ عَوْرَاتِي وَآمِنْ رَوْعَاتِي", 259 | "transliteration": "Allahumma astur 'awrati wa amin raw'ati", 260 | "translation": "O Allah, conceal my faults and calm my fears" 261 | }, 262 | { 263 | "arabic": "اللَّهُمَّ احْفَظْنِي مِنْ بَيْنِ يَدَيَّ وَمِنْ خَلْفِي وَعَنْ يَمِينِي وَعَنْ شِمَالِي وَمِنْ فَوْقِي وَأَعُوذُ بِعَظَمَتِكَ أَنْ أُغْتَالَ مِنْ تَحْتِي", 264 | "transliteration": "Allahumma ihfazni min bayni yadayya wa min khalfiy wa 'an yamini wa 'an shimali wa min fawqi wa a'udhu bi 'azamatika an ughtala min tahti", 265 | "translation": "O Allah, protect me from in front of me, behind me, on my right, on my left, and from above me, and I seek refuge in Your Greatness from being taken unaware from below me" 266 | }, 267 | { 268 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْكَسَلِ وَالْهَرَمِ وَالْمَأْثَمِ وَالْمَغْرَمِ وَمِنْ فِتْنَةِ الْقَبْرِ وَعَذَابِ الْقَبْرِ", 269 | "transliteration": "Allahumma inni a'udhu bika minal kasali wal harami wal ma'thami wal maghram wa min fitnati al-qabri wa 'adhabi al-qabr", 270 | "translation": "O Allah, I seek refuge in You from laziness, old age, sin, and debt, and from the trial of the grave and the punishment of the grave" 271 | }, 272 | { 273 | "arabic": "اللَّهُمَّ اغْفِرْ لِي خَطِيئَتِي وَجَهْلِي وَإِسْرَافِي فِي أَمْرِي وَمَا أَنْتَ أَعْلَمُ بِهِ مِنِّي", 274 | "transliteration": "Allahumma ighfir li khati'ati wa jahli wa israfi fi amri wa ma anta a'lamu bihi minni", 275 | "translation": "O Allah, forgive my mistakes, my ignorance, my excesses in all my affairs, and what You know better than I" 276 | }, 277 | { 278 | "arabic": "اللَّهُمَّ اغْفِرْ لِي جِدِّي وَهَزْلِي وَخَطَئِي وَعَمْدِي وَكُلُّ ذَلِكَ عِنْدِي", 279 | "transliteration": "Allahumma ighfir li jiddi wa hazli wa khata'i wa 'amdi wa kullu dhalika 'indi", 280 | "translation": "O Allah, forgive my seriousness and my jokes, my mistakes and my deliberate actions, and all of that is with me" 281 | }, 282 | { 283 | "arabic": "اللَّهُمَّ اغْفِرْ لِي مَا قَدَّمْتُ وَمَا أَخَّرْتُ وَمَا أَسْرَرْتُ وَمَا أَعْلَنْتُ وَمَا أَسْرَفْتُ وَمَا أَنْتَ أَعْلَمُ بِهِ مِنِّي", 284 | "transliteration": "Allahumma ighfir li ma qaddamtu wa ma akhkhartu wa ma asrartu wa ma a'lantu wa ma asraftu wa ma anta a'lamu bihi minni", 285 | "translation": "O Allah, forgive what I have done before and what I will do later, what I have hidden and what I have revealed, and my excesses, and what You know better than I" 286 | }, 287 | { 288 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ جَهْدِ الْبَلَاءِ وَدَرَكِ الشَّقَاءِ وَسُوءِ الْقَضَاءِ وَشَمَاتَةِ الْأَعْدَاءِ", 289 | "transliteration": "Allahumma inni a'udhu bika min jahdi al-bala'i wa daraki ash-shaqa'i wa su'i al-qada'i wa shamatati al-a'da'i", 290 | "translation": "O Allah, I seek refuge in You from the hardship of affliction, being overtaken by misery, evil fate, and the gloating of enemies" 291 | }, 292 | { 293 | "arabic": "اللَّهُمَّ أَصْلِحْ لِي دِينِي الَّذِي هُوَ عِصْمَةُ أَمْرِي وَأَصْلِحْ لِي دُنْيَايَ الَّتِي فِيهَا مَعَاشِي وَأَصْلِحْ لِي آخِرَتِي الَّتِي فِيهَا مَعَادِي", 294 | "transliteration": "Allahumma aslih li dini alladhi huwa 'ismatu amri wa aslih li dunyaya allati fiha ma'ashi wa aslih li akhirati allati fiha ma'adi", 295 | "translation": "O Allah, set right for me my religion which is the safeguard of my affairs, set right for me my worldly life in which is my livelihood, and set right for me my Hereafter in which is my return" 296 | }, 297 | { 298 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ فِتْنَةِ الْقَبْرِ وَعَذَابِ الْقَبْرِ", 299 | "transliteration": "Allahumma inni a'udhu bika min fitnati al-qabri wa 'adhabi al-qabr", 300 | "translation": "O Allah, I seek refuge in You from the trial of the grave and the punishment of the grave" 301 | }, 302 | { 303 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْفَقْرِ وَالْقِلَّةِ وَالذِّلَّةِ وَأَعُوذُ بِكَ أَنْ أَظْلِمَ أَوْ أُظْلَمَ", 304 | "transliteration": "Allahumma inni a'udhu bika minal faqr wa al-qilla wa al-dhilla wa a'udhu bika an azlima aw uzlam", 305 | "translation": "O Allah, I seek refuge in You from poverty, scarcity, and humiliation, and I seek refuge in You from oppressing or being oppressed" 306 | }, 307 | { 308 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْهَمِّ وَالْحَزَنِ وَالْعَجْزِ وَالْكَسَلِ وَالْبُخْلِ وَالْجُبْنِ وَضَلَعِ الدَّيْنِ وَغَلَبَةِ الرِّجَالِ", 309 | "transliteration": "Allahumma inni a'udhu bika minal hammi wal hazan wal 'ajzi wal kasal wal bukhl wal jubn wa dala'i d-dayni wa ghalabati r-rijal", 310 | "translation": "O Allah, I seek refuge in You from anxiety and sorrow, from incapacity and laziness, from miserliness and cowardice, from the burden of debt and from being overpowered by men" 311 | }, 312 | { 313 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ جُهْدِ الْبَلَاءِ وَدَرَكِ الشَّقَاءِ وَسُوءِ الْقَضَاءِ وَشَمَاتَةِ الْأَعْدَاءِ", 314 | "transliteration": "Allahumma inni a'udhu bika min juhdi al-bala'i wa daraki ash-shaqa'i wa su'i al-qada'i wa shamatati al-a'da'i", 315 | "translation": "O Allah, I seek refuge in You from the hardship of affliction, being overtaken by misery, evil fate, and the gloating of enemies" 316 | }, 317 | { 318 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ مُنْكَرَاتِ الْأَخْلَاقِ وَالْأَعْمَالِ وَالْأَهْوَاءِ", 319 | "transliteration": "Allahumma inni a'udhu bika min munkarati al-akhlaq wal a'mal wal ahwa'", 320 | "translation": "O Allah, I seek refuge in You from reprehensible morals, actions, and desires" 321 | }, 322 | { 323 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ مُنْكَرَاتِ الْأَخْلَاقِ وَالْأَعْمَالِ وَالْأَهْوَاءِ وَالْأَدْوَاءِ", 324 | "transliteration": "Allahumma inni a'udhu bika min munkarati al-akhlaq wal a'mal wal ahwa'i wal adwa'", 325 | "translation": "O Allah, I seek refuge in You from reprehensible morals, actions, desires, and diseases" 326 | }, 327 | { 328 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْفَقْرِ وَالْفَاقَةِ وَالْمَسْكَنَةِ وَالذُّلِّ", 329 | "transliteration": "Allahumma inni a'udhu bika minal faqr wa al-faqa wa al-maskana wa adh-dhulli", 330 | "translation": "O Allah, I seek refuge in You from poverty, destitution, lowliness, and humiliation" 331 | }, 332 | { 333 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْبُخْلِ وَالْجُبْنِ وَالْعَجْزِ وَالْكَسَلِ وَمِنْ أَنْ أُرَدَّ إِلَى أَرْذَلِ الْعُمُرِ", 334 | "transliteration": "Allahumma inni a'udhu bika minal bukhl wal jubn wal 'ajzi wal kasal wa min an uradda ila ardhalil 'umur", 335 | "translation": "O Allah, I seek refuge in You from miserliness, cowardice, incapacity, laziness, and from being returned to the worst part of life" 336 | }, 337 | { 338 | "arabic": "اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ عِلْمٍ لَا يَنْفَعُ وَمِنْ قَلْبٍ لَا يَخْشَعُ وَمِنْ نَفْسٍ لَا تَشْبَعُ وَمِنْ دُعَاءٍ لَا يُسْتَجَابُ", 339 | "transliteration": "Allahumma inni a'udhu bika min 'ilmin la yanfa' wa min qalbin la yakhsha' wa min nafsin la tashba' wa min du'a'in la yustajab", 340 | "translation": "O Allah, I seek refuge in You from knowledge that does not benefit, a heart that does not fear, a soul that is not satisfied, and a supplication that is not answered" 341 | } 342 | ] --------------------------------------------------------------------------------