Coder Social home page Coder Social logo

i3-workspace-groups's Introduction

i3 Workspace Groups

A Python library and set of command line tools for managing i3wm workspaces in groups. I find this tool useful for managing many workspaces in i3.

PyPI version pipeline status

Demo flow

Table of Contents

Background

I often find myself working with many i3 workspaces at once (7-8+), usually related to multiple projects/contexts (personal/work etc). This has caused me a few issues, for example:

  • Working with a set of workspaces of a given project/context, without being distracted by unrelated workspaces.
  • Reusing the same workspace number in multiple projects/contexts. For example, I have two different emails for personal and work stuff, and I want Super+1 to always switch to the workspace with the email client relevant to my current context.
  • Finding a free workspace for a new window (that can also be reached with my keybindings)

This has led me to create the i3-workspace-groups project, which enables you to define and manage groups of workspaces, each with their own "namespace", and switch between them.

Installation

The scripts can be installed using pip:

python3 -m pip install i3-workspace-groups

Then you should be able to run the command line tool i3-workspace-groups. There are also a few utility scripts provided that require rofi and which are useful for interactively managing the groups, using rofi as the UI. They include:

If you want to use client/server mode for improved speed/latency, it's recommended to install one of the following tools to further improve speed:

  • socat: available in all major distros
  • BSD netcat (GNU version not supported)
  • ncat

Configuration

i3

In order to use these tools effectively, commands need to be bound to keybindings. For example, my i3 config contains the following exerts:

set $mod Mod4

set $exec_i3_groups exec --no-startup-id i3-workspace-groups

# Switch active workspace group
bindsym $mod+g exec --no-startup-id i3-switch-active-workspace-group

# Assign workspace to a group
bindsym $mod+Shift+g exec --no-startup-id i3-assign-workspace-to-group

# Select workspace to focus on
bindsym $mod+w exec --no-startup-id i3-focus-on-workspace

# Move the focused container to another workspace
bindsym $mod+Shift+w exec --no-startup-id i3-move-to-workspace

# Rename/renumber workspace. Uses Super+Alt+n
bindsym Mod1+Mod4+n exec --no-startup-id i3-rename-workspace

bindsym $mod+1 $exec_i3_groups workspace-number 1
bindsym $mod+2 $exec_i3_groups workspace-number 2
bindsym $mod+3 $exec_i3_groups workspace-number 3
bindsym $mod+4 $exec_i3_groups workspace-number 4
bindsym $mod+5 $exec_i3_groups workspace-number 5
bindsym $mod+6 $exec_i3_groups workspace-number 6
bindsym $mod+7 $exec_i3_groups workspace-number 7
bindsym $mod+8 $exec_i3_groups workspace-number 8
bindsym $mod+9 $exec_i3_groups workspace-number 9
bindsym $mod+0 $exec_i3_groups workspace-number 10

bindsym $mod+Shift+1 $exec_i3_groups move-to-number 1
bindsym $mod+Shift+2 $exec_i3_groups move-to-number 2
bindsym $mod+Shift+3 $exec_i3_groups move-to-number 3
bindsym $mod+Shift+4 $exec_i3_groups move-to-number 4
bindsym $mod+Shift+5 $exec_i3_groups move-to-number 5
bindsym $mod+Shift+6 $exec_i3_groups move-to-number 6
bindsym $mod+Shift+7 $exec_i3_groups move-to-number 7
bindsym $mod+Shift+8 $exec_i3_groups move-to-number 8
bindsym $mod+Shift+9 $exec_i3_groups move-to-number 9
bindsym $mod+Shift+0 $exec_i3_groups move-to-number 10

# Switch to previous/next workspace (in all groups).
bindsym $mod+p workspace prev
bindsym $mod+n workspace next

bar {
  strip_workspace_numbers yes
  # The rest of your bar config goes below.
  # ...
}

i3-workspace-groups

i3-workspace-groups has an optional config file located at $XDG_CONFIG_HOME/i3-workspace-groups/config.toml (defaults to ~/.config/i3-workspace-groups/config.toml). See the default config file for all the possible options to configure, their meaning, and their default values.

Usage

