Change window size linux

Keyboard command/shortcut to resize window

The bottom of my (Chromium) window is off the bottom of the screen. If I move the window up, Unity maximises the window (which I do not want). What key combination can I press to make the active window shorter (smaller)?

9 Answers 9

Hold down Alt and press space .

Then press R on your keyboard. You can now use the arrows to resize the window.

it shows the arrow key to resize, but window is not resized. Should I press then another key to apply the change?

You can press Alt + F8 and your mouse pointer will automatically switch to a resizing pointer, which you can use to resize your window either with the mouse or using the arrow keys.

You can then click or press esc to stop and turn your normal pointer back on.

Alt F7 allow me to move the window around without it snapping onto the top bar. That would’ve worked for me too.

It depends how you move your mouse after pressing F8. Horizontally → width, vertically → height, diagonally → both.

I tend to use alt + middle-drag to resize windows.

It’s not pure keyboard but it is useful in awkward situations (like this)

I find Alt + right-click + drag to be the most convenient way to do this.

As there is no mention of the shortcut using super key I will add it. This is complete keyboard shortcut, which has a super key(key with windows symbol). Just press super key + ctrl and then use arrow keys to resize the window. Arrow Up and Down keys maximize and minimize current window respectively.

Bonus Tip: Hold the super key and a short cut menu pops up with all possible short cuts.Tested on ubuntu 14.04 and works on 16.04 also.

Right-click the title bar, select Resize and then control the window size with the mouse.

The combo is different in Ubuntu (Unity) and Kubuntu (KDE).

Ubuntu 16.04 defaults to Alt + middle mouse button and then drag with mouse.

Kubuntu with KDE 5.8 defaults to Alt + right mouse button and then drag with mouse.

Place mouse on one of the nine edges, and then drag in the direction you want to upsize or downsize.

Источник

Resizing a window to a set size in Linux

Anyone knows a good way to resize any window to for example 640×480? Reason is, of course, screencasting. Under windows I’ve used ZoneSize from donationcoder. (Btw: For Firefox it’s easy, just use the web developer toolbar.)

4 Answers 4

$ wmctrl -l 0x00c00003 -1 rgamble-desktop Bottom Expanded Edge Panel 0x00c00031 -1 rgamble-desktop Top Expanded Edge Panel 0x00e00022 -1 rgamble-desktop Desktop 0x0260007c 0 rgamble-desktop Google - Mozilla Firefox 

To resize a window based on its title:

wmctrl -r Firefox -e 0,0,0,640,480 

The arguments to the resize option are gravity,X,Y,width,height so this will place the window at the top-left corner of the screen and resize it to 640X480.

Читайте также:  Linux compiler h no such file or directory

you can also specify the window with -r ‘:SELECT:’ . That way, you can point and click the window that you want to resize.

Using wmctrl, there is also some pre defined states:

If a window is currently in the state maximized , it won’t respond to a resizing in pixels using the -e parameter^. This is where the -b param is useful.

The -b option expects a list of comma separated parameters: «(remove|add|toggle),PROP1,PROP2]»

wmctrl -r Firefox -b toggle,maximized_horz 
wmctrl -r Firefox -b toggle,maximized_vert ----- --------------- remove modal add sticky toggle maximized_vert maximized_horz shaded skip_taskbar skip_pager hidden fullscreen above below 

About the precise question, the -e param allow resizing by values as follow:

Gravity, position X, position Y, window width, window height

// gravity,x,y,w,h wmctrl -r "Resizing" -e 0,0,0,640,480 

Источник

How to set window size and location of an application on screen via command line?

I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:

firefox myfile.html size 800x600 location bottom-left 

I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…

6 Answers 6

Here is a community version of the answer by Yokai that incorporates examples offered by Rudolf Olah.

You can use the tool called xdotool to control window size and location. Not only that, any script you write in bash , using xdotool , can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the mousemove and click commands.

xdotool search --onlyvisible --name firefox 
xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT 
xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y 

For example, if the window id for firefox is 123 you would do this:

xdotool windowsize 123 800 600 xdotool windowmove 123 0 1080 

The bottom-left positioning will have to be figured out based on your screen resolution.

There’s a bug with xdotool , wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can’t move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147

I don’t see this bug in Ubuntu 19.10. It’s interesting that the other answer, which says that it’s impossible, has 20 upvotes.

xdotool allows you to chain several commands together. so you could do: xdootool search —onlyvisible —name firefox windowmove 100 100

This still works well enough, but, if a window has a decoration (like firefox has) it is being treated as part of the window, leaving you with a window slightly smaller than intended.

Is there a way to move the window such that the client area of the window starts at the given coordinates, not the window border?

As far as I know, this is not possible as Firefox does not accept commands to control the window. That’s also (mostly) the responsibility of the window manager, so I doubt that there ever will be parameters to do that. However, you can control the window with wmctrl, but that’s going to be a little bit difficult:

#!/usr/bin/env bash firefox -new-instance -new-window "http://www.reddit.org" & # Process ID of the process we just launched PID=$! # Window ID of the process. pray that there's # only one window! Otherwise this might break. # We also need to wait for the process to spawn # a window. while [ "$WID" == "" ]; do WID=$(wmctrl -lp | grep $PID | cut "-d " -f1) done # Set the size and location of the window # See man wmctrl for more info wmctrl -i -r $WID -e 0,50,50,250,250 

There might be more clever ways to do it, and there are some interoperability issues with Firefox (e.g. that no other instance is running) but it should get you going.

Читайте также:  Проверить версию jdk linux

Just a little note. The resizing won’t work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.

Thanks for your answer! On Ubuntu 18.04.3 I had an error with the code; suggest shebang #!/bin/bash at beginning of code for concerned users.

This doesn’t solve the problem of the position, but at least you can set dimensions :

firefox -width 200 -height 500 

In the past I have created an HTML document that would set the window size with Javascript then redirect to the page I wanted. It’s a stupid hack but, hey, it works.

Looks like this doesn’t work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.

I do this all the time. I use DevilsPie2, however, because it’s more robust. It uses the LUA scripting language, which isn’t very difficult.

Here’s my lua script for Thunderbird, which I want to open on the far left monitor (laptop screen) when it opens:

if (get_window_name()=="Mozilla Thunderbird") then pin_window() set_window_geometry( 50, 10, 1220, 780 ) end where 50 = X coordinate (for upper-left corner of the window) 10 = Y coordinate ( " " ) 1220 = window width 780 = window height 

To set this up, you create a directory in your home configuration (on Ubuntu-like distributions) named devilspie2, eg /home/$USERNAME/.config/devilspie2

For Thunderbird, I created thunderbird.lua, though the filename doesn’t matter. I have a different filename for each application though you can put everything into one script file if you wish. Set devilspie2 to start automatically when you login, eg /home/$USERNAME/.config/autostart/devilspie2.desktop

Here’s a link to a good page about various options available to your lua script: https://github.com/gusnan/devilspie2/blob/master/README

One note: The scripts don’t have to be executable. Mine are 664 and work fine. A few of the other programs I control are openconnect, pidgin, RecordMyDesktop, timeshift, xeyes, xload, & yad. I use pin_window on them so they appear on all desktops, plus other commands depending on the application.

Источник

Thread: Change window size using terminal

hellocatfood is offlineFrothy Coffee!

Join Date Dec 2007 Location Birmingham, England Beans 187 —> Beans 187 Distro Ubuntu Development Release

Change window size using terminal

Is there anyway to change the size of a window that’s already open to a specific value? For example, I want to resize the size of an instance of gedit to exactly 100×200. Is there any way to do this?

AlphaLexman is offlineMay the Ubuntu Be With You!

Join Date Apr 2009 Location Midwest, U.S.A. Beans 1,209 —> Beans 1,209 Distro Ubuntu 10.04 Lucid Lynx

Читайте также:  Linux memory usage details

Re: Change window size using terminal

Check out the man page for ‘XResizeWindow’

I’ve never done it but it looks like your solution.

Laptop: Dell Inspiron 8200 — Fedora 13 — Goddard
Desktop: Self-Built — [Ku, Lu, Xu, U]buntu — Lucid 10.04.3 (LTS)
Linux User: 498249 / Ubuntu User: 29241

theneoindian is offline5 Cups of Ubuntu

Re: Change window size using terminal

QuoteOriginally Posted by AlphaLexman View Post

Check out the man page for ‘XResizeWindow’

I’ve never done it but it looks like your solution.

AlphaLexman is offlineMay the Ubuntu Be With You!

Join Date Apr 2009 Location Midwest, U.S.A. Beans 1,209 —> Beans 1,209 Distro Ubuntu 10.04 Lucid Lynx

Re: Change window size using terminal

QuoteOriginally Posted by theneoindian View Post

Yes, it is a function, not exactly a command line answer to the op’s question. But trying to point the op in a new direction for the solution.

Laptop: Dell Inspiron 8200 — Fedora 13 — Goddard
Desktop: Self-Built — [Ku, Lu, Xu, U]buntu — Lucid 10.04.3 (LTS)
Linux User: 498249 / Ubuntu User: 29241

stinkeye is offline

I Ubuntu, Therefore, I Am

Re: Change window size using terminal

wmctrl -r gedit -e 0,-1,-1,100,200

use anything that’s unique to the window’s title
eg if the title bar shows conkyvnstat (~/conky)-gedit
I would just use conkyv

You can also make a bash script set up to a keyboard shortcut
that will resize the active window I use this to resize and move
my active window to the screen centre.

wmctrl -r :ACTIVE: -e 0,400,275,875,550
sudo apt-get install wmctrl
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). Please see the EWMH specification for other values. 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, with the exception that the value of -1 in any position is interpreted to mean that the current geometry value should not be modified.

eudennis is offlineFirst Cup of Ubuntu

Re: Change window size using terminal

That’s great. It’s just what I was looking for. But it didn’t work with Google Chrome yet, but still cool

DarkBowser is offline5 Cups of Ubuntu

ExclamationRe: Change window size using terminal

I have a question related to this: I can’t open Assaultcube because of my resolution.

I try to open it from the terminal and here is what I get:

ryard@ryard-Latitude-2100:~$ assaultcube Using home directory: /home/ryard/.assaultcube_v1.104 current locale: en_US.UTF-8 init: sdl init: net init: world init: video: sdl init: video: mode nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 30 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 30 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 55 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 56 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 59 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 58 nvfx_screen_get_param:95 - Warning: unknown PIPE_CAP 30 X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 129 (XFree86-VidModeExtension) Minor opcode of failed request: 10 (XF86VidModeSwitchToMode) Value in failed request: 0x194 Serial number of failed request: 131 Current serial number in output stream: 133 ryard@ryard-Latitude-2100:~$

Источник

Оцените статью
Adblock
detector