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 = "???" wmname = "???"
MOD = "mod4" 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 = [ keys = [
Key([MOD], "f", lazy.window.toggle_floating()),
# Moving inside a screen # Moving inside a screen
Key([MOD], "Tab", lazy.layout.next()), Key([MOD], "Tab", lazy.layout.next()),
Key([MOD], "j", lazy.layout.down()), Key([MOD], "j", lazy.layout.down()),
Key([MOD], "k", lazy.layout.up()), Key([MOD], "k", lazy.layout.up()),
Key([MOD, "shift"], "Tab", lazy.layout.rotate()), Key([MOD, "shift"], "Tab", lazy.layout.rotate()),
#Key([MOD, "shift"], "Tab", lazy.spawncmd()), # circle inside layout # Key([MOD, "shift"], "Tab", lazy.spawncmd()), # circle inside layout
Key([MOD, "shift"], "j", lazy.layout.shuffle_down()),
Key([MOD, "shift"], "k", lazy.layout.shuffle_up()), Key([MOD, "shift"], "k", lazy.layout.shuffle_up()),
Key([MOD, "shift"], "j", lazy.layout.shuffle_down()),
# Move between screens # Move between screens
Key([MOD], "l", lazy.to_screen(1)), Key([MOD], "l", lazy.to_screen(0)),
Key([MOD], "h", lazy.to_screen(0)), Key([MOD], "h", lazy.to_screen(1)),
#Key([MOD, "shift"], "l", move to screen 1), # Key([MOD, "shift"], "l", move to screen 1),
#Key([MOD, "shift"], "h", move to screen 0), # Key([MOD, "shift"], "h", move to screen 0),
# Toggle between different layouts as defined below # Toggle between different layouts as defined below
Key([MOD], "space", lazy.next_layout()), Key([MOD], "space", lazy.next_layout()),
# Toggle between split and unsplit sides of stack. # Toggle between split and unsplit sides of stack.
# Split = all windows displayed # Split = all windows displayed
# Unsplit = 1 window displayed, like Max layout, but still with # Unsplit = 1 window displayed, like Max layout, but still with
@ -62,9 +92,7 @@ keys = [
# Key([MOD, "shift"], "Return", lazy.layout.toggle_split()), # Key([MOD, "shift"], "Return", lazy.layout.toggle_split()),
# Swap panes of split stack # Swap panes of split stack
# Key([MOD, "shift"], "space", lazy.layout.rotate()), # Key([MOD, "shift"], "space", lazy.layout.rotate()),
# Screens
#Screens
Key([MOD], "r", lazy.spawncmd()), Key([MOD], "r", lazy.spawncmd()),
# Key([MOD], 'r', lazy.run_extension(extension.DmenuRun( # Key([MOD], 'r', lazy.run_extension(extension.DmenuRun(
# dmenu_prompt=">", # dmenu_prompt=">",
@ -76,78 +104,87 @@ keys = [
# dmenu_height=24, # Only supported by some dmenu forks # dmenu_height=24, # Only supported by some dmenu forks
# ))), # ))),
Key([MOD], "Return", lazy.spawn(TERM)), Key([MOD], "Return", lazy.spawn(TERM)),
Key([MOD], "q", lazy.window.kill()), Key([MOD], "q", lazy.window.kill()),
Key([MOD, "control"], "r", lazy.restart()), Key([MOD, "control"], "r", lazy.restart()),
Key([MOD, "control"], "q", lazy.shutdown()), Key([MOD, "control"], "q", lazy.shutdown()),
Key([MOD, "control"], "equal", lazy.spawn("systemctl suspend")), Key([MOD, "control"], "equal", lazy.spawn("systemctl suspend")),
# Change the volume if our keyboard has keys # Change the volume if our keyboard has keys
Key( Key([], "XF86AudioRaiseVolume", lazy.spawn("pamixer -i 2")),
[], "XF86AudioRaiseVolume", Key([], "XF86AudioLowerVolume", lazy.spawn("pamixer -d 2")),
lazy.spawn("pamixer -i 2") Key([], "XF86AudioMute", lazy.spawn("pamixer -t")),
),
Key(
[], "XF86AudioLowerVolume",
lazy.spawn("pamixer -d 2")
),
Key(
[], "XF86AudioMute",
lazy.spawn("pamixer -t")
),
] ]
groups = [ groups = [
Group("", spawn="firefox", layout="Tall", persist=True), Group("t:", spawn="firefox", layout="Tall", persist=True),
Group("", spawn="thunderbird", layout="verticaltile", persist=True), Group("y:", spawn="thunderbird", layout="verticaltile", persist=True),
Group("", spawn="st tmuxp load enseignement", layout="max", persist=True), Group("u:", spawn="st tmuxp load enseignement", layout="TallRight", persist=True),
Group("", layout="Wide", persist=True), Group("i:", layout="Wide", persist=True),
Group("", layout="TallLeft", persist=True), Group("o:", layout="TallRight", persist=True),
Group("", layout="Wide", persist=True), Group("p:", layout="Wide", persist=True),
] ]
groups_keys = ["t", "y", "u", "i", "o", "p"] groups_keys = ["t", "y", "u", "i", "o", "p"]
for i, g in enumerate(groups): for i, g in enumerate(groups):
k = groups_keys[i] k = groups_keys[i]
keys.extend([ keys.extend(
[
# mod1 + letter of group = switch to group # mod1 + letter of group = switch to group
Key([MOD], k, lazy.group[g.name].toscreen()), Key([MOD], k, lazy.group[g.name].toscreen()),
# mod1 + shift + letter of group = switch to & move focused window to group # 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( groups.append(
ScratchPad("scratchpad", [ ScratchPad(
DropDown("music", "st mocp", x=0.25, y=0.25, height=0.5, width=0.5, opacity=0.8), "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")), Key([MOD], "m", lazy.group["scratchpad"].dropdown_toggle("music")),
]) ]
)
borders = {
"border_focus": colors[13],
"border_normal": colors["BG"],
}
layouts = [ layouts = [
layout.Max(), layout.Max(),
layout.VerticalTile(), layout.VerticalTile(**borders),
layout.MonadTall(name="Tall", layout.MonadTall(
align=1, name="Tall",
align=0,
ratio=0.5, ratio=0.5,
**borders,
), ),
layout.MonadTall(name="TallLeft", layout.MonadTall(
align=1, name="TallRight",
align=0,
ratio=0.7, ratio=0.7,
**borders,
), ),
layout.MonadWide(name="Wide", layout.MonadWide(
name="Wide",
ratio=0.8, ratio=0.8,
**borders,
), ),
] ]
widget_defaults = dict( widget_defaults = dict(
font='DroidSans', font="DroidSans",
fontsize=12, fontsize=12,
padding=3, padding=3,
) )
@ -158,26 +195,47 @@ screens = [
Screen( Screen(
bottom=bar.Bar( bottom=bar.Bar(
[ [
widget.GroupBox(), widget.GroupBox(
widget.Prompt(), 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.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.Systray(),
#widget.CurrentLayoutIcon(scale=0.5), # widget.CurrentLayoutIcon(scale=0.5),
], ],
size = 24, size=24,
#background = "#000fff", background=colors["BG"],
), ),
), ),
] ]
# Drag floating layouts. # Drag floating layouts.
mouse = [ mouse = [
Drag([MOD], "Button1", lazy.window.set_position_floating(), Drag(
start=lazy.window.get_position()), [MOD],
Drag([MOD], "Button3", lazy.window.set_size_floating(), "Button1",
start=lazy.window.get_size()), lazy.window.set_position_floating(),
Click([MOD], "Button2", lazy.window.bring_to_front()) 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 dgroups_key_binder = None
@ -186,29 +244,33 @@ main = None
follow_mouse_focus = True follow_mouse_focus = True
bring_front_click = False bring_front_click = False
cursor_warp = False cursor_warp = False
floating_layout = layout.Floating(float_rules=[ floating_layout = layout.Floating(
{'wmclass': 'confirm'}, float_rules=[
{'wmclass': 'dialog'}, {"wmclass": "confirm"},
{'wmclass': 'download'}, {"wmclass": "dialog"},
{'wmclass': 'error'}, {"wmclass": "download"},
{'wmclass': 'file_progress'}, {"wmclass": "error"},
{'wmclass': 'notification'}, {"wmclass": "file_progress"},
{'wmclass': 'splash'}, {"wmclass": "notification"},
{'wmclass': 'toolbar'}, {"wmclass": "splash"},
{'wmclass': 'confirmreset'}, # gitk {"wmclass": "toolbar"},
{'wmclass': 'makebranch'}, # gitk {"wmclass": "confirmreset"}, # gitk
{'wmclass': 'maketag'}, # gitk {"wmclass": "makebranch"}, # gitk
{'wname': 'branchdialog'}, # gitk {"wmclass": "maketag"}, # gitk
{'wname': 'pinentry'}, # GPG key password entry {"wname": "branchdialog"}, # gitk
{'wmclass': 'ssh-askpass'}, # ssh-askpass {"wname": "pinentry"}, # GPG key password entry
]) {"wmclass": "ssh-askpass"}, # ssh-askpass
]
)
auto_fullscreen = True auto_fullscreen = True
focus_on_window_activation = "smart" focus_on_window_activation = "smart"
@hook.subscribe.startup_once @hook.subscribe.startup_once
def autostart(): def autostart():
home = expanduser('~') home = expanduser("~")
call([home + '/.config/qtile/autostart.sh']) call([home + "/.config/qtile/autostart.sh"])
@hook.subscribe.screen_change @hook.subscribe.screen_change
def restart_on_randr(qtile, ev): def restart_on_randr(qtile, ev):