The main operations the CLI tool i3-workspace-groups supports are:

  • Assign the focused workspace to a group with a given name (and creating the group if it doesn't exist).
  • Switch the currently active group. Note that the active group is not necessarily the same as the focused group.
  • Navigation and movement within a group while ignoring the other groups. See examples below.

The tools provided use i3 workspace names to store and read the group for each workspace. For example, if a user assigns the workspace mail to the group work, it will be renamed to work:mail.

Example walk through

NOTE: This walk through assumes that you configured keybindings like the example i3 config.

Say we start with the following workspace names:

  1. 1 with cat videos from YouTube.
  2. 2 with a news reader.
  3. 3 with a photo editor.
  4. 4 with an email client for work.

An important thing to understand here is that every i3 workspace is always assigned to a single group. And since we haven't assigned any workspace to a group yet, all the workspaces are implicitly in the default group, which is denoted as <default>.

After a few hours of leisure time, you decide to do some work, which requires opening a few windows on a few workspaces. In order to create a new group, first you switch to the workspace 4, and then you press Super+Shift+g, which will prompt you for a group to assign to the current workspace. You type work and press enter. Since there's no group named work yet, the tool will create it and assign the focused workspace to it. You will then notice that the workspace name will change in i3bar to work:4. Then, you press Super+g in order to switch the active group. You will be shown a list of existing groups, which will now be work and <default>. You should now see your workspaces in i3bar ordered as following: work:4, 1, 2, 3. What happened here? When you switched to the work group, the first thing that the tool did was to move all the workspaces in the work group (only work:mail) to be in the beginning of the workspace list. Then, it renamed the workspaces in the default group to include the group name, so that they can be differentiated from other workspaces in the work group with the same name.

Then, you decide that you want to open a new terminal window in a new workspace. So you press Super+2, which will move you to a new workspace named work:2. Note that although there is already a workspace with the name 2 in the default group (now shown as 2 in the workspace list), using Super+2 actually takes you to a new empty workspace in the group work.

After some time working, you become lazy and you want to get back to cat videos, but you promise yourself to get back to work in a few hours, and you don't want to lose your open windows. So you press Super+g to switch the active work back to the default one. You should now see your workspaces in i3bar ordered as following: 1, 2, 3, work:4. The focus will also shift to the first workspace in the default group (1 in this case). Now that you're back in the default group, pressing Super+2 will again lead you to the workspace 2 in the default group.

Concepts

Active workspace

The active workspace is the workspace with the lowest number. Typically, this will be the workspace that appears first in the workspace list in i3bar (the leftmost one).

NOTE: In a multi-monitor setup, there is an active workspace per monitor.

NOTE: The active workspace is not necessarily the focused workspace.

Active group

The active group is the group of the active workspace. This group will normally contain workspaces related to the task you're doing at the time it's active. When you want to work on another task, you can switch the active group. Workspaces that are not in the active group can still be interacted with, but some commands provided are designed to make it easier to interact with the workspaces of the active group.

NOTE: In a multi-monitor setup, there is an active group per monitor.

Focused group

The group of the focused workspace.

Default group

The group of workspaces that were not assigned to a group by the user. This group is displayed as <default>. When you start using i3-workspace-groups, none of your current workspaces will be assigned to a group yet, so they will all be in the default group.

Limitations

  • Interaction with other i3 tools: workspace names are used for storing the group, so if another tool changes a workspace name without preserving the format that i3-workspace-groups uses, i3-workspace-groups can make a mistake about the group assignment.
  • Latency: there can be noticeable latency in some machines for the script commands. On my high performance desktop this is not noticeable, but on my laptop it is. I measured the latency of commands to be around 100-200 ms, most of it coming from importing python libraries, so it's not possible to reduce it much without running it as a daemon (which will overcomplicate things). In the long term, I plan to rewrite it in go. UPDATE: there is a new experimental client/server mode which significantly reduces latency. Documentation is still WIP (see #52).
  • Number of monitors/groups/workspaces: Supports up to 10 monitors, each containing up to 100 groups, each containing up to 100 workspaces.

Sway compatibility

This project depends on i3ipc for its interaction with i3, so should also work the same on sway. That said, I don't test it on sway and i3 is my main window manager.

Polybar

The official internal/i3 module does not support workspace groups.

In order to display workspace information in polybar, there are two steps:

  1. Add the custom i3 workspace groups module to your polybar
  2. Run a script in the background to update polybar's display whenever an i3 window event occurs

1. Add the custom i3 workspace groups module to your polybar config

Create an i3-mod module by adding the following to your polybar config:

[module/i3-mod]
type = custom/ipc
hook-0 = ${env:I3_MOD_HOOK}
initial = 1

Then, add the i3-mod module to your modules:

modules-center = i3-mod

Then, when launching polybar, do something like the following to configure the I3_MOD_HOOK:

while IFS='' read -r monitor; do
    i3_mod_hook="i3-workspace-groups polybar-hook --monitor '${monitor}'"
    I3_MOD_HOOK="${i3_mod_hook}" polybar your-bar-name &
done < <(polybar --list-monitors | cut -d':' -f1)

2. Run a background script to update polybar's on i3 events

Run the i3-groups-polybar-module-updater script. This script is responsible for calling the hook to update polybar whenever a relevant i3 window event occurs.

i3-workspace-groups's People

Contributors

b0o avatar cjbassi avatar damani42 avatar dependabot-preview[bot] avatar eivindt avatar infokiller avatar orhun avatar ps251 avatar rt-kill avatar ruborcalor avatar wheatdog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

i3-workspace-groups's Issues

Add option to customize window icons

We should provide a json file to define a mapping between window metadata (class, instance, title, or whatever) to icons so that users can customize the icons.
This file should probably reside in ${XDG_CONFIG_HOME}/i3-workspace-groups, which defaults to ~/.config/i3-workspace-groups.

multiple monitors group switching

Currently, the behaviour for multiple monitors and groups is, that when switching to another group, the inactive monitor does not switch to the new group.
This is confusing in the workflow and you always need to swap workspaces for each screen.
Is this a bug, or intented behaviour?

I think it would be better if, by switching groups, all monitors switch to the same group so you have coherent behaviour.

Multiple monitor support

It would be great if switching to a group would activate it on all monitors on which it exists.

Assigning workspace to another group with a taken number

I'm searching for a way to directly assign a workspace with the same number to another group. Currently if there is a collision nothing happens and it fails silently. It would be great if it would get the lowest free number if the number is taken.

Steps to reproduce:

  1. open a window in the default group in workspace 1
  2. open a new group named new
  3. make use you are also on workspace new:1
  4. open a terminal
  5. try to assign workspace to default group with either of these commands:
❯ i3-assign-workspace-to-group                                          
Workspace with local number "1" already exists in group: "": "100101:​​​​1"
❯ i3-workspace-groups --renumber-workspaces assign-workspace-to-group '' # I hoped renumber-workspaces would help, but it makes not difference
Workspace with local number "1" already exists in group: "": "100101:​​​​1"

Workaround:

  1. find a number that is not taken in default group
  2. assign workspace to default group

Workspaces not assigned to group; or switched to, and no icons

Output of i3 --moreversion 2>&- || i3 --version and pip show i3pci and python3.7 --version

Binary i3 version: 4.16.1-184-g00181678 (2019-07-03, branch "shape") © 2009 Michael Stapelberg and contributors Running i3 version: 4.16.1-184-g00181678 (2019-07-03, branch "shape") (pid 20125)

Name: i3ipc Version: 2.1.1

Python 3.7.3

What I tried:

To assign workspaces to groups
Switch to a workspace within a group using the bind (i.e workspace number).

(also I had to rename all bindcodes to bindsyms before they worked.)

In addition, I tried to exec the commands from the terminal:

Traceback (most recent call last):
  File "/home/user/.local/bin/i3-workspace-groups", line 198, in <module>
    main()
  File "/home/user/.local/bin/i3-workspace-groups", line 192, in main
    controller.assign_workspace_to_group(args.group)
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 604, in assign_workspace_to_group
    self.organize_workspace_groups(group_to_workspaces)
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 478, in organize_workspace_groups
    workspace.name, new_name))
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 420, in send_i3_command
    if not reply[0]['success']:
