aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2025-02-24 19:38:46 +0100
committerWolfgang Müller2025-02-24 19:38:46 +0100
commit9dc38e4de224c1da4502f46fab9ae568861c927f (patch)
tree86d79a43c8cd5d0832b7d1cc013e3cfd1d0b5fe8
parent3aca5ff0a88984a9ad0b2872267f64be9bcc159f (diff)
downloadweltschmerz-9dc38e4de224c1da4502f46fab9ae568861c927f.tar.gz
Allow user to influence geometry hints resize behaviour
For the longest time weltschmerz has defaulted to passing width_inc and height_inc to set_geometry_hints, making it such that the window can only be resized in increments of the cell size. Whilst this is advantageous with floating windows, once weltschmerz is forced into a specific geometry (e.g. when put into a tiling context), the window manager or compositor will have to accept weltschmerz's geometry hints and make the window smaller than the space allotted for it. Since some people care about pixel-perfect alignment for their tiled windows, make this behaviour controllable by introducing a new 'resize-hints' setting. To remain backwards-compatible, this setting is true by default, but when switched off, weltschmerz will stop setting the width_inc and height_inc geometry hints, making it freely resizable by adding dynamic padding around the terminal's viewport. Co-authored-by: Juhani Krekelä <juhani@krekelä.fi>
-rw-r--r--config.vala2
-rw-r--r--terminal.vala8
-rw-r--r--weltschmerz.111
-rw-r--r--weltschmerz.de.112
-rw-r--r--weltschmerz.fi.111
5 files changed, 42 insertions, 2 deletions
diff --git a/config.vala b/config.vala
index d972bac..fcbb7ed 100644
--- a/config.vala
+++ b/config.vala
@@ -13,6 +13,7 @@ class Config {
public bool scrollbar;
public bool allow_hyperlinks;
public bool prefer_osc7;
+ public bool resize_hints;
public Gdk.RGBA? foreground;
public Gdk.RGBA? background;
@@ -59,6 +60,7 @@ class Config {
scrollbar = reader.read_boolean("misc", "scrollbar", true);
allow_hyperlinks = reader.read_boolean("misc", "allow-hyperlinks", false);
prefer_osc7 = reader.read_boolean("misc", "prefer-osc7", true);
+ resize_hints = reader.read_boolean("misc", "resize-hints", true);
foreground = reader.read_colour("colours", "foreground", null);
background = reader.read_colour("colours", "background", null);
diff --git a/terminal.vala b/terminal.vala
index 6dfe61e..e44889e 100644
--- a/terminal.vala
+++ b/terminal.vala
@@ -140,9 +140,13 @@ class Terminal : Gtk.Overlay {
base_height = base_height,
min_width = char_width * 28 + base_width,
min_height = char_height * 3 + base_height,
- width_inc = char_width,
- height_inc = char_height
};
+
+ if (conf.resize_hints) {
+ geometry.width_inc = char_width;
+ geometry.height_inc = char_height;
+ }
+
window.set_geometry_hints(null, geometry, BASE_SIZE | RESIZE_INC | MIN_SIZE);
vte.set_allow_hyperlink(conf.allow_hyperlinks);
diff --git a/weltschmerz.1 b/weltschmerz.1
index ed6e76a..487a2eb 100644
--- a/weltschmerz.1
+++ b/weltschmerz.1
@@ -199,6 +199,17 @@ only
is used.
The default is
.Sy true .
+.It Sy resize-hints
+When set to
+.Sy true ,
+.Nm
+will pass geometry hints to the window manager indicating that resizing
+should happen at multiples of the cell size.
+When set to
+.Sy false ,
+no such hints are passed, and resizing can happen freely.
+The default is
+.Sy true .
.El
.Pp
The
diff --git a/weltschmerz.de.1 b/weltschmerz.de.1
index e2e6d2a..3a8dec7 100644
--- a/weltschmerz.de.1
+++ b/weltschmerz.de.1
@@ -220,6 +220,18 @@ so wird lediglich
herangezogen.
Der Standardwert ist
.Sy true .
+.It Sy resize-hints
+Ist der Wert
+.Sy true ,
+zeigt
+.Nm
+dem Fenstermanager an, dass die Fenstergröße nur schrittweise um ein
+Vielfaches der Zellgröße verändert werden sollte.
+Ist der Wert
+.Sy false ,
+so lässt sich das Fenster frei vergößern.
+Der Standardwert ist
+.Sy true .
.El
.Pp
Die Schlüsselgruppe
diff --git a/weltschmerz.fi.1 b/weltschmerz.fi.1
index e1b28e9..40bdfc0 100644
--- a/weltschmerz.fi.1
+++ b/weltschmerz.fi.1
@@ -211,6 +211,17 @@ Tämän ollessa
käyttää vain proc-tiedostojärjestelmää.
Oletusarvo on
.Sy true .
+.It Sy resize-hints
+Tämän ollessa
+.Sy true ,
+.Nm
+pyytää geometriaehdotuksin ikkunanhallintaohjelmalta, että ikkunan kokoa
+muutettaessa se porrastettaisiin merkkikennon koon moninkerraksi.
+Tämän ollessa
+.Sy false ,
+ikkuna voi olla minkä tahansa kokoinen.
+Oletusarvo on
+.Sy true .
.El
.Pp
Ryhmä