Skip to content

Instantly share code, notes, and snippets.

@scaramangado
Last active February 23, 2022 19:04
Show Gist options
  • Save scaramangado/6e6e940866655b603d6785e5c6437beb to your computer and use it in GitHub Desktop.
Save scaramangado/6e6e940866655b603d6785e5c6437beb to your computer and use it in GitHub Desktop.
Minimal configuration for qtile + polybar bug (~/.config/qtile)
import os
import subprocess
from libqtile import layout, hook, bar
from libqtile.config import Key, Group, Screen
from libqtile.lazy import lazy
meta = "mod4"
alt = "mod1"
ctrl = "control"
shift = "shift"
terminal = "/usr/bin/alacritty"
browser = "/usr/bin/firefox"
layout_settings = {
"border_focus": "#ffffff",
"border_width": 2,
"margin": 10,
"new_client_position": "bottom",
"single_border_width": 1,
"single_margin": 10,
"change_ratio": 0.01,
"change_size": 10,
}
layouts = [
layout.MonadTall(**layout_settings),
]
keys = [
Key([meta, ], "Return", lazy.spawn(terminal), desc="Launch Terminal"),
Key([meta, ], "b", lazy.spawn(browser), desc="Launch Browser"),
Key([meta, ], "Left", lazy.screen.prev_group(), desc="Go to then group on the left"),
Key([meta, ], "Right", lazy.screen.next_group(), desc="Go to then group on the right"),
Key([meta, ], "q", lazy.window.kill(), desc="Close focused window"),
Key([meta, ctrl], "F5", lazy.restart(), desc="Restart Qtile"),
Key([meta, ], "Escape", lazy.shutdown(), desc="Shutdown Qtile"),
]
groups = [
Group("0"),
Group("1"),
Group("2"),
]
for i in groups:
keys.extend([
Key([meta, ], i.name, lazy.group[i.name].toscreen(), desc="Switch to group {}".format(i.name)),
Key([meta, "shift", ], i.name, lazy.window.togroup(i.name), desc="Move window to group {}".format(i.name)),
])
screens = [
Screen(top=bar.Bar([], 60)),
Screen(top=bar.Bar([], 60))
]
@hook.subscribe.startup
def autostart():
autostart_script = os.path.expanduser("/polybar.sh")
subprocess.call([autostart_script])
#!/bin/sh
killall polybar
MONITOR=DisplayPort-0 polybar -c ~/.config/qtile/polybar_config primary &
MONITOR=DisplayPort-1 polybar -c ~/.config/qtile/polybar_config secondary &
[bar/primary]
monitor = DisplayPort-0
override-redirect = true
modules-left = ewmh
enable-ipc = true
[bar/secondary]
monitor = DisplayPort-1
override-redirect = true
modules-left = ewmh
enable-ipc = true
[module/ewmh]
type = internal/xworkspaces
icon-0 = 0;0
icon-1 = 1;1
icon-2 = 2;2
icon-default =
format = <label-state>
label-active = %icon%
label-urgent = %icon%
label-occupied = %icon%
label-empty = %icon%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment