aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJuhani Krekelä2021-06-17 20:22:13 +0300
committerWolfgang Müller2021-06-17 19:42:27 +0200
commit0774a46257bdc6daa1c6a1c3485d75bd07ef849c (patch)
treeaaa26ff08b075fcb120c0ce8170e93bb214a38bd
parent1869309c20c313b587e769878dce15ea831476d6 (diff)
downloadweltschmerz-0774a46257bdc6daa1c6a1c3485d75bd07ef849c.tar.gz
Add setting for controlling cursor blinking
Currently weltschmerz always uses the global GTK setting for cursor blink, which means that the cursor blink setting is stored separately from the rest of the configuration. Add a setting for overriding it in the config file, so that all the relevant settings can be adjusted in one standardized place. Reviewed-by: Wolfgang Müller <wolf@oriole.systems>
Diffstat (limited to '')
-rw-r--r--config.vala2
-rw-r--r--configreader.vala16
-rw-r--r--terminal.vala1
-rw-r--r--weltschmerz.118
4 files changed, 36 insertions, 1 deletions
diff --git a/config.vala b/config.vala
index be3f353..0234aac 100644
--- a/config.vala
+++ b/config.vala
@@ -2,6 +2,7 @@ class Config {
public bool autohide_mouse;
public Vte.CursorShape cursor_shape;
+ public Vte.CursorBlinkMode cursor_blink;
public Pango.FontDescription font;
public int scrollback;
public bool scrollbar;
@@ -44,6 +45,7 @@ class Config {
public void load() {
autohide_mouse = reader.read_boolean("misc", "autohide-mouse", false);
cursor_shape = reader.read_cursor("misc", "cursor-shape", "block");
+ cursor_blink = reader.read_blink("misc", "cursor-blink", "system");
font = Pango.FontDescription.from_string(reader.read_string("misc", "font", "Monospace 12"));
scrollback = reader.read_integer("misc", "scrollback", 10000);
scrollbar = reader.read_boolean("misc", "scrollbar", true);
diff --git a/configreader.vala b/configreader.vala
index a57a7ab..6348d5e 100644
--- a/configreader.vala
+++ b/configreader.vala
@@ -185,4 +185,20 @@ class ConfigReader {
return BLOCK;
}
}
+
+ public Vte.CursorBlinkMode read_blink(string group, string key, string default) {
+ string blink = read_string(group, key, default);
+
+ switch(blink) {
+ case "true":
+ return ON;
+ case "false":
+ return OFF;
+ case "system":
+ return SYSTEM;
+ default:
+ append_warning("invalid cursor blink setting '%s' in %s.%s".printf(blink, group, key));
+ return SYSTEM;
+ }
+ }
}
diff --git a/terminal.vala b/terminal.vala
index a6c0a76..3fcdea6 100644
--- a/terminal.vala
+++ b/terminal.vala
@@ -95,6 +95,7 @@ class Terminal : Gtk.Overlay {
vte.set_mouse_autohide(conf.autohide_mouse);
vte.set_scrollback_lines(conf.scrollback);
vte.set_cursor_shape(conf.cursor_shape);
+ vte.set_cursor_blink_mode(conf.cursor_blink);
vte.set_colors(conf.foreground, conf.background, conf.palette);
vte.set_color_bold(conf.bold);
diff --git a/weltschmerz.1 b/weltschmerz.1
index 6f0ac22..3c92ef6 100644
--- a/weltschmerz.1
+++ b/weltschmerz.1
@@ -1,4 +1,4 @@
-.Dd March 28, 2020
+.Dd June 17, 2021
.Dt WELTSCHMERZ 1
.Os
.Sh NAME
@@ -119,6 +119,22 @@ and
.Sy underline .
The default is
.Sy block .
+.It Sy cursor-blink
+Specifies whether the cursor should blink.
+Possible values are
+.Sy true ,
+.Sy false ,
+and
+.Sy system .
+The default is
+.Sy system .
+.Pp
+When set to
+.Sy system ,
+.Nm
+will honour the GTK setting
+.Sy gtk-cursor-blink .
+Refer to the GTK documentation for more details.
.It Sy font
Specifies the font used to draw text, in the form of a Pango font
description.