How could I accomplish this? Hide / Show bar in Cinnamon

Forum rules
Before you post please read how to get help
Post Reply
evan140
Level 1
Level 1
Posts: 1
Joined: Sat Sep 08, 2018 10:56 am

How could I accomplish this? Hide / Show bar in Cinnamon

Post by evan140 » Sat Sep 08, 2018 11:21 am

My skill level:
I'm kind of a newb. I know a little programming from learning Unity3D. I understand some basic object orientation stuff. I have not really done much at all as a programmer. That's my skill level. I'm also incredibly new to Linux as well.

How would I accomplish this? What would I need to learn?
I have Mint Cinnamon 19 installed. I have a bar on the bottom of the screen, and one on the top. I would like the top bar to enter mode "intelligently auto hide" (or even just hide) when there is no maximized window on the screen. When a window becomes maximized, I would like that top bar to become always show.
  • Maximized: Show
  • Not maximized or minimized: Intelligently Hide (or hide as second choice)
I'm hoping this is a small project that would be fun to learn.

Thank you for any help.

User avatar
CaptainKirksChair
Level 4
Level 4
Posts: 310
Joined: Sat Feb 18, 2017 9:29 pm

Re: How could I accomplish this? Hide / Show bar in Cinnamon

Post by CaptainKirksChair » Tue Sep 11, 2018 9:14 pm

I don't know if the panel can change configuration on the fly. I think you get a choice and that's it. If you want to try, I would recommend the cinnamon.css file as a starting point. You MAY be able to do something with that but I can't say for sure and most likely not. Remember to backup the original and work with a copy. If anything goes wrong, restore the original and start again.

I just put my Cinnamon panel to the top of the screen and set it to always show. You don't lose that much screen real estate and the panel is where it belongs.

User avatar
smurphos
Level 8
Level 8
Posts: 2036
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: How could I accomplish this? Hide / Show bar in Cinnamon

Post by smurphos » Wed Sep 12, 2018 1:55 am

Hi,

The panel show/hide behaviour isn't theme related so don't go hunting through cinnamon.css

You can change the settings programmatically via interacting with the dconf settings database. You can use these commands in a bash script.

Examples - check existing settings.

gsettings get org.cinnamon panels-enabled returns for me
['1:0:top', '2:0:left']

This basically means I have two panels on the primary monitor, one on the top and one on the left.

gsettings get org.cinnamon panels-autohide returns for me
['1:false', '2:intel']

My left panel intelligently autohides and the top is always there.

Set new settings. So if I wanted my top panel to autohide I would do.

gsettings set org.cinnamon panels-autohide "['1:true', '2:intel']"

It's probably worth installing dconf-editor to get a GUI with a nice overview of the backend settings. Or you can use gsettings to do the same.

gsettings list-recursively org.cinnamon

To check the window state from a bash script you are looking at tools like wmctrl, xdotool and xwininfo

Some example commands

xwininfo -id $(xdotool getactivewindow) -stats

wmctrl -lG

If you want to avoid the hackery of doing this via a bash script then you are looking at either modifying your Cinnamon install or writing an extension. A lot of the UI is in JavaScript - take a look at /usr/share/cinnamon/js/ui/panel.js

Extensions are JavaScript based as-well - take a look at https://github.com/linuxmint/cinnamon-spices-extensions for examples of how they are put together.

Post Reply

Return to “Scripts & Bash”