Re-write some shell scripts to Python with i3ipc

This commit is contained in:
Adam Goldsmith 2022-03-10 11:49:41 -05:00
parent cbdedf626d
commit 3b393c2fea
4 changed files with 24 additions and 18 deletions

12
.config/i3/move_to_workspace.py Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env python3
import sys
import i3ipc
i3 = i3ipc.Connection()
if len(sys.argv) == 1:
print("\n".join([ws.name for ws in i3.get_workspaces()]))
else:
i3.command("move to workspace {sys.argv[1]}")

View File

@ -1,9 +0,0 @@
#!/bin/bash
if [ -z "$1" ]
then
i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n
else
i3-msg move to workspace "$1" 1>2
fi

12
.config/i3/switch_workspace.py Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env python3
import sys
import i3ipc
i3 = i3ipc.Connection()
if len(sys.argv) == 1:
print("\n".join([ws.name for ws in i3.get_workspaces()]))
else:
i3.command("workspace {sys.argv[1]}")

View File

@ -1,9 +0,0 @@
#!/bin/bash
if [ -z "$1" ]
then
i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n
else
i3-msg workspace "$1" 1>2
fi