0

So I've run into an issue where whenever I set the WindowTypeHint to anything other than normal the window just disappears. I've verified the hint type with print.Below is my sample code

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk

# Create the main window
class MyWindow(Gtk.Window):
    def __init__(self):
        super().__init__(title="Hello World")
# Innitially setting the bar to off
        self.set_decorated(False)
# Attempting to set window type to prevent minimizing when show desktop is hit and to stay behind other objects etc.
        self.set_type_hint(Gdk.WindowTypeHint.DOCK)
# Defining the button and drawing it
        self.button = Gtk.Button(label="Click Here")
        self.button.connect("clicked", self.on_button_clicked)
        self.add(self.button)

# define the button functions
    def on_button_clicked(self, widget):
        if win.props.decorated == False:
            win.set_decorated(True)
        else:
            win.set_decorated(False)
        print("Hello World")
        print(win.props.decorated)
        print(self.props.type_hint)

# Set alias for the window
win = MyWindow()

# Testing. Print the hint type to console
print(win.props.type_hint)

# Window settings. 
win.set_keep_below(True)
win.connect("destroy", Gtk.main_quit)
win.show_all()
print(win.props.type_hint)
Gtk.main()

Window to appear as a dock on the desktop where the mouse pointer is or in the corner of one of the monitors the same way glava works with it's settings.

Shimo
  • 1
  • 1

1 Answers1

0

Item was drawing off screen. Multiple monitors had it throwing the item into the corner off screen between them. If anyone else comes across this I resolved it by setting the coordinates with self.move(x, y) in the initialisation. Found where I wanted it to root with win.get_position() on button press to find where I wanted it.

Shimo
  • 1
  • 1