Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/com.github.johnfactotum.Foliate.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<key name="translate-target-language" type="s">
<default>''</default>
</key>
<key name="selection-popup" type="b">
<default>true</default>
</key>
</schema>

<schema id="com.github.johnfactotum.Foliate.viewer.view"
Expand Down
7 changes: 5 additions & 2 deletions src/book-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ export const BookViewer = GObject.registerClass({
Properties: utils.makeParams({
'fold-sidebar': 'boolean',
'highlight-color': 'string',
'selection-popup': 'boolean',
}),
InternalChildren: [
'top-overlay-box', 'top-overlay-stack',
Expand Down Expand Up @@ -550,7 +551,8 @@ export const BookViewer = GObject.registerClass({
},
})
this.highlight_color = 'yellow'
utils.bindSettings('viewer', this, ['fold-sidebar', 'highlight-color'])
this.selection_popup = true
utils.bindSettings('viewer', this, ['fold-sidebar', 'highlight-color', 'selection-popup'])
this._view.fontSettings.bindSettings('viewer.font')
this._view.viewSettings.bindSettings('viewer.view')
this._view.webView.connect('notify::zoom-level', webView =>
Expand Down Expand Up @@ -739,7 +741,7 @@ export const BookViewer = GObject.registerClass({
'preferences', 'help-overlay', 'show-info', 'bookmark',
'export-annotations', 'import-annotations',
],
props: ['fold-sidebar'],
props: ['fold-sidebar', 'selection-popup'],
})
utils.addPropertyActions(Adw.StyleManager.get_default(), ['color-scheme'], actions)
this.insert_action_group('view', this._view.actionGroup)
Expand Down Expand Up @@ -874,6 +876,7 @@ export const BookViewer = GObject.registerClass({
this.#data.addAnnotation(annotation) }))
}
#showSelection({ type, value, text, content, lang, pos: { point, dir } }) {
if (type !== 'annotation' && !this.selection_popup) return Promise.resolve()
if (type === 'annotation') return new Promise(resolve => {
this._annotation_view.scrollToCFI(value)
const annotation = this.#data.annotations.get(value)
Expand Down
4 changes: 4 additions & 0 deletions src/ui/book-viewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
<attribute name="label" translatable="yes">Autohide Cursor</attribute>
<attribute name="action">view.autohide-cursor</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Show Selection Popup</attribute>
<attribute name="action">viewer.selection-popup</attribute>
</item>
</section>
<section>
<item>
Expand Down