Skip to content

Commit

Permalink
Add Sixel Support
Browse files Browse the repository at this point in the history
Related to Guake#1806

sem-ver: feature
  • Loading branch information
theCapypara committed Jan 25, 2023
1 parent 2e5e309 commit c1874c2
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
5 changes: 5 additions & 0 deletions guake/data/org.guake.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@
<summary>Audible bell</summary>
<description>If true, the system alert sound will be played on a bell character.</description>
</key>
<key name="use-sixel" type="b">
<default>false</default>
<summary>Use Sixel</summary>
<description>If true, terminals will render sixel escape sequences.</description>
</key>
<key name="window-width" type="i">
<default>100</default>
<summary>Window width.</summary>
Expand Down
24 changes: 23 additions & 1 deletion guake/data/prefs.glade
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
<property name="top-padding">12</property>
<property name="left-padding">12</property>
<child>
<!-- n-columns=3 n-rows=5 -->
<!-- n-columns=3 n-rows=6 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
Expand Down Expand Up @@ -533,6 +533,28 @@
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="use_sixel">
<property name="label" translatable="yes">Render sixel escape sequences (images)</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">start</property>
<property name="use-underline">True</property>
<property name="draw-indicator">True</property>
<signal name="toggled" handler="on_use_sixel_toggled" swapped="no"/>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
Expand Down
8 changes: 8 additions & 0 deletions guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ def on_use_audible_bell_toggled(self, chk):
"""Changes the value of use_audible_bell in dconf"""
self.settings.general.set_boolean("use-audible-bell", chk.get_active())

def on_use_sixel_toggled(self, chk):
"""Changes the value of enable_sixel in dconf"""
self.settings.general.set_boolean("use-sixel", chk.get_active())

# scrolling tab

def on_use_scrollbar_toggled(self, chk):
Expand Down Expand Up @@ -1182,6 +1186,10 @@ def load_configs(self):
value = self.settings.general.get_boolean("use-audible-bell")
self.get_widget("use_audible_bell").set_active(value)

# use sixel
value = self.settings.general.get_boolean("use-sixel")
self.get_widget("use_sixel").set_active(value)

self._load_screen_settings()

value = self.settings.general.get_boolean("quick-open-enable")
Expand Down
9 changes: 9 additions & 0 deletions guake/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ def configure_terminal(self):
if hasattr(self, "set_alternate_screen_scroll"):
self.set_alternate_screen_scroll(True)

enable_sixel = client.get_boolean("use-sixel")
if enable_sixel:
# TODO: Once Sixel support is stable and there's a release with it built-in by default,
# we can use a version check like done above for other features.
try:
self.set_enable_sixel(True)
except: # pylint: disable=bare-except
log.warn("set_enable_sixel is not supported by your version of VTE")

self.set_can_default(True)
self.set_can_focus(True)

Expand Down
9 changes: 9 additions & 0 deletions releasenotes/notes/sixel_support-467783a27379bbe2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
release_summary: >
Add experimental support for displaying Sixels. This can be enabled with a new setting.
features:
- add sixel support #1806

known_issues:
- sixel support requires VTE to be compiled with `-Dsixel=true`, since support for it is still experimental.

0 comments on commit c1874c2

Please sign in to comment.