Browse Source

add optional base postfix to the page title

PHP-GTK3
yggverse 8 months ago
parent
commit
8944bd2792
  1. 4
      config.json
  2. 17
      src/Entity/Tab/Page.php

4
config.json

@ -33,6 +33,10 @@ @@ -33,6 +33,10 @@
"ellipsize":
{
"mode":3
},
"postfix":
{
"hostname":true
}
},
"redirect":

17
src/Entity/Tab/Page.php

@ -834,6 +834,23 @@ class Page @@ -834,6 +834,23 @@ class Page
?string $value = null
): void
{
// Append hostname postfix
if ($this->config->title->postfix->hostname && str_starts_with($this->request->get_text(), 'gemini://'))
{
$address = new \Yggverse\Net\Address(
$this->request->get_text()
);
if ($address->getHost())
{
$value = sprintf(
'%s - %s',
$value,
$address->getHost()
);
}
}
// Build new tab label on title length reached
if ($value && mb_strlen($value) > $this->config->title->width->chars)
{

Loading…
Cancel
Save