def rename(): rnwps = i3rnwps() print rnwps for desk in rnwps.keys(): print(desk) if desk != rnwps[desk]: i3.rename('workspace', "\"%s\"" % (desk), 'to', rnwps[desk])
def rename_ws(): global ws_num cmd = "i3-input -F 'echo %s' -P 'New workspace name: ' | grep 'output = ' | cut -c 10-" new_ws_name = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0][:-1].decode('UTF-8') try: ws_num = re.findall(r'\d+', new_ws_name)[0] new_ws_num = True except: new_ws_num = False if 'ws_num' in globals(): if new_ws_name != "": if new_ws_name[0] != "_": if new_ws_num: new_ws_name = new_ws_name[len(ws_num):] if new_ws_name[0:1] == ':': new_ws_name = new_ws_name[1:] if new_ws_name.strip() != "": new_ws_name = ws_num + ': ' + new_ws_name.strip() else: new_ws_name = ws_num else: new_ws_name = ws_num + ': ' + new_ws_name.strip() else: new_ws_name = new_ws_name[1:].strip() else: new_ws_name = ws_num new_ws_name = '"' + new_ws_name + '"' i3.rename('workspace to ' + new_ws_name)
def rename(): rnwps = i3rnwps() print rnwps for desk in rnwps.keys(): print(desk) if desk != rnwps[desk]: i3.rename('workspace', "\"%s\"" % (desk),'to', rnwps[desk])
def cmd_move_group(direction): ws = i3.get_workspaces() group, current_wnum = get_wgroup(ws) if direction == 'up': empty_group = find_closest_empty_group(ws, group, True) pass elif direction == 'down': empty_group = find_closest_empty_group(ws, group, False) pass else: raise Exception('Invalid direction: {0}'.format(direction)) if empty_group < 0: return current_wids = wids_by_furthest(ws, group, current_wnum) wids = [wroundid(empty_group, wid % 10) for wid in current_wids] print 'move_group', direction, current_wids, '->', wids collisions = set(wids).intersection(set(w.get('num') for w in ws)) if collisions: raise Exception('Can\'t move, there would be collisions: {0}'.format( sorted(collisions))) for cur_wid, new_wid in zip(current_wids, wids): i3.rename('workspace', str(cur_wid), 'to', str(new_wid))
def workspace_rename(ws1, ws2): try: i3.rename("workspace %s to %s" % (ws1, ws2)) except i3.MessageError: return
# Do nothing if there aren't more than one active ouput if len(active_outputs) < 2: sys.exit() a, b = active_outputs[:2] print("{} <-> {}".format(a['current_workspace'], b['current_workspace'])) a_workspace = a['current_workspace'] i3.workspace(a_workspace) time.sleep(0.025) i3.move('workspace to output right') time.sleep(0.025) i3.workspace(a_workspace) time.sleep(0.025) i3.rename('workspace to', TEMP_WORKSPACE) time.sleep(0.025) b_workspace = b['current_workspace'] i3.workspace(b_workspace) time.sleep(0.025) i3.move('workspace to output right') time.sleep(0.025) i3.workspace(b_workspace) time.sleep(0.025) i3.rename('workspace to', a_workspace) time.sleep(0.025) i3.workspace(TEMP_WORKSPACE) time.sleep(0.025) i3.rename('workspace to', b_workspace)