Re-write some shell scripts to Python with i3ipc
This commit is contained in:
parent
cbdedf626d
commit
3b393c2fea
12
.config/i3/move_to_workspace.py
Executable file
12
.config/i3/move_to_workspace.py
Executable 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]}")
|
@ -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
12
.config/i3/switch_workspace.py
Executable 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]}")
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user