Git Product home page Git Product logo

Comments (3)

ssokolow avatar ssokolow commented on May 18, 2024

That's already covered under issue #13 (move tiling presets into the config file) and, before holiday overwork hit me like a ton of bricks, I was just about to finally sit down and do the hard work of designing the new config file format needed to fix it.

I hope to get back to that in January or, if something comes up, definitely February. (I may also start writing a GUI for editing the new config file format)

However, I'll leave this feature request open as a reminder that I should offer at least one ready-made alternative config for people with bigger monitors. (It didn't occur to me because I use a pair of 1280x1024 monitors and the boundary between them subdivides the tiling space nicely)

Workaround

In the mean time, if you're feeling adventurous, look at lines 130 through 142 of quicktile.py.

col, gv = 1.0 / 3, GravityLayout()

#TODO: Figure out how best to put this in the config file.
POSITIONS = {
    'middle': [gv(x, 1, 'middle') for x in (1.0, col, col * 2)],
} #: command-to-position mappings for L{cycle_dimensions}

for grav in ('top', 'bottom'):
    POSITIONS[grav] = [gv(x, 0.5, grav) for x in (1.0, col, col * 2)]
for grav in ('left', 'right'):
    POSITIONS[grav] = [gv(x, 1, grav) for x in (0.5, col, col * 2)]
for grav in ('top-left', 'top-right', 'bottom-left', 'bottom-right'):
    POSITIONS[grav] = [gv(x, 0.5, grav) for x in (0.5, col, col * 2)]

That's what currently defines the available layouts.

If you weren't already aware, Python uses an indent-based block syntax instead of curly braces (hence the indent after the for ...: lines) however, within bracket pairs (list/dict/set/tuple literals, function calls, expressions, etc.), whitespace is as insignificant as in PHP and JavaScript. (So, as long as you keep the indent after those for ...: lines in mind, you shouldn't have any problems)

The top line defines three columns by setting col to 1.0 / 3 and then the rest of the lines define layouts as either explicit widths or multiples of the column width.

(In retrospect, maybe I shouldn't have taken advantage of the tuple packing/unpacking syntax for code that Python novices might want to edit. It's just var_a, var_b = "Value A", "Value B".)

POSITIONS is a dict (associative array) mapping position keywords like top-left to sequences of presets to cycle through. (Here generated by the [gv(...) for x in some_list] list comprehensions which, if you haven't seen them before, are an expression-form shorthand for a for (foreach in PHP) loop, an optional function call (gv), and an optional if statement which I don't use here)

The syntax for gv(...) is defined on line 109 and it's sort of a stop-gap measure until I design the new config file but here's how it works:

  1. The function signature is basically gv(width, height, gravity_keyword, position_x, position_y)
  2. Only the first two arguments are mandatory. The gravity defaults to top-left and the two position values are calculated from the gravity if unspecified.
  3. The gravity keyword defines where on the window the position_x and position_y coordinates refer to.
  4. All values except the gravity keyword are percentages of the monitor size in the range 0.0 to 1.0, inclusive.
  5. All valid values for the gravity keyword are in the dict on line 97.
  6. I haven't yet got a unit test for it but, if you manually generate the (x, y, w, h) tuple that gv(...) returns, you should be able to define presets which preserve one or more components by passing None as one of the values.

from quicktile.

zamicol avatar zamicol commented on May 18, 2024

Thank you! I'm going to take a look a this when I get some time.

from quicktile.

ssokolow avatar ssokolow commented on May 18, 2024

Just so you know, I've finally started to do the big re-architecting I've wanted to do all these years and, as a result, there's now a ColumnCount key in the config file.

More improvements are planned, but that should be a good start.

Be warned, however, that the installation process has changed because I split QuickTile into multiple files to get past a mental block. It's still simple and you have the same choices, but you'll want to re-read the relevant section of the README.

from quicktile.

Related Issues (20)

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.