tadly / hideIt.sh

Automagically hide/show a window by its name when the cursor is within a defined region or you mouse over it.
GNU General Public License v3.0
248 stars 11 forks source link

please help hide polybar #6

Closed prankousky closed 5 years ago

prankousky commented 5 years ago

Hi everybody,

I have read this issue already and set my polybar to override-redirect = true. When I do this, I am able to hide my polybar (and restore by hovering over it), however my terminal (qterminal) is overlapped by polybar whenever it is there (thereby permanently hiding the first line).

In order to prevent this, I either need to use override-redirect ? true offset-x = 2 offset-y = 5, or disable it completely # override-redirect = true.

I think this script is fantastic (just stumbled upon it on reddit) and would love to implement it in my workflow. But unless I always let polybar overlap my terminal (which happens when I use override), I cannot use it. Is there another way to do this?

I use multiple screens. It is usually terminal on the left screen, webbrowser on the right. When I use override-redirect, of course, the browser gets overlapped by polybar as well.

My WM is i3-gaps.

Thanks for any ideas on how to fix this =)

tadly commented 5 years ago

Back when I still used to hide my bar I tried working around this by creating a secondary placeholder bar. It's not going to be pretty though because when your bar is hidden (while the placeholder is still there) you obviously will have a gap.

If you're using i3 (which I assume you are) then there's no way around this. For that reason I actually preferred having it overlap stuff as it was hidden most of the time.

Grabbed this from a backup, hope it's what I actually used back then. This should give you an invisible bar unless you aren't using a compositor. In that case you're even more out of luck:

[bar/top_placeholder]
monitor = eDP-1
width = <your screen width>
height = <height of your actual bar>

modules-left = placeholder

[module/placeholder]
type = custom/script
width = 1
prankousky commented 5 years ago

Thank you @tadly . I was hoping that there'd be a solution that would allow the bar to be there when not using fullscreen (so no gap), but display it on hover when fullscreen is enabled.

Currently, I don't run anything in fullscreen, actually. I would run firefox in fullscreen, but it runs on my largest monitor, where I definitely want to see polybar all the time, or at least at most times...

tadly commented 5 years ago

Okay that's different to what I gathered from your initial request.

If I understood you correctly you basically want:

  1. hideIt to be disabled/off when not in fullscreen
  2. hideIt to be active on hover if an application is running in fullscreen

There's another project of mine - savery - which can detect when the active window enters/leaves fullscreen. This feature I specifically added so I could completely hide my tray when entering fullscreen.

As your cases is the opposite, I would:

  1. Create a placeholder bar like described above.
  2. Create your main bar with override-redirect = true
  3. Create a systemd user service for hideIt (to simplify the next steps)
  4. Use savery enter_fullscreen_action to start the service systemctl --user start <service>
  5. Use savery leave_fullscreen_action to stop the service systemctl --user stop <service>

Example service as I use it:

[Unit]
Description=hideIt.sh - Polybar top
Requires=wm.target polybar@top.service
After=polybar@top.service
PartOf=polybar@top.service

[Service]
Type=simple
ExecStart=/usr/bin/hideIt.sh -N '^polybar-top_eDP1$' -d top -s 1 -H
Restart=on-failure
RestartSec=1
StartLimitBurst=3

[Install]
WantedBy=wm.target

Hope this covers everything.

prankousky commented 5 years ago

Thank you. Sorry, not a native speaker... What I am trying to achieve is

I will not be able to test savery until back on my main computer late next week, but I will definitely check it out then :)

tadly commented 5 years ago

Closing due to inactivity.

If you need any more help just leave a comment.