eXpl0it3r / streamdeck-clockify

Clockify Action for the Elgato Stream Deck
MIT License
46 stars 8 forks source link

Option to have title text only be current time #9

Closed HughMacdonald closed 1 year ago

HughMacdonald commented 1 year ago

I've just started using this plugin, and it's awesome.

One feature that I think would be really useful would be to have the option to have the title text on the button only be the current time being logged.

As far as I can tell, there are currently 4 options:

  1. Project Name, Task Name, Time
  2. Timer Name (if set)
  3. Title (if set)
  4. Nothing (if Show Title is turned off)

I've got my buttons set up with an icon to show what it is for, but it would be great to be able to also show the current time on this view, without also showing the Project Name and Task Name.

Thanks

eXpl0it3r commented 1 year ago

Glad you like it! 🙂

Hadn't considered just using the timer with custom button icons, but I think that makes perfectly sense, so I'll see how to best implement this. Let me know if you have a suggestion on how you'd expect to configure something like this in the Stream Deck interface.

HughMacdonald commented 1 year ago

I've actually already started having a look at how it might be implemented myself.

My initial thought was to have a checkbox called something like "Timer Only Title". However, a more power-user approach might be to have a multi-line title format string that would default to something like "{projectName}\n{taskName}\n{timer}" that could then be edited to show only the fields that the user wanted to see.

HughMacdonald commented 1 year ago

If the "Title Format" approach sounds good to you, I'm going to give it a go myself. I've not done any StreamDeck plugin dev before, but I'm pretty comfortable with C#

eXpl0it3r commented 1 year ago

Oh nice! Always happy to receive contributions.

As long as we keep the non-power user functionality of just showing a title, when enter some text, then that sounds like a great option to me. Might be a bit tricky to communicate the syntax options, but a power user should also be able to read the readme or similar. 😉

If you enable GitHub Actions, it should actually fully build and package the plugin, takes away the hassle of manually dealing with the plugin creation.

HughMacdonald commented 1 year ago

That's awesome that you've got it all set up with GH Actions.

I'm thinking it could be hidden under an "Advanced" drop-down. The main tricky part would be what to do if they use a key that doesn't exist, or don't have matching {}s, etc...

eXpl0it3r commented 1 year ago

I'd see two options:

The first can easily hide some issues, while the second might not really be verbose enough. One could log the output, but those logs aren't really easily accessible. Maybe there's a bit space in the inspector view to show a slightly extended error message.

I suggest, you just give it a go and see with what you end up 🙂

HughMacdonald commented 1 year ago

I need to get back to actual work now, so may take another look at this tomorrow.

Do you tend to work by pushing up to GH regularly and then using the CI-generated plugin to test with? That feels like a really awkward way of testing as you go

eXpl0it3r commented 1 year ago

I've just recently added GitHub Actions. It's honestly not much more awkward than working locally, as you need to build/publish, then use the plugin packaging tool to create a new plugin, then replace the existing plugin, by either uninstalling it manually and reinstalling it, or closing StreamDeck deleting the plugin directory and install the new plugin.

There's the install.ps1 script to automate some of that, but it's still cumbersome. The GitHub Action is at least very useful, so I don't have to do the same dance on two platforms. 😄

HughMacdonald commented 1 year ago

The one thing that I'm realising might be tricky is ensuring that adding this setting doesn't change functionality for people using the plugin.

The way I'm thinking of doing this, it could only leave blank where an element isn't included. But in the current code, if timerName is set, then it uses it (and nothing else), whereas if it isn't set, then it uses projectName and taskName

HughMacdonald commented 1 year ago

BTW - I think I spotted a typo in the code. In PluginSettings.cs, line 20, the C# property is TimeName, but the Json propert name and PropertyInspector have it as timerName

HughMacdonald commented 1 year ago

I've had a quick go at this. The one thing that I haven't figured out is how to get the value from the UI replicated into the C# property. It may be because I'm using a textarea.

I'm just using string.Replace(), so it will just show {blah} if something is used in the format that isn't supported.

https://github.com/eXpl0it3r/streamdeck-clockify/compare/master...HughMacdonald:streamdeck-clockify:master

HughMacdonald commented 1 year ago

I'm also interested in what the options are for different colour of text on the title. The dark grey text that this plugin uses is really not readable against the backgrounds I'm using. The BarRaider Spotify plugin is white text with a black outline, which is much more easily readable

eXpl0it3r commented 1 year ago

That's just the default font, I believe. I guess one can configure it somehow and/or Spotify does some additional magic 😄

For Clockify you can change it:

image

HughMacdonald commented 1 year ago

Ahh - thanks! I guess Spotify just sets the default somehow. That made it much nicer already!

eXpl0it3r commented 1 year ago

Took me a bit to figure it out, but you have to tell the Barraider integration, that you want the textarea to be a property by setting the sdProperty class and then need to update the settings when changing the contents of the textarea by adding oninput="setSettings()".

Feel free to take or re-implement my commit 🙂

https://github.com/eXpl0it3r/streamdeck-clockify/compare/feature/format-title

Haven't yet looked at the rest of the changes much, but it seems to work 👌