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

Creating a new workspace

asked 2015-05-19 13:52:41 +0000

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

I want to be able to open a new workspace with a simple keyboard shortcut, without having to press an unused number key. I found this command:

i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))

from here: https://github.com/sandeel/i3-new-wor...

If I just enter it on my terminal it works exactly as advertised but when I add it to the config file like this:

bindsym $mod+n exec i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))

and reload the config file, pressing $mod+n doesn't result in a new workspace.

I'm new to i3 and I'm sure I'm missing something very obvious, but I just can't figure it out.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-05-19 19:08:37 +0000

aunsn gravatar image

Put your line in a script somewhere (for instance in ~/.i3/empty_workspace.sh), adding "#!/bin/bash" at the begining, make it executable and add this to your config file

bindsym $mod+n exec --no-startup-id ~/.i3/empty_workspace.sh

It doesn't really answer your question but it solves your problem ;)

edit flag offensive delete link more

Comments

I'm not sure why, but at least this works. Thanks.

walter gravatar imagewalter ( 2015-05-19 21:42:15 +0000 )edit

@walter It's due to escaping. It can be solved without externing it into a script, but I think it's the better solution because it keeps the config more readable and maintainable.

Airblader gravatar imageAirblader ( 2015-05-20 00:44:01 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-05-19 13:52:41 +0000

Seen: 411 times

Last updated: May 19