summaryrefslogtreecommitdiffstatshomepage
path: root/posts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--posts/img/weltschmerz-hyperlinks.pngbin0 -> 32088 bytes
-rw-r--r--posts/img/weltschmerz-open-directory.pngbin0 -> 40911 bytes
-rw-r--r--posts/new-features-in-weltschmerz.md132
3 files changed, 132 insertions, 0 deletions
diff --git a/posts/img/weltschmerz-hyperlinks.png b/posts/img/weltschmerz-hyperlinks.png
new file mode 100644
index 0000000..ef4b157
--- /dev/null
+++ b/posts/img/weltschmerz-hyperlinks.png
Binary files differ
diff --git a/posts/img/weltschmerz-open-directory.png b/posts/img/weltschmerz-open-directory.png
new file mode 100644
index 0000000..8d1353b
--- /dev/null
+++ b/posts/img/weltschmerz-open-directory.png
Binary files differ
diff --git a/posts/new-features-in-weltschmerz.md b/posts/new-features-in-weltschmerz.md
new file mode 100644
index 0000000..f189909
--- /dev/null
+++ b/posts/new-features-in-weltschmerz.md
@@ -0,0 +1,132 @@
+title: New features in weltschmerz 1.3.0
+date: 2020-04-13
+author: Wynn Wolf Arbor
+
+Over the past few weeks I have been working on bringing a few new
+features to [weltschmerz](weltschmerz.html), my terminal emulator. One
+of them is the addition of a major VTE feature that I had overlooked
+when I first prototyped it: The support for **OSC 8 hyperlinks**.
+
+The remaining two are smaller in nature, but hopefully just as useful:
+The context menu has learned a couple of new tricks, namely **copying a
+selection as HTML**, and the ability to **open the current directory**
+in the desktop environment's default file manager.
+
+Additionally, I have overhauled and improved the configuration
+management code to make future changes and additions easier. These
+improvements include a small bug fix, but are otherwise invisible to the
+end user.
+
+Head on over to the [project page](weltschmerz.html) to get the newest
+version right away, or read on to take a closer look at each new
+feature.
+
+## Hyperlink support
+
+The motivation for this feature came when I [read about](https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/)
+the new `-fanalyzer` static analysis pass that will come with GCC 10.
+The post mentions that in sufficiently capable terminals, new CWE
+identifiers and the option names for warnings are clickable hyperlinks
+pointing people to the right place in the documentation.
+
+Since the post mentioned _gnome-terminal_ as one such capable emulator,
+I assumed that VTE had to have been updated with hyperlink support and
+went to find out when that happened. It turned out that it had been
+added [way back when](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)
+in 2017, I just never paid much attention to it.
+
+Since VTE already had full support, I decided to add this feature to
+weltschmerz as well. Now, if enabled, hyperlinks are clickable; they
+open up in the application that GLib thinks is best for the given URI.
+To make the user aware of what they will open, the terminal now renders
+a tooltip with the URI when hovering over a hyperlink:
+
+![hyperlinks in weltschmerz](img/weltschmerz-hyperlinks.png)
+
+Given the relative infancy of this functionality, and a couple of
+[security concerns](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#security),
+this feature is disabled by default. If you want to try it out, it can
+be enabled in weltschmerz's config file like so:
+
+```ini
+[misc]
+allow-hyperlinks = true
+```
+
+## Copy as HTML
+
+Whilst looking through VTE's [Vala
+documentation](https://valadoc.org/vte-2.91/Vte.Terminal.html) to find
+out more about hyperlinks, I stumbled across the [definition](https://valadoc.org/vte-2.91/Vte.Format.html)
+for the _Format_ enum which controls in what format the selection is
+copied to the clipboard. `TEXT` makes the clipboard contain the plain
+text copy of the selection, and `HTML` formats the selection as HTML,
+with mostly complete style and colour information, like this:
+
+<pre class="indent clear">
+<b>diff --git a/NEWS b/NEWS</b>
+<b>index a9b1359..4e1c329 100644</b>
+<b>--- a/NEWS</b>
+<b>+++ b/NEWS</b>
+<font color="#5C4BC8">@@ -1,5 +1,11 @@</font>
+ This file lists important changes to the weltschmerz terminal emulator.
+
+<font color="#377945">+Changes in version 1.2.1, released on January 17, 2020:</font>
+<font color="#377945">+</font>
+<font color="#377945">+ --- MINOR BUGFIXES ---</font>
+<font color="#377945">+ * weltschmerz.1: The manual page now contains updated contact and author</font>
+<font color="#377945">+ information.</font>
+<font color="#377945">+</font>
+ Changes in version 1.2.0, released on December 30, 2019:
+
+ --- MINOR NEW FEATURES ---
+</pre>
+
+Adding support for this was straightforward. **Copy as HTML** is now
+available as a context menu entry whenever there is an active selection.
+The above is an excerpt of the output of `git-diff(1)` from one of the
+release commits. Except for the font (which depends on your browser),
+this is exactly how it looked in my terminal.
+
+## Open directory
+
+For the longest time I primarily used [ranger](https://github.com/ranger/ranger),
+a terminal file manager, to traverse directories and open files quickly.
+A few months back I decided to try out a few GUI-based ones and found that
+[Thunar](https://docs.xfce.org/xfce/thunar/start) does the job very
+well. So well, in fact, that I rarely use ranger anymore these days. I
+find that for regular day-to-day browsing, I am much faster with the
+mouse and quick drag-and-drop actions are now essential to me.
+
+I still spend most of my time in a terminal, however, and whilst it is
+very easy to open a terminal from within Thunar, it used to be not so
+easy to open an instance of Thunar (or whichever file manager you
+prefer) from within weltschmerz.
+
+![Open directory context menu entry in weltschmerz](img/weltschmerz-open-directory.png)
+
+Now, with the new **Open directory** context menu entry (or by hitting
+`Ctrl+Shift+O`), weltschmerz opens the current directory in the desktop
+manager's default file manager. Note that VTE relies on **OSC 7** to
+determine which directory an application is in.
+
+The shell I use, [fish](https://fishshell.com/), emits the correct
+escape sequence [automatically](https://github.com/fish-shell/fish-shell/blob/8029f15f1fd4f77b0105fcf7421a5cdf551e2fec/share/functions/__fish_config_interactive.fish#L269)
+whenever it enters a new directory, but other shells will most likely
+**not** do this by default. In that case, the menu entry will be greyed
+out. However, for other shells, it should simply be sufficient to put the
+proper escape sequence into `PS1` or something comparable to
+`PROMPT_COMMAND` in bash. Note that it has to contain a URI (and not
+a regular path).
+
+Consider something like the following (though note that `hostname` and `path`
+should be URL-encoded):
+
+```sh
+printf '\e]7;file://%s%s\a' "$hostname" "$path"
+```
+
+## Closing
+
+That's it for this release. I hope these new features will be useful (or
+at least interesting) to people. Until next time!