parasurv@webspace ~ $

Blog: [Site updates] [Linux] [Free Software] [Culture] [Health] [Watches] Learning: [Emacs Journal] [Linux Wiki] Personal: [Contact] [About me]

Shorts: [Microblog] [Linkblog] Important: [Read] [Watch] [Listen] Other pages: [Old games stuff]

Hide bar in i3wm

I love i3 window manager, and I love that you can create minimalists system, both in function and look. Recently I thought to myself, what if I hide polybar and there is only window on screen? But I don't want a permament hide, I need a shortcut to show it, if I need it.

Here comes in r/i3wm subreddit, and here is the solution. Note, that I use Manjaro and package names probably are different on other distros.

There is no built-in solution for this, but there is a tool, called xdo which let's you do some things with windows, and since polybar is a window, it works!

## 1. Install xdo and xprop

We need these packages.

$ sudo pacman -S xdo xorg-xprop

## 2. Create the bash script

Copy these lines in your favorite text editor and save it somewhere as a bash script (sh).

#!/bin/sh

xdopath=$(which xdo) if [ $? -ne 0 ]; then echo "Cannot find \`xdo\` command." 1>&2 exit 1 fi

id=$(xdo id -N "Polybar")

if xprop -id $id | grep -q "Normal"; then xdo hide -N "Polybar" else xdo show -N "Polybar" fi

Make it executable:

$ chmod +x nameofscript.sh

## 3. Edit your i3 config file, and assign a shortcut

For me it become $mod+p, but you can use it whatever you want and free.

bindsym $mod+p exec ~/.config/scripts/polyhide.sh

Refresh your i3wm, and try it out! So far it works well, and instantly, even with using compton.

Hosted on Neocities and created with Emacs, the world best text editor, operating system. This website doesn't track you. I don't use any javascript or other scripts. I don't store any information about the visitors. It's just pure old fashioned HTML. Some parts of the site is not up-to-date design wise. I may or may not update them in the future. I don't really support mobile stuff, but I bet if you disable the little CSS I have, you can read the site perfectly.