I am trying to write a script to let me start a set of terminals of specific size at a specific position on screen (for instance, four terminals spread across my screen in a grid model each active). If there is already a tool that can do this, that would be great too... Any suggestions?
I'm sure there will be better answers but one thing I did find useful was this:
gnome-terminal --geometry=130x25+20+525
So on my large monitor, the following is giving me two nice terminals:
#!/bin/sh
gnome-terminal --geometry=150x125+20+25
gnome-terminal --geometry=150x125+1020+25
And the following is the explanation from the man page for quick reference:
-geometry WIDTHxHEIGHT+XOFF+YOFF
(where WIDTH, HEIGHT, XOFF,
and YOFF are numbers) for specifying a preferred size and location for
this application's main window.
The WIDTH and HEIGHT parts of the geometry specification are usually
measured in either pixels or characters, depending on the application.
The XOFF and YOFF parts are measured in pixels and are used to specify
the distance of the window from the left or right and top and bottom
edges of the screen, respectively. Both types of offsets are measured
from the indicated edge of the screen to the corresponding edge of the
window. The X offset may be specified in the following ways:
+XOFF The left edge of the window is to be placed XOFF pixels in from
the left edge of the screen (i.e., the X coordinate of the win-
dow's origin will be XOFF). XOFF may be negative, in which
case the window's left edge will be off the screen.
-XOFF The right edge of the window is to be placed XOFF pixels in
from the right edge of the screen. XOFF may be negative, in
which case the window's right edge will be off the screen.
The Y offset has similar meanings:
+YOFF The top edge of the window is to be YOFF pixels below the top
edge of the screen (i.e., the Y coordinate of the window's ori-
gin will be YOFF). YOFF may be negative, in which case the
window's top edge will be off the screen.
-YOFF The bottom edge of the window is to be YOFF pixels above the
bottom edge of the screen. YOFF may be negative, in which case
the window's bottom edge will be off the screen.
This approach is very simple and using a command like this:
gnome-terminal -x sh -c "ls|less"
In addition to the above commands, one can do even more fancy things :) For instance, you can make it launch itself into a specific directory (very useful if you're editing source code in one window and debugging using the other like I am).
Terminitor is a project that addresses this: https://github.com/achiu/terminitor
Unfortunately, it doesn't have gnome-terminal support yet (just OS X and Konsole).
Terminator has such a feature.
Related
When I open a file-chooser window (floating), it opens in a way that the superior part is out of the screen, as shown below.
Is just noticed this only happens in my secondary monitor with lower resolution:
➜ xrandr G conn
eDP-1 connected primary 2256x1504+0+0 (normal left inverted right x axis y axis) 285mm x 190mm
DP-1 connected 1920x1080+2256+0 (normal left inverted right x axis y axis) 476mm x 268mm
Is there a way to configure the file-chooser (or any floating windows) so it is always centered? Or at least to fit in the lower resolution?
I had the exact same problem. I fixed it by restricting the max size of floating windows by adding the following line to my i3 config file:
floating_maximum_size 640 x 480
However this does, as it says, restrict the maximum size, so it will stop a floating window being opened larger than that size as well as also not allowing you to resize it any larger than that manually, which might not be what you want. It's what I use though.
I wonder about this bottom and left gap, and also wanna remove it
It occurs only when i open "vim", not Iterm itself
Is there any solution?
The general principle is that the screen of a terminal emulator is a grid where each cell has the same dimensions as the others and those dimensions are determined by the font and font size used. If the window's dimensions and the grid's dimension are incompatible, then the window can't be filled with the grid and you have that kind of gap.
In this case, the cell dimensions are 16px * 38px so the grid can only fit in a box whose dimensions are a multiple of 16 in width and a multiple of 38 in height.
Now, your screen's dimensions appear to be 1630px * 2862px, which is rather unusual. The width is not a multiple of 16 and the height is not a multiple of 38, so, with your current font settings it is impossible to fill the screen.
For that to be theoretically possible, you would need font settings that make individual cells 16.3px wide and 38.16px tall, or some other "impossible" ratio.
Note that you also have a padding, here, that effectively prevents the grid to ever fill the window anyway.
None of that is really a problem when the program you run in your terminal emulator doesn't paint the background of those cells but your Vim colorscheme does, which makes the effect described above apparent.
The only practical workarounds are:
Define the same background in Vim and in your terminal emulator.
Make Vim's background transparent.
I'm playing about with the most recent NSDocument in a Swift document-based-app. One thing that's a bit odd is that the starting location for a new window is near the bottom of the screen.
Playing with the Storyboard a bit, its not clear how to use the built-in settings to come up with a reasonable "near the top" selection - the setting moves up from the bottom, not down from the top, so the position would change depending on the screen size?
I assume there's a position mechanism I can hook, but it's not obvious in the shell code that's supplied. Any hints?
OS X coordinate system is flipped in contrast to iOS. So the 0,0 is the bottom left corner.
You can calculate the position of your window in similar manner (any screen size)
CGFloat width = NSWidth([self.window screen].frame);
CGFloat height = NSHeight([self.window screen].frame);
[self.window setFrame:NSMakeRect(100, height - 100, width, height) display:YES];
Most easiest is to set initial height to 900 and forget about it and enable window restoration -> this will cause to open the window where it previously was and this is where it user wants.
Select your window in Storyboard. And fill initial position coordinates
# xdotool --version
xdotool version 2.20110530.1
# wmctrl --version
1.07
# bash --version
GNU bash, version 4.1.10(1)-release (i586-suse-linux-gnu)
I have been playing around with the Commands wmctrl and xdotool for rearranging/moving windows around the desktop. And I was wondering if it's possible to use, for example, the bottom-left Corner as the transformation point for where I want that point to end up..?
For example, if wanted to move the current window to point 100,1000 (*i.e. X-Axis=100 and Y-Axis=1000), but instead of using the top-left corner as the point that will end-up at 100,1000, I want to use current window's Bottom-Left corner instead...
Is this possible to specify this with either of these commands?
I know I could probably do this with some math equations by getting the geometry of the window and then subtract or add the height of the window (*i.e. the y-axis) from the coordinate, in order to modify where the top-left corner would be, in essence putting the bottom-left corner where I want it. But in actuality I'm moving the top-left corner, but making it seem like I'm moving it using the bottom-left corner instead.
I know this isn't the same thing, but I saw you can use the "--polar" option (*moving with degrees instead of px) with the "--window" option to use the center of the window as the point of origin... But, nothing to really specify a different corner as the transformation point...
Or maybe there is another command other then the wmctrl or xdotool command to accomplish this...
Any thoughts or suggestions would be greatly appreciated!
Thanks in Advance,
Matt
I have a chart show info of apps, but when run it on devices android. The position of text on chart not consistently.
These images illustrate the problem: https://drive.google.com/folderview?id=0B7-CxJHQ5ZnjYjVlTlFQdElWRGM&usp=sharing
I use TextLabelWidget in AndroidPlot. How to keep position of TextLabelWidget on chart with the same image1 in link above on devices?
The problem appears to be that your plot area is set to fill the width of the screen and since the bars are evenly distributed in that space, their x positions are essentially fractions of the screen width.
At the same time you have labels that appear to be positioned using absolute positioning. As an example, this code will position 4 labels at 0%, 25%, 50% and 75% screen width, 80 pixels down from the top of the screen:
txtWidget1.position(0, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget2.position(0.25f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget3.position(0.50f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget4.position(0.75f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
There are some other factors that you are also probably going to need to deal with such as bar width but this should get you closer. You may find this doc useful as far as a guide for the different positioning methods.
Another tool to consider using if you aren't using it already is the Configurator. This will let you set your positions etc. inside xml and override values based on screen size, orientation, etc.