5/17/2023 0 Comments Hammerspoon pull to topWindows are positioned relative to the screen, so we end up having to get the size of the screen and subtract the size of the panel to find the available size.Įven more fun is that we’re operating against X windows, which are quite low-level. The point of this program is to expand the window horizontally or vertically to the width or height of the desktop (or some even division). The calculations are surprisingly complicated. Xdotool does most of the heavy lifting for this program: finding the active window, getting its dimensions, getting the dimensions of other things (screen, panel) and setting the new size and position of the window. Its function is pretty straightforward in concept: get the currently active window, compute new size and position for it based on the requested options, and resize and move it. This is a program that lets you move and resize windows, fake keyboard and mouse input and other stuff.Īnd so on top of this I wrote tiler. I started reading some of the X11 protocol elements available for this sort of thing, but it turned out to be easier to just use xdotool. And most importantly for this, window manipulation primitives weren’t available.įortunately, X has always had the ability to “remotely” manipulate windows in various ways. I think perhaps DBus interfaces are the place where most things that a similar thing would operate against, but I spent some time poking around and there’s no where near the depth or breadth of functionality exposed that way. I did look around to see if there’s anything like Hammerspoon available. They work, but they sort of remove the window from the normal layout, and lock them in place until you explicitly un-remove them, which leads me to a bunch of mucking around trying to figure out why the window won’t move. There are keyboard shortcuts to tile left, tile right and maximise but they’re … weird. Later I started using Miro, another Hammerspoon script that did the same thing but had more features, including cycling quarter widths and half-height windows.Įlementary OS and its Gala window manager didn’t have much to offer me here unfortunately. This was my main form of customisation for macOS, and one of the first things I did was to reimplement my window layout shortcuts via a script called gravity_windows. This exposes a ton of the operating system to a Lua runtime, letting you write your own scripts to do things. When I switched to macOS, a friend recommended Hammerspoon. I want everything flat I need to be able to move around workspaces and quickly see what’s happening). Taken together, it became really easy to open a new window, throw it to the correct position and use it straight away, without taking my hands off the keyboard. I would also set it up so that Super-F1 would open a new terminal window. Not maximize, but more like what you’d get if you used the mouse to resize the window. They were pretty simple: you could tap keys to make a window use the left half, right half or entire screen. So naturally, where my terminal windows are positioned on the screen is kind of a big deal to me.īack when I ran XFCE, I got used to using its keyboard shortcuts to position windows. As I said before, I spend most much of my life in terminal windows, being a sysadmin or a programmer or anything else like that.
0 Comments
Leave a Reply. |