From 5f19288099c4fcf595ff5ef14b3abe85ef5f1890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 7 Jun 2013 13:48:38 +0200 Subject: i3: better rename --- .i3/config | 7 ++++--- .i3/scripts/workspaces.py | 13 +++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to '.i3') diff --git a/.i3/config b/.i3/config index 52b8ec3..3e127eb 100644 --- a/.i3/config +++ b/.i3/config @@ -46,9 +46,9 @@ bindsym $alt+Control+l exec $nsi $script/xlock.sh bindsym $mod+Shift+w kill bindsym $alt+F4 kill # reload the configuration file -bindsym $mod+Shift+r reload +bindsym $mod+backslash reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Control+r restart +bindsym $mod+Shift+bar restart # exit i3 (logs you out of your X session) bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" @@ -153,7 +153,8 @@ bindsym $mod+g exec $nsi $script/workspaces.py switch bindsym $mod+Shift+g exec $nsi $script/workspaces.py move # rename «3 -bindsym $mod+r exec $nsi i3-input -F 'rename workspace to "%s"' -P 'Rename workspace: ' +bindsym $mod+Shift+r exec $nsi $script/workspaces.py rename +bindsym $mod+r exec $nsi $script/workspaces.py rename_num # new temp workspace «3 bindsym $mod+n exec $nsi $script/workspaces.py new diff --git a/.i3/scripts/workspaces.py b/.i3/scripts/workspaces.py index 44de01f..498587b 100755 --- a/.i3/scripts/workspaces.py +++ b/.i3/scripts/workspaces.py @@ -46,6 +46,15 @@ def to_ws(cmd, prompt): if sel is not None: cmd(sel) +def rename(keep = False): + cur_ws = i3.filter(i3.get_workspaces(), focused = True)[0] + input = partial(sh.i3_input, P = "Rename workspace: ") + + if keep and cur_ws["num"]: + input(F = ('rename workspace to "%d: %%s"' % cur_ws["num"])) + else: + input(F = 'rename workspace to "%s"') + if __name__ == "__main__": try: arg = sys.argv[1] @@ -60,6 +69,10 @@ if __name__ == "__main__": new_ws(switch) elif arg == "move_new": new_ws(move) + elif arg == "rename": + rename(False) + elif arg == "rename_num": + rename(True) else: print("Unknown arg: %s" % arg) sys.exit(1) -- cgit v1.2.3