ObsidianSimpleTimeTracker icon indicating copy to clipboard operation
ObsidianSimpleTimeTracker copied to clipboard

[Suggestion] Possible to add a left sidebar view that see all the tacker?

Open Quorafind opened this issue 2 years ago • 2 comments

RT, or a way to find which one is still running to prevent from forgetting

Quorafind avatar Sep 28 '22 05:09 Quorafind

This would be AWESOME!!!!

rk-kontur avatar Mar 23 '24 22:03 rk-kontur

You can use this global search in Obsidian to find which timers are still running:

/(?<!"startTime":null,)"endTime":null/

I also wrote this AHK script (Windows only) which shows a modal when closing Obsidian if any timer is unstopped:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Main:
SetTitleMatchMode RegEx
WinWait,- Obsidian v[0-9. ]+$
WinWaitClose,- Obsidian v[0-9. ]+$
ObsisdianCheckUnclosedTimers()
Goto, Main

ObsisdianCheckUnclosedTimers(){
	VaultPath := "C:\Path\To\Vault"
	if !FileExist(VaultPath)
		return
	SearchPattern := VaultPath . "*.md"
	Loop, Files, %SearchPattern%, R
	{
		FileRead, FileContents, %A_LoopFileFullPath%
	    If (ErrorLevel) {
		    MsgBox Error : %A_LastError%
		    return
	    }
		FoundPos := RegExMatch(FileContents, "(?<!""startTime"":null,)""endTime"":null")
		If (FoundPos)
		{
		    MsgBox, 4,, Timers are still running. Run Obsidian?
		    IfMsgBox Yes
			    Run, obsidian://search?vault=Notes&query=/(?<!.startTime.:null`,).endTime.:null/
				return
		}
	}
	return
}

brrd avatar Sep 11 '24 13:09 brrd