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

Generate Workspace Names from Criteria

asked 2014-05-26 13:01:04 +0000

ANOKNUSA gravatar image

Is it possible to generate workspace names on-the-fly using window criteria? Something akin to

i3-msg move container to workspace [class]

Obviously that syntax doesn't work, but it illustrates the idea. I've looked over the User's Guide, and there doesn't seem to be a way to do it built into i3's standard controls. Is it possible using the IPC, however? The desired outcome is to use a single keystroke to send certain windows to their own unique workspaces.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2014-05-28 18:52:04 +0000

ANOKNUSA gravatar image

updated 2014-07-15 01:11:55 +0000

Inspired by an answer in this thread, I just slapped together a quick fix in Bash that does the trick. It uses xdotool to get the WINDOW_NAME variable of the currently focused window and passes it to i3-msg. Just give it a keybinding in the config file.

#!/usr/bin/bash
#
# Use xdotool to get the WINDOW_NAME of the focused window and pass it to
# i3-msg, moving the focused window to a unique workspace

function getinfo {
xdotool getwindowname $(xdotool getwindowfocus)
}

i3-msg "move window to workspace $( getinfo )"

EDIT: Thanks to GitHub user yiuin, I've come up with a way to do this that's simpler (doesn't require xdotool) and more versatile (the user can control the names of workspaces/labels) using two scripts found in yiuin's repository. My GitHub repository contains two scripts for this---shelve and pull. shelve uses i3-msg and dmenu to apply a mark to a container and move it to a workspace named after the mark. pull then does this in reverse, listing marked containers and pulling the selected container to the currently focused workspace.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-05-26 13:01:04 +0000

Seen: 1,467 times

Last updated: Jul 15 '14