AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 624461
Accepted
janw
janw
Asked: 2015-05-17 04:52:50 +0800 CST2015-05-17 04:52:50 +0800 CST 2015-05-17 04:52:50 +0800 CST

高级窗口放置

  • 772

TLDR我正在寻找windowpad的 ubuntu 替代品

我知道窗口放置可以用Ctrl- Alt-Numpad#和Ctrl- Super-定义,arrow但这些还不够。我确实有CompizConfig >循环使用多种尺寸

但我想分配一个热键使窗口保持在左侧,全高,1/3 宽度。右边也一样。中间一个。我习惯于使用 Windowpad(在 Windows 上),它允许我定义几乎任何东西。我已经习惯了。

有什么办法可以调整这个吗?

澄清编辑。这与打开窗口无关,而是与当前活动窗口有关。

unity
  • 1 1 个回答
  • 330 Views

1 个回答

  • Voted
  1. Best Answer
    terdon
    2015-05-17T06:12:09+08:002015-05-17T06:12:09+08:00

    听起来你在找xdotoolor wmctrl。这些工具可让您编写与 GUI 的各种交互的脚本。两者都可以从存储库安装,您可以使用您喜欢的任何一个:

    sudo apt-get install wmctrl xdotool
    

    我的显示器是 1920 x 1080,所以 1/3 宽度为 640。要将活动窗口放置在屏幕左侧,全高和 1/3 宽度,我会运行:

    wmctrl -r :ACTIVE: -e 0,0,0,640,1080
    

    格式解释man wmctrl如下:

    -r <WIN>
         Specify a target window for an action.
    -e <MVARG>
         Resize and move a window that has been specified with a -r action 
         according to the  <MVARG> argument.
    
     [...]
    
    <MVARG>
         A move and resize argument has the format 'g,x,y,w,h'.  All five components  are  integers.
         The  first  value, g, is the gravity of the window, with 0 being the
         most common value (the default value for the window). [...]
         The four remaining values are a standard geometry specification: x,y 
         is the position of the top  left  corner  of  the  window, and w,h
         is the width and height of the window [...].
    
    <WIN>
         This  argument  specifies a window that is the target of an action. [...]
         The  window name string :ACTIVE: may be used to instruct wmctrl to 
         use the currently active window for the action.
    

    您还可以通过自动检测宽度来使其更具动态性。此命令打印显示的宽度:

    $ xrandr | grep -Po 'current\s*\K\d+'
    1920
    

    因此,您可以像这样将其集成wmctrl:

    wmctrl -r :ACTIVE: -e 0,0,0,$(($(xrandr | grep -Po 'current\s*\K\d+')/3)),1080
    

    现在,您所要做的就是将该命令分配给 Unity 设置中的键盘快捷键,一切就绪。

    • 2

相关问题

  • 如何将 Web 应用程序放入 Unity Launcher?

  • Ubuntu 上网本 10.10 中没有 Alt+F2?

  • Unity 中的 gnome-do 样式键盘快捷键

  • 在哪里提交 Unity 的错误/愿望清单?

  • Unity 启动器——它可以作为单独的包提供吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve