How To Use Jwno With Your Ultrawide Monitors
It feels so empty here, so I decided to share something from Jwno’s Cookbook. Jwno is quite customizable, that it can sometimes be confusing when you want to achieve a certain setup (well, it may be partly because I did a bad job at designing those APIs, but let’s just ignore this for the time being). I hope the cookbook and these tiny “tutorials” I post here can be of some help to you.
We’ll talk about ultrawide monitors today.
(Well, I don’t have an ultrawide, so…)
Sometimes an ultrawide monitor is just… too wide. Traditionally a tiling window manager would want to utilize all your screen real estate, but, say, when you have a single window on an ultrawide monitor, and it takes up the whole screen, it just looks ridiculous, and surely feels bad when we need to aim at the content shown on the edges.
Luckily Jwno’s top-level frames (the frames representing a monitor) can be transformed freely. For example, to transform the top-level frame for the active monitor, define these functions (You can copy-and-paste the code snippets into Jwno’s REPL to try them out too):
(import jwno/util)
(defn shrink-top-frame []
(def top-frame
(:get-current-top-frame
(get-in jwno/context [:window-manager :root])))
(def rect (in top-frame :rect))
# This will reserve 500 pixels of space on the left and
# right sides of your monitor.
(:transform top-frame
(util/shrink-rect rect
{:left 500
:right 500
:top 0
:bottom 0}))
(:retile (in jwno/context :window-manager) top-frame))
(defn restore-top-frame []
(def top-frame
(:get-current-top-frame
(get-in jwno/context [:window-manager :root])))
(:transform top-frame
(get-in top-frame [:monitor :work-area]))
(:retile (in jwno/context :window-manager) top-frame))
Whenever you want to “squeeze” or restore your windows, just call shrink-top-frame
or restore-top-frame
:
(shrink-top-frame)
# Or
(restore-top-frame)
Even better, you can bind these functions to custom keys, and squeeze the windows interactively. For example:
(:add-command (in jwno/context :command-manager)
:shrink-top-frame
shrink-top-frame)
# You need to do this in your config file, on your own
# keymap object, to enable this keyboard shortcut.
(:define-key my-awesome-keymap
"Win + S"
:shrink-top-frame)
If you want to always reserve some space on your ultrawide monitor, use the :monitor-updated
hook instead:
(import jwno/util)
(defn is-my-ultrawide-monitor? [monitor]
(def [width height]
(util/rect-size (in monitor :rect)))
# You can also check your monitor's physical position
# via the monitor's :rect property. We simply check
# it's aspect ratio here.
(>= (/ width height) (/ 21 9)))
(:add-hook (in jwno/context :hook-manager)
:monitor-updated
(fn [top-frame]
(when (is-my-ultrawide-monitor?
(in top-frame :monitor))
(put (in top-frame :tags)
:paddings
{:left 500
:right 500
:top 10
:bottom 10}))))
This also works when new monitors are detected, or when you change the resolution or DPI settings.
Well, that’s pretty much everything I want to say about Jwno and ultrawide monitors. Again, I hope the things I post here will be helpful. Given Jwno’s ability to be customized, I’m sure you’ll discover you own ways of using it. Please do share your cool tricks and/or thoughts in the comments. Cheers! 🤘
Get Jwno
Jwno
A tiling window manager for Windows 10/11, built with Janet and ❤️.
Status | In development |
Category | Tool |
Author | Agent Kilo |
Tags | janet, tiling, uiautomation, window-manager, windows |
More posts
- Jwno 0.9.9 Released8 days ago
Leave a comment
Log in with itch.io to leave a comment.