TypeError: 'CommandReply' object is not subscriptable

[user@arch bin]$ i3-workspace-groups workspace-number 2
Traceback (most recent call last):
  File "/home/user/.local/bin/i3-workspace-groups", line 198, in <module>
    main()
  File "/home/user/.local/bin/i3-workspace-groups", line 171, in main
    controller.focus_workspace_number(args.workspace_relative_number)
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 635, in focus_workspace_number
    target_local_number)
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 620, in _get_workspace_name_from_context
    self.organize_workspace_groups(group_to_workspaces)
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 478, in organize_workspace_groups
    workspace.name, new_name))
  File "/home/user/.local/lib/python3.7/site-packages/i3wsgroups/i3_workspace_groups.py", line 420, in send_i3_command
    if not reply[0]['success']:
TypeError: 'CommandReply' object is not subscriptable

What I saw:

Rofi opened, but the current workspace was not assigned to the group(?).
The workspace-number binds did not seem to show any response.

What I expected:

Current workspace to be assigned to the group specified in rofi
To switch to (/create) a new workspace within a group, as mentioned in readme: So you press Super+2, which will move you to a new workspace named "work:2"

Final notes

I am able to (i3-) switch active workspace group, and workspace_prev/next binds move me to the first group, then remains there. Lastly, When I attempted to autoname the workspaces from terminal I just saw some little boxes with numbers in bar. I expect all of this is my total misunderstanding of how your program works, or perhaps it is a version problem?

By the way, I love this concept. The idea, to use an analogy, for example that we would have one folder containing all our files is ridiculous. Clearly there needs to be sub folders (groups).

Saving workspace groups

I know it's probably very hard to implement (even with adapting https://github.com/JonnyHaystack/i3-resurrect), but it would be really cool to save project-specific workspace groups and restore some of their windows at once.

I imagine huge efficiency boost when on coming back to project after 2 months (or after laptop shuts down because I forgot to charge it), I would just restore all development environment, testing environment, terminal windows that have matching docker commands.

Workspace 1 - inconsistent behavior

Whenever I start i3, workspace number 1 is automatically shown.
However, if I use the usual $sup + 1 to switch to workspace 1, another workspace with the same number pops up, as clear from the figure.

image

Those are the relevant lines of the i3 config file.

# bindsym $sup+1 workspace 1
set $exec_i3_groups exec --no-startup-id i3-workspace-groups
bindsym $sup+1 $exec_i3_groups workspace-number 1

Any clue on what's happening?

EDIT: Of course, without i3-workspace-groups, the behaviour is consistent. Also, I know that I'm not using the library at all here. Still, I prefer to use the "normal" behaviour in most cases, while switching to the power of groups only in specific circumstances.

EDIT2: pip shows that I have version 0.4.6 (latest).

assert local_number < _MAX_WORKSPACES_PER_GROUP TypeError: '<' not supported between instances of 'NoneType' and 'int'

Hi!

I'd love to use i3-workspace-groups with Sway 1.2.

Currently, I get an error when calling i3-rename-workspace:

Traceback (most recent call last):
  File "/usr/bin/i3-workspace-groups", line 257, in <module>
    main()
  File "/usr/bin/i3-workspace-groups", line 236, in main
    controller.update_focused_workspace(metadata_updates)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 304, in update_focused_workspace
    global_name, workspace_id = self._derive_workspace(metadata)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 234, in _derive_workspace
    return (self._create_workspace_name(metadata), workspace.id)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 207, in _create_workspace_name
    monitor_index, group_index, (metadata.local_number))
  File "/usr/lib/python3.7/site-packages/i3wsgroups/workspace_names.py", line 232, in compute_global_number
    assert local_number < _MAX_WORKSPACES_PER_GROUP
TypeError: '<' not supported between instances of 'NoneType' and 'int'

There's a similar stacktrace for i3-assign-workspace-to-group:

Traceback (most recent call last):
  File "/usr/bin/i3-workspace-groups", line 257, in <module>
    main()
  File "/usr/bin/i3-workspace-groups", line 240, in main
    controller.update_focused_workspace(metadata_updates)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 304, in update_focused_workspace
    global_name, workspace_id = self._derive_workspace(metadata)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 236, in _derive_workspace
    return (self._create_workspace_name(metadata), None)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 207, in _create_workspace_name
    monitor_index, group_index, (metadata.local_number))
  File "/usr/lib/python3.7/site-packages/i3wsgroups/workspace_names.py", line 232, in compute_global_number
    assert local_number < _MAX_WORKSPACES_PER_GROUP
TypeError: '<' not supported between instances of 'NoneType' and 'int'

Am I using this wrong?

Thanks in advance!


Python 3.7.4
Arch Linux 5.3.10

Noisy warnings are written to the log

When the marks _i3_groups_current_focused or _i3_groups_last_focused are not defined, a warning is written to the log. However, this is actually benign when the script is initially launched, since these marks were not defined yet.

The simplest solution would be to reduce the log level for these logs. The downside of this is that if for some reason these marks are removed by another script, it will be harder for users to understand what happened, but I guess this is still better than polluting the logs.

Release version 1.0.0

See also #19 (comment)

Must:

  • Polybar module
    • Finish #56
    • Reach feature parity with my polybar fork, including configurability
    • Support #3
  • #52
  • #34

Maybe:

  • #28
  • #63
  • #31 if easy, probably not?
  • #50
  • Switch to pyproject.toml and use it instead of the separate config files
  • Rename scripts to bin
  • Distribute python binaries via entry points (keep scripts for non-Python)
  • Move docs to a separate file and make README lean
  • Remove .envrc
  • Move requirement files (and environment.yml?) to req folder
  • New demo gif

