Adding an example of CommandSet.

This commit is contained in:
Derek Taylor
2023-08-07 21:14:10 -05:00
parent ca4ff380aa
commit 378440d5db

View File

@@ -26,8 +26,7 @@
import os import os
import subprocess import subprocess
from libqtile import qtile from libqtile import bar, extension, hook, layout, qtile, widget
from libqtile import bar, hook, layout, widget
from libqtile.config import Click, Drag, Group, Key, KeyChord, Match, Screen from libqtile.config import Click, Drag, Group, Key, KeyChord, Match, Screen
from libqtile.lazy import lazy from libqtile.lazy import lazy
# from libqtile.utils import guess_terminal # from libqtile.utils import guess_terminal
@@ -131,6 +130,21 @@ keys = [
Key([mod], "period", lazy.next_screen(), desc='Move focus to next monitor'), Key([mod], "period", lazy.next_screen(), desc='Move focus to next monitor'),
Key([mod], "comma", lazy.prev_screen(), desc='Move focus to prev monitor'), Key([mod], "comma", lazy.prev_screen(), desc='Move focus to prev monitor'),
# An example of using the extension 'CommandSet' to give
# a list of commands that can be executed in dmenu style.
Key([mod], 'z', lazy.run_extension(extension.CommandSet(
commands={
'play/pause': '[ $(mocp -i | wc -l) -lt 2 ] && mocp -p || mocp -G',
'next': 'mocp -f',
'previous': 'mocp -r',
'quit': 'mocp -x',
'open': 'urxvt -e mocp',
'shuffle': 'mocp -t shuffle',
'repeat': 'mocp -t repeat',
},
pre_commands=['[ $(mocp -i | wc -l) -lt 1 ] && mocp -S'],
))),
# Emacs programs launched using the key chord CTRL+e followed by 'key' # Emacs programs launched using the key chord CTRL+e followed by 'key'
KeyChord([mod],"e", [ KeyChord([mod],"e", [
Key([], "e", lazy.spawn(myEmacs), desc='Emacs Dashboard'), Key([], "e", lazy.spawn(myEmacs), desc='Emacs Dashboard'),