Sublime Forum

How to make tab close button appear only when I hover the tab?

#1

I want to make the tab close button of each tab invisible except when I hover this tab.

Here is how I tried to adjust Default.sublime-theme for this:

{
  "variables":
  {
    "file_tab_close_opacity": { "target": 0, "speed": -1 },
    "file_tab_close_hover_opacity": { "target": 1, "speed": -1 },
    "file_tab_close_selected_opacity": { "target": 0, "speed": -1 },
    "file_tab_close_selected_hover_opacity": { "target": 1, "speed": -1 },
  },
  "rules":
  [
  ]
}

However, this doesn’t really make the desired behavior. With the current adjustments, the tab close button appears when I hover the area of the tab close button — it is not enough to hover just the tab itself for this.

How to achieve the desired behavior? Which settings, and how, should I adjust?

And a side question: I already have "animation_enabled": false, but despite of this, tab close buttons were nevertheless appeared and disappeared smoothly, not instantly. To make them appear and disappear instantly, I changed the value of speed to -1. Is it correct or there is a better way?

0 Likes

#2

Like this?

{
    "rules": [
        {
            "class": "tab_close_button",
            "layer0.opacity": 0.0
        },
        {
            "class": "tab_close_button",
            "parents": [{"class": "tabset_control", "attributes": ["hover"]}, {"class": "tab_control", "attributes": ["hover"]}],
            "layer0.opacity": 0.7
        },
        {
            "class": "tab_close_button",
            "attributes": ["hover"],
            "layer0.opacity": 1.0
        },
    ]
}

1 Like