Assign workspaces to monitors

Hi, i3-workspace-groups is exactly what I was looking for! However the following lines in my i3 config file no longer work. If I am in workspace 1 on my left monitor and then switch to workspace 6, the new workspace will be created on the left monitor instead of the right.

# Monitors:                                                                     
set $left_mon DP-4                                                              
set $right_mon DP-2   

# Variable names of workspaces                                                      
#Left                                                                               
set $wp_1 1                                                                         
set $wp_2 2                                                                         
set $wp_3 3                                                                         
set $wp_4 4                                                                         
set $wp_5 5                                                                         
#Right                                                                              
set $wp_6 6                                                                         
set $wp_7 7                                                                         
set $wp_8 8                                                                         
set $wp_9 9                                                                         
set $wp_10 10                                                                       
                                                                                    
# Set monitor of workspaces 
workspace $wp_3 output $left_mon                                                
workspace $wp_1 output $left_mon                                                
workspace $wp_2 output $left_mon                                                
workspace $wp_4 output $left_mon                                                
workspace $wp_5 output $left_mon                                                
workspace $wp_8 output $right_mon                                               
workspace $wp_6 output $right_mon                                               
workspace $wp_7 output $right_mon                                               
workspace $wp_9 output $right_mon                                               
workspace $wp_10 output $right_mon

Workspace labels: enable sharing a workspace between groups

From issue #18:

One thing I was thinking it would be useful to do would be to have the ability to indicate that some specific workspace is "shared" across all groups..

For example, it might be nice to dedicate workspace "1" to a web browser, which is shared across all groups.. Then workspace 2-N could be used for various group-specific windows.

Is this something that might be possible with the way i3-workspace-groups is currently implemented?

Suggestion for a polybar module

Hello infokiller,
first I would like to thank you for the great tool you've made! I was looking for something like this for a long time!
The only problem is that I didn't like how the workspaces appear in polybar, so I've made a little script to get the following output:
image
The yellow numbers are on a 2nd screen. I thought that it would be nice to show a shorthand notation for the numbers if there are many consecutive.

The script is this one: https://gitlab.com/cdutsov/dotfiles/-/blob/master/polybar/i3-mod.sh
And it needs to be triggered on changes in the workspaces, so a simple python script can be used to tell that to polybar:
https://gitlab.com/cdutsov/dotfiles/-/blob/master/polybar/i3-pyton.py

And the polybar module can be set up with:

[module/i3-mod]
type = custom/ipc
hook-0 = ~/.config/polybar/i3-mod.sh
initial = 1

I've been using it for a few days and it seems to be working ok. It can be improved probably, but I thought that it would be nice to share it even like that.

Make logging more silent by default

Currently the logging outputs a bunch of info logs to stderr and syslog with no user control. It should be more silent by default and allow some customization via command line options.

No icon show

I've read this #16 (comment)

i3 version:  4.19.1 (2021-02-01) © 2009 Michael Stapelberg and contributors
	from i3-gaps
i3blocks version: 1.5
i3ipc: 2.2.1
python 3.9.4

I've set the icons section enabled, but there is no icon showing in status bar. I wonder if it's because the version of i3ipc is too high? If so, would you mind setting the version limit in environment.yml? If not could you help me to solve the problem? Thanks a lot!

Hide workspaces in inactive group

I can think of two possible ways that this can be done:

  • Sending containers to the scratchpad and later retrieving them
  • Configure the bar

Odd workspace naming

Hi,

Mi workspace names are 1:1 or 2:2 when I assign a name then they are for example 101:work:1 after messing around with names and groups the workspace names never return to 1:1 or something like that. I commented the name set for workspaces on mi i3 config.

Besides on screenshot you can see there is a utf-8 code on default group name.
Screenshot from 2020-07-06 19-11-11

The n:n nomenclature is normal? Thanks in advance

KeyError: 'enable' after i3-switch-active-workspace-group

Hi!

Calling i3-switch-active-workspace-group produces a stacktrace:

