Code Monkey home page Code Monkey logo

i3expo-ng's Introduction

Overview

Expo is a 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 occurs. 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
  • pillow
  • xdg
  • pyxdg

Usage

Compile and install

Compile with make and install with make install.

Manual compilation

Compile the package with make or manually as follows:

python3 setup.py sdist

Install with:

pip install .

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

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

Install in Ubuntu

apt-get install python3-pip python-setuptools libx11-dev make gcc x11-xserver-utils
make install

Install in Arch Linux

pacman -S libx11 python-pip make gcc xorg-xrandr
make install

Install in Slackware Linux with sbopkg

sqg -p i3expo-ng
sbopkg -i i3expo-ng

Manual compile python extension

You can compile the prtscn.c manually with:

gcc -shared -O3 -Wall -fPIC -Wl,-soname,prtscn `pkg-config --cflags --libs python3` -o prtscn.so prtscn.c -lX11

( not needed if you use python setup.py or make )

Configuration

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 the config file if you wish. Here's an example:

[OUTPUT_ALIASES]

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

Update the configuration

When installing with make install, an existing configuration file would be maintained.

If the program crashes due to missing fields in the config file (e.g. after an update), you can force the copy of the default config with make install FORCE=1. The old one will be maintained as config.old.

Startup

Add this to your i3 config: exec_always --no-startup-id ~/.local/bin/i3expod -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" 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

i3expo-ng's People

Contributors

aleemont avatar ariabr avatar bignocciolino avatar emjames avatar il-katta avatar jason-curtis avatar massimogirondi avatar morrolinux avatar tonus1 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  avatar

i3expo-ng's Issues

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

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

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.

Config values and font

Hi
I have a problem rendering names of workspaces. It might be a font problem, icons being rendered with awesome font.
Perhaps a pointer where to place a substitution script might be great.
2023-01-14_145547_screenshot
2023-01-14_230824_screenshot

Anyway, a short documentation could be great for the config file (wether the alternative to None has to be quoted, what value is expected for name_*).

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

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...

Trying to package

Hi
I'm trying to make a buildscript (SlackBuilds for Slackware-15.0) for i3expo-ng and all it dependencies.
Everything builds fine but pytest-asyncio for now.

The program generates the temporary workspace but with no screenshots and this error

Traceback (most recent call last):
  File "/usr/lib64/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/bin/i3expod.py", line 396, in show_ui
    qm = pygame.font.SysFont('sans-serif', 550).render('?', True, (150, 150, 150))
  File "/usr/lib64/python3.9/site-packages/pygame/sysfont.py", line 436, in SysFont
    return constructor(fontname, size, set_bold, set_italic)
  File "/usr/lib64/python3.9/site-packages/pygame/sysfont.py", line 354, in font_constructor
    font = Font(fontpath, size)
  File "/usr/lib64/python3.9/site-packages/pygame/pkgdata.py", line 27, in <module>
    from pkg_resources import resource_stream, resource_exists
  File "/usr/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module>
    def _initialize_master_working_set():
  File "/usr/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 568, in _build_master
    ws.require(__requires__)
  File "/usr/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib64/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'xdg' distribution was not found and is required by i3expod

Is it related to the missing pytest-asyncio dependency ?

Or a missing one ?

I have

pyxdg-0.27-x86_64-6
xdg-dbus-proxy-0.1.2-x86_64-1_SBo
xdg-desktop-portal-1.12.1-x86_64-1
xdg-desktop-portal-kde-5.23.5-x86_64-1
xdg-user-dirs-0.17-x86_64-3
xdg-utils-1.1.3-noarch-4

Are already avaible if needed

NAME                                         VERSION
desktop/libqtxdg                          3.10.0
desktop/slackware-xdg-menu      0.7.6.2
desktop/xdg-desktop-portal-gtk   1.4.0
desktop/xdgmenumaker              2.0
libraries/libxdg-basedir                1.2.3
system/qtxdg-tools                      3.10.0
system/xdg-dbus-proxy               0.1.2
system/xdg-utils-cxx                    1.0.1

I could bet for xdg-basedir...

Any clue appreciate.

Regards

i3expod shows only current desktop

Hello everyone,
as the title states, i3expod shows only the current desktop, and I can't seem to make it display all other desktops which have windows in it.

I'm on slackware64-current, using i3 4.22 and i3expo-ng from sbopkg (version 20221012_b55a74b)

Can you help me fix this?
Thanks in advance
Here's a screenshot, I currently have a terminal window on desktop 3 and a text editor on terminal 2, but they won't show up.

2023-04-09-093630_1366x768_scrot

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!

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?

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?

Not working with bspwm

Everytime i launch the app it throws me this message:

Traceback (most recent call last):
  File "/home/candres/.local/bin/i3expod.py", line 65, in <module>
    i3 = i3ipc.Connection()
  File "/usr/lib/python3.9/site-packages/i3ipc/connection.py", line 68, in __init__
    raise Exception('Failed to retrieve the i3 or sway IPC socket path')
Exception: Failed to retrieve the i3 or sway IPC socket path

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.

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.)

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".

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.