diff --git a/guake/data/org.guake.gschema.xml b/guake/data/org.guake.gschema.xml
index d8846e77b..278828b48 100644
--- a/guake/data/org.guake.gschema.xml
+++ b/guake/data/org.guake.gschema.xml
@@ -171,6 +171,11 @@
Audible bell
If true, the system alert sound will be played on a bell character.
+
+ false
+ Update window size by sliding scale or text box
+ If true, window size is determined by scale widget. Otherwise, by spin button in preferences.
+
100
Window width.
@@ -181,6 +186,26 @@
Window height.
Percent of the screen that will be used by guake terminal vertically.
+
+ 100
+ Window pixel width.
+ Resolution of the screen that will be used by guake terminal horizontally.
+
+
+ 100
+ Window pixel height.
+ Resolution of the screen that will be used by guake terminal vertically.
+
+
+ 1920
+ Max window pixel width.
+ Maximum resolution of the screen that will be used by guake terminal horizontally.
+
+
+ 1080
+ Max window pixel height.
+ Maximum resolution of the screen that will be used by guake terminal vertically.
+
0
Horizontal window displacement.
diff --git a/guake/data/prefs.glade b/guake/data/prefs.glade
index f1b2c2db2..b81c3c09e 100644
--- a/guake/data/prefs.glade
+++ b/guake/data/prefs.glade
@@ -68,11 +68,23 @@
1
10
+
+
- 2
+ 3
0
@@ -1508,6 +1520,45 @@
True
+
+ 3
+ 2
+
+
+
+
+ True
+ False
+ Dimensions in pixels
+
+
+ 2
+ 0
+
+
+
+
+ True
+ True
+ window_vertical_dimension_adjustment
+ True
+ if-valid
+
+
+
+ 2
+ 1
+
+
+
+
+ True
+ True
+ window_horizontal_dimension_adjustment
+ True
+ if-valid
+
+
2
2
diff --git a/guake/gsettings.py b/guake/gsettings.py
index fe0e2b0f9..0799595be 100644
--- a/guake/gsettings.py
+++ b/guake/gsettings.py
@@ -58,6 +58,8 @@ def __init__(self, guake_inst):
)
settings.general.onChangedValue("window-height", self.size_changed)
settings.general.onChangedValue("window-width", self.size_changed)
+ settings.general.onChangedValue("window-pixel-height", self.size_changed)
+ settings.general.onChangedValue("window-pixel-width", self.size_changed)
settings.general.onChangedValue("window-valignment", self.alignment_changed)
settings.general.onChangedValue("window-halignment", self.alignment_changed)
settings.general.onChangedValue("window-vertical-displacement", self.alignment_changed)
diff --git a/guake/prefs.py b/guake/prefs.py
index 9452c64c7..f412ba220 100644
--- a/guake/prefs.py
+++ b/guake/prefs.py
@@ -454,14 +454,45 @@ def on_display_n_changed(self, combo):
def on_window_height_value_changed(self, hscale):
"""Changes the value of window_height in dconf"""
+ self.settings.general.set_boolean("window-pixel-or-scale-update", True)
val = hscale.get_value()
self.settings.general.set_int("window-height", int(val))
+ value = self.settings.general.get_int("window-pixel-height")
+ self.prefDlg.get_widget("window_vertical_dimension").set_value(value)
+
def on_window_width_value_changed(self, wscale):
"""Changes the value of window_width in dconf"""
+ self.settings.general.set_boolean("window-pixel-or-scale-update", True)
val = wscale.get_value()
self.settings.general.set_int("window-width", int(val))
+ value = self.settings.general.get_int("window-pixel-width")
+ self.prefDlg.get_widget("window_horizontal_dimension").set_value(value)
+
+ def on_window_vertical_dimension_value_changed(self, spin):
+ """Changes the value of window-vertical-displacement"""
+ self.settings.general.set_boolean("window-pixel-or-scale-update", False)
+ max_value = self.settings.general.get_int("max-window-pixel-height")
+ val = int(spin.get_value())
+ if val <= max_value:
+ self.settings.general.set_int("window-pixel-height", val)
+
+ value = self.settings.general.get_int("window-height")
+ self.prefDlg.get_widget("window_height").set_value(value)
+
+ def on_window_horizontal_dimension_value_changed(self, spin):
+ """Changes the value of window-horizontal-displacement"""
+ self.settings.general.set_boolean("window-pixel-or-scale-update", False)
+ max_value = int(self.settings.general.get_int("max-window-pixel-width"))
+ val = int(spin.get_value())
+
+ if val <= max_value:
+ self.settings.general.set_int("window-pixel-width", val)
+
+ value = self.settings.general.get_int("window-width")
+ self.prefDlg.get_widget("window_width").set_value(value)
+
def on_window_halign_value_changed(self, halign_button):
"""Changes the value of window_halignment in dconf"""
which_align = {
@@ -632,6 +663,7 @@ def on_window_horizontal_displacement_value_changed(self, spin):
"""Changes the value of window-horizontal-displacement"""
self.settings.general.set_int("window-horizontal-displacement", int(spin.get_value()))
+
def reload_erase_combos(self, btn=None):
self.prefDlg.reload_erase_combos(btn)
@@ -740,6 +772,7 @@ class fake_guake:
self.load_configs()
self.get_widget("config-window").hide()
+
def spawn_sync_pid(self, directory=None, terminal=None):
argv = []
user_shell = self.settings.general.get_string("default-shell")
@@ -1148,6 +1181,14 @@ def load_configs(self):
value = self.settings.general.get_int("window-width")
self.get_widget("window_width").set_value(value)
+ value = self.settings.general.get_int("window-pixel-height")
+ max_value = self.settings.general.get_int("max-window-pixel-height")
+ self.get_widget("window_vertical_dimension").set_value(value)
+ self.get_widget("window_vertical_dimension").set
+
+ value = self.settings.general.get_int("window-pixel-width")
+ self.get_widget("window_horizontal_dimension").set_value(value)
+
# window displacements
value = self.settings.general.get_int("window-vertical-displacement")
self.get_widget("window_vertical_displacement").set_value(value)
@@ -1303,6 +1344,7 @@ def load_configs(self):
# it's a separated method, to be reused.
self.reload_erase_combos()
+
# custom command context-menu configuration file
custom_command_file = self.settings.general.get_string("custom-command-file")
if custom_command_file:
diff --git a/guake/utils.py b/guake/utils.py
index dc07c80e6..010081b53 100644
--- a/guake/utils.py
+++ b/guake/utils.py
@@ -255,8 +255,11 @@ def set_final_window_rect(cls, settings, window):
horizontal alignment is given by window_alignment.
"""
# fetch settings
+ update_by_scale = settings.general.get_boolean("window-pixel-or-scale-update")
height_percents = settings.general.get_int("window-height")
width_percents = settings.general.get_int("window-width")
+ height_pixel = settings.general.get_int("window-pixel-height")
+ width_pixel = settings.general.get_int("window-pixel-width")
halignment = settings.general.get_int("window-halignment")
valignment = settings.general.get_int("window-valignment")
vdisplacement = settings.general.get_int("window-vertical-displacement")
@@ -265,6 +268,8 @@ def set_final_window_rect(cls, settings, window):
log.debug("set_final_window_rect")
log.debug(" height_percents = %s", height_percents)
log.debug(" width_percents = %s", width_percents)
+ log.debug(" height_pixel = %s", height_pixel)
+ log.debug(" width_pixel = %s", width_pixel)
log.debug(" halignment = %s", halignment)
log.debug(" valignment = %s", valignment)
log.debug(" hdisplacement = %s", hdisplacement)
@@ -281,6 +286,14 @@ def set_final_window_rect(cls, settings, window):
total_height = window_rect.height
total_width = window_rect.width
+ settings.general.set_int("max-window-pixel-height",total_height)
+ settings.general.set_int("max-window-pixel-width",total_width)
+
+ if not update_by_scale:
+ height_percents = int((height_pixel/total_height)*100)
+ width_percents = int((width_pixel/total_width)*100)
+ settings.general.set_int("window-height",height_percents)
+ settings.general.set_int("window-width",width_percents)
if halignment == ALIGN_CENTER:
log.debug("aligning to center!")
@@ -300,6 +313,10 @@ def set_final_window_rect(cls, settings, window):
window_rect.x += total_width - window_rect.width - hdisplacement
window_rect.height = int(float(total_height) * float(height_percents) / 100.0)
+ if update_by_scale:
+ settings.general.set_int("window-pixel-height",window_rect.height)
+ settings.general.set_int("window-pixel-width",window_rect.width)
+
if valignment == ALIGN_TOP:
window_rect.y += vdisplacement
elif valignment == ALIGN_BOTTOM:
diff --git a/releasenotes/notes/pixel-defined-window-8062a170d105512a.yaml b/releasenotes/notes/pixel-defined-window-8062a170d105512a.yaml
new file mode 100644
index 000000000..9ba4188c8
--- /dev/null
+++ b/releasenotes/notes/pixel-defined-window-8062a170d105512a.yaml
@@ -0,0 +1,7 @@
+release_summary: >
+ Terminal window size is set by pixel rather than solely by the sliding scale in the preferences window.
+
+features:
+ - |
+ - Terminal window size can be configured in the preferences window by explicit pixel dimensions
+