Eu descobri que os nomes podem ser definidos usando
gsettings set org.compiz.workspacenames:/org/compiz/profiles/unity/plugins/workspacenames/ names [\"Name1\",\"Name3\"]
gsettings set org.compiz.workspacenames:/org/compiz/profiles/unity/plugins/workspacenames/ viewports [1,3]
Então eu escrevi um script python para fazer o que eu queria:
#!/usr/bin/python
import sys
from subprocess import Popen, PIPE
getoutput = lambda x: Popen(x, stdout=PIPE).communicate()[0]
listIntOutput = lambda x: "[%s]" % ",".join([str(i) for i in x])
listStrOutput = lambda x: "[%s]" % ",".join(["\"%s\"" % s for s in x])
SCHEMA = \
"org.compiz.workspacenames:/org/compiz/profiles/unity/plugins/workspacenames/"
if len(sys.argv) < 2:
name = ""
else:
name = " ".join(sys.argv[1:])
# get the position of the current workspace
ws = list(int(i.strip(",")) for i in getoutput(("xprop", "-root",
"-notype", "_NET_DESKTOP_VIEWPORT")).split()[-2:])
# get the number of horizontal and vertical workspaces
hsize = int(getoutput(("gconftool",
"--get", "/apps/compiz-1/general/screen0/options/hsize")))
vsize = int(getoutput(("gconftool",
"--get", "/apps/compiz-1/general/screen0/options/vsize")))
# get the dimentions of a single workspace
x, y = list(int(i) for i in getoutput(("xwininfo", "-root",
"-stats", )).split("geometry ")[1].split("+")[0].split("x"))
# enumerate workspaces
workspaces, n = [], 0
for j in range(vsize):
for i in range(hsize):
workspaces.append([n, [x*i, y*j, ], ])
n += 1
# Get the (1-indexed) viewport #
vp = list(i for i in workspaces if i[1] == ws)[0][0] + 1
# Get the current named viewports
vps = eval(getoutput(("gsettings", "get", SCHEMA, "viewports")));
names = eval(getoutput(("gsettings", "get", SCHEMA, "names")));
if vp not in vps:
# If this viewport is not yet named, then just append it.
vps.append(vp)
names.append(name)
getoutput(("gsettings", "set", SCHEMA, "viewports", listIntOutput(vps)));
getoutput(("gsettings", "set", SCHEMA, "names", listStrOutput(names)));
else:
# Rename the viewport.
index = vps.index(vp)
names[index] = name
getoutput(("gsettings", "set", SCHEMA, "names", listStrOutput(names)));
Com base nesse script: link
A única ressalva que eu encontrei é que
gconftool --get /apps/compiz-1/general/screen0/options/hsize # and vsize
não retornou os valores corretos que eu defini no ccsm, então tive que configurá-los manualmente separadamente para que o script funcionasse.
gconftool --set /apps/compiz-1/general/screen0/options/hsize #
gconftool --set /apps/compiz-1/general/screen0/options/vsize #