-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminal window configured by pixel size #2267
base: master
Are you sure you want to change the base?
Changes from all commits
d39df99
052b04c
4d5ecd0
a908e2a
9c4101c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,11 +68,23 @@ | |
<property name="step-increment">1</property> | ||
<property name="page-increment">10</property> | ||
</object> | ||
<object class="GtkAdjustment" id="window_horizontal_dimension_adjustment"> | ||
<property name="lower">100</property> | ||
<property name="upper">5000</property> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just on a quick check in my display settings, the width numbers do go up to 5120 and I do suspect there's panoramic monitors out there that push the possible upper bound to silly levels. Is it necessary to have upper/lower bounds? I guess lower bounds are naturally needed because guake would become unusable at certain sizes but monitors and monitor resolutions are just going to get bigger. |
||
<property name="step-increment">100</property> | ||
<property name="page-increment">10</property> | ||
</object> | ||
<object class="GtkAdjustment" id="window_horizontal_displacement_adjustment"> | ||
<property name="upper">10000000</property> | ||
<property name="step-increment">10</property> | ||
<property name="page-increment">10</property> | ||
</object> | ||
<object class="GtkAdjustment" id="window_vertical_dimension_adjustment"> | ||
<property name="lower">100</property> | ||
<property name="upper">5000</property> | ||
<property name="step-increment">100</property> | ||
<property name="page-increment">10</property> | ||
</object> | ||
<object class="GtkAdjustment" id="window_vertical_displacement_adjustment"> | ||
<property name="upper">10000000</property> | ||
<property name="step-increment">10</property> | ||
|
@@ -1330,7 +1342,7 @@ | |
<property name="top-padding">6</property> | ||
<property name="left-padding">6</property> | ||
<child> | ||
<!-- n-columns=3 n-rows=3 --> | ||
<!-- n-columns=4 n-rows=3 --> | ||
<object class="GtkGrid"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
|
@@ -1485,7 +1497,7 @@ | |
<signal name="value-changed" handler="on_window_vertical_displacement_value_changed" swapped="no"/> | ||
</object> | ||
<packing> | ||
<property name="left-attach">2</property> | ||
<property name="left-attach">3</property> | ||
<property name="top-attach">1</property> | ||
</packing> | ||
</child> | ||
|
@@ -1496,7 +1508,7 @@ | |
<property name="label" translatable="yes">Displacement in pixels</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">2</property> | ||
<property name="left-attach">3</property> | ||
<property name="top-attach">0</property> | ||
</packing> | ||
</child> | ||
|
@@ -1508,6 +1520,45 @@ | |
<property name="numeric">True</property> | ||
<signal name="value-changed" handler="on_window_horizontal_displacement_value_changed" swapped="no"/> | ||
</object> | ||
<packing> | ||
<property name="left-attach">3</property> | ||
<property name="top-attach">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="label" translatable="yes">Dimensions in pixels</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">2</property> | ||
<property name="top-attach">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkSpinButton" id="window_vertical_dimension"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="adjustment">window_vertical_dimension_adjustment</property> | ||
<property name="numeric">True</property> | ||
<property name="update-policy">if-valid</property> | ||
<signal name="value-changed" handler="on_window_vertical_dimension_value_changed" swapped="no"/> | ||
</object> | ||
<packing> | ||
<property name="left-attach">2</property> | ||
<property name="top-attach">1</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkSpinButton" id="window_horizontal_dimension"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="adjustment">window_horizontal_dimension_adjustment</property> | ||
<property name="numeric">True</property> | ||
<property name="update-policy">if-valid</property> | ||
<signal name="value-changed" handler="on_window_horizontal_dimension_value_changed" swapped="no"/> | ||
</object> | ||
<packing> | ||
<property name="left-attach">2</property> | ||
<property name="top-attach">2</property> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The placement of this just makes the previous block of code effectively dead. See primary comment. |
||
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: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we want to update percentage and pixel dimensions in unison, not sure why we would want our recorded percentage and pixel dimensions to be different at any point. |
||
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: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this just be determined by the monitor settings?