#!/usr/bin/env python3 from libqtile.config import Key from libqtile.command import lazy from libqtile.config import Click, Drag class MyKeys(): def __init__(self,mod,browser,term,editor): self.mod = mod self.browser = browser self.term = term self.editor = editor def init_keys(self): my_keys = [ Key([self.mod], "Return", lazy.spawn(self.term), desc='Launches My Terminal' ), Key([self.mod, "shift"], "a", lazy.spawn('anki'), desc='Launch anki'), Key([self.mod, "shift"], "m", lazy.spawn("spotify"), desc="Laucnh spotify"), Key([self.mod], "Tab", lazy.spawn("dmenu_run -p 'Run: '"), desc='Run Launcher' ), Key([self.mod], "p", lazy.spawn("passmenu -p 'Password for: '"), ), Key([self.mod], "b", lazy.spawn(self.browser), desc="Open browser" ), Key([self.mod, "shift"], "c", lazy.next_layout(), desc='Toggle through layouts' ), Key([self.mod], "q", lazy.window.kill(), desc='Kill active window' ), Key([self.mod, "shift"], "r", lazy.restart(), desc='Restart Qtile' ), Key([self.mod, "shift"], "0", lazy.shutdown(), desc='Shutdown Qtile' ), Key([self.mod, "shift"], "e", lazy.spawn(self.editor), desc='Launch editor' ), ### Switch focus of monitors Key([self.mod], "period", lazy.next_screen(), desc='Move focus to next monitor' ), Key([self.mod], "comma", lazy.prev_screen(), desc='Move focus to prev monitor' ), ### Treetab controls Key([self.mod, "shift"], "h", lazy.layout.move_left(), desc='Move up a section in treetab' ), Key([self.mod, "shift"], "l", lazy.layout.move_right(), desc='Move down a section in treetab' ), ### Window controls Key([self.mod], "j", lazy.layout.down(), desc='Move focus down in current stack pane' ), Key([self.mod], "k", lazy.layout.up(), desc='Move focus up in current stack pane' ), Key([self.mod, "shift"], "j", lazy.layout.shuffle_down(), lazy.layout.section_down(), desc='Move windows down in current stack' ), Key([self.mod, "shift"], "k", lazy.layout.shuffle_up(), lazy.layout.section_up(), desc='Move windows up in current stack' ), Key([self.mod], "h", lazy.layout.shrink(), lazy.layout.decrease_nmaster(), desc='Shrink window (MonadTall), decrease number in master pane (Tile)' ), Key([self.mod], "l", lazy.layout.grow(), lazy.layout.increase_nmaster(), desc='Expand window (MonadTall), increase number in master pane (Tile)' ), Key([self.mod], "n", lazy.layout.normalize(), desc='normalize window size ratios' ), Key([self.mod], "m", lazy.layout.maximize(), desc='toggle window between minimum and maximum sizes' ), Key([self.mod, "shift"], "f", lazy.window.toggle_floating(), desc='toggle floating' ), Key([self.mod], "f", lazy.window.toggle_fullscreen(), desc='toggle fullscreen' ), ### Stack controls Key([self.mod, "shift"], "Tab", lazy.layout.rotate(), lazy.layout.flip(), desc='Switch which side main pane occupies (XmonadTall)' ), Key([self.mod, "shift"], "space", lazy.layout.toggle_split(), desc='Toggle between split and unsplit sides of stack' ), ### Volume controls Key([], "XF86AudioLowerVolume", lazy.spawn('amixer sset Master 5%-'), desc="Decrease volume" ), Key([], "XF86AudioRaiseVolume", lazy.spawn('amixer sset Master 5%+'), desc="Increase volume" ), ### Spotify Key([self.mod, "shift"], "p", lazy.spawn("spotify-control play-pause"), desc="play/pause music" ), Key([self.mod, "shift"], "n", lazy.spawn("spotify-control next"), desc="next song" ), Key([self.mod, "shift"], "b", lazy.spawn("spotify-control previous"), desc="previous song" ), ### Change languages Key([self.mod], "F1", lazy.spawn("setxkbmap us -option caps:swapescape"), desc= "change to US layout" ), Key([self.mod],"F2", lazy.spawn("setxkbmap gr"), desc= "change to greek layout" ), ] return my_keys def init_mouse(self): mouse_keys = [ Drag([self.mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), Drag([self.mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), Click([self.mod], "Button2", lazy.window.bring_to_front()), ] return mouse_keys