tweak(qtile): run commands in zsh for shell features
This commit is contained in:
parent
9f26f7a3e0
commit
82729bf336
1 changed files with 20 additions and 2 deletions
|
@ -54,6 +54,13 @@ class Apps:
|
|||
"""
|
||||
return f"{terminal or cls.TERMINAL} {' '.join(args)} -- {program}"
|
||||
|
||||
@classmethod
|
||||
def shell_command(cls, command, args=tuple(), *, shell=None):
|
||||
"""
|
||||
Returns a string of a command to run a command in the shell, with the given arguments.
|
||||
"""
|
||||
return f'{shell or cls.SHELL} {" ".join(args)} -- "{command}"'
|
||||
|
||||
@classmethod
|
||||
def open_in_terminal(cls, program, args=tuple(), *, terminal=None):
|
||||
"""
|
||||
|
@ -61,6 +68,17 @@ class Apps:
|
|||
"""
|
||||
return lazy.spawn(cls.terminal_command(program, args=args, terminal=terminal))
|
||||
|
||||
@classmethod
|
||||
def shell_in_terminal(
|
||||
cls, command, sargs=tuple(), targs=tuple(), *, shell=None, terminal=None
|
||||
):
|
||||
"""
|
||||
Opens a program in the terminal using the shell, with the given shell and terminal arguments.
|
||||
"""
|
||||
return cls.open_in_terminal(
|
||||
cls.shell_command(command, sargs, shell=shell), targs, terminal=terminal
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def open_in_editor(cls, file_, args=tuple()):
|
||||
"""
|
||||
|
@ -261,12 +279,12 @@ keys = [
|
|||
# Keys for spawning commands or applications
|
||||
Key(
|
||||
[Keys.SUPER], "r",
|
||||
lazy.spawncmd(),
|
||||
lazy.spawncmd(command=Apps.shell_command("%s", args=("-ic",))),
|
||||
desc="Spawn a command using a prompt widget",
|
||||
),
|
||||
Key(
|
||||
[Keys.SUPER, Keys.SHIFT], "r",
|
||||
lazy.spawncmd(prompt="shell", command=Apps.terminal_command("%s", args=("--hold",))),
|
||||
lazy.spawncmd(prompt="shell", command=Apps.terminal_command(Apps.shell_command("%s", args=("-ic",)), args=("--hold",))),
|
||||
desc="Spawn a command in a shell using a prompt widget",
|
||||
),
|
||||
Key(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue