Skip to content

Conversation

@redphx
Copy link
Contributor

@redphx redphx commented Nov 1, 2025

Disclaimers: I only have basic knowledge of C/C++. If I do something wrong/stupid, please help me correct it. Thanks.

Successfully tested on Kobo Clara BW fw 4.43

Pressing the Power button on Kobo is the same as pressing the Escape key on keyboard.
So to take screenshot, we just need to:

  1. Enable the "Screenshots" feature
  2. Send an "Escape" KeyEvent to the QApplication instance
  3. Restore the "Screenshots" setting to original state (if needed)

Menu item:

menu_item :main :Capture Screenshot:nickel_screenshot :capture

I also refactored the Settings related code so it can be reused easily.

Currently after taking screenshot it doesn't show anything to indicate that the task was done. Maybe add another option to show a toast?

Thanks for the great project!

Demo video:

nickelmenu-screenshot.mp4

@redphx redphx requested a review from pgaskin as a code owner November 1, 2025 03:57
Copy link
Owner

@pgaskin pgaskin left a comment

Choose a reason for hiding this comment

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

Seems good overall, but I haven't looked at it too closely or tested it yet.

@redphx
Copy link
Contributor Author

redphx commented Nov 1, 2025

Currently after taking screenshot it doesn't show anything to indicate that the task was done. Maybe add another option to show a toast?

Now by default it will show a toast after capturing screenshot. You can disable it by using "capture:quiet".

//libnickel 4.6 * _ZN8SettingsC2ERK6Deviceb _ZN8SettingsC2ERK6Device
NM_ACT_SYM(symbols.Settings_Settings, "_ZN8SettingsC2ERK6Deviceb");
NM_ACT_SYM(symbols.Settings_SettingsLegacy, "_ZN8SettingsC2ERK6Device");
NM_CHECK(SettingsSymbols{}, symbols.Settings_Settings || symbols.Settings_SettingsLegacy, "could not dlsym Settings constructor (new and/or old)");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the old code, this was:

NM_CHECK(nullptr, Settings_Settings || Settings_SettingsLegacy, "could not dlsym Settings constructor (new and/or old)");

I had to change nullptr to SettingsSymbols{} to make it work. Will it be a problem?

@pgaskin
Copy link
Owner

pgaskin commented Nov 2, 2025

Now by default it will show a toast after capturing screenshot

I'd rather not since this doesn't really provide anything over chaining a toast action.

@redphx
Copy link
Contributor Author

redphx commented Nov 2, 2025

It doesn't hide the reading menu while taking screenshot, so it's better to be used with shortcut key #207

screen_001

@redphx
Copy link
Contributor Author

redphx commented Nov 2, 2025

Now by default it will show a toast after capturing screenshot

I'd rather not since this doesn't really provide anything over chaining a toast action.

I think it's still useful when capturing screenshot using a page turner.

Edit: sorry I got your idea now. Do you want me to revert that change?
Edit 2: reverted

Copy link
Owner

@pgaskin pgaskin left a comment

Choose a reason for hiding this comment

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

Tested on 21533 and 23552. Code looks fine, errors are checked, setting is always restored once set even in the failure cases.

@pgaskin pgaskin merged commit 413eb41 into pgaskin:master Dec 7, 2025
@pgaskin
Copy link
Owner

pgaskin commented Dec 7, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants