我为 Ubuntu 18.04 和 20.04 写了这个流行的答案,但现在由于 Wayland,它不能在 Ubuntu 22.04 上运行。
https://github.com/negesti/gnome-shell-extensions-negesti#wayland--wnck:
由于这种依赖性以及 Wayland 和 X11 识别应用程序的不同概念(wm_class 与 application_id),Wayland 不受支持!
来自https://extensions.gnome.org/extension/39/put-windows/:
任何想法、修复或替代方案?
这是一些东西,但不是很有用,在我玩它的 2 分钟内:https ://help.ubuntu.com/stable/ubuntu-help/shell-windows-states.html.en
如果这很重要,新的 Ubuntu 22.04 安装有GNOME Shell 42.5
,如 所示gnome-shell --version
。
WinTile 看起来很有前途,但到目前为止运气不佳。我开了一个问题:https ://github.com/Fmstrat/wintile/issues/91#issue-1504090370
我这样做需要两个快捷键,Ctrl++将窗口向左或向右抛出,然后Super++将其抛向角落。那就是:holdLeft/RightCtrlSuperUp/Down
这是:按住Ctrl+ Super,然后按箭头键。
作为额外的奖励,我有Ctrl+ Super+Left/Right使窗口居中:
这回答了您在这里真正要问的问题(即,将窗口放在角落里),但它不会调整窗口大小以适应例如屏幕的四分之一,这可能是您想要问的。对于平铺,仍然有几个可用的扩展,即使您列出的扩展不再更新。在 Gnome Extensions 网站上查找“tile”以找到并试用它们。
要重置为默认值,请更改
set
并reset
省略命令的最后一个参数。我发现了如何为此安装和使用两个非常好的扩展:
我喜欢同时使用这两个扩展。我已经在 Ubuntu 22.04 中使用 X11 和 Wayland 窗口管理器服务器测试了它们,并且这两个扩展在这两种情况下都有效。
扩展 1:Awesome Tiles(使用键盘快捷键调整大小并将窗口对齐边缘和角落)
由于Ubuntu 22.04 中的一个已知错误,您无法从此处的浏览器安装“Awesome Tiles”:https ://extensions.gnome.org/ 。相反,从以下位置安装它
gnome-shell-extension-manager
:按Windows键并键入“Extension Manager”打开其 GUI。它的图标是一个蓝色的拼图。
单击顶部的“浏览”选项卡,然后搜索“awesome tiles”。单击“安装”按钮进行安装。在这里你可以看到我的已经“安装”:
单击顶部的“已安装”选项卡,确保滑块显示“Awesome Tiles”已激活(单击滑块以激活/停用它),然后单击齿轮图标以修改其设置:
以下是它使用的默认设置和快捷键:
如您所见,它使用Super( Windows) 键 + 键盘键。然而,许多较小的笔记本电脑和键盘在键盘右侧没有小键盘,因此我建议您使用我之前在“Put Windows”中Alt使用过的+ Windows+ Letters 快捷键。另外,我真的很讨厌窗户周围的缝隙(很多——太多了,如果我不能删除它们,我根本不会推荐这个工具),所以我建议你通过改变“缝隙”来消除缝隙窗口和工作区之间”设置为 0,并禁用“窗口之间的间隙”。
但是,在我们可以添加我喜欢的所有快捷方式之前,我们必须禁用默认的 Ubuntu Alt+ Windows+ S“屏幕阅读器打开或关闭”快捷方式,这会产生干扰。转到您的 Ubuntu 设置 --> 键盘 --> 单击“查看和自定义快捷方式” --> 输入“alt+super+s”,如下所示:
单击“打开或关闭屏幕阅读器”快捷方式可以看到当前分配给哪个快捷方式
Alt+Super+S
,然后按Backspace禁用该快捷方式-->单击“设置”按钮。您现在可以看到它是“已禁用”。完美的:Now go ahead and change your "Awesome Tiles" keyboard shortcuts to be as follows. Remember that the Super key is the Windows key on a PC. Here are my new settings. I have highlighted all of the ones I just changed:
Update: I just changed this too: I changed 0.35 -> 0.33, and I added 0.25:
If you ever want to reset all of the settings to their defaults, see my answer here: How do I reset a Gnome Extension's settings to default? Ex: for "Awesome Tiles" in Ubuntu 22.04?.
Two other settings you may want to mess with are the "Center Tiling Steps" and "Side Tiling Steps". If you press the same shortcut repeatedly, it cycles through those multiple size settings as set there. Those are values from 0 to 1, where
0
represents 0% of the full size for that position, and1
represents the full size for that position, So, press the same shortcut repeatedly to cycle through 3 (as currently set) different sizes for each one, sized according to those settings.To get the most consistent results, I like to tile the window to center first. So, if I wanted to resize and snap the window to the top-left corner, I would press first Alt + Windows + S to center the window, and then I'd press Alt + Windows + Q to resize and snap it to the top-left. Centering between each move ensures it's always the correct size for that new position.
That's it! This is an excellent extension to use keyboard shortcuts to resize and snap your windows to edges and corners!
Extension 2: WinTile (allows you to drag with the mouse your windows to resize and snap them to left, right, or corners)
If in a hurry, just jump straight down to the "Install WinTile" section below. It's just a few short commands and steps.
The WinTile tool works phenomenally-well in Ubuntu 22.04, with both the X and Wayland window manager servers, and easily snaps windows into corners or edges. You have to follow my install instructions below, however, as it can't be installed from the browser (yet).
It takes some getting used-to compared to the tools I've been using for the past 8 years: CompizConfig in Unity in Ubuntu 14.04 and 16.04 and the "Put Windows" tool in GNOME in Ubuntu 18.04 and 20.04, but overall it gives a more-natural experience if you're using a mouse. Just drag the window towards the monitor edge or towards the corner and it automatically resizes and snaps accordingly! Here is an animated gif from the GitHub page: https://github.com/Fmstrat/wintile:
WinTile er, uh, problems
The WinTile tool hasn't been maintained in about a year so it's missing a few small PRs to bring it up-to-date. Therefore, it cannot be installed from the Gnome extensions store just quite yet. The biggest change it is missing is this tiny PR, which simply adds Gnome
41
and42
to themetadata.json
file to indicate it is compatible with these versions of Gnome as well: https://github.com/Fmstrat/wintile/pull/82/filesNote that the "About" section of Ubuntu 22.04's Settings shows me that it uses GNOME 42.5:
Here is the main WinTile repo: https://github.com/Fmstrat/wintile
Until it merges its 8 open PRs, and/or until someone else forks it and takes it over, we will use this temporary fork (which has disabled "Issues" in GitHub because they don't want to maintain it), but which conveniently has merged the open PRs: https://github.com/Captn138/wintile-reloaded
References I used to figure out the above and the following:
Install WinTile
Like I said, for now we will use https://github.com/Captn138/wintile-reloaded. Here's how to install it:
Open a terminal with Ctrl + Alt + T and run the following commands, one-at-a-time:
Now manually log back into Ubuntu, then open your Gnome Extension web-page as a portal into your locally-running Gnome extensions server: https://extensions.gnome.org/local/
You'll now see "WinTile RELOADED" as an option!:
To activate it, you can either click the toggle button from "OFF" to "ON" in that extension webpage, or run this at the terminal:
If you run the terminal command, you'll see the toggle update live in the browser window.
That's it! Drag windows to the corners of your monitor to your heart's content.
Configuration options
If you click the little tool icon in the browser you can change some settings if you like. Here are the possible settings to tweak. I decreased my "Delay in ms before preview displays" setting from the default 500ms to 100ms to make it much snappier.
Overall, not quite as versatile as "Put Windows" or "Awesome Tiles", but WinTile works great in Ubuntu 22.04, with both Wayland and X window servers, and it's more-intuitive for Windows users and those who like to use trackpads or mice ?.
Graphics driver problems in Ubuntu 22.04?
This is kind of related if you just installed Ubuntu 22.04.
如果您发现您的新 22.04 计算机有图形驱动程序问题或死机,并且您有 NVIDIA 图形卡,请在此处查看我的详细解答以更新您的图形驱动程序。请参阅:(推荐)选项 2:直接从 NVIDIA 下载并安装驱动程序。