Apply black formatter to python files
This commit is contained in:
parent
b3d0b39886
commit
99b4d9f2fe
@ -8,8 +8,7 @@ i3 = i3ipc.Connection()
|
||||
workspaces = i3.get_workspaces()
|
||||
|
||||
for tens, workspace_group in groupby(workspaces, lambda ws: ws.num // 10):
|
||||
workspaces = [ws for ws in workspace_group
|
||||
if ws.num != -1 and ws.num % 10 != 0]
|
||||
workspaces = [ws for ws in workspace_group if ws.num != -1 and ws.num % 10 != 0]
|
||||
|
||||
workspaces.sort(key=lambda ws: ws.num)
|
||||
for num, ws in enumerate(workspaces, 1):
|
||||
|
@ -17,11 +17,11 @@ cmd = partial(subprocess.run, capture_output=True, encoding="ascii")
|
||||
def alias(server_name):
|
||||
match server_name.rpartition("@"):
|
||||
case [_, _, "salt"]:
|
||||
return 'cms/*cms-net-svcs'
|
||||
return "cms/*cms-net-svcs"
|
||||
case [_, _, ("iPad1" | "iPad2" | "iPad3")]:
|
||||
return 'cms/*ipads'
|
||||
return "cms/*ipads"
|
||||
case [_, _, ("octopi-taz-6" | "octopi-lulzbot-mini")]:
|
||||
return 'cms/*octopi'
|
||||
return "cms/*octopi"
|
||||
case _:
|
||||
return server_name
|
||||
|
||||
@ -43,14 +43,16 @@ def get_password(password_name: str) -> None:
|
||||
|
||||
|
||||
def select_and_type(server_name: str) -> None:
|
||||
files = chain(PASSWORD_STORE.glob(f"servers/**/{server_name}.gpg"),
|
||||
PASSWORD_STORE.glob(f"servers/**/*@{server_name}.gpg"))
|
||||
files = chain(
|
||||
PASSWORD_STORE.glob(f"servers/**/{server_name}.gpg"),
|
||||
PASSWORD_STORE.glob(f"servers/**/*@{server_name}.gpg"),
|
||||
)
|
||||
file_list = {str(f.relative_to(PASSWORD_STORE).with_suffix("")) for f in files}
|
||||
|
||||
selected = rofi_select(file_list)
|
||||
password = get_password(selected)
|
||||
|
||||
subprocess.run(["xdotool", "type", password + '\n'])
|
||||
subprocess.run(["xdotool", "type", password + "\n"])
|
||||
|
||||
|
||||
window_name = cmd(["xdotool", "getactivewindow", "getwindowname"]).stdout.strip()
|
||||
|
@ -10,15 +10,22 @@ workspaces = i3.get_workspaces()
|
||||
focused = [ws for ws in workspaces if ws.focused]
|
||||
|
||||
if len(focused) == 1: # I have no idea when it wouldn't be, but whatever
|
||||
inputName = subprocess.check_output(
|
||||
['rofi', '-dmenu', '-l', '0', '-p', 'New name']).decode().strip()
|
||||
inputName = (
|
||||
subprocess.check_output(["rofi", "-dmenu", "-l", "0", "-p", "New name"])
|
||||
.decode()
|
||||
.strip()
|
||||
)
|
||||
oldNum = str(focused[0].num)
|
||||
|
||||
# basically either take raw input, allow clearing text part of a name,
|
||||
# or add input to current number
|
||||
# TODO: handle renaming of workspace without number to another name without a number
|
||||
newName = inputName if re.match('^[0-9]+:', inputName) is not None else \
|
||||
oldNum if inputName == "" else \
|
||||
oldNum + ':' + inputName
|
||||
newName = (
|
||||
inputName
|
||||
if re.match("^[0-9]+:", inputName) is not None
|
||||
else oldNum
|
||||
if inputName == ""
|
||||
else oldNum + ":" + inputName
|
||||
)
|
||||
|
||||
i3.command(f"rename workspace to {newName}")
|
||||
|
Loading…
Reference in New Issue
Block a user