You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
866 B
32 lines
866 B
#!/usr/bin/python3 |
|
|
|
import subprocess, json, os |
|
|
|
mapFile = open(os.environ['HOME'] + '/.config/ratflow/profiles/current/autoapp.conf', 'r'); |
|
|
|
map = json.loads(mapFile.read()); |
|
|
|
print(map) |
|
|
|
def getCurrentWorkspaceNum(): |
|
command = "i3-msg -t get_workspaces" |
|
proc = subprocess.Popen([command], stdout=subprocess.PIPE, shell=True) |
|
(out, err) = proc.communicate() |
|
jworkspaces = json.loads(out) |
|
|
|
print(jworkspaces) |
|
|
|
for workspace in jworkspaces: |
|
if workspace['focused'] == True: |
|
return workspace['num'] |
|
return False |
|
|
|
|
|
workspaceNum = str(getCurrentWorkspaceNum()) |
|
|
|
if workspaceNum in map: |
|
command = "i3-msg exec "+map[workspaceNum] |
|
print ("running command: " + command) |
|
proc = subprocess.Popen([command], stdout=subprocess.PIPE, shell=True) |
|
else: |
|
print("no application assigned to workspace " + workspaceNum)
|
|
|