Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.7
- import argparse
- import sys
- from xpybutil import conn, root
- import xpybutil.ewmh as ewmh
- parser = argparse.ArgumentParser(
- description='Change workspace name',
- formatter_class=argparse.ArgumentDefaultsHelpFormatter)
- aa = parser.add_argument
- aa('change_from', type=str, metavar='EXISTING_NAME',
- help='The name of the workspace to change.')
- aa('change_to', type=str, metavar='NEW_NAME',
- help='The NEW name of the workspace.')
- conf = parser.parse_args()
- names = ewmh.get_desktop_names(conn, root).reply()
- # Which name do we want to change?
- for i, name in enumerate(names):
- if name == conf.change_from:
- names[i] = conf.change_to
- ewmh.set_desktop_names_checked(conn, root, names).check()
- print 'Changed %s to %s' % (conf.change_from, conf.change_to)
- break
- else:
- print >> sys.stderr, 'Could not find workspace named %s' % conf.change_from
- sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement