Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Allow for template string {{prompt}} in the entry name #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Just search for the Action "Toggl" within the Stream Deck app and install it. Th

Just press any Toggl Button to start tracking time. The button should indicate tracking by turning red and showing the current tracking time (if no *Title* is set). The status of the button is defined by workspace, project and entry name. If you setup two identical buttons (even on different Stream Deck profiles), both button indicate the same. If you start or stop your timer using the Toggl app (web, desktop, mobile) Toggl for Stream Deck will follow by changing the status.

## Variable Entry Names

You can have dynamic bits of yoru Entry Name by using the template `{{prompt}}` (no spaces).

A prompt will appear to ask what it should be replaced with. Due to a limitation of the Stream Deck, the prompt may appear behind other apps.

## 📞 Help

Feel free to ask your questions on [my Discord Server](https://discord.gg/YWy3UAy). Please use GitHub Issues for reporting bugs and requesting new features.
Expand Down
4 changes: 4 additions & 0 deletions plugin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ async function toggle(context, settings) {
// Toggl API Helpers

function startEntry(apiToken = isRequired(), activity = 'Time Entry created by Toggl for Stream Deck', workspaceId = 0, projectId = 0, billableToggle = false) {
if (activity.includes('{{prompt}}')) {
let promptVal = prompt('What entry name would you like?');
activity = activity.replace('{{prompt}}', promptVal);
}
return fetch(
`${togglBaseUrl}/time_entries/start`, {
method: 'POST',
Expand Down