Can't hide browser sidebar

Since a long time ago, the checkbox to hide the browser sidebar is uncheckable, so that I can’t hide the Anki browser sidebar (a feature that rarely I use, and is occupying a large portion of my screen)

I know there is an option to slide the three dots to the left, but I want to completely disable the sidebar

How can I fix this? There is some CSS parameter that I can hide the sidebar? Or maybe in the Anki config files?

Version ⁨2.1.52
QT: Qt5
Python 3.10.4
python-pyqt5 5.15.6-7
python-pyqt6 6.3.0-1

(Already tried downgrading and the problem persisted)

Tried setting :

    def showSidebar(self) -> None:
        self.sidebarDockWidget.setVisible(False)

in /usr/lib/python3.10/site-packages/aqt/browser/browser.py, doen’t worked.

That checkbox was removed because it didn’t seem particularly useful.

The sidebar is a Qt widget, so it cannot be hidden with CSS I’m afraid.

There is actually another hidden checkbox to toggle the sidebar, accessible by right-clicking on the divider. But for some reason, it’s not checkable now.

I found about this from Henrik’s comment here: move remaining Filter button items into sidebar · ankitects/anki@b8d67cd · GitHub

3 Likes

Maybe the best thing would be for the sidebar to disappear when you resize it to a very small size, with the handle bar, and only leave that bar visible, so that you just have to resize it to make it appear again. Also, clicking that bar could toggle the visibility state. I would find it more ergonomic than having to open a pop-up menu and click on a checkbox.

6 Likes

I seem to recall Anki used to allow users to do exactly that. It resulted in quite a few support requests from users who’d hidden the sidebar and then couldn’t figure out how to restore it.

Software like Gimp, which usually have a lot of modal windows, that you can hide, also have a menu in the toolbar with each modal window and a checkbox, reflecting the visibility of that window. Maybe having the same thing would greatly help these users: “no matter how I made something (dis)appear, I always know how to revert my action”. With that, a more ergonomic but somehow mysterious for some users way of resizing the sidebar can be kept.

2 Likes

I think simply making the handle protrude, maybe even slightly over other elements, works rather well. Here’s how Gmail shows the handle of the right panel if you collapse it:

image

Or one could place a button with “>>” in the top left that appears when the sidebar is collapsed.

1 Like

That checkbox was removed because it didn’t seem particularly useful.

In resource limited computers, the browser window loads waaay faster if Anki hasn’t the paintask to load and display the sidebar (and, in my case, thousands of tags). I remember that from a old version when I was able to hide the sidebar.

Now with the View menu, there would be a more obvious place to find the restore action.

3 Likes

I seem to recall users sometimes managed to hide the sidebar via the Filter button and then couldn’t figure out how to restore it either, but that’s a decent point - it would hopefully be easier to find in the View menu.

there are at least two add-ons that allow to hide the sidebar that should work:

4 Likes

Adapting from the addons:

def my_toggle_sidebar(self):
    new_state = False if self.sidebarDockWidget.isVisible() else True
    self.sidebarDockWidget.setVisible(new_state)

The code above worked when called by shortcut hook. How can I make it the default?

Tried:

def disable_sidebar(self):
    self.sidebarDockWidget.setVisible(False)

browser_menus_did_init.append(disable_sidebar)

But after toggling the sidebar to make it visible again

Caught exception:
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/aqt/browser/sidebar/tree.py", line 337, in mouseReleaseEvent
    self._on_search(index)
  File "/usr/lib/python3.10/site-packages/aqt/browser/sidebar/tree.py", line 440, in _on_search
    if item := self.model().item_for_index(index):
AttributeError: 'NoneType' object has no attribute 'item_for_index'

If I disable the sidebar by default, I get this error. How can I fix this?