程序占据屏幕的2/3和1/3?

有没有已知的应用程序可以实现这一目标? 如果没有,无论如何干涉我自己,我不需要50/50的特定设置我需要一个程序占用2/3和另外1/3。 会非常有用!

如上所述,如果一个程序不存在,我应该阅读什么才能让它工作? (一个特定的快捷方式,例如2/3和另一个1/3)

截至今天使用万神殿。

介绍

下面的脚本要求用户为窗口选择1/3或2/3resize选项,然后允许用户选择要resize的窗口。 要调整为1/3的窗口将跳到左侧,2/3窗口将跳到右侧。 可以根据需要将脚本绑定到键盘快捷键。

初步设置

该脚本依赖于wmctrl程序来完成这项工作。 确保首先安装它

 sudo apt-get install wmctrl 

设置脚本

  1. 在您的主文件夹中创建名为bin文件夹。 您可以使用该命令执行此操作

     mkdir $HOME/bin` 
  2. 在该文件夹中创建文件resizer.sh 。 将以下脚本复制到该文件。

  3. 确保脚本可执行

     chmod 755 $HOME/bin/resizer.sh 
  4. 打开系统设置 – > 键盘 – > 快捷方式 – > 自定义快捷方式
    创建一个新的快捷方式并将其作为命令提供给脚本的完整路径,
    例如,/ /home/serg/bin/resizer.sh

我的例子

我首先设置了快捷方式:

在此处输入图像描述

然后按快捷方式。 弹出菜单允许选择1/3或2/3resize; 我选择1.注意,除了一个1位数外,没有额外的输入

在此处输入图像描述

接下来,我选择自由浮动的浏览器窗口。 它跳到左边,现在宽度为1/3,桌面高度。

在此处输入图像描述

2/3选项的行为相同,除了2/3窗口将放在右侧 在此处输入图像描述

怪癖

测试完此脚本后,resize不适用于最大化或左/右分割窗口( Ctrl Super / )。 因此,窗口必须是非最大化的,自由浮动的。

脚本来源

 #!/bin/bash #-------------------- # Author: Serg Kolo # Date: Sept 26,2015 # Purpose: a script to resize a window to its # 1/3 or 2/3 of width. # Written for http://askubuntu.com/q/678608/295286 #-------------------- #--------------------- # This part takes user input through graphical popup; # Input must be 1 or 2, anything else results into an error # If user selects 1, we set window to 1/3 of desktop width # and place it on the left; # If user selects 2, we set window to 2/3 of desktop width # and place it on the right; SIZE=$(zenity --entry --text "Enter (1) for 1/3 and (2) for 2/3 of width") case $SIZE in "1")NUM=0.333; XPOS=0;; "2")NUM=0.667;XPOS=455;; *) zenity --error --text="Invalid input"; exit ;; esac #-------------------- # In this part we determine the geometry of the desktop # and then calculate the width that we want the window to # be set using bc, the command line calculator # printf is used to convert floating point result to # integer value, which is required for wmctrl ROOT_WIDTH=$(xwininfo -root | awk '/Width/ {print $2}') ROOT_HEIGHT=$(xwininfo -root | awk '/Height/ {print $2}' ) NEW_WIDTH=$(bc <<< $ROOT_WIDTH*$NUM) NEW_WIDTH=$(printf "%.0f" $NEW_WIDTH) #---------------------- # This is what actually does the job. # wmctrl allows you to select the window with -r :SELECT: # and sets that window to specific gravity,x-position,y-position,width # height. To keep the script neutral, I've decided to set the # height to default desktop height. User can resize the height as # necessary by themselves wmctrl -r :SELECT: -e 0,$XPOS,0,$NEW_WIDTH,$ROOT_HEIGHT