Skip to content

[DictQuickLookup] enable full-screen mode for open dictionary window#13862

Merged
Frenzie merged 7 commits into
koreader:masterfrom
Commodore64user:full-screen-dict
Jun 2, 2025
Merged

[DictQuickLookup] enable full-screen mode for open dictionary window#13862
Frenzie merged 7 commits into
koreader:masterfrom
Commodore64user:full-screen-dict

Conversation

@Commodore64user

@Commodore64user Commodore64user commented May 26, 2025

Copy link
Copy Markdown
Member

we've all been there, you look up a word definition only to realise is long AF and you ponder, why isn't there an easy way to go full screen mode here? well worry not past me... here it is.

what's new

  • Static Variables and Properties: Added a new static variable temp_fullscreen_request and a private property _is_temporary_fullscreen_mode to manage the temporary fullscreen state.
  • Gesture and Key Bindings: Introduced a new gesture (spread) and a key binding (screenkb/shift + home ) to trigger the temporary fullscreen mode.
  • Initialisation Logic: Updated the init method to check for temp_fullscreen_request and set the appropriate dictionary and fullscreen mode state during initialisation.
  • Fullscreen Mode Implementation: Added setTemporaryFullScreenMode and onSetTemporaryFullScreenMode methods to handle the logic for enabling fullscreen mode, including re-triggering lookups and managing the window_list.
  • Cleanup on Close: Modified the onClose method to revert the fullscreen mode setting when the widget is closed.

screen recording

name

This change is Reviewable

@poire-z poire-z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure I like the playing with temporary state and restoring - and the way it is done with a module variable, but if there's no other simpler way, ok.

Comment thread frontend/ui/widget/dictquicklookup.lua Outdated
local modifier = Device:hasScreenKB() and "ScreenKB" or "Shift"
self.key_events.ChangeToPrevDict = { { modifier, Input.group.PgBack } }
self.key_events.ChangeToNextDict = { { modifier, Input.group.PgFwd } }
self.key_events.SetTemporaryFullScreenMode = { { modifier, "Home" } }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You got a big home !
(Glad to see the Home button not taking you home :))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

well, we're not using home, we are using screenkb + home

Comment thread frontend/ui/widget/dictquicklookup.lua Outdated
-- We want to remember the current dict_index (e.g. 5/7), so that it can be restored later.
DictQuickLookup.temp_fullscreen_request = { dict_index = self.dict_index, }
-- This setting will be reverted upon closing the new instance. Note that any would be child windows will also open in fullscreen mode.
G_reader_settings:makeTrue("dict_largewindow")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A bit dirty to play with temporary toggling a user setting. Any other way ?
(So, you're still using a small window ?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I did think it wasn't ideal. But I couldn't come up with an idea that was as "clean" as this.

I use the patched window, thank you very much, I wanted to make it more dramatic here as the patch probably has a user base of 1 (2?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is also adding a full-screen = true to temp-fullscreen-request and using that instead of G-setts

Comment thread frontend/ui/widget/dictquicklookup.lua Outdated
-- This setting will be reverted upon closing the new instance. Note that any would be child windows will also open in fullscreen mode.
G_reader_settings:makeTrue("dict_largewindow")

local ui_ref = self.ui or UIManager

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could call it just local ui = (every object is a ref).

Comment thread frontend/ui/widget/dictquicklookup.lua Outdated
Comment on lines +1024 to +1029
local ui = self.ui or UIManager
-- Re-trigger the lookup, and close this instance _after_ the new one is created.
if self.is_wiki then
ui_ref:handleEvent(Event:new("LookupWikipedia", self.word, self.is_sane_word, self.word_boxes, false, self.lang, function() self:onClose(true) end))
ui:handleEvent(Event:new("LookupWikipedia", self.word, self.is_sane_word, self.word_boxes, false, self.lang, function() self:onClose(true) end))
else
ui_ref:handleEvent(Event:new("LookupWord", self.word, true, self.word_boxes, self.highlight, nil, function() self:onClose(true) end))
ui:handleEvent(Event:new("LookupWord", self.word, true, self.word_boxes, self.highlight, nil, function() self:onClose(true) end))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Btw, I'm not sure calling UIManager:handleEvent (the module itself) will work.
If there's no self.ui (and you can't find a use case where there is none), just do nothing / return if there is none.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

and you can't find a use case where there is none

Well in that case is not needed then, i was being cautious in case FM would ever say, nope not having it.

@poire-z

poire-z commented May 27, 2025

Copy link
Copy Markdown
Contributor

(Also, you wrote everything with the word "temp fullscreen", while it is actually just "temp large window".)

@Commodore64user

Copy link
Copy Markdown
Member Author

Wondering if @poire-z is upset or something ;)

@poire-z

poire-z commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

No, still just busy.
There are still a lof of "fullscreen" mention, which should be "large window" (because that's what this is, and for consistency while reading, so we know all this is about templargewindow and there is not a different feature called tempfullscreen).

    _is_temporary_fullscreen_mode = false,
-- Static variable to hold request data for temporary fullscreen
DictQuickLookup.temp_fullscreen_request = nil
            SetTemporaryFullScreenMode = {
    self.temp_large_window = DictQuickLookup.temp_fullscreen_request and DictQuickLookup.temp_fullscreen_request.full_screen == true
    if DictQuickLookup.temp_fullscreen_request and DictQuickLookup.temp_fullscreen_request.dict_index then
        self:changeDictionary(DictQuickLookup.temp_fullscreen_request.dict_index, true)
        DictQuickLookup.temp_fullscreen_request.dict_index = nil
        self._is_temporary_fullscreen_mode = true
            self.key_events.SetTemporaryFullScreenMode = { { modifier, "Home" } }
function DictQuickLookup:onSetTemporaryFullScreenMode()
    self:setTemporaryFullScreenMode()
function DictQuickLookup:setTemporaryFullScreenMode()
    DictQuickLookup.temp_fullscreen_request = {
        full_screen = true, -- note: any would-be child window will also open in fullscreen mode.
    if self._is_temporary_fullscreen_mode then
        DictQuickLookup.temp_fullscreen_request = nil

@benoit-pierre

Copy link
Copy Markdown
Member

Maybe "maximized" would be a better term.

@poire-z

poire-z commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

But this PR just temporarily enable the existing "large window" display, it does not need a new word :)

Comment thread frontend/ui/widget/dictquicklookup.lua Outdated
-- We want to remember the current dict_index (e.g. 5/7), so that it can be restored later.
DictQuickLookup.temp_large_window_request = {
dict_index = self.dict_index,
full_screen = true, -- note: any would-be child window will also open in fullscreen mode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this one needs to be named full_screen, althought being part of a table named temp_large_window_request ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

you are something else ;)

@Frenzie Frenzie added this to the 2025.05 milestone Jun 2, 2025
@Frenzie Frenzie merged commit 06661b0 into koreader:master Jun 2, 2025
2 of 4 checks passed
@Commodore64user Commodore64user deleted the full-screen-dict branch June 2, 2025 13:26
@Commodore64user

Commodore64user commented Dec 7, 2025

Copy link
Copy Markdown
Member Author

kindle added a similar feature to this one in 5.18.6, not claiming or suggesting this PR was their inspiration, but it looks a bit sus ;)

their implementation is a bit rubbish though. ¯\_(ツ)_/¯

0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
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.

4 participants