i3wm opacity with Compton - opacity

Everything in my Compton config works fine except for the opacity-rule
active-opacity = 0.75;
inactive-opacity = 0.75;
opacity-rule = ["90:class_g = 'google-chrome'"];
I am using Compton from the Arch repos.
I can't find much documentation, I am just wondering if the newest version works differently than it used to? (I remember this working at one time)
Any advice would be appreciated.

Possibly this is problem -
Let’s face it: Using transparency (or ARGB background with transparent parts) on any window decorated by i3 is known to break.
The problem is in how i3 adds title bars to windows. Unlike most window managers, i3 creates a completely separate window for the title bar (rather than wrapping it inside a frame window that contains both the application window and its title bar). So the first problem comes up: When using -i (inactive-opacity), the window and its title bar are not associated, and we frequently can’t give the title bar the correct opacity.
(from https://github.com/chjj/compton/wiki/faq#3-why-does-transparency-not-work-correctly-in-i3).

Related

How to handle window resizes in GTK4?

I am trying to build a virtualized grid container to display 100k+ files in PyGTK 4 on Fedora 35. I succeeded in creating the layout and scrolling support which works beautifully.
In order to support resizing of my application window, I need to react to changes its size. I already connected to the notify signal of the window and handle the default-width, default-height, maximized and unmaximized events to update the geometry of my layout. However, everytime I invoke get_width() of my widget/app window after the maximized event I only get the width before the window was maximized! Is this by design?
I've been trying pretty hard but I fail to come to a working solution for this simple problem. Can anyone help me?
Edit
Here is some code to outline how I am trying to measure the window size. I modified the code to use connect_after instead of connectas proposed by #GüntherWagner. However, the behavior is the same for both methods:
class TestLayout(Gtk.ScrolledWindow):
def on_realize(self, widget):
...
self.get_root().connect_after('notify', self.on_notify)
def on_notify(self, widget, param):
if param.name in [..., 'maximized', 'unmaximized']:
self.draw()
def draw(self):
self.width = self.get_width()
self.height = self.get_height()

Unity editor - How to stop field from turning blue when its edited

I am making a tool in Unity to build your project for muliple platforms when you press a button.
I started with the preferences window for the tool, and came up with an anoying thing. Whenever I change the enum value of the EnumPopup field, the field turns blue in the editor window. Is there a way to disable this?
See how in the 2nd picture the field is not blue, and in the 3rd picture the field has changed to blue? How do I prevent this from happening?
Thanks in advance!
Difficult to help without having the rest of your code.
This is Unity built-in behaviour. I tried a lot of stuff see here to disable / overwrite the built-in coloring of prefix labels but had no luck so far.
A workarround however might be to instead use an independent EditorGUI.LabelField which will not be affected by the EnumPopup together with the EditorGUIUtility.labelWidth:
var LabelRect = new Rect(
FILEMANAGEMENT_ENUMFIELD_RECT.x,
FILEMANAGEMENT_ENUMFIELD_RECT.y,
// use the current label width
EditorGUIUtility.labelWidth,
FILEMANAGEMENT_ENUMFIELD_RECT.height
);
var EnumRect = new Rect(
FILEMANAGEMENT_ENUMFIELD_RECT.x + EditorGUIUtility.labelWidth,
FILEMANAGEMENT_ENUMFIELD_RECT.y,
FILEMANAGEMENT_ENUMFIELD_RECT.width - EditorGUIUtility.labelWidth,
FILEMANAGEMENT_ENUMFIELD_RECT.height
);
EditorGUI.LabelField(LabelRect, "File relative to");
QuickBuilder.Settings.Relation = (QuickBuilder.Settings.PathRelation)EditorGUI.EnumPopup(EnumRect, QuickBuilder.Settings.Relation);
As you can see the label is not turned blue while the width keeps being flexible
Sidenotes
Instead of setting values via edito scripts directly like
QuickBuilder.Settings.Relation = you should always try and use the proper SerializedProperty. It handles things like Undo/Redo and also marks the according objects and scenes as dirty.
Is there also a special reason why you use EditorGUI instead of EditorGUILayout? In the latter you don't need to setup Rects.
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField("File relative to", GUILayout.Width(EditorGUIUtility.labelWidth));
QuickBuilder.Settings.Relation = (QuickBuilder.Settings.PathRelation)EditorGUILayout.EnumPopup(QuickBuilder.Settings.Relation);
}
EditorGUILayout.EndHorizontal();

