Get Dash instance when creating GNOME Shell Extension - gnome-shell

I'm creating my own extension for GNOME Shell and I run into problem while searching for some documentation of Dash.
I need to find width, height, visibility and position of Dash. But I have been unsuccesful to find some doc at https://gjs-docs.gnome.org/ about Dash at all. Is there any other page, where to find these information? How to get "instance" (object with these properties) of Dash?
EDIT:
I have found that method Main.layoutManager.getWorkAreaForMonitor(0) is the one that solve my problem. It does not returns instance of Dash as I was asking for (because of that I let answer opened), but it returns work-area of screen (work area is Rectangle of monitor size, without Panel and Dash). Access x and y for get left-top corner, width and height for size without Panel and Dash. When Dash is hidding when covered by window, work-area does not take Dash in count. Btw. this is exactly what I was looking for.

Related

printf "\033[8;(width);(height)t" works for a specific height and width but is there something more universal

I have a script which is for running as a first run script on different machines and I don't know ahead of time what the width/height of the monitors will be. What I hoping to find is a command like printf "\033[8;(width);(height)t" which is more universal and will expand the terminal to maximum no matter which size monitor is connected to the computer. I had an escape sequence that worked great, but I lost the script along with the code when one of my drives died (I know, backup, backup, and backup again) and can't seem to find that fix again anywhere.
Using the printf "\033[8;(width);(height)t" escape code sequence works if I know in advance what the height and width of the maximized monitor dimensions are (for instance using printf "\033[8;58;238t" will work on my 1920x1080 monitor just fine and will expand as expected) but it is not enough for a larger monitor. Using tput cols and tput lines will give me what the current window dimensions are, but not the maximum dimensions.
I know I can use the keyboard and mouse to do this, but I am strictly looking for something that will expand the window without any other input or key presses, if for no other reason than knowing how to do it and making it work. This needs to execute at the beginning of a bash script on a fresh Ubuntu flavor installation (the script does unique installations and updates). It might be able to work if I could figure out how to get the maximum terminal size possible of a screen into a variable to be used in the code mentioned above.
I have tried echo -ne '\e[9;1t' and printf '\e[9;1t', also echo -ne '\e[10;2t' and printf '\e[10;2t' escape codes to no avail, mentioned at https://terminalguide.namepad.de/seq/ (Control Characters and Escape Sequences) on pages "Alias: Maximize Terminal" and "Maximize Terminal Window". This is one of the few references I can find. Any searching of various ways to ask this question doesn't seem to yield any results and they all seem to rely on knowing ahead of time what the maximum dimensions can be.
Any hints of what I can use for this would be helpful, thank you.
Set the size to a number that is guaranteed to be larger than any existing screen. Pad it some to accommodate for rapidly increasing screen resolutions:
printf "\033[8;99999;99999t"
The window manager should truncate the size to the maximum available area.

How to measure margin between font-elements in XD?

It seems not possible to view the exact margin between font-elements in XD (dev-view). Below you'll find a screenshot of a situation where we need to measure the exact distance between two Font-elements (XD developer-view).
It needs to bypass the line-height, but it doesn't. To be able to do this, we need the line-height to be zero. But when we edit the line-height in XD for a word or sentence on a single row, XD does not change that line-height.
Anybody encountered the same situation?
In this example the line-height is 32. We go to XD. Change it to zero, save it and SHARE FOR DEVELOPMENT. But the line-height remains 32. Also changing it to 1 instead of zero won't make any difference.
To fix this issue, you have to select the Text within Adobe XD. Right Click and select Path > Convert to Path. The margins around the Text will disappear and when in DEVELOPMENT view it becomes possible to see the right margin. A small problem remains. When you want to edit the text when it's a shape, you have to delete it and place a new text and turn it into a shape again. the text when converted to a shape
The default selector in Adobe XD will not give you the exact margin between two text. You have to convert the text layer into paths (Convert to Outlines) to get the exact margin.
But remember after converting text layer into path the text cannot be edited because now the letter are separate vector shapes.
To convert text layer into Path, select the layer and goto Object>Path>Click Convert to Path
You can use the Guides to drag one below your text and another one on top of the second text, and then you can see the distance between the 2 guides.
Check this youtube video for a quick tutorial on it. This is going to be a manual action. I don't think there's a key to press to check the distance automatically.

Get mouse position in pixels using escape sequences

I'm trying to obtain the position of the mouse in pixels within an application running in a terminal.
The top answer to how to get MouseMove and MouseClick in bash? explains how to get the mouse position, counted in character cells, not in pixels.
I'm looking for a solution which also works if the app is running on a remote server and accessed via SSH (using xdotool will not work in this case, unless ssh -X was used).
I guess the solution will therefore involve escape sequences or an IOCTL.
It's okay if the escape sequences only work with one or few terminal emulators (I can use a detection mechanism to provide a fallback on the terminals which lack support for the escape sequence).
If the escape sequence only works on a few terminal emulators, I'm also curious to know the "group" of escape sequences that allow graphical output on these terminals (e.g. Sixel, Tektronix or ReGIS).
The goal is to embed small GUI elements in mostly text-based applications. It is currently possible on quite a few terminal emulators using Sixel, Tektronix or ReGIS do draw things, and \e[1000h or similar escape codes to get mouse events, unfortunately these mouse events are low-resolution (the coordinates in character cells, not in pixels).
xterm reports the mouse position with pixel resolution with the following escape sequences:
switch on pixel resolution: \e[2;1'z
report mouse position: \e['|
Details are described at http://invisible-island.net/xterm/ctlseqs/ctlseqs.html

VIM center text to screen, with left and right inactive borders

I use vim to edit text files. My screen is too wide and it's cumbersome to always look near left border of screen when editing. If you open a document in MS Office, the page is "centered" instead of left-aligned, and has non-active area borders on RHS and LHS. How do I get similar behavior from vim?
Here are a couple approaches that won't work too well:
First, if you read VIM: Show a 3 character border on left of window or MacVim: how do I set a left gutter (margin) for my buffers?, you might try this:
:set foldcolumn=50
This won't work, because the maximum value of foldcolumn is limited to 12.
Second, if you read How to create a border between the line numbers and text in Vim, you might try using numberwidth instead of foldcolumn:
:set numberwidth=50
But this won't work either, because the maximum value of numberwidth is limited to 10.
The best approach that will work, as far as I've been able to find, is https://superuser.com/q/537584/376367. See that question's answer for more details, but the summary is: create two vertical splits, and edit your file in the middle. If the vertical divider lines and tildes bother you, you could hide them with:
:highlight VertSplit guifg=bg guibg=bg
:highlight NonText guifg=bg
Caution: if you use listchars, they also use NonText highlighting and will also be hidden by this trick.
A plugin which centers the text and removes distractions for you is Goyo, especially useful in combination with Limelight.

What is a robust method for capturing screen of child window in Windows 7?

Pardon my frustration. I've asked about this in many places and I seriously don't think that there wouldn't be a way in Windows 7 SDK to accomplish this.
All I want, is to capture part of a 'child window' ( setParent() ) created by a parent. I used to do this with bitblt() but the catch is that the child window can be any type of application, and in my case has OpenGL running in a section of it. If I bitblt() that, then the OGL part comes blank, doesn't get written to the BMP.
DWM, particularly dwmRegisterThumbnail() doesn't allow thumbnail generation of child windows. So please give me a direction.
Thanks.
It's been a while since I did any of this, so my explanation might be a bit vague, but from what I remember, the Windows doesn't "see" the OpenGL rendered inside the window.
What Windows does is create the window at the specified size and then "hands it over" to OpenGL for rendering. This means that you can't get at the pixels as rendered from the Windows side of the code.
When we wanted to capture the 3D we had to re-render the screen to an off screen bitmap which was then saved (or printed).
Obviously a whole screen capture (Print Screen) works because it's reading the final pixels.
I suggest that you:
Forget the Thumbnail part of the task (in terms of capture).
Calculate where your window is.
Capture full screen.
Excise the area you are interested in (using data from step 2).
Rescale to the appropriate thumbnail size.
Sorry, its more work, but it should work, which is better than what you have right now.
This may help:
http://code.google.com/p/telekinesis/source/browse/trunk/Mac/Source/glgrab.c?r=140
http://www.codeproject.com/KB/dialog/screencap.aspx
Also Java's Robot class (http://java.sun.com/javase/6/docs/api/java/awt/Robot.html#createScreenCapture%28java.awt.Rectangle%29)
I don't have access to the source code of any child window that may be open including the one with OpenGL

Resources