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

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
evan140

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

Post by evan140 »

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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
CaptainKirksChair
Level 4
Level 4
Posts: 456
Joined: Sat Feb 18, 2017 9:29 pm

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

Post by CaptainKirksChair »

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 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

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

Post by smurphos »

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.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Locked

Return to “Scripts & Bash”