diff --git a/@Resources/Fonts/accid___.ttf b/@Resources/Fonts/accid___.ttf new file mode 100644 index 0000000..77970f9 Binary files /dev/null and b/@Resources/Fonts/accid___.ttf differ diff --git a/@Resources/Screenshots/infinibar.png b/@Resources/Screenshots/infinibar.png new file mode 100644 index 0000000..693760a Binary files /dev/null and b/@Resources/Screenshots/infinibar.png differ diff --git a/@Resources/Screenshots/kimai-default.png b/@Resources/Screenshots/kimai-default.png new file mode 100644 index 0000000..c8a4e4d Binary files /dev/null and b/@Resources/Screenshots/kimai-default.png differ diff --git a/@Resources/Screenshots/kimai2-cmd-rainmeter-header.bmp b/@Resources/Screenshots/kimai2-cmd-rainmeter-header.bmp new file mode 100644 index 0000000..f58310a Binary files /dev/null and b/@Resources/Screenshots/kimai2-cmd-rainmeter-header.bmp differ diff --git a/@Resources/kimai2-cmd/kimai2-cmd.exe b/@Resources/kimai2-cmd/kimai2-cmd.exe index ddb7667..d29075c 100644 Binary files a/@Resources/kimai2-cmd/kimai2-cmd.exe and b/@Resources/kimai2-cmd/kimai2-cmd.exe differ diff --git a/README.md b/README.md index d089d71..7f66d5e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,73 @@ # kimai2-cmd-rainmeter Rainmeter widget for Kimai2 -TODO: Write readme +[Rainmeter](https://www.rainmeter.net/) is an open source desktop customization tool for Windows -## Install +[Kimai2](https://www.kimai.org/) is an open source self-hosted time tracker + +This widget uses [kimai2-cmd](https://github.com/infeeeee/kimai2-cmd). Executable included in this repo and in the rmskin package. + +## Variants + +- kimai-default: similar to the Kimai webui + +![kimai-deafult screenshot](@Resources/Screenshots/kimai-default.png) + +- infinibar: fits my hardware monitor skin [infinibar](https://github.com/infeeeee/infinibar) + +![infinibar screenshot](@Resources/Screenshots/infinibar.png) + +If you have an idea of another variant, just open an issue! + +## Installation + +### Prerequisites - Install Rainmeter -- Download this to Rainmeter skin folder -- Rename settings.ini.example to settings.ini and edit -- Enable in rainmeter \ No newline at end of file +- Install Kimai on your server +- Create an API password for your username on your Kimai installation. In Kimai: User menu (Top right corner) -> Edit -> API + +### Installation + +- Download the rmskin package from [releases](https://github.com/infeeeee/kimai2-cmd-rainmeter/releases/latest) +- Open the rmskin package with Rainmeter, enable the skin +- Click on the Kimai logo, and add your server address and creditentials in the opening new window +- Click on the reload icon to update the skin + +## Usage + +- Click on the Kimai logo to open yourt Kimai webui in your default browser +- Click on the name of the current active recording or on the 'No active recording' text to show your recent measurements +- Click on one of a recent measurement to restart it +- Click on the ▶️ play button to restart your latest measurement +- Click on the ⏹ stop button to stop your current measurement +- Click on the 🔄 reload button to reload settings from the server. Play and stop also reloads everything, use this button if you made changes on the Kimai webUI +- When you click on the 🔄 reload button it will disappear and only reapper if everything was reloaded successfully. + +## Settings + +### Kimai specific settings + +Settings stored in the `@Resources\kimai2-cmd\settings.ini` file. You can change your server settings here, reload the skin after you modified this file. + +### Variant specific settings + +- kimai2-default: `kimai2\kimai-default.ini` +- infinibar: + - `@Resources\infinibar`: this files are same as the settings files of the infinibar skin, contains a lot of unnecessary variables + - `kimai2\infinibar.ini` + +## Troubleshooting + +If the widget is out of sync, try to click on the 🔄 reload button! + +The widget only supports single concurrent measurements! If you click on the ⏹ stop button it will stop all ongoing measurement, and it only shows the latter started current measurement. + + +## Acknowledgments + +The font used in the infinibar skin is Accidental Residency, created by Tepid Monkey. + +## License + +MIT \ No newline at end of file diff --git a/kimai2/infinibar.ini b/kimai2/infinibar.ini index 5fdceac..6fcf64e 100644 --- a/kimai2/infinibar.ini +++ b/kimai2/infinibar.ini @@ -1,15 +1,13 @@ [Metadata] Name=kimai2-cmd-rainmeter infinibar Author=infeeeee -Information=All settings are in the Variables.inc file | More info at github: https://github.com/infeeeee/infinibar, Created by UNIGHT(http://unight.deviantart.com/) modded by DISCONNECTVD (http://dscnctvd.deviantart.com/) +Information=All settings are in the Variables.inc file | More info at github: https://github.com/infeeeee/infinibar License=MIT Version=0.0.1 -Update=1000 [Variables] activeRecording=Click KIM to setup serverUrl=[!CommandMeasure MeasureFirstrun "Run"] -activeDur='' @include=kimaiVars.inc @@ -108,8 +106,7 @@ leftmouseupaction=[!hidemeter meterRefreshButton][!CommandMeasure MeasureReload [meterCurrentProject] Meter=String MeterStyle=styleSmallCenter -; Text=[MeasureDuration] #activeRecording# -Text=#activeRecording# +Text=[MeasureActiveTime]#activeRecording# DynamicVariables=1 ClipString=1 Y=#barY# diff --git a/kimai2/kimai-default.ini b/kimai2/kimai-default.ini index 6ac9b85..58b05a1 100644 --- a/kimai2/kimai-default.ini +++ b/kimai2/kimai-default.ini @@ -133,9 +133,9 @@ leftmouseupaction=[!hidemeter meterRefreshButton][!CommandMeasure MeasureReload Meter=String MeterStyle=styleSelected W=250 -Text=#activeRecording# +Text=[MeasureActiveTime]#activeRecording# DynamicVariables=1 -ClipString=0 +ClipString=1 leftmouseupaction=[!SetVariable MenuVis '0'][!SetVariable activeRecording Select] @include=kimaiData.inc diff --git a/kimai2/kimaiMeasures.inc b/kimai2/kimaiMeasures.inc index 7e6d53c..292c8b8 100644 --- a/kimai2/kimaiMeasures.inc +++ b/kimai2/kimaiMeasures.inc @@ -53,21 +53,27 @@ State=Show ; OutputFile=#CURRENTPATH#log.txt ; OutputType=UTF8 -; [MeasureDuration] -; Measure=String -; Formula=#activeRecording# -; IfMatch=No active recording -; IfMatchAction=[!SetVariable activeDur ''] -; IfNotMatchAction=[!SetVariable activeDur (MeasureHrs + : + MeasureMins)] +[MeasureCurrTimeMin] +Measure=Time +Format=%M +IfBelowValue=1 +IfBelowAction=[!SetVariable activeMins (#activeMins#+60)] +[MeasureStartMin] +Measure=Calc +Formula=MeasureCurrTimeMin +OnUpdateAction=[!PauseMeasure MeasureStartMin] -; [MeasureHrs] -; Measure=Calc -; Formula=#activeHrs#+MeasureHrs+1%25 +[MeasureMins] +Measure=Calc +Formula=MeasureCurrTimeMin+#activeMins#-MeasureStartMin +IfAboveValue=59 +IfAboveAction=[!SetVariable activeMins (#activeMins#-60)][!SetVariable activeHrs (#activeHrs#+1)] +DynamicVariables=1 -; [MeasureMins] -; Measure=Calc -; Formula=MeasureMins >= 0 ? (MeasureMins+1%60) : #activeMins# -; UpdateDivider=60 -; IfCondition=MeasureMins = 60 -; IfTrueAction=[!SetVariable #activeHrs# (#activeHrs#+1)] +[MeasureActiveTime] +Measure=String +String=#activeHrs#:[MeasureMins] +DynamicVariables=1 +RegExpSubstitute=1 +Substitute="(:)(\d)$":"\10\2 ","(:\d\d)$":"\1 ","^:00 $":"","#activeHrs#:00":"" \ No newline at end of file