Feat: fix shortcuts

This commit is contained in:
Bertrand Benjamin 2021-06-15 10:02:44 +02:00
parent edf7c81bf2
commit abefbe1314

220
config.py
View File

@ -34,27 +34,57 @@ from typing import List # noqa: F401
wmname = "???"
MOD = "mod4"
TERM = "st"
TERM = "urxvt"
# Base16 - hybrid (with 5 and 13 from jmbi)
colors = {
# special
"FG": "#c5c8c6",
"BG": "#1d1f21",
"C": "#c5c8c6",
# black
0: "#282a2e",
8: "#373b41",
# red
1: "#a54242",
9: "#cc6666",
# green
2: "#8c9440",
10: "#b5bd68",
# yellow
3: "#de935f",
11: "#f0c674",
# blue
4: "#5f819d",
12: "#81a2be",
# magenta
5: "#d13516",
13: "#c25431",
# cyan
6: "#5e8d87",
14: "#8abeb7",
# white
7: "#707880",
15: "#c5c8c6",
}
keys = [
Key([MOD], "f", lazy.window.toggle_floating()),
# Moving inside a screen
Key([MOD], "Tab", lazy.layout.next()),
Key([MOD], "j", lazy.layout.down()),
Key([MOD], "k", lazy.layout.up()),
Key([MOD, "shift"], "Tab", lazy.layout.rotate()),
#Key([MOD, "shift"], "Tab", lazy.spawncmd()), # circle inside layout
Key([MOD, "shift"], "j", lazy.layout.shuffle_down()),
# Key([MOD, "shift"], "Tab", lazy.spawncmd()), # circle inside layout
Key([MOD, "shift"], "k", lazy.layout.shuffle_up()),
Key([MOD, "shift"], "j", lazy.layout.shuffle_down()),
# Move between screens
Key([MOD], "l", lazy.to_screen(1)),
Key([MOD], "h", lazy.to_screen(0)),
#Key([MOD, "shift"], "l", move to screen 1),
#Key([MOD, "shift"], "h", move to screen 0),
Key([MOD], "l", lazy.to_screen(0)),
Key([MOD], "h", lazy.to_screen(1)),
# Key([MOD, "shift"], "l", move to screen 1),
# Key([MOD, "shift"], "h", move to screen 0),
# Toggle between different layouts as defined below
Key([MOD], "space", lazy.next_layout()),
# Toggle between split and unsplit sides of stack.
# Split = all windows displayed
# Unsplit = 1 window displayed, like Max layout, but still with
@ -62,9 +92,7 @@ keys = [
# Key([MOD, "shift"], "Return", lazy.layout.toggle_split()),
# Swap panes of split stack
# Key([MOD, "shift"], "space", lazy.layout.rotate()),
#Screens
# Screens
Key([MOD], "r", lazy.spawncmd()),
# Key([MOD], 'r', lazy.run_extension(extension.DmenuRun(
# dmenu_prompt=">",
@ -76,78 +104,87 @@ keys = [
# dmenu_height=24, # Only supported by some dmenu forks
# ))),
Key([MOD], "Return", lazy.spawn(TERM)),
Key([MOD], "q", lazy.window.kill()),
Key([MOD, "control"], "r", lazy.restart()),
Key([MOD, "control"], "q", lazy.shutdown()),
Key([MOD, "control"], "equal", lazy.spawn("systemctl suspend")),
# Change the volume if our keyboard has keys
Key(
[], "XF86AudioRaiseVolume",
lazy.spawn("pamixer -i 2")
),
Key(
[], "XF86AudioLowerVolume",
lazy.spawn("pamixer -d 2")
),
Key(
[], "XF86AudioMute",
lazy.spawn("pamixer -t")
),
Key([], "XF86AudioRaiseVolume", lazy.spawn("pamixer -i 2")),
Key([], "XF86AudioLowerVolume", lazy.spawn("pamixer -d 2")),
Key([], "XF86AudioMute", lazy.spawn("pamixer -t")),
]
groups = [
Group("", spawn="firefox", layout="Tall", persist=True),
Group("", spawn="thunderbird", layout="verticaltile", persist=True),
Group("", spawn="st tmuxp load enseignement", layout="max", persist=True),
Group("", layout="Wide", persist=True),
Group("", layout="TallLeft", persist=True),
Group("", layout="Wide", persist=True),
Group("t:", spawn="firefox", layout="Tall", persist=True),
Group("y:", spawn="thunderbird", layout="verticaltile", persist=True),
Group("u:", spawn="st tmuxp load enseignement", layout="TallRight", persist=True),
Group("i:", layout="Wide", persist=True),
Group("o:", layout="TallRight", persist=True),
Group("p:", layout="Wide", persist=True),
]
groups_keys = ["t", "y", "u", "i", "o", "p"]
for i, g in enumerate(groups):
k = groups_keys[i]
keys.extend([
keys.extend(
[
# mod1 + letter of group = switch to group
Key([MOD], k, lazy.group[g.name].toscreen()),
# mod1 + shift + letter of group = switch to & move focused window to group
Key([MOD, "shift"], k, lazy.window.togroup(g.name), lazy.group[g.name].toscreen()),
])
Key(
[MOD, "shift"], k, lazy.window.togroup(g.name)
), # , lazy.group[g.name].toscreen()),
]
)
groups.append(
ScratchPad("scratchpad", [
DropDown("music", "st mocp", x=0.25, y=0.25, height=0.5, width=0.5, opacity=0.8),
]),
ScratchPad(
"scratchpad",
[
DropDown(
"music", "st mocp", x=0.25, y=0.25, height=0.5, width=0.5, opacity=0.8
),
],
),
)
keys.extend([
keys.extend(
[
Key([MOD], "m", lazy.group["scratchpad"].dropdown_toggle("music")),
])
]
)
borders = {
"border_focus": colors[13],
"border_normal": colors["BG"],
}
layouts = [
layout.Max(),
layout.VerticalTile(),
layout.MonadTall(name="Tall",
align=1,
layout.VerticalTile(**borders),
layout.MonadTall(
name="Tall",
align=0,
ratio=0.5,
**borders,
),
layout.MonadTall(name="TallLeft",
align=1,
layout.MonadTall(
name="TallRight",
align=0,
ratio=0.7,
**borders,
),
layout.MonadWide(name="Wide",
layout.MonadWide(
name="Wide",
ratio=0.8,
**borders,
),
]
widget_defaults = dict(
font='DroidSans',
font="DroidSans",
fontsize=12,
padding=3,
)
@ -158,26 +195,47 @@ screens = [
Screen(
bottom=bar.Bar(
[
widget.GroupBox(),
widget.Prompt(),
widget.GroupBox(
active=colors["FG"],
foreground=colors[8],
highlight_color=[colors[1], colors[13]],
highlight_method="border",
this_current_screen_border=colors[13],
this_screen_border=colors[8],
other_current_screen_border=colors[13],
other_screen_border=colors[8],
),
widget.Prompt(
background=colors[13],
),
# widget.WindowName(),
widget.Clock(format='%A %d %B %Y %I:%M %p'),
widget.Spacer(bar.STRETCH),
widget.Clock(
format="%A %d %B %Y %I:%M",
background=colors[13],
foreground=colors[15],
),
widget.Systray(),
#widget.CurrentLayoutIcon(scale=0.5),
# widget.CurrentLayoutIcon(scale=0.5),
],
size = 24,
#background = "#000fff",
size=24,
background=colors["BG"],
),
),
]
# Drag floating layouts.
mouse = [
Drag([MOD], "Button1", lazy.window.set_position_floating(),
start=lazy.window.get_position()),
Drag([MOD], "Button3", lazy.window.set_size_floating(),
start=lazy.window.get_size()),
Click([MOD], "Button2", lazy.window.bring_to_front())
Drag(
[MOD],
"Button1",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
Drag(
[MOD], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()
),
Click([MOD], "Button2", lazy.window.bring_to_front()),
]
dgroups_key_binder = None
@ -186,29 +244,33 @@ main = None
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout = layout.Floating(float_rules=[
{'wmclass': 'confirm'},
{'wmclass': 'dialog'},
{'wmclass': 'download'},
{'wmclass': 'error'},
{'wmclass': 'file_progress'},
{'wmclass': 'notification'},
{'wmclass': 'splash'},
{'wmclass': 'toolbar'},
{'wmclass': 'confirmreset'}, # gitk
{'wmclass': 'makebranch'}, # gitk
{'wmclass': 'maketag'}, # gitk
{'wname': 'branchdialog'}, # gitk
{'wname': 'pinentry'}, # GPG key password entry
{'wmclass': 'ssh-askpass'}, # ssh-askpass
])
floating_layout = layout.Floating(
float_rules=[
{"wmclass": "confirm"},
{"wmclass": "dialog"},
{"wmclass": "download"},
{"wmclass": "error"},
{"wmclass": "file_progress"},
{"wmclass": "notification"},
{"wmclass": "splash"},
{"wmclass": "toolbar"},
{"wmclass": "confirmreset"}, # gitk
{"wmclass": "makebranch"}, # gitk
{"wmclass": "maketag"}, # gitk
{"wname": "branchdialog"}, # gitk
{"wname": "pinentry"}, # GPG key password entry
{"wmclass": "ssh-askpass"}, # ssh-askpass
]
)
auto_fullscreen = True
focus_on_window_activation = "smart"
@hook.subscribe.startup_once
def autostart():
home = expanduser('~')
call([home + '/.config/qtile/autostart.sh'])
home = expanduser("~")
call([home + "/.config/qtile/autostart.sh"])
@hook.subscribe.screen_change
def restart_on_randr(qtile, ev):