-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Arturo Volpe <[email protected]>
- Loading branch information
Showing
5 changed files
with
128 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,7 @@ | |
[url "[email protected]:"] | ||
insteadOf = http://github.com/ | ||
insteadOf = https://github.com/ | ||
|
||
[diff "zip"] | ||
textconv = unzip -c -a | ||
|
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Sample shell script for using notify-send with matterhorn This script | ||
# works on Linux only. It depends on the 'notify-send' command. | ||
|
||
# Positional parameters passed to this script by Matterhorn: | ||
mentioned="${1?}" | ||
sender="${2?}" | ||
message="${3?}" | ||
|
||
# Script options | ||
|
||
# notify_URGENCIES | ||
# | ||
# The first word is the urgency for items where you are not mentioned. | ||
# The second word is the urgency for items where you are mentioned. | ||
# Use "none" to not be notified; otherwise use "low", "normal", or | ||
# "critical". | ||
notify_URGENCIES="normal normal" | ||
|
||
# The desktop notification category | ||
notify_CATEGORY="im.received" | ||
|
||
# Notification header | ||
notify_HEAD="$sender" | ||
|
||
# Notification body | ||
notify_BODY="$message" | ||
|
||
getUrgencyHelper() { | ||
if [ "$mentioned" == "1" ] | ||
then | ||
echo "$1" | ||
else | ||
if [ "$mentioned" == "2" ] | ||
then | ||
echo "$2" | ||
else | ||
echo "Error: mentioned value '$mentioned' unexpected" > /dev/stderr | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
getUrgency() { | ||
# We are using arguments as a poor man's bash array for portability | ||
# shellcheck disable=SC2086 | ||
getUrgencyHelper $notify_URGENCIES | ||
} | ||
|
||
urgency=$(getUrgency) | ||
|
||
printf -v NOW '%(%Y-%m-%d %H:%M:%S)T' -1 | ||
|
||
echo "$NOW: $@" >> ~/.matterhon_notifications | ||
|
||
if [[ "$message" == *":clockify:"* ]]; then | ||
echo "$NOW: $@" >> ~/.matterhon_clockify | ||
exit | ||
fi | ||
|
||
if [ ! -z "$urgency" ] | ||
then | ||
test "$urgency" = "none" || | ||
terminal-notifier -subtitle "$notify_HEAD:" -title "Matterhorn" -message "$notify_BODY" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# | ||
echo "Command and arguments: $0 $@" >> ~/debug.log | ||
|
||
# Check if there is exactly one argument | ||
if [ $# -ne 1 ]; then | ||
echo "Usage: $0 <URL>" | ||
exit 1 | ||
fi | ||
|
||
url="$1" | ||
|
||
# Define domains to be ignored | ||
ignore_domains=("tel.meet" "another.domain") | ||
|
||
# Define domains to be opened with Google Chrome | ||
chrome_domains=("google" "figma") | ||
|
||
# Extract the domain from the URL | ||
domain=$(echo $url | awk -F/ '{print $3}') | ||
|
||
# Check if the domain is in the ignore list | ||
for ignore_domain in "${ignore_domains[@]}"; do | ||
if [[ "$domain" == *"$ignore_domain"* ]]; then | ||
exit | ||
fi | ||
done | ||
|
||
# Check if the domain is in the Chrome list | ||
for chrome_domain in "${chrome_domains[@]}"; do | ||
if [[ "$domain" == *"$chrome_domain"* ]]; then | ||
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --profile-directory="Profile 1" "$url" | ||
exit | ||
fi | ||
done | ||
|
||
# If it's not in either list, execute the 'open' command | ||
open "$url" |
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