Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "reverse speed" setting #44

Conversation

jakob30061
Copy link

@jakob30061 jakob30061 commented May 13, 2023

Hey Sergei,
After show this awesome extension to a friend, who is a mac user, he installed the mac version of this tool.

Their where some settings, customizing the cat. (changing sprites, other stats like gpu use, etc.)
One setting i found really useful, was having the cat sprinting most of the time and running "laggy" when the cpu usage was higher.
Not that is make sense, but it looks fun.

I added a setting and reverse the animation timeout.

New switch in settings:
image

@win0err
Copy link
Owner

win0err commented May 28, 2023

Hello, @jakob30061!

Thank you for the contribution!

@jakob30061
Copy link
Author

Hello,
could you please confirm if this pull request will be merged?
If so, I am would try to resolve the conflicts with the current state of the codebase.

@win0err
Copy link
Owner

win0err commented Jan 11, 2024

could you please confirm if this pull request will be merged

Sure

@jakob30061
Copy link
Author

I resolved the conflicts and updated the code for this feature.

Maybe you could check the Russian translation :)

po/ru.po Outdated
@@ -62,32 +62,36 @@ msgstr "Только проценты"
msgid "Character only"
msgstr "Только персонаж"

#: src/resources/ui/preferences.ui:51
#: src/resources/ui/preferences.ui:49
msgid "Reverse speed"
Copy link
Owner

@win0err win0err Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be clearer to name this setting Invert running speed'?
I'm not a native speaker, but doesn't Reverse speed sound like the cat would run backwards?

msgid "Invert running speed"
msgstr "Инвертировать скорость"

src/indicator.js Outdated
@@ -112,14 +118,17 @@ export default class RunCatIndicator extends PanelMenuButton {

repaintUi() {
/** @type {CharacterState} */
const characterState = this.#data?.cpu > this.#settings.idleThreshold ? 'active' : 'idle'
const isActive = this.#data?.cpu > this.#settings.idleThreshold || this.#settings.reverseSpeed;
Copy link
Owner

@win0err win0err Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that idleThreshold is not compatible with invertRunningSpeed setting. If utilization is 100%, it makes it harder for the cat to run, but it would be weird if it fell asleep :D WDYT?

If you agree with statement above, you could do something like:

let utilization = this.#data?.cpu
let isActive = this.#data?.cpu > this.#settings.idleThreshold

if (this.#settings.invertRunningSpeed) {
	utilization = 100 - utilization
	isActive = true
}

And that's it. But you have to update settings UI, see the next comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope i'm not mistaken, but this const isActive = this.#data?.cpu > this.#settings.idleThreshold || this.#settings.invertRunningSpeed should ignore the idleThreshold setting if invertRunningSpeed is active.

So the cat isn't sleeping, despite a idleThreshold value greater than 0.

@@ -43,6 +43,18 @@
</property>
</object>
</child>

Copy link
Owner

@win0err win0err Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to lock idle threshold settings if invert-running-speed is enabled.

Example: https://github.com/aunetx/blur-my-shell/blob/30459d58d303595b198711c5d6ebc03a5006fd87/resources/ui/dash.ui#L53
Ping me if you need an assistance with this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Before you could change the idle threshold setting but nothing would happen.

This didn't work, cause i needed the inverted the behavior.

src/indicator.js Outdated Show resolved Hide resolved
src/indicator.js Show resolved Hide resolved
@win0err
Copy link
Owner

win0err commented Jan 21, 2024

@jakob30061: I need some time to test the feature manually

@jakob30061
Copy link
Author

@jakob30061: I need some time to test the feature manually

Hey,
could you already test the feature?

@win0err win0err changed the base branch from master to feature/invert-characters-speed March 17, 2024 14:42
@win0err win0err merged commit 2ec7843 into win0err:feature/invert-characters-speed Mar 17, 2024
2 checks passed
@win0err
Copy link
Owner

win0err commented Mar 17, 2024

@jakob30061: I've merged to the dev branch and refactored code (see commit 871740e). Thank you for your work and patience!

I plan to add one more feature (#52) and release a new version.

Dev branch: feature/v27

win0err pushed a commit that referenced this pull request Mar 20, 2024
* Add setting to schema

* Add functionality for reverse speed

* Update translation files

* Rename reverse-speed to invert-running-speed

* Lock idleThreshold if reverseRunningSpeed is active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants