Skip to content

Instantly share code, notes, and snippets.

@plskz
Created July 6, 2023 01:39
Show Gist options
  • Save plskz/cf2cdc4ae467b6238c21fe94589e4c55 to your computer and use it in GitHub Desktop.
Save plskz/cf2cdc4ae467b6238c21fe94589e4c55 to your computer and use it in GitHub Desktop.
Raycast script
#!/usr/bin/env PATH=$PATH:/opt/homebrew/opt/node@18/bin node
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title Open Logseq Today's JW
// @raycast.mode fullOutput
// Optional parameters:
// @raycast.icon ๐Ÿ“†
// Documentation:
// @raycast.description Open Logseq Today Journal
// @raycast.author Zai Santillan
// @raycast.authorURL https://github.com/plskz
const { exec } = require('child_process')
const date = new Date()
const today = date.toISOString().split('T')[0]
const [year, month, day] = today.split('-')
let uri = `logseq://graph/.life-archive?page=${year}/${month}/${day}`
console.log(uri);
console.log(`Opening Logseq JW Today: ${today}`);
exec(`open "${uri}"`) // doesn't work. that's why i'm using shell script instead.
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Open Logseq Today's JW
# @raycast.mode silent
# Optional parameters:
# @raycast.icon ๐Ÿ“†
# Documentation:
# @raycast.author Zai Santillan
# @raycast.authorURL https://github.com/plskz
today=$(date +%Y-%m-%d)
IFS='-' read -r year month day <<< "$today"
uri="logseq://graph/.life-archive?page=${year}/${month}/${day}"
echo "$uri"
echo "Opening Logseq JW Today: $today"
open "$uri"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment