-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hammerspoon: add location module to replace CoreLocationCLI
It stopped working fulldecent/corelocationcli#50
- Loading branch information
1 parent
f75dfb0
commit 2c8dedb
Showing
4 changed files
with
43 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Intentionally not setting -e because we want the script to continue if CoreLocationCLI fails. | ||
# Intentionally not setting -e because we want the script to continue if getting the location data fails | ||
set -u -o pipefail | ||
|
||
if [[ -n "${DEBUG-}" ]]; then | ||
set -x | ||
fi | ||
|
||
FLAGS="$(CoreLocationCLI --format "-latitude %latitude -longitude %longitude")" | ||
LOCATION_DATA="$TMPDIR/.location.json" | ||
|
||
# Can't use -P (regex pattern) because macOS has the BSD grep while -P works on GNU grep. | ||
if grep -q "\-latitude .* -longitude .*" <<<"$FLAGS"; then | ||
printf "%s" " $(next-prayer mawaqit $FLAGS)" | ||
# Validate the JSON syntax | ||
if jq -e . "$LOCATION_DATA" >/dev/null 2>&1; then | ||
FLAGS=$(jq '"-latitude \(.location.latitude) -longitude \(.location.longitude)"' "$LOCATION_DATA") | ||
|
||
printf "%s" " $(next-prayer mawaqit "$FLAGS")" | ||
else | ||
printf "%s" "$(next-prayer aladhan)" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ in { | |
"raycast" | ||
"anki" | ||
"appcleaner" | ||
"corelocationcli" | ||
"firefox" | ||
"imageoptim" | ||
"kap" | ||
|