The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.
Ask Your Question
0

Add friendly name to workspace, but keep numbers for shortcuts

asked 2013-04-19 11:53:16 +0000

ierpe gravatar image

updated 2013-04-19 12:30:11 +0000

Hi,

I'm new (from today :) to i3, and so far I love it!

Now I'm starting some applications on logon like this:

exec i3-msg workspace 1 ; i3-msg exec firefox ;

Works fine. Now what I would like to have would be something like this:

exec i3-msg workspace 1:Firefox ; i3-msg exec firefox ;

So my workspace would have a friendly name, the problem is that when I do this the shortcut to access the workspace 1 (logically) opens a new workspace.

So my question is: is it possible to give a friendly name to a workspace while keeping its shortcut/number reference...?

== Edit after first answer ==

Ok, from the first answer and some more testing, I got even more lost... sorry for my noobyness.

Basically, what I want to achieve on login is:

  • Create a workspace called "1: Firefox" and start firefox within
  • Create a workspace called "2: VIM" and start vim within
  • etc

And then being able with $mod+1 to go to workspace "1: Firefox", $mod+2 go to workspace "2: VIM", etc

Could you post the config syntax to:

  • Create the workspaces and launch the application within
  • Create the workspace shortcuts in order to be able to reach them
edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
0

answered 2013-04-19 12:43:29 +0000

Ultrabug gravatar image

updated 2015-03-10 12:30:46 +0000

Adaephon gravatar image

This a sample config to solve your problem (with my names, just adapt to yours):

# switch to workspace
bindsym $mod+ampersand workspace number 1 irc
bindsym $mod+eacute workspace number 2 www
bindsym $mod+quotedbl workspace number 3 code
bindsym $mod+apostrophe workspace number 4 code
bindsym $mod+parenleft workspace number 5 code
bindsym $mod+minus workspace number 6 code
bindsym $mod+egrave workspace number 7 code
bindsym $mod+underscore workspace number 8 code
bindsym $mod+ccedilla workspace number 9 mail
bindsym $mod+agrave workspace number 10 mon

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1 irc
bindsym $mod+Shift+2 move container to workspace number 2 www
bindsym $mod+Shift+3 move container to workspace number 3 code
bindsym $mod+Shift+4 move container to workspace number 4 code
bindsym $mod+Shift+5 move container to workspace number 5 code
bindsym $mod+Shift+6 move container to workspace number 6 code
bindsym $mod+Shift+7 move container to workspace number 7 code
bindsym $mod+Shift+8 move container to workspace number 8 code
bindsym $mod+Shift+9 move container to workspace number 9 mail
bindsym $mod+Shift+0 move container to workspace number 10 mon

# force a window on a named workspace
assign [class="Opera"] 2 www
assign [class="Firefox"] 10 mon
edit flag offensive delete link more

Comments

This works, however, the commands for moving focused containers to a workspace should be of the format `bindsym $mod+Shift+5 move container to workspace number 5 code`. Otherwise, if a workspace is created by moving a container to it, it won't have its proper nickname.

eddie-dunn gravatar imageeddie-dunn ( 2015-01-12 11:22:17 +0000 )edit

Thx @eddie-dunn you're right, I've updated the answer.

Ultrabug gravatar imageUltrabug ( 2015-03-10 08:38:29 +0000 )edit
1

A generally good idea is to put workspace names into variables because it will make changing the name of a workspace in your config much easier.

airblader gravatar imageairblader ( 2015-04-01 20:29:52 +0000 )edit
2

answered 2013-04-19 12:06:01 +0000

Tucos gravatar image

updated 2013-04-19 12:40:38 +0000

This is what the workspace number command is for. Prefixing the workspace with a number means that number can be used to reference to the named workspace.

As per the userguide, given a workspace called '1: Firefox', workspace number 1 will take you to '1: Firefox' (so the bindsym would become bindsym $mod+1 workspace number 1. As for starting an app on a given workspace once, see the last paragraph here.

If the app does not support startup-notification (GTK does, so i think you should be fine as far as firefox and gvim go), things get much nastier and you'll need hacky scripts. I personally just assign firefox to a fixed workspace.

edit flag offensive delete link more

Comments

Hey sorry I tried different things but I still could not get it to work :( I edited my question

ierpe gravatar imageierpe ( 2013-04-19 12:30:52 +0000 )edit

And I've updated the answer.

Tucos gravatar imageTucos ( 2013-04-19 12:40:55 +0000 )edit

Why is the default configuration using `workspace N` instead of `workspace number N`, which looks (at least to me) a better candidate for a default? This better match intuitive expectation. If one have a workspace named “1:foo”, pressing `$mod+1` he/she probably expect to go to workspace “1:foo”.

Hibou57 gravatar imageHibou57 ( 2014-07-05 08:51:18 +0000 )edit
0

answered 2013-04-21 11:26:51 +0000

teto gravatar image

updated 2013-04-21 11:29:03 +0000

I do something similar with scratchpad so this should be a near working example (i3 4.5.1).

set $w1 1 main

urxvtc -name vim -e vim

# unsure about the syntax, I use "move scratchpad" here
for_window [instance="vim"] move to workspace $w1



bindsym $mod+ampersand workspace $w1
bindsym $mod+Shift+1 move container to workspace $w1
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-04-19 11:53:16 +0000

Seen: 11,293 times

Last updated: Mar 10