How to add a "tutorial message div" to figures?

After installing R2018b, the first figure I opened contained an interesting message (shown in blue):
The reason it's interesting is because it contains features like text wrapping, transparency, the fact that the image maintains a constant width even though the text resizes (this reminded me of CSS3 flexbox, hence the tag), etc.
The last part of the animation is in slow motion, to better show how the div's size follows that of the figure.
In case it matters, I'm using Win 10 v1803.
Question:
I'd like to know how we can draw similar, custom, divs (for a lack of a better word) in our figures. (It's important to stress that this is not a UIFigure!)
What I found so far:
The Learn More link opens the page:
web(fullfile(docroot, 'matlab/creating_plots/interactively-explore-plotted-data.html'))
yet breakpoints in the entry points of either web or docroot (or even doc) aren't hit.
Assuming that this element is a Child of the figure, I attempted to locate a handle to it:
>> set(gcf,'MenuBar','none'); findall(gcf)
ans =
22×1 graphics array:
Figure (1)
ContextMenu
AnnotationPane
Axes
AxesToolbar
Text
Text
Text
ToolbarStateButton (Brush/Select Data)
ToolbarStateButton (Data Tips)
ToolbarStateButton (Rotate 3-D)
ToolbarStateButton (Pan)
ToolbarStateButton (Zoom In)
ToolbarStateButton (Zoom Out)
ToolbarPushButton (Restore View)
Button
Button
Button
Button
Button
Button
Button
however, making these controls invisible using set(h(2:end), 'Visible', false) didn't make the div disappear.
Saving the figure as .fig or generating code for it, doesn't leave any trace of this div.
When uiinspect-ing the figure, this div doesn't show (or at least, I couldn't find it).
I don't know what exactly I did to make it reappear once more, but since it's set to appear on the very first time you boot R2018b, I suspect deleting prefdir (obviously, after backing it up) and restarting MATLAB could bring it back.
The only thing I didn't try yet, is to attach a java debugger to MATLAB and attempt to trace the caller to com.mathworks.mlservices.MLHelpServices.setCurrentLocation (from mlservices.jar), which opens the help browser.
After some digging in the Java side of things (starting from findjobj, followed by a lot of .getComponent(0).getComponent(0)...), I've finally managed to locate the component in question. Here's what I learned:
This component is called InfoPanel, and is part of MATLAB's Java API. The class definition itself is found in:
MATLAB/R2018b/java/jar/hg.jar!/com/mathworks/hg/util/InfoPanel.class
To make it appear, we need to call the static method addBannerPanel, passing in a figure handle:
com.mathworks.hg.util.InfoPanel.addBannerPanel( figure(randi(1E4)) );
Or another signature that also accepts a custom panel:
jIP = com.mathworks.hg.util.InfoPanel;
jIP.setBackground(java.awt.Color(0.8, 0.7, 0.1));
com.mathworks.hg.util.InfoPanel.addBannerPanel( figure(randi(1E4)), jIP );
The MATLAB setting that controls whether this should appear is showinteractioninfobar inside the <prefdir>/matlab.settings XML.
It appears that the "interesting parts" of InfoPanel are private, which means it allows barely any customization (mostly some colors; not the string or the icon), but it should be fairly easy to make a copy of this class and expose all elements we need.

How To Position a Picture on A Second Page Of A Word Document VB6

I am making a program that repeatedly creates pages of an undefined quantity, and on the top of all the pages is a logo that is in a certain position. If I have everything in a for loop and at the end I include these commands to make a page break:
Set oRng = oDoc.Bookmarks("\EndOfDoc").Range
oRng.InsertBreak
The second time (and subsequent times) the table I make goes on the the next page, but the image does not. I have tried setting the "top" property to
distFromTop + pageLength * pageNumber.
I would assume it might have to do with the anchor property, but I have no idea what data type that even gets or how it affects the placement
I insert the image using:
oDoc.Shapes.AddPicture "C:\Users\name\Desktop\file.jpg", , , CentimetersToPoints(1.3), CentimetersToPoints(0.9 + pageLength * j), CentimetersToPoints(6.1), CentimetersToPoints(2.9)
The picture adds multiple times, but both to .9 from the top on the first page and 1.3 from the left, on the first page.
How can I make the pic go .9 from the top of a certain page
EDIT: I would like to avoid putting it in a header because that would mess up the alignment of the other elements of the doc
Ok, So what worked for me was this:
Set oRng = oDoc.Bookmarks("\EndOfDoc").Range
oRng.InsertBreak
oDoc.Shapes.AddPicture "C:\Users\me\Desktop\file.jpg", , , CentimetersToPoints(1.3),
CentimetersToPoints(0.9), CentimetersToPoints(6.1), CentimetersToPoints(2.9),
oDoc.Bookmarks("\EndOfDoc").Range
I still don't quite understand why it works, because the documentation for a range objects / anchors was fairly hard for me to understand... I tried this out and this worked. For my purposes that worked, but if anyone knows why that works I would love to know
Thanks for your answers

gtkmm button not maintaining size and location

I have created two gtkmm button and added to HBox object. I called pack_end, and maintained the size as 21,20. But, the sizes are not maintained. Here is the code i have written and the window that i got while running the program.
Note: MYWindow is subclass of Gtk::Window
void MYWindow::customizeTitleBar()
{
//create a vertical box
Gtk::VBox *vBox = new Gtk::VBox(FALSE,0);
//create a horizontal box
Gtk::HBox *hBox = new Gtk::HBox(TRUE,0);
hBox->set_border_width(5);
//create title bar image
Gtk::Image *titleBarImage = new Gtk::Image("src/WindowTitleBar.png");
titleBarImage->set_alignment(Gtk::ALIGN_LEFT);
// hBox->pack_start(*titleBarImage,Gtk::PACK_EXPAND_WIDGET,0);
//create cloze button for window
mButtonClose = new Gtk::Button;
(*mButtonClose).set_size_request(21,20);
Gtk::Image *mImage = new Gtk::Image("src/Maximize.jpeg");
(*mButtonClose).add(*mImage);
(*mButtonClose).set_image_position(Gtk::POS_TOP);
// connecting close window function when cliked on close button
//(*mButtonClose).signal_clicked().connect( sigc::mem_fun(this, &MYWindow::closeWindow));
hBox->pack_end(*mButtonClose,Gtk::PACK_EXPAND_WIDGET,0);
Gtk::Button * mBtton = new Gtk::Button;
mBtton->set_size_request(21,20);
Gtk::Image *img = new Gtk::Image("src/Maximize.jpeg");
mBtton->add(*img);
mBtton->set_image_position(Gtk::POS_TOP);
hBox->pack_end(*mBtton,Gtk::PACK_EXPAND_WIDGET,0);
vBox->add(*hBox);
//drawing area box
Gtk::HBox *hBoxDrawingArea = new Gtk::HBox;
Gtk::DrawingArea *mDrawingArea = new Gtk::DrawingArea;
hBoxDrawingArea->pack_start(*mDrawingArea,Gtk::PACK_EXPAND_WIDGET,0);
vBox->add(*hBoxDrawingArea);
//status bar hBox
Gtk::HBox *hBoxStatusBar = new Gtk::HBox;
vBox->add(*hBoxStatusBar);
this->add(*vBox);
this->show_all();
}
I am not yet a gtk expert (but I'm learning), here's one thing you can try, which is what I've been doing.
Make a little standalone project using glade. Glade makes it really easy to screw around with all the packing settings so you can immediately see the effects of your changes.
I think in the case of resizing the window, you'll have to save the glade file and run your program (using gtkbuilder to render the glade file) and manually resize the window to see the effect, but once you make the standalone project, you can use it for other gtk testing.
And if you're like me, you'll get swayed by the wonderfulness that is glade and build your whole system that way.
But basically, it sounds like a packing issue, because I've got buttons that don't resize all over the place.
As for not moving, I'm not sure you can do that, but again I'm not an expert. I think you should be able to pin the size of some if not all of the hbox pieces so that the button inside them will not move, but I'm not sure what happens if you don't have any hbox parts that can't be variably sized to take up the slack when you grow the window.
Again, sounds like something fun to try in glade. :-)
I think you pack to FALSE , Maybe this is the problem :
Gtk::HBox *hBox = new Gtk::HBox(TRUE,0)
I use python gtk with something like this:
box1.pack_start(box2,False)