Traceback (most recent call last):
  File "/usr/bin/i3-workspace-groups", line 253, in <module>
    main()
  File "/usr/bin/i3-workspace-groups", line 226, in main
    args.focused_monitor_only)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 168, in switch_active_group
    self.switch_monitor_active_group(monitor, target_group)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 150, in switch_monitor_active_group
    monitor_name)
  File "/usr/lib/python3.7/site-packages/i3wsgroups/controller.py", line 81, in organize_workspace_groups
    if self.config['icons']['enable'] and (
KeyError: 'enable'

Running i3-workspace-groups --log-level debug list-workspaces gives

2019-11-13 19:56:46,461 DEBUG [i3-workspace-groups:201] Using merged config:
{'icons': {'default_icon': '',
          'delimiter': '',
          'min_duplicates_count': 3,
          'rules': [{'icon': '\ue795',
                      'match': 'kitty|Termite|URxvtc?',
                      'property': 'class'},
                    {'icon': '\ue743',
                      'match': 'Chromium|Chrome',
                      'property': 'class'},
                    {'icon': '\ue745',
                      'match': 'Firefox',
                      'property': 'class'},
                    {'icon': '\uf0ea', 'match': 'copyq', 'property': 'class'},
                    {'icon': '\ue5fe', 'match': 'Ranger', 'property': 'class'},
                    {'icon': '\uf120', 'match': 'Rofi', 'property': 'class'},
                    {'icon': '\ue244', 'match': 'Pqiv', 'property': 'class'},
                    {'icon': '\ue22b', 'match': 'Pinta', 'property': 'class'},
                    {'icon': '\uf008', 'match': '[Mm]pv', 'property': 'class'},
                    {'icon': '嗢', 'match': '[Vv]lc', 'property': 'class'},
                    {'icon': '\uf1c2',
                      'match': '[Ll]ibreoffice-writer',
                      'property': 'class'},
                    {'icon': '\uf1c3',
                      'match': '[Ll]ibreoffice-calc',
                      'property': 'class'},
                    {'icon': '\uf03d', 'match': 'Peek', 'property': 'class'},
                    {'icon': '\ue235',
                      'match': 'ipython',
                      'property': 'class'},
                    {'icon': '\ue235', 'match': 'python', 'property': 'class'},
                    {'icon': '\ue235',
                      'match': 'jupyter-qtconsole',
                      'property': 'class'},
                    {'icon': '\ue7c5', 'match': 'Gvim', 'property': 'class'},
                    {'icon': '\uf013',
                      'match': 'settings',
                      'property': 'class'},
                    {'icon': '聆', 'match': 'slack', 'property': 'class'},
                    {'icon': '\uf725',
                      'match': 'Zathura',
                      'property': 'class'},
                    {'icon': '\ue215',
                      'match': 'Telegram',
                      'property': 'class'},
                    {'icon': '墳',
                      'match': 'Pavucontrol',
                      'property': 'class'}],
          'try_fallback_rules': True},
'renumber_workspaces': False}
2019-11-13 19:56:46,465 DEBUG [workspace_names.py:251] Workspace 201:​Work​:1​​ parsed as: {'global_number': 201, 'group': 'Work', 'static_name': '1', 'dynamic_name': '', 'local_number': None}
2019-11-13 19:56:46,465 DEBUG [workspace_names.py:251] Workspace 201:​Work​:2​​ parsed as: {'global_number': 201, 'group': 'Work', 'static_name': '2', 'dynamic_name': '', 'local_number': None}
2019-11-13 19:56:46,465 DEBUG [workspace_names.py:251] Workspace 201:​Work​:3​​ parsed as: {'global_number': 201, 'group': 'Work', 'static_name': '3', 'dynamic_name': '', 'local_number': None}
2019-11-13 19:56:46,466 DEBUG [workspace_names.py:251] Workspace 201:​Work​:4​​ parsed as: {'global_number': 201, 'group': 'Work', 'static_name': '4', 'dynamic_name': '', 'local_number': None}
2019-11-13 19:56:46,466 DEBUG [workspace_names.py:251] Workspace 301:​Rieju​:5​​ parsed as: {'global_number': 301, 'group': 'Rieju', 'static_name': '5', 'dynamic_name': '', 'local_number': None}
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "journal_2019.md"
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "/home/mb "
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "/home/mb/config/vim_conf/.vim "
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "Mutt with 1312 messages for Bull Bytes"
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "assert local_number < _MAX_WORKSPACES_PER_GROUP TypeError: '<' not supported between instances of 'NoneType' and 'int' · Issue #25 · infokiller/i3-workspace-groups - Mozilla Firefox"
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "slides_unit_06.tex"
2019-11-13 19:56:46,466 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "slides_unit_06.pdf"
2019-11-13 19:56:46,467 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "Patrick_Blackburn,_Johan_Bos,_Kristina_Striegnitz_Learn_Prolog_Now.pdf"
2019-11-13 19:56:46,467 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "descendants.pl"
2019-11-13 19:56:46,467 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "/home/mb/dev/prolog/hello_prolog "
2019-11-13 19:56:46,467 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "config"
2019-11-13 19:56:46,467 INFO [icons.py:50] No icon specified for window with class: "None", instance: "None", title: "None", name: "/home/mb "
201	Work	1			3x	201:​Work​:1​​	LVDS-1
201	Work	2				201:​Work​:2​​	LVDS-1
201	Work	3				201:​Work​:3​​	LVDS-1
201	Work	4			3x	201:​Work​:4​​	LVDS-1
301	Rieju	5				301:​Rieju​:5​​	LVDS-1
~$ 

Let me know if I can provide anything else.

i3-autoname-workspaces: workspace names get reset upon moving to workspace

Workspaces get renamed to <group>:<workspace_number> every time I change workspaces.

I'm using i3-autoname-workspaces --window-icons-all-groups, and I'm switching between workspaces using i3-workspace-groups workspace-number x. This problem does not occur when I switch using i3's default workspace number x.

Switching workspaces behaves weirdly on Sway

Hi!

When switching to workspace using

bindsym $mod+1 $exec_i3_groups workspace-number 1

I'm taken to a workspace named 1:1.

Similarly, when doing $mod+2 I end up at 2:2.

Is this intentional?

After assigning a workspace to a group using

bindsym $mod+Shift+g exec --no-startup-id i3-assign-workspace-to-group

I'm pretty sure there's a bug since when I try to switch to workspace 1, I get a workspace 101:1.

Switching to 2 produces workspace 102:2.

Thanks for taking the time to deal with this!


I use the configuration from the README, slightly adapted:

# Workspaces

# From https://github.com/infokiller/i3-workspace-groups
set $exec_i3_groups exec --no-startup-id i3-workspace-groups

# Switch active workspace group
bindsym $mod+g exec --no-startup-id i3-switch-active-workspace-group

# Assign workspace to a group
bindsym $mod+Shift+g exec --no-startup-id i3-assign-workspace-to-group

# Select workspace to focus on
bindsym $mod+m exec --no-startup-id i3-focus-on-workspace

# Move the focused container to another workspace
bindsym $mod+Shift+m exec --no-startup-id i3-move-to-workspace

# Rename/renumber workspace. Uses Super+Alt+n
bindsym Mod1+Mod4+n exec --no-startup-id i3-rename-workspace

bindsym $mod+1 $exec_i3_groups workspace-number 1
bindsym $mod+2 $exec_i3_groups workspace-number 2
bindsym $mod+3 $exec_i3_groups workspace-number 3
bindsym $mod+4 $exec_i3_groups workspace-number 4
bindsym $mod+5 $exec_i3_groups workspace-number 5
bindsym $mod+6 $exec_i3_groups workspace-number 6
bindsym $mod+7 $exec_i3_groups workspace-number 7
bindsym $mod+8 $exec_i3_groups workspace-number 8
bindsym $mod+9 $exec_i3_groups workspace-number 9
bindsym $mod+0 $exec_i3_groups workspace-number 10

I'm still on Sway version 1.2.


For reproducing this while being on i3, I'd start a new virtual terminal (Ctrl-Alt-F2), install sway and xwayland (for rofi) using sudo pacman -Sy sway xorg-server-xwayland. Then, after editing Sway's config file at ~/.config/sway/config I'd start it with sway.

Latest git head: moving a container fails

Simple repro:

$  i3-workspace-groups move-to-number 2
Traceback (most recent call last):
  File "/usr/bin/i3-workspace-groups", line 263, in <module>
    main()
  File "/usr/bin/i3-workspace-groups", line 227, in main
    controller.move_to_workspace_number(_create_group_context(args),
TypeError: move_to_workspace_number() takes 3 positional arguments but 4 were given

The rename feature doesn't seems works.

I use fedora 30 and i3-workspace-groups 0.3.4 version. The behavior of the rename is strange. When I try to rename a workspace in the status bar I have still the old name and the new name. When I want change the workspace with Shift+g I have still the old name.

Strange behavior with multiple monitors?

Greetings!

I am trying out i3-workspace-groups for the first time on a dual monitor setup, and noticed some strange behavior when switching between workspaces located on different monitors.

I currently have i3 setup to show workspaces 1-3 on one of the monitors by default, and workspaces 4-6 on the other one:

workspace "1" output HDMI-0
workspace "2" output HDMI-0
workspace "3" output HDMI-0
workspace "4" output DP-1
workspace "5" output DP-1
workspace "6" output DP-1

Aside from that, I am using pretty much all of the suggested default configuration options from the i3-workspaces-groups README.

i3 config: link

Issue

  1. The first thing I notice, is that at first, workspace 1 in the default group is listed as "1", however, as soon as I switch to another workspace in the same group, it gets renamed as "1:1'.

  2. The bigger issue, however, is that after switching to a workspace on a different monitor, when I attempt to switch back to workspace 1 on the first monitor, a second "1" is added at first. Pressing "mod + 1" twice more eventually fixes the issue (see steps & outcomes described below..)

The sequence of steps taken to reproduce the issue are listed below.

Key:

  • "L" = "left monitor"
  • "R" = right monitor.
  • "[n]" = focused workspace

The workspaces listed in i3bar for each monitor are shown after the "L" and "R".

Steps:

L 4
R [1]
<open term>

<mod + 2>

L 4
R 1:1 [2]

<open term>
<mod + 3>

L 4
R 1:1 2 3

<open term>
<mod + 4>

L [4]
R 1:1 2 3

<mod + 1>
L 4
R [1] 1:1 2
 // original terminal opened in "1" not displayed...

<mod + 1>
L 4
R 1:1 [1] 2
 // workspace "1" moves to right of "1:1" in i3bar, but nothing else changes
 // original terminal opened in "1" not displayed...

<mod + 1>
L 4
R [1:1] 2 3

 // after third "mod + 1" press, workspace "1" goes away, "1:1" is selected, and
 // original term appears again..

Unrelated

This is not related to the above, but I thought I would ask briefly here and file a separate issue if you think it is possible / worthwhile implementing.

One thing I was thinking it would be useful to do would be to have the ability to indicate that some specific workspace is "shared" across all groups..

For example, it might be nice to dedicate workspace "1" to a web browser, which is shared across all groups.. Then workspace 2-N could be used for various group-specific windows.

Is this something that might be possible with the way i3-workspace-groups is currently implemented?

Regardless, I appreciate you taking the time to put this tool together and making it available to the public! It's a really nice contribution. 👍

System info

  • i3 version 4.17.1 (2019-08-30)
  • i3-workspace-groups #66a71c7

Assing programs to workspaces + create Groups at startup

Hi
Nice tool this is!
I have 3 questions:

  1. can i create workspaces at startup?
    I would like to have some groups created like WORK, HOME, CHAT, WEB etc.
    No i create them on the fly which is nice but i have to do that every time
    Can i predefine them in my config?

  2. Can is assign programs to workspaces when they are started?
    Like i would like to assign Chromium to Workspace 1 in Group Web when i start it.
    And Spotify to Workspace 3 in group Music.

  3. maybe part of 2) : now when i have 3 workspaces in CHAT they are called Chat:1 Chat:2 and Chat:3, i would name them Chat:1 IRC, Chat 2: WHATSAPP for instance.
    Is that possible too?

Thanks for your time..

Ray

Move a group to another monitor

I switch monitors frequently when I move my laptop between places. Is there a command or script that can move an entire group (all of it's workspaces) from one monitor to another?

I'd be happy to try to code it and submit a PR, but I'd like to make sure I'm not missing something and this already exists.

switch-active-group doesn't behave as expected with multiple monitors

switch-active-group, and by extension i3-switch-active-workspace-group, change the focused and active workspace of only the current monitor while only changing the active workspace of other monitors. The group is switched properly but the other windows aren't re-focused. This is of course a non-issue on a single monitor, but with multiple monitors the behavior is very strange and unintuitive. The current workspace switches, but the others stay focused on their old group/workspace which seems like it almost defeats the entire purpose of using the groups system. I feel a much better default behavior would be for all monitors to automatically focus on their new active group and have an optional flag to enable the current behavior.

Performance Issue

I was using i3-workspace-groups (thanks to this performance booster tool) with Polybar for day-by-day work and experienced a delay on the Polybar updater script. For example, when I have many groups and workspaces there is a delay in showing active ws on the bar.
As you mentioned here:

Don't use Python for tools that should launch fast (less than 100ms). Prefer Go in this case. For example, i3-workspace-groups was written in Python, which causes some operations to have noticeable latency.

Do you detect any bottleneck in the i3-workspace-groups process? Is there any effort to rewrite it with Go?
I am eager to contribute.

Strip workspace numbers in polybar

Is it possible to strip the implementation detail numbers in polybar? I've looked through all the relevant issues and they seem to all refer to i3bar.

Thanks for your work!

New release?

I'm packaging this project for the FreeBSD OS.
As the last release is quiet old and some new changes came into the project.
Maybe it is time for a new release?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.