The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

Rename workspace with i3-input using numbers and text

asked 2013-05-09 12:26:29 +0000

emanuel gravatar image

Hi !

As described in the user guide, I added the following binding to rename workspaces: bindsym $mod+r exec i3-input -F 'rename workspace to %s' -P 'New name: '

But I cannot use a number as preffix in order to take advantage of selecting workspaces with the i3 command workspace + number since i3-input would delete every whitespace.

e.g: "2: Music" would be named "2:Music" and bindsym $mod+2 workspace 2 wouldn't select that workspace.

What can I do ?

Thanks in advance!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-05-09 21:41:48 +0000

badboy_ gravatar image

updated 2013-05-09 21:42:00 +0000

Short answer: workspace number X

More: https://faq.i3wm.org/question/1657/add-friendly-name-to-workspace-but-keep-numbers-for-shortcuts/

edit flag offensive delete link more

Comments

Oh .. I feel terrible ! I read the entire i3 user guide and the answer was under my nose..thanks buddy.

emanuel gravatar imageemanuel ( 2013-05-10 01:08:01 +0000 )edit

You are not the only one reading over the keyword 'Number' :)

joepd gravatar imagejoepd ( 2013-05-10 05:53:53 +0000 )edit
0

answered 2013-05-20 13:50:41 +0000

ndemou gravatar image

updated 2013-05-20 16:02:52 +0000

If you've read the accepted answer and the link and still don't get it (like I did see my PS bellow) then here it is in black and white:

this keybinding will take you to the workspace having a name starting with 1

bindsym $mod+1 workspace number 1

whereas this will take you to the workspace named "1" (nothing more nothing less)

bindsym $mod+1 workspace 1

There's a good chance you have the later syntax in your config.

So, to give you the big picture, if you want to work with named workspaces you must:

  1. define a keybinding like this in your config (I chose $mod+n from reName because $mod+r was allready taken for Resize):

    bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' (unimportant details regarding this command in notes [1],[2])

  2. make sure that your config has bindings with the number keyword for switching to your workspaces (i.e. lines like this: bindsym $mod+1 workspace number 1 and not like this: bindsym $mod+1 workspace 1)

Notes:

1: the user guide omits the double quotes around %s but they are needed (names with spaces will be truncated if you don't use them -- maybe other bad things will happen).

2: super-geeks can also directly execute commands like this: i3-msg 'rename workspace 1 to "1: foo"' in order to rename a workspace.


PS I can't tell you how bad I felt after trying and retrying for many minutes to rename and access my workspaces with $mod+<num>. Either it was a silly moment or the guide and the syntax begs for misunderstandings. In (my very biased opinion at the moment) it's more of the later :). It seems that this particular topic (working with named workspaces) of the otherwise excellent user guide is full of traps:

  1. $mod+r is presented as an example both for resizing clients and for renaming workspaces
  2. the keybinding command that uses i3-input omits " around %s. As a result renaming to anything containing spaces fails. The examples always have spaces in the names.
  3. the topic of this thread
edit flag offensive delete link more

Comments

great answer. How can I get it to display the number of the currently focused workspace by default. Lets say I am on workspace "2: www" and I want to rename it to "2: editor". When I press hotkey I want prompt to deafult to "2: " since that is the prefix I would always want

majkinetor gravatar imagemajkinetor ( 2013-10-12 14:37:51 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2013-05-09 12:26:29 +0000

Seen: 3,683 times

Last updated: May 20 '13