Git Product home page Git Product logo

qtile-plasma's Introduction

Plasma

Build Status codecov PyPI Version Python Versions

Plasma is a flexible, tree-based layout for Qtile.

If you're looking for a well-tested and maintained alternative to Qtile's default layouts, give it a try.

About

Plasma works on a tree structure. Each node represents a container with child containers aligned either horizontally or vertically (similar to i3). Each window is attached to a leaf, taking either a proportional or a specific custom amount of space in its parent container. Windows can be resized, rearranged and integrated into other containers, enabling lots of different setups.

Demo

Here is a quick demo showing some of the main features (adding modes, moving, integrating and resizing):

Demo

Installation

Install the package. You can get it from PyPI:

pip install --upgrade qtile-plasma

Then, add the layout to your config (~/.config/qtile/config.py):

from plasma import Plasma
...
layouts = [
    Plasma(
        border_normal='#333333',
        border_focus='#00e891',
        border_normal_fixed='#006863',
        border_focus_fixed='#00e8dc',
        border_width=1,
        border_width_single=0,
        margin=0
    ),
    ...
]

Add some key bindings, too. I am using these:

from libqtile.command import lazy
from libqtile.config import EzKey
...
keymap = {
    'M-h': lazy.layout.left(),
    'M-j': lazy.layout.down(),
    'M-k': lazy.layout.up(),
    'M-l': lazy.layout.right(),
    'M-S-h': lazy.layout.move_left(),
    'M-S-j': lazy.layout.move_down(),
    'M-S-k': lazy.layout.move_up(),
    'M-S-l': lazy.layout.move_right(),
    'M-A-h': lazy.layout.integrate_left(),
    'M-A-j': lazy.layout.integrate_down(),
    'M-A-k': lazy.layout.integrate_up(),
    'M-A-l': lazy.layout.integrate_right(),
    'M-d': lazy.layout.mode_horizontal(),
    'M-v': lazy.layout.mode_vertical(),
    'M-S-d': lazy.layout.mode_horizontal_split(),
    'M-S-v': lazy.layout.mode_vertical_split(),
    'M-a': lazy.layout.grow_width(30),
    'M-x': lazy.layout.grow_width(-30),
    'M-S-a': lazy.layout.grow_height(30),
    'M-S-x': lazy.layout.grow_height(-30),
    'M-C-5': lazy.layout.size(500),
    'M-C-8': lazy.layout.size(800),
    'M-n': lazy.layout.reset_size(),
}
keys = [EzKey(k, v) for k, v in keymap.items()]

Done!

Commands

The layout exposes the following commands:

next() Focus next window.
previous() Focus previous window.
recent() Focus most recently focused window.
(Toggles between the two latest active windows.)
left() Focus window to the left.
right() Focus window to the right.
up() Focus window above.
down() Focus window below.
move_left() Move current window left.
move_right() Move current window right.
move_up() Move current window up.
move_down() Move current window down.
integrate_left() Integrate current window left.
integrate_right() Integrate current window right.
integrate_up() Integrate current window up.
integrate_down() Integrate current window down.
mode_horizontal() Next window will be added horizontally.
mode_vertical() Next window will be added vertically.
mode_horizontal_split() Next window will be added horizontally, splitting space of current window.
mode_vertical_split() Next window will be added vertically, splitting space of current window.
size(x) Change size of current window.
(It's recommended to use width()/height() instead.)
width(x) Set width of current window.
height(x) Set height of current window.
reset_size() Reset size of current window to automatic (relative) sizing.
grow(x) Grow size of current window.
(It's recommended to use grow_width()/grow_height() instead.)
grow_width(x) Grow width of current window.
grow_height(x) Grow height of current window.

Contributing

If you have found a bug or want to suggest a feature, please file an issue.

To work on Plasma locally, you need to clone submodules too, since the layout integration tests use some of Qtile's test fixtures:

git clone --recursive https://github.com/numirias/qtile-plasma/

Also make sure you meet the hacking requirements of Qtile. In particular, have xserver-xephyr installed. Then run:

make init

If that fails, run the init instructions from the Makefile one by one.

All new changes need to be fully test-covered and pass the linting:

make lint
make test

If you made changes to the layout API, also re-build this README's commands section:

make readme

qtile-plasma's People

Contributors

numirias 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtile-plasma's Issues

Adding to main qtile repo

numirias,

I'm one of the qtile developers and wanted to leave a note to say a big thank you for your work on this layout.

It's very popular with some of our users so we're going to incorporate it into the main qtile codebase (with full acknowledgement to you) so even more people can use it.

So thanks again for the work here. We appreciate you!

elParaguayo

"from plasma import Plasma" crashes qtile on Ubuntu

I'm running Ubuntu 16.04 and even just importing the Plasma class seems to crash qtile and cause it to resort to the default config. Any ideas why this is happening?

Plasma is installed correctly and I've had a look through the source and I can't see anything in the __init__ that could be running on import. Is import order important?

Error in `from plasma import Plasma` for new python version.

Arch recently updated python to 3.11, since then I have not been able to use Plasma. Running
python config.py gives the error

Traceback (most recent call last):
  File "/home/roshan/.config/qtile/config.py", line 11, in <module>
    from plasma import Plasma
  File "/home/roshan/.local/lib/python3.11/site-packages/plasma/__init__.py", line 1, in <module>
    from .layout import Plasma
  File "/home/roshan/.local/lib/python3.11/site-packages/plasma/layout.py", line 6, in <module>
    from .node import Node, AddMode, NotRestorableError
  File "/home/roshan/.local/lib/python3.11/site-packages/plasma/node.py", line 20, in <module>
    HORIZONTAL, VERTICAL = Orient
    ^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

This error is just because of the import, it persists even if I'm not using the library ever again in the config.

The plasma layout doesn't follow layout theme

I really like your work.
However, there is only one thing that is causing me to hold back on making it my default layout. When I resize the window, the border turns into the color emerald blue, and after that the border I specified in my layout theme is completely gone. Is there anyway to fix this?

Video demo

From reading the readme, I'm finding it difficult to visualise how this layout works. Please consider adding a short video demo showing the basics of this layout.

Is this still maintained?

@numirias Are you still interested in maintaining this package? If not, I'd be willing to try and keep it going. There's still quite a few people who like to use this layout and the current version here is now broken for newer Python versions (see #29 #28).

Python 3.11 Compatability

The current version of the code is not compatible with Python 3.11. Specifically, individual values of enums cannot be unpacked anymore. So lines like

HORIZONTAL, VERTICAL = Orient

and

UP, DOWN, LEFT, RIGHT = Direction

are no longer valid and have to be replaced with

HORIZONTAL = Orient.HORIZONTAL
VERTICAL   = Orient.VERTICAL

and

UP    = Direction.UP
DOWN  = Direction.DOWN
LEFT  = Direction.LEFT
RIGHT = Direction.RIGHT

setting width from qtile shell / client_managed hook

Hi, Ive been trying to set the width of a program from within a hook, so that as soon as I launch for example MPV, it will resize it to a width of 1920.
On trying to run the command from qtile shell,
layout > width(500)

File "/home/gary/.local/lib/python3.9/site-packages/plasma/node.py", line 328, in size
val = max(min(val, self.parent.capacity - occupied),
TypeError: '<' not supported between instances of 'int' and 'str'

I am sorry, I don't know how to submit a patch, but I fixed this by changing line 328 of node.py to

val = max(min(int(val), self.parent.capacity - occupied),

to change the type of val to an integer

I am still having trouble calling the width function directly from within a hook, but I am unsure if I am doing it correctly or if this is just unsupported, I would be appreciative if you could give me some direction on how to accomplish this? I have a rather hacky solution in place at the moment to simulate a keypress which is bound to the lazy.layout.width() function

Thank you

Bring some options from Qtile's Tile layout

I'm currently using Tile as primary layout. I'd like to switch to Plasma, but it lacks some major options before I can to the switch:

  • ratio
  • masterWindows
  • expand
  • ratio_increment
  • add_on_top
  • add_after_last
  • shift_windows
  • master_match

These are mostly trivial and I believe corresponding functions can be mostly copied from Tile layout's source code.

reset_size() not working after a vertical split

Reset_size() has not no effect after performing a vertical split. After closing the vertical split window it works fine.
Steps to reproduce:

  1. Open two windows
  2. Change split mode to vertical
  3. Open a third window
  4. grow/shrink the window
  5. Call reset_size()

5th step should reset/normalize the size of all windows but it has no effect

Error from Qtile Check

After the installation of qtile-plasma through pip, I added this line to my config.py file
from plasma import Plasma

and got the following error from "qtile check". What may be wrong?

checking qtile config file /home/murpheux/.config/qtile/config.py
/tmp/tmpveqd7x41/config.py:11: error: Skipping analyzing 'plasma': found module but no type hints or library stubs
/tmp/tmpveqd7x41/config.py:11: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
config file type checking failed: Command '['mypy', '--python-version=3.8', '/tmp/tmpveqd7x41/config.py']' returned non-zero exit status 1.

I am running python 3.9.4 on manjaro linux. Thanks

Installation is failing on Ubuntu 18

After executing pip3 install --upgrade qtile-plasma i see errors:

    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 245kB 679kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-jnoa60a6/qtile/setup.py", line 71, in <module>
        'libqtile/core/xcursors_ffi_build.py:xcursors_ffi',
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 128, in setup
        _install_setup_requires(attrs)
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 121, in _install_setup_requires
        dist.parse_config_files(ignore_option_errors=True)
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 494, in parse_config_files
        ignore_option_errors=ignore_option_errors)
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 110, in parse_configuration
        options.parse()
      File "/usr/lib/python3/dist-packages/setuptools/config.py", line 380, in parse
        self.section_prefix, section_name))
    distutils.errors.DistutilsOptionError: Unsupported distribution option section: [options.data_files]
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-jnoa60a6/qtile/

My qtile version: 0.10.7 (installed with sudo apt install qtile).

Qtile focus behavior (below, above)

Hi,

When I used the BSP layout of Qtile and I use conky for instance, the terminal windows are above conky
But when I use Plasma layout conky is above my terminals. The config I use is:

conky.config = {                                                                            
  alignment = 'top_right',                                                                  
  background = false,                                                                       
  border_inner_margin = 15,                                                                 
  color2 = 'f2f2f2',                                                                        
  cpu_avg_samples = 2,                                                                      
  default_color = 'cf6a4c',                                                                 
  double_buffer = true,                                                                     
  font = 'Cousine Nerd Font Mono:size=10',                                                  
  draw_shades = true,                                                                       
  gap_x = 30,                                                                               
  gap_y = 50,                                                                               
  pad_percents = 300,                                                                       
  minimum_width = 250,                                                                      
  no_buffers = true,                                                                        
  own_window = true,                                                                        
  own_window_type = 'override',                                                             
  own_window_transparent = false,                                                           
  own_window_colour = '1e1e1e',                                                             
  own_window_class = 'conky-sysinfo',                                                       
  own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',                    
  update_interval = 1.0,                                                                    
  use_xft = true,                                                                           
  own_window_title = 'Conky Sysinfo',                                                       
}

I don't get it..
my dotfiles are found at https://github.com/combro2k/dotfiles

What qtile version is supported?

I'm getting following error both with 0.10.7 and recently released 0.11.0:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nazar-pc/.local/lib/python3.6/site-packages/plasma/layout.py", line 64, in add
    self.root.restore(new)
  File "/home/nazar-pc/.local/lib/python3.6/site-packages/plasma/node.py", line 560, in restore
    raise NotRestorableError()
plasma.node.NotRestorableError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nazar-pc/.local/bin/qtile", line 11, in <module>
    load_entry_point('qtile', 'console_scripts', 'qtile')()
  File "/web/github/qtile/libqtile/scripts/qtile.py", line 125, in main
    q = make_qtile()
  File "/web/github/qtile/libqtile/scripts/qtile.py", line 119, in make_qtile
    state=options.state,
  File "/web/github/qtile/libqtile/manager.py", line 245, in __init__
    self.scan()
  File "/web/github/qtile/libqtile/manager.py", line 568, in scan
    self.manage(item)
  File "/web/github/qtile/libqtile/manager.py", line 627, in manage
    c = window.Window(w, self)
  File "/web/github/qtile/libqtile/window.py", line 770, in __init__
    group.add(self)
  File "/web/github/qtile/libqtile/group.py", line 270, in add
    i.add(win)
  File "/home/nazar-pc/.local/lib/python3.6/site-packages/plasma/layout.py", line 66, in add
    node.add_node(new, self.add_mode)
  File "/home/nazar-pc/.local/lib/python3.6/site-packages/plasma/node.py", line 539, in add_node
    self.parent.add_child_after(node, self)
  File "/home/nazar-pc/.local/lib/python3.6/site-packages/plasma/node.py", line 498, in add_child_after
    self.add_child(new, idx=old.index+1)
  File "/home/nazar-pc/.local/lib/python3.6/site-packages/plasma/node.py", line 495, in add_child
    Node.fit_into(node.siblings, total - (total / len(self)))
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

mode_vertical/horizontal

Following methods from readme seem to be either not implemented or not working properly:

  • lazy.layout.mode_horizontal()
  • lazy.layout.mode_vertical()
  • lazy.layout.mode_horizontal_split()
  • lazy.layout.mode_vertical_split()
2018-03-02 00:03:29,686 libqtile manager.py:handle_KeyPress():L933  KB command error mode_horizontal: No such command.
2018-03-02 00:03:29,939 libqtile manager.py:handle_KeyPress():L933  KB command error mode_vertical: No such command.
2018-03-02 00:03:31,850 libqtile manager.py:handle_KeyPress():L933  KB command error mode_horizontal_split: No such command.
2018-03-02 00:03:32,068 libqtile manager.py:handle_KeyPress():L933  KB command error mode_vertical_split: No such command.

Maintain layout on qtile restart

It'd be nice if when qtile restarts the layout was kept. Getting the window sizes to stick if changes in monitor happen maybe tough, but at least getting the vertical/horizontal tiling part correct would be quite nice.

Installation question

I'm currently on develop branch of qtile and installed one with pip3 install -e ..

Does this layout support develop branch and how can I install it without replacing my current installation (qtile-plasma package loads stable version of qtile by dependencies). I'm not a Python developer, so question might be silly, but nevertheless.

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.