Exposè for i3 WM. Fork of https://gitlab.com/d.reis/i3expo to fix crashes and improve features/usability

Overview

Overwiew

Expo is an simple and straightforward way to get a visual impression of all your current virtual desktops that many compositing window managers use. It's not a very powerful approach, but a very intuitive one and especially fits workflows that use lots of temporary windows or those in which the workspaces are mentally arranged in a grid.

i3expo emulates that function within the limitations of a non-compositing window manager. By listening to the IPC, it takes a screenshot whenever a window event occurrs. Thanks to an extremely fast C library, this produces negligible overhead in normal operation and allows the script to remember what state you left a workspace in.

The script is run as a background process and reacts to signals in order to open its UI in which you get an overview of the known state of your workspaces and can select another with the mouse or keyboard.

This fork

This fork adds:

  • Dynamic workspace grid (changes size depending on how many workspaces you have)
  • Multi-monitor support
  • Vertical monitor support
  • Compact view for better use of screen real estate
  • Drag focused window to a new or different workspace
  • Create a new workspace on any monitor with one click
  • Bugfixes and performance improvements (via cache)
  • Visual/Aesthetic perks
  • Zero configuration service with reasonable default settings

Example output:

Sample

Dependencies

  • Python 3
  • PyGame
  • i3ipc

Usage

Compile the prtscn.c as follows:

gcc -shared -O3 -Wall -fPIC -Wl,-soname,prtscn -o prtscn.so prtscn.c -lX11

Put the prtscn.so in the same directory as the Python script (or adjust the location in the code).

Copy the default config to your .config folder like so:

mkdir -p ~/.config/i3expo
cp defaultconfig ~/.config/i3expo/config

Colors can be specified by using their PyGame names or in #fff or #ffffff hex.

Display output names can be unpleasant to read but you can alias them in hte config file if you wish. Here's an example:

[OUTPUT_ALIASES]

DVI-D-0 = Center
HDMI-A-0 = Right
DisplayPort-0 = Left

Add this to your i3 config exec_always "~/i3expo-ng/i3expod.py -f -w /home/user/Images/wallpapers/14.jpg"

-f is for fullscreen (causes pygame to crash on a black screen on some distros)

-w is for wallpaper. Should match your i3 wallpaper

All parameters are optional.

Send SIGUSR1 to i3expod.py to show the Expo UI, for example by adding bindsym $mod+Tab exec --no-startup-id "killall -s SIGUSR1 i3expod.py" to your i3 config. Send SIGHUP to have the application reload its configuration.

Navigate the UI with the mouse or with they keyboard using hjkl, the arrow keys, Return and Escape.

Known issues

On some distros (or hardware? has to be investigated more) fullscreen mode will crash pygame on a black screen. Simple workaround is to remove -f flag and use the program windowed

Limitations

Since it works by taking screenshots, the application cannot know workspaces it hasn't seen yet. Furthermore, the updates are less continuous than you might be used to if you're coming from a compositing WM where they can happen live and in the background.

When you drag the active window to a new or another workspace, the screenshot of the current workspace won't be updated until the workspace isn't visited back again, and will continue to show the window you moved. There's no clean way to handle this as it would require taking a screenshot of the workspace after you changed it and before jumping to the new/other workspace you dragged your window to.

Empty workspaces don't technically exist to i3 and are thus inaccessible in the default config because it's not possible to handle named inexistant workspaces. If you still want to access them, you will have to set switch_to_empty_workspaces to True and define your names under Workspaces like e. g. workspace_1 = 1:Firefox.

Bugs

Stalled windows whose content i3 doesn't know cause interface bugs and could probably be handled better, but this needs more testing.

Todo

It's theoretically feasible to take the window information from i3's tree and allow for dragging of windows from one workspace to another or even from container to container. However, this would be massively complex (especially on the UI side) and it's not clear if it would be worth the effort. <-- Kind of did it. It was worth it :)

