Zorin 17 and Caffeine

I can't get Caffeine to run after installing it on Zorin Os 17 Pro.

When I try and run caffeine-indicator from the Terminal, I get the following error:

Traceback (most recent call last):
  File "/usr/bin/caffeine-indicator", line 187, in <module>
    caffeine = Caffeine()
  File "/usr/bin/caffeine-indicator", line 137, in __init__
    self.window = make_unmapped_window("Caffeine indicator")
  File "/usr/bin/caffeine-indicator", line 128, in make_unmapped_window
    screen = display.Display().screen()
  File "/usr/lib/python3/dist-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "/usr/lib/python3/dist-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/usr/lib/python3/dist-packages/Xlib/protocol/display.py", line 166, in __init__
    raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n'

Hi! I've been having the same issue and couldn't fix it. I did found a temporary solution. You can run the following command in Terminal before launching Caffeine Indicator:

$ xhost +

I'm not sure how safe is this command so it might be wise to wait until someone with expertise comment on this topic

User @Omnimaxus also noted that Caffeine did not seem to work, which was the first instance I ever saw of it not working.

Now, two others.

If all of these are occurring on Zorin OS 17 Core (which is the first Zorin OS to default to Wayland), checking if using Zorin Desktop on X at your login screen might be the first test of this that you consider.

Looking over the errors that @tetsuo29 posted above, there is a translation issue between compositing and window management and this suggests that the Wayland Protocol is not compatible with the xdg calls in use when running these apps.

1 Like

I found a similar solution on another site:

xhost +local:$USER > /dev/null

And that fixes the problem. However, I tried adding that line to my .bashrc and then my .profile files and only when it is added to my .bashrc file and I first open a Terminal window does it get run and fix the issue.

So, now I'm wondering what file I can put this in so that it is executed when I log in and so I don't have to first open a Terminal window before opening the Caffeine Indicator? Ideally, I'd like to have the Caffeine Indicator app running at login.

Did you use export when added to your ~.profile?

Nope. I'm not familiar with how to use export to run a command.

All I did was add some lines to the end of .profile:

# fix caffeine indicator issue
xhost +local:$USER > /dev/null

That didn't appear to have any effect when added to .profile. But, when those 2 lines are added to .bashrc, if I open a Terminal after logging in, then caffeine will run.

I'm trying to figure out how to have that command run when I login (without the need to open a Terminal window). So, far, no luck.

Is this on Zorin OS 17?

Just as you describe should work - and has worked with similar commands on Zorin OS 16. Now, accessing the profile is often an xsession action, meaning that if on Wayland, it would not work. And Z17 defaults... to Wayland...
And... you are setting a command to use the Xhost for that action, already...
You might try switching at login to Zorin Desktop on X to verify this and see if that works.
Or try

export DISPLAY=:0
xhost +local:$USER > /dev/null

So, after way too much trial and error, here's I ended up doing...

I placed the following script in my home directory and named it start_caffeine_indicator.sh (and made it executable):


# pause
sleep 1

# fix problem with caffeine not being allowed to run
xhost +local:$USER > /dev/null

sleep 1

# launch caffeine-indicator
/usr/bin/caffeine-indicator &

Then I opened the Startup Applications app and added an item:
Name: Caffeine Indicator
Command: /home/russ/start_caffeine_indicator.sh

Saved it. Logged out and logged back in and voila, the Caffeine Indicator appeared in my top bar- even before Dropbox or Variety did.

Now if only I could get the Dropbox menu to work without having to lock/unlock the screen once.

1 Like

I dumped Caffeine and went with Espresso. Espresso works beautifully. Can pick individual games and applications to work specifically with Espresso (within the extension using the Extension Manager from the Software Center).

Interesting. Where do you get Espresso? I'm not seeing it in the Software Center.

Also, does it work in Zorin 17?

You need to download the Extension Manager. (Not the GNOME extensions manager.) Set up the Extension Manager, then look for it from within Extensions Manager. This help?

1 Like

And yes, it works 100% in Zorin OS 17.

It is a Gnome Extension. To get it you can do it with a Browser and visit the Gnome Extensions Website. Another Way (which I prefer because I think it is more practical) is the Extension Manager. You get this in the Gnome Software Center (search for extension):

When You installed it open it and go to the Browse Tab and search espresso:


Sweet! Thanks for the tip. Giving it a try.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.