mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45: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":
|
||||
{
|
||||
"default":"New page"
|
||||
"default":"New page",
|
||||
"width":
|
||||
{
|
||||
"chars":32
|
||||
},
|
||||
"ellipsize":
|
||||
{
|
||||
"mode":3
|
||||
}
|
||||
},
|
||||
"redirect":
|
||||
{
|
||||
|
|
|
|||
|
|
@ -763,23 +763,45 @@ class Page
|
|||
?string $value = null
|
||||
): 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
|
||||
{
|
||||
$title = $this->config->title->default;
|
||||
$this->app->tabs->set_tab_label_text(
|
||||
$this->box,
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
$this->app->tabs->set_tab_label_text(
|
||||
$this->box,
|
||||
$title
|
||||
);
|
||||
|
||||
// Update window title
|
||||
$this->app->setTitle(
|
||||
$title
|
||||
$value ? $value : $this->config->title->default
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue