File chooser windows above top of the screen in alternate screen using i3 - i3

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.

Related

TM-U220B escpos supporting the bigger font size (Python3)

Is there any possible way to print bigger font size in TM-U220B by using escpos (Python3) ? I have tried so many time and yet still cannot print bigger font size or image as well.
Thank you very much if you could helped me.
Only the following commands can be used with TM-U220.
It seems that you can specify 3 types of double width, double height, and double width height, but it may not be supported.
Please try it.
It may be possible to double width.
ESC !
There are two types that can be specified for image printing: 8-dot single-density or 8-dot double-density.
And it seems that it only expands in the width direction, not in the height direction.
ESC *
FS q [obsolete command]
FS p [obsolete command]
Please click the TM-U220 button in the Select your printer model [-] table on each of the above pages for model-dependent details.
In addition:
This is a QA article for other POS apps, but it seems that enlarged printing is possible.
Epson TM U220 font size

How to select output monitor to display?

workdir$ xrandr | grep -i connected
DVI-I-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm
DP-3 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 476mm x 267mm
from above output we can confirm that I have two monitors connected.
I have wrote small xlib application which displays "hello world" on screen.
Sample Code:
https://www.lemoda.net/c/xlib-text-box/
output comes on one monitor ,but I need to display it on another connected monitor.
enter code here
Now issue was application always shows the display on DP-3,but I want to show the application on DVI-I-1 monitor,how to do?
I have tried to change input argument of XOpenDisplay but it fails with "could not open display".
Also tried changing the primary monitor status to DVI-I-1 but still it didn't work out

SDL2 virtual pixel size

If I let SDL create the window to default dimensions, I get 1024×768, and everything looks normal. If I explicitly create it with dimensions of 1024×768, everything looks normal. But if I explicitly created with dimensions of 512×384, instead of getting a window with less pixels, I get a window in which every pixel is shrunk, but the logical size of the window is still 1024×768. Is this logical size hardwired into SDL2 in some way?
But no! I wanted fewer pixels, not smaller pixels. I want my pixels to still be the size they really are on the screen. If I draw a line from (0,0) to (511, 383) wanted to go the full diagonal extent of my window. What other function do I need to use alongside of SDL_CreateWindow to achieve this result?
1024x768
512x384, code assuming that 512x384 is logical window size
Thanks, Nelxiost, for provoking me to find my own answer. Here is the key code, omitting error handling code in between:
gWindow = SDL_CreateWindow(title, 1024, 768, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, 0);
gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED |
SDL_RENDERER_TARGETTEXTURE);
target = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA8888,
SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT);
and here is the corrected last line of the code:
target = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_RGBA8888,
SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH/2, SCREEN_HEIGHT/2);
Summary: if you want one logical pixel to equal one physical pixel, create the target texture with the same dimensions as the window.
On the other hand, if you want the logical dimensions of the window to be invariant regardless of the size of the window, create the target texture with those dimensions in all cases.

How do you run an application in bash and select which monitor it runs on?

I have a question that is hard to search for the answer (I always end up with answers for monitor manipulation). I am writing a bash shell script to help me with my code dev and I have two monitors.
When I run my executable that I have compiled I want to tell it to run on a particular monitor (i.e. different to the monitor that I have my terminal open on so I can view the debug on one screen and have the app on another).
How would I go about doing this? Something like:
./myProject > but run on monitor 2
Where myProject is my binary executable.
Thanks all.
If you run separate displays on each monitor (less likely these days), the DISPLAY environment variable is what you want.
If you use Xinerama (spreading one logical display across multiple monitors), however:
Aside: X11 vocabulary: A "display" is one or more "screens" with input devices; e.g. keyboard and mouse, a.k.a. a "seat." A "screen" is a logical canvas that is partially or completely displayed on one or more "monitors;" when using multiple monitors for one "screen," the windows can be partially displayed on each monitor, but share the same X11 DISPLAY identifier; this is called Xinerama. The DISPLAY format is host : display-number . screen-id, so e.g. on my Xinerama set-up both monitors are part of screen 0 on a display number that counts up from 0 with each logged-in user on the same host. "Seats" are logical groups of monitor+input that are using different hardware; multiple "displays" can occur using "virtual console" switching, which is how Gnome and KDE allow multiple users to sign in on a single "seat" machine.
Most GUI toolkits allow you to specify the window's geometry using the --geometry or -geometry switch.
Qt uses the older MIT-style -geometry form. GTK+/Gnome uses the GNU-style --geometry.
This assumes that you're allowing Qt to post-process your command-line, e.g. passing argv into QtApplication or similar.
The “logical display” will have a resolution which is the sum of the resolutions in each direction of the arrangement of your monitors. For example, I have 2 × 1920×1080 displays hooked up right now. xrandr reports:
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 8192 x 8192
To display a window on the right-hand monitor, I can give a geometry string that has its x co-ordinates between 1920…3839 (inclusive).
The usual format is: width x height ± x-offset ± y-offset ­­— but the width and height are optional, if you prefer to take the defaults. The ± are + to count relative to the top/left, or - to count relative to the bottom/right.
So, for example:
gedit --geometry 800x600+1920+0 # set size at top-left of right screen
gedit --geometry +1920+100 # default size at top-left of right screen
gedit --geometry -0+0 # default size at top-right of entire display
Unfortunately, the only programmatic way I know of to determine the area of the display on each monitor from the shell would be to parse the output from xrandr; e.g.
$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 8192 x 8192
LVDS1 connected (normal left inverted right x axis y axis)
1366x768 60.0 +
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
VGA1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm
1920x1080 60.0*+
1680x1050 60.0
1280x1024 60.0
1440x900 59.9
1280x720 60.0
1024x768 60.0
800x600 60.3
640x480 60.0
720x400 70.1
HDMI1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 287mm
1920x1080 60.0*+
1680x1050 59.9
1280x1024 60.0
1440x900 59.9
1280x720 60.0
1024x768 60.0
800x600 60.3
640x480 60.0
720x400 70.1
DP1 disconnected (normal left inverted right x axis y axis)
$ xrandr | perl -ne 'if (/(\d+)x(\d+)\+(\d+)\+(\d+)/) '\
> ' { print "$3,$4 - ", $3 + $1 - 1, ",", $4 + $2 - 1, "\n" }'
0,0 - 1919,1079
1920,0 - 3839,1079
(You'd normally want to avoid splitting the Perl one-liner across two lines in the shell, but the '\…' trick there is to make it legible on SO.)
The --geometry answer given above and accepted simply won't work in many cases...
There are a lot of near-identical questions like this floating around the various StackExchange sites & AskUbuntu, the answer I've eventually found (on a Linux Mint distro based on Ubuntu 14.04) is to use wmctrl. I'm leaving an answer just since no one else has mentioned it on this thread.
(There's another called Devil's Pie and another called Compiz if you search for those too you'll find the Q&A's I'm talking about)
wmctrl is the sort of simple unix tool you're probably looking for if you're writing Bash scripts. I also saw someone suggest using xdotool, depends what the specific goal is.
wmctrl offers window matching by window title or pid (not compatible with all types of X-managed windows)
Some helpful resources:
wmctrl man page
user doc 1
user doc 2
“How to shift applications from workspace 1 to 2 using command?"”
More specific answer RE: specifying the dimensions
“Both wmctrl and xdotool work fine if you set a window maximized.”
I connect a second monitor on the left or on the right depending on where I'm working each day, and I think the solution for me will involve
finding the dimensions from xrandr (as shown in BRPocock's answer),
parsing that to tell which is the external connected monitor (VGA/HDMI etc.) rather than the inbuilt one,
specifying a dimension to give to a maximised window on the connected screen (i.e. the left/right/top/bottom offset, which will change according to side of the screen being used)
Leaving my notes and [eventually] some code produced here in case it's useful to anyone else.
Use a fifo
open a terminal window on the monitor you want the output to appear on and do
mkfifo /tmp/myfifo
cat /tmp/myfifo
then on the source terminal do
./myProject >/tmp/myfifo
This assumes it is a console app. If it is graphical then you will need another approach, which will be dependent on what windowing manager + toolkit you are using.
All you need to do is set the DISPLAY environmental variable prior to running your application.
To find out what you need to set it to, run the following on the monitor you want it to show up on:
echo $DISPLAY
You should see, for example :0.1 or :0.0.
Then you can specify that you want your app to run on that display like so:
DISPLAY=:0.1 ./my_app
As your application uses QT, you are probably using KDE. In System Settings > Window Behavior > Advanced, set Placement to Under Mouse. Click the desired monitor, ALT+Tab to switch to your terminal, and start the program.

Starting terminals in a specific way?

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.

Resources