mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
implement tab width settings
This commit is contained in:
parent
bdb586144c
commit
bb42afd2ce
2 changed files with 40 additions and 10 deletions
10
config.json
10
config.json
|
|
@ -25,7 +25,15 @@
|
||||||
{
|
{
|
||||||
"title":
|
"title":
|
||||||
{
|
{
|
||||||
"default":"New page"
|
"default":"New page",
|
||||||
|
"width":
|
||||||
|
{
|
||||||
|
"chars":32
|
||||||
|
},
|
||||||
|
"ellipsize":
|
||||||
|
{
|
||||||
|
"mode":3
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"redirect":
|
"redirect":
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -763,23 +763,45 @@ class Page
|
||||||
?string $value = null
|
?string $value = null
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
if ($value)
|
// Build new tab label on title length reached
|
||||||
|
if ($value && mb_strlen($value) > $this->config->title->width->chars)
|
||||||
{
|
{
|
||||||
$title = $value;
|
$label = new \GtkLabel(
|
||||||
|
$value ? $value : $this->config->title->default
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($this->config->title->width->chars)
|
||||||
|
{
|
||||||
|
$label->set_width_chars(
|
||||||
|
$this->config->title->width->chars
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->config->title->ellipsize->mode)
|
||||||
|
{
|
||||||
|
$label->set_ellipsize(
|
||||||
|
// https://docs.gtk.org/Pango/enum.EllipsizeMode.html
|
||||||
|
$this->config->title->ellipsize->mode
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app->tabs->set_tab_label(
|
||||||
|
$this->box,
|
||||||
|
$label
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$title = $this->config->title->default;
|
$this->app->tabs->set_tab_label_text(
|
||||||
|
$this->box,
|
||||||
|
$value
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->tabs->set_tab_label_text(
|
// Update window title
|
||||||
$this->box,
|
|
||||||
$title
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->app->setTitle(
|
$this->app->setTitle(
|
||||||
$title
|
$value ? $value : $this->config->title->default
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue