/xpytile

Automatic / dynamic window tiling for XFCE

Primary LanguagePython

xpytile

Tiling and simultaneous resizing of side-by-side windows (theoretically not only) for Xfce.

Purpose

A Python script to auto-tile and to simultaneously resize docked windows for Xfce.

Features:

Simultaneous resizing of adjacent windows
5 different tilers

Hotkeys for:

  • Tiling and/or simultaneous resizing can be enabled/disabled
  • Tiling can be triggered manually on demand
  • Changing tiler
  • Storing and re-creating current windows layout
  • Cycling windows
  • Swap windows
  • Set/unset window decoration
  • and more, see below

The tiler can be controlled remotely.
All settings are workspace specific.
So for each workspace you can choose independently, if tiling is enabled and which tiler should be used.
No limit of supported workspaces
Config-file
Pure Python, easily hackable

New features

Hotkey to focus previously active window
Can be controlled remotely.
Dragging a window with the mouse slightly over the left or the top or bottom border of the workspace
triggers a re-tiling. So the window positions can be changed / swapped by dragging a window.
Option to set the mouse-cursor in the middle of the new active window, when changed by hotkey.
    This visual feedback is helpful, especially when the window decoration is turned off.
Focus can be set to next adjacent window, in the direction of the pressed arrow-key
Max. number of tiled windows for the currently active tiler can be increased/decreased per hot-key

Hotkeys

Hotkeys can be defined in the config-file.
Most important hotkeys (full set see config-file):
Super_L - 1         tiler - master and stack vertically
Super_L - 2         tiler - vertically
Super_L - 3         tiler - master and stack horizontally
Super_L - 4         tiler - horizontally
Super_L - 0         tiler - maximize
Super_L - c         cycle tiler
Super_L - 5         restore windows layout
Super_L - 6         store windows layout
Super_L - ^         cycle windows
Super_L - ESC     swap current window with top/left-most window
Super_L - q         toggle simultaneous resizing (on/off)
Super_L - w         toggle tiling (on/off)
Super_L - y         toggle window-decoration (on/off) of tiled windows (*)
Super_L - a         shrink width/height of master window
Super_L - s         enlarge width/height of master window
Super_L - m         increment number of max. tiled windows for active tiler
Super_L - n         decrement number of max. tiled windows for active tiler
Super_L - arrow  focus next adjacent window in the given direction
Super_L - b         focus previously active window
Super_L - .         log name & tile of active window in /tmp/xpytile_<USERNAME>.log
Super_L - -         exit
*) Hint: In XFCE one can resize windows with Alt - Right-Click and drag,
         which is useful when windows-decorations are turned off

Configuration

Well, edit the hopefully self-explanatory config-file xpytilerc

Installation

Place xpytilerc in XDG_CONFIG_HOME in ~/.config/ or in /etc/ respectively
ArchLinux - users can install xpytile-git from the AUR

Start

./xpytile.py
or, to let run in background: nohup ./xpytile.py > /dev/null 2>&1 & You may want to assign a hotkey.
In Xfce for example, add a shortcut to xpytile.py with:
Xfce-Menu -> Settings -> Keyboard -> Application Shortcuts

Dependencies

notify-send (package: notifylib for ArchLinux, libnotify-bin for Debian/Ubuntu)
python3, python-xlib

Bugs

I'm currently not aware of a bug.
However, when the program crashes it writes traceback info in /tmp/xpytile_<USERNAME>.log

License

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.

Questions

(Q) Are gaps supported?
(A) Nope, but you could use an Xfce theme with gaps.

(Q) Does xpytile support multiple monitor setups?
(A) On workspaces that span multiple monitors, simultaneous resizing works fine, tiling not really.

(Q) How do I get the exact name and title of a window I want xpytile to ignore?
(A) Run xpyile with -v or -vv or use the hotkey to log name and title of the current window.

(Q) What can I do, xptile isn't picking up my hotkeys?
(A) Run ./getModifierCode.py, press Super_L - 1 (or the modifier you'd like to use)
      and check/edit xpytilerc (line: modifier = )

(Q) I'm running out of hotkeys, what can I do?
(A) xpytile can be controlled remotely, consider making a dmenu or rofi script.