And getting it into a publishable state, obviously.

Credit

Stackoverflow user JHolta for the screenshot library to be found in this thread: https://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux

GitLab/Reddit user d.reis for the idea and initial implementation which got me started :) https://www.reddit.com/r/i3wm/comments/8at5dv/i_wrote_an_expolike_script_for_i3/

https://gitlab.com/d.reis/i3expo

Comments
  • i3expo non funziona

    i3expo non funziona

    Ciao morro, seguo con molto interesse il tuo canale e ho provato a installare i3expo sulla mia manjaro con i3wm. Ho seguito passo passo la tua guida, ma i3expo non va; se provo ad avviarlo da shell ottengo:

    Traceback (most recent call last): File "/home/mario/i3expo-ng/./i3expod.py", line 790, in read_config() File "/home/mario/i3expo-ng/./i3expod.py", line 166, in read_config for key in config['OUTPUT_ALIASES']: File "/usr/lib/python3.9/configparser.py", line 960, in getitem raise KeyError(key) KeyError: 'OUTPUT_ALIASES'

    Scusa l'ignoranza ma non so davvero che pesci prendere! Puoi aiutarmi? Grazie in anticipo per l'attenzione...

    opened by marmod75 18
  • Problems in EndeavourOS

    Problems in EndeavourOS

    Actually i'm using EndeavourOS with kde+i3. As soon as i launch i3expod, it gives a black screen for about 5 seconds after creating the temporary workspace. But then it doesn't show anything, it seems that it only creates the workspace.(I don't have named workspaces.)

    opened by Andre0-0 4
  • Doesn't seem to work with named workspaces?

    Doesn't seem to work with named workspaces?

    I have workspaces with names like "1: main", "2: video", etc. The i3expo window displays them fine, but when I select the first workspace (for example) it creates a new empty workspace called "1" instead of going to "1: main".

    opened by eater 4
  •  i3expo-ng doing nothing

    i3expo-ng doing nothing

    Ciao Morro, grande idea quel che ci voleva per i3! Passo all'inglese per rendere questa issue utile per altri utenti della grande rete.


    [Steps]

    • I installed the requirements in a conda enviroment (sort of virtualens).
    • All the required packages are importable in python.
    • Compiled prtscn.c without problems.
    • Configuration is in the right place, and I adapted it to my monitors. Simply, when I run i3expod.py nothing happens.

    [Info]

    I'm on Arch using pure i3wm, now DE.

    [Question]

    Any idea? Maybe pygame is the culprit?

    opened by kidpixo 3
  • On multi-monitor only get the primary monitor size

    On multi-monitor only get the primary monitor size

    Currently, when we run i3expo on a multi-monitor setup, the layout gets picked up by pygame as only one large screen and so it shows the UI over multiple screens, breaking the flow of the UI. To address this, we now use xrandr and awk to get the primary display's resolution.

    Current state

    Without fullscreen

    Left: The multi-monitor layout. Right: When running i3expo without fullscreen, the UI is too large. three_screens_no_fullscreen

    With fullscreen

    Left: The multi-monitor layout. Right: When running i3expo in fullscreen, the UI is shown over the three screens and breaks the flow of the UI. three_screens_fullscreen

    With this commit

    Without fullscreen

    Left: The multi-monitor layout. Right: When running i3expo without fullscreen, UI is the correct proportion to the primary. monitor. three_screens_no_fullscreen_fix

    However, note that the window is still a bit bigger but using i3's fullscreen fixes this: three_screens_no_fullscreen2_fix

    With fullscreen

    Left: The multi-monitor layout. Right: When running i3expo in fullscreen, UI is still shown over the three screens but the UI is the correct proportion to the primary display. Future work. three_screens_fullscreen_fix

    I tested it using a single monitor and it works as expected. Looking forward to your comments!

    opened by emjames 3
  • Fix xdg import and config file path

    Fix xdg import and config file path

    First of all, thank you for the great work! I've been looking for something like this for a while.

    I ran into a couple of small issues when I installed it on:

    Fedora 33
    Python 3.9.5
    pip3 20.2.2
    
    1. ModuleNotFoundError: No module named 'xdg.BaseDirectory'

    I solved it by replacing the import with:

    from xdg import xdg_config_home
    

    But is this just my case? I checked the docs on xdg and it reflects the same method as my system however it works on your system. Comments on this?

    1. 'KeyError': 'OUTPUT_ALIASES'

    After running make install, the default configuration did not get copied into XDG_CONFIG_HOME/i3expo (i.e. ~/.config/i3expo). It looks like it gets copied to XDG_CONFIG_HOME/.config/i3expo (i.e. .config/.config/i3expo). I addressed this by modifying the path in the Makefile.

    Looking forward to your suggestions and comments!

    opened by emjames 3
  • Required python moduled and redundant import

    Required python moduled and redundant import

    Some Python modules (Pillow [formerly PIL] and xdg) require manual installation from PIP, you should include those into README.md

    Some imports are redundant:

    22 from PIL import Image, ImageDraw 23 from xdg.BaseDirectory import xdg_config_home 24 from contextlib import suppress 25 from PIL import Image, ImageFilter, ImageEnhance

    Can be simplified with:

    22 from xdg.BaseDirectory import xdg_config_home 23 from contextlib import suppress 24 from PIL import Image, ImageFilter, ImageEnhance, ImageDraw

    Seems to work nicely. Great job.

    opened by aleemont 3
  • Improve display handling and Makefile

    Improve display handling and Makefile

    Hey Ciao!

    Some patches to improve the usability:

    • X11 display handling The primary display can be disconnected (counter-intuitive but it can happen). With the previous solution, if the display was not connected, the program crashed. This patch improve display handling by searching the primary one. If not found as connected, select the first display in the list.
    • Makefile Automatically compile and install the software with make install. Install the requirements too.
    • .gitignore and prtscn.so file Adding a compiled library is generally useless since it would need to be recompiled for each machine. Remove it from the tree and avoid to add it again with .gitignore.
    opened by MassimoGirondi 3
  • Black screen dopo aver mandato il segnale -SIGUSR1

    Black screen dopo aver mandato il segnale -SIGUSR1

    Buonasera, dopo aver installato tutte le dipendenze di python ecc.. mettendo le scorciatoie di avvio nel config di i3 dando il segnale sigusr1 si avvia ma lo schermo rimane nero e dopo 4 secondi sparisce.

    File conf di i3: exec_always --no-startup-id "~/git/i3expo-ng/i3expod.py -f -w /home/jac/.wallpaper/dark-archlinux2.png" bindsym Mod1+Tab exec --no-startup-id "killall -s SIGUSR1 i3expod.py"

    PS Come si poteva notare dalla conf di i3 ho clonato i3expo in /home/git e non in /home, non credo sia un problema questo..

    Buona serata!

    opened by Jei-sKappa 2
  • Workspace Transition Animations

    Workspace Transition Animations

    This is probably well outside the scope of this project, but in reading how this project works, I'm curious whether or not the same method could be employed in order to animation workspace transitions?

    For instance, sliding to the left or right to the next workspace.

    opened by Swivelgames 1
  • Add pyxdg ad requred dependencie

    Add pyxdg ad requred dependencie

    Issue

    After installing i3expo-ng and and launching the program with: ~/.local/bin/i3expod.py, i noticed a dependency error with this output

    File "/home/alfonso/.local/bin/i3expod.py", line 22, in <module> from xdg.BaseDirectory import xdg_config_home ModuleNotFoundError: No module named 'xdg.BaseDirectory'

    So i solved it by downloading pyxdg from pip with: pip install pyxdg

    And now i can launch the program.

    I believe that it needs to be added as a required dependency

    opened by BigNocciolino 1
  • Using shift+hjkl with i3expo open causes it to stop responding

    Using shift+hjkl with i3expo open causes it to stop responding

    Exception in thread Thread-3 (show_ui):
    Traceback (most recent call last):
      File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
        self.run()
      File "/usr/lib/python3.10/threading.py", line 946, in run
        self._target(*self._args, **self._kwargs)
      File "/.../i3expo-ng/./i3expod.py", line 757, in show_ui
        cmd += 'move workspace to output ' + new_wss_output[active_frame].name + ';'
    KeyError: None
    
    opened by matejdro 0
  • Quattro problemi

    Quattro problemi

    1. Quando premo la combinazione in uno schermo diverso dal principale, si apre lo stesso su quello principale. Come mai? Come posso sistemare?
    2. Al primo avvio, viene mostrato solo lo schermo iniziale nella schermata di i3expo, e gli altri schermi hanno dei punti di domanda.
    3. Gli schermi non hanno impostate le loro dimensioni, vengono tutti mostrati come 1920x1080, nonostante solo uno lo sia.
    4. Come si può modificare l'ordine in cui vengono mostrati gli schermi? Viene sempre mostrato per primo lo schermo terziario, come mai? C'è un ordine?

    Grazie P.S. Se è utile scriverlo in inglese, lo faccio subito, ed inoltre scusa per l'issue inizialmente vuoto, ho premuto invio per sbaglio

    opened by techkek 0
  • Sending two SIGUSR1s in quick succession causes focus to shift to workspace -1 (?) and stop responding

    Sending two SIGUSR1s in quick succession causes focus to shift to workspace -1 (?) and stop responding

    If two or more SIGUSR1s are sent quickly one after the other, focus selects to workspace -1 and displays a loading cursor icon until workspace is manually switched back to workspaces 1..10 and - i3expod.py quits with either KeyError: -1 in File "/home/zaraksh/.local/bin/i3expod.py", line 110, in signal_show i3.command('workspace ' + global_knowledge["wss"][visible_ws_primary]['name'] +

    or,

    UnboundLocalError: local variable 'jump' referenced before assignment File "/home/zaraksh/.local/bin/i3expod.py", line 793, in show_ui if not jump:

    To recreate - (About ~60% chance) killall -s SIGUSR1 i3expod.py && killall -s SIGUSR1 i3expod.py

    killall -s SIGUSR1 i3expod.py && sleep 1 && killall -s SIGUSR1 i3expod.py killall -s SIGUSR1 i3expod.py && sleep 2 && killall -s SIGUSR1 i3expod.py do not recreate the issue

    killall -s SIGUSR1 i3expod.py && sleep 0.5 && killall -s SIGUSR1 i3expod.py does, however

    opened by zarakshR 0
  • Workspaces are sorted in alphabetical order

    Workspaces are sorted in alphabetical order

    [10th...19th] workspaces are placed after 1st and before 2nd, [20th...29th] between 2nd and 3rd and so on. This is not a big problem, but may be confusing with massive usage of workspaces. Any clue about how to fix it?

    opened by aleemont 1
A Cataclysm: Dark Days Ahead launcher with additional features

CDDA Game Launcher A Cataclysm: Dark Days Ahead launcher with additional features. Download here. Implemented features Launching the game Detecting th

Rémy Roy 402 Jan 2, 2023
Recreation of HexGame in Pygame. More features will come soon !

Hex with Pygame Historical point of view What Are the rules of this game ? Some Strategies and tips The algorithm for the Win Other fonctionnalities W

null 4 Mar 26, 2022
A rhythm-based game that automatically generates obstacles based on a song's features.

DISCLAIMER: This is my first coding project, created in December 2019. The game may not be optimized, and looking back on it, there are a lot of chang

Kenneth Huang 1 Dec 27, 2021
This is Minesweeper coded in Python. It has almost all features from the main game

Minesweeper This is Minesweeper coded in Python. It has almost all features from the main game Use right click to open tile, right click on an open ti

null 3 Jul 12, 2022
Allows you to email people wordle spoilers. Very beta, not as many features

wordlespoiler Allows you to email people wordle spoilers. Very beta, not as many features How to Use 1.) Make a new gmail account. Go to settings (Man

null 0 Jan 4, 2023
null 3 Oct 22, 2021
The Original Snake Game. Maneuver a snake in its burrow and earn points while avoiding the snake itself and the walls of the snake burrow.

Maneuver a snake in its burrow and earn points while avoiding the snake itself and the walls of the snake burrow. The snake grows when it eats an apple by default which can be disabled in the settings tab where you can also find all the other customization options.

null 17 Nov 12, 2022
Python Knots and Crosses game, with customizable markers and more!

Knot-and-Crosses Python Knots and Crosses game, with customizable markers and more! Features: Ability to change your marker Ability to change how many

null 4 Nov 7, 2021
Lutris helps you install and play video games from all eras and from most gaming systems.

Lutris Lutris helps you install and play video games from all eras and from most gaming systems. By leveraging and combining existing emulators, engin

Pop!_OS 2 Nov 15, 2021
Useful guides, tutorials, and FAQs related to LEGO Universe and Darkflame Universe.

Awesome Lego Universe A curated list of awesome things related to LEGO Universe. LEGO Universe was a kid-friendly massively-multiplayer online role pl

Eric Myllyoja 33 Dec 12, 2022
A module for use with Pygame. Includes fully customisable buttons, textboxes, sliders and many more, as well as the ability to create and run animations on these widgets.

Pygame Widgets A helper module for common widgets that may be required in developing applications with Pygame. It supports fully customisable buttons,

null 37 Jan 2, 2023
learn and have fun developing 2D retro games using python and pygame

Retro 2D Game Development Using Python + PyGame Skill up your programming skills with a walk down the memory lane. Learn how to create a retro 2D game

Marvin Trilles 1 Feb 23, 2022
A Neural Network based chess engine and GUI made with Python and Tensorflow/Keras.

Haxaw-Chess Haxaw: Haxaw is the Neural Network based chess engine made with Python and Tensorflow/Keras. Also uses the python-chess library. (WIP: Imp

Sarthak Bharadwaj 8 Dec 10, 2022
A comprehensive, feature-rich, open source, and portable, collection of Solitaire games.

PySol Fan Club edition This is an open source and portable (Windows, Linux and Mac OS X) collection of Card Solitaire/Patience games written in Python

Shlomi Fish 368 Dec 28, 2022
Mandaw 2 Mar 1, 2022
Quiz game made entirely with python and pygame for school work

Tabela de conteúdo Descrição Como instalar Linguagens usadas Contribuidores Créditos Problemas com o jogo? Contate-nos Descrição Quiz feito inteiramen

null 3 Apr 12, 2022
Brax is a differentiable physics engine that simulates environments made up of rigid bodies, joints, and actuators

Brax is a differentiable physics engine that simulates environments made up of rigid bodies, joints, and actuators. It's also a suite of learning algorithms to train agents to operate in these environments (PPO, SAC, evolutionary strategy, and direct trajectory optimization are implemented).

Google 1.5k Dec 31, 2022
An all-inclusive Python framework for the Riot Games League of Legends API. We focus on making the data easy and fun to work with, while providing all the tools necessary to create a website or do data analysis.

Cassiopeia A Python adaptation of the Riot Games League of Legends API (https://developer.riotgames.com/). Cassiopeia is the sister library to Orianna

Meraki Analytics 473 Jan 7, 2023
Python desktop application to create, distribute, discover, and run codegames

Python desktop application to create, distribute, discover, and run codegames

null 2 Nov 16, 2021