Commit 84d68438 authored by Maxime Bombar's avatar Maxime Bombar
Browse files

[i3/bin] Uncommitted stuff about new_workspace.py and venv

parent f92a22eb
......@@ -4,19 +4,41 @@
import i3ipc
from argparse import ArgumentParser
import logging
import colorlog
logger = logging.getLogger()
def main():
i3 = i3ipc.Connection()
workspaces = i3.get_workspaces()
all_numbers = sorted(list(map(lambda w: w.num, workspaces)))
all_numbers = sorted(list(set(map(lambda w: w.num, workspaces))))
logger.info(f"Current workspaces are {all_numbers}.")
new = all_numbers[0]
i = 0
while i < len(all_numbers) and new == all_numbers[i]:
while i < len(all_numbers) and (all_numbers[i] < 0 or new == all_numbers[i]):
new += 1
i += 1
logger.info(f"i3-msg 'workspace {new}'")
i3.command(f"workspace {new}")
if __name__ == '__main__':
if __name__ == "__main__":
format_string = "%(asctime)s - %(levelname)s - %(message)s"
stdout_handler = logging.StreamHandler()
stdout_formatter = colorlog.ColoredFormatter(
"%(log_color)s{}".format(format_string)
)
stdout_handler.setFormatter(stdout_formatter)
logger.addHandler(stdout_handler)
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="More logging.", action="store_true")
args = parser.parse_args()
if args.verbose:
logger.setLevel(logging.DEBUG)
main()
......@@ -5,3 +5,5 @@ if [ ! -d ~/.config/i3/venv ]; then
source ~/.config/i3/venv/bin/activate;
pip3 install -r ~/.config/i3/requirements.txt;
fi
source ~/.config/i3/venv/bin/activate;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment