Example #1
0
    def create_window(self, argv, descriptor):
        """
        Create application main window as the Gtk.Window.

        :param: argv: application arguments.
        :param descriptor: general application descriptor.
        """
        gtk_window = Gtk.Window()
        embed = GtkClutter.Embed()
        gtk_window.add(embed)
        gtk_window.stage = embed.get_stage()
        clutter_window = window.Window(self, gtk_window.stage, descriptor)
        clutter_window.wrapper = gtk_window
        gtk_window.stage.set_title('PISAK')
        gtk_window.stage.set_position(unit.MONITOR_X, unit.MONITOR_Y)
        if arg_parser.get_args().debug:
            coeff = 0.7
            size = coeff * unit.w(1), coeff * unit.h(1)
            gtk_window.stage.set_size(*size)
            gtk_window.set_default_size(*size)
            gtk_window.set_resizable(True)
        else:
            gtk_window.stage.set_size(unit.w(1), unit.h(1))
            gtk_window.stage.set_fullscreen(True)
            gtk_window.fullscreen()
        gtk_window.connect("destroy", lambda _: Gtk.main_quit())
        return clutter_window
    def run(self):
        self.running = True

        self.load_options()  # loads from config file
        self.parse_options(
        )  # parses the command-line arguments, these take precedence over the saved config
        self.save_options()
        self.prepare_file_queues()

        self.set_title(self.options.title)
        self.screen = self.get_screen()

        self.embed = GtkClutter.Embed()
        self.add(self.embed)
        self.embed.set_visible(True)

        self.stage = self.embed.get_stage()
        self.stage.set_color(
            Clutter.Color.get_static(Clutter.StaticColor.BLACK))
        if self.options.mode == 'fullscreen':
            self.stage.hide_cursor()

        self.texture = Clutter.Texture.new()
        self.next_texture = None
        self.prev_texture = None
        self.data_queue = Queue()

        self.connect_signals()

        self.will_enlarge = random.choice((True, False))

        self.resize(600, 400)
        self.move_to_monitor(self.options.monitor)

        self.current_mode = self.options.mode
        self.mode_was_changed = False
        if self.options.mode == 'fullscreen':
            self.fullscreen()
            self.set_skip_taskbar_hint(True)
        elif self.options.mode == 'maximized':
            self.maximize()
        elif self.options.mode == 'desktop':
            self.maximize()
            self.set_decorated(False)
            self.set_keep_below(True)
        elif self.options.mode == 'undecorated':
            self.set_decorated(False)

        def after_show(*args):
            def f():
                self.move_to_monitor(self.options.monitor)
                self.prepare_next_data()
                self.next()

            GObject.timeout_add(200, f)

        self.connect('show', lambda *args: GObject.idle_add(after_show))

        self.show()
        Gtk.main()
Example #3
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.embed = GtkClutter.Embed()
        self.mainActor = self.embed.get_stage()

        self.videoPlayback = ClutterGst.Playback()
        self.videoContent = ClutterGst.Content()
        self.videoPlayback.set_seek_flags(ClutterGst.SeekFlags.ACCURATE)

        self.videoContent.set_player(self.videoPlayback)
        self.videoPlayback.connect("notify::progress", rewind_progress)

        self.set_startup_id('Oboi')
        self.set_type_hint(Gdk.WindowTypeHint.DESKTOP)
        self.set_skip_pager_hint(True)
        self.set_skip_taskbar_hint(True)
        self.set_accept_focus(True)
        self.stick()
        self.set_resizable(False)
        self.set_keep_below(True)
        self.set_decorated(False)

        self.drag_dest_set(Gtk.DestDefaults.MOTION | Gtk.DestDefaults.DROP,
                           None, Gdk.DragAction.MOVE)

        self.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK
                        | Gdk.EventMask.SMOOTH_SCROLL_MASK)

        self.mainActor.set_background_color(
            Clutter.color_from_string("#000")[1])
        self.wallpaperActor = Clutter.Actor()

        self.videoPath = "file:///home/qwerty/Downloads/videoplayback.mp4"
        self.videoPlayback.set_uri(self.videoPath)
        print("Video path:", self.videoPlayback.get_uri())
        self.videoPlayback.set_playing(True)
        print("Is paying:", self.videoPlayback.get_playing())
        self.wallpaperActor.set_content(self.videoContent)
        # size = get_desktop_size()

        self.wallpaperActor.set_pivot_point(0.5, 0.5)
        self.wallpaperActor.scale_y = 1
        self.wallpaperActor.scale_x = 1

        self.mainActor.add_child(self.wallpaperActor)
        self.add(self.embed)
Example #4
0
 def create_window(self, argv, descriptor):
     gtk_window = Gtk.Window()
     embed = GtkClutter.Embed()
     gtk_window.add(embed)
     gtk_window.stage = embed.get_stage()
     clutter_window = window.Window(self, gtk_window.stage, descriptor)
     clutter_window.wrapper = gtk_window
     gtk_window.stage.set_title('Pisak Main')
     if arg_parser.get_args().debug:
         coeff = 0.7
         size = coeff * unit.w(1), coeff * unit.h(1)
         gtk_window.stage.set_size(*size)
         gtk_window.set_default_size(*size)
         gtk_window.set_resizable(True)
     else:
         gtk_window.stage.set_fullscreen(True)
         gtk_window.fullscreen()
     gtk_window.connect("destroy", lambda _: Gtk.main_quit())
     return clutter_window
Example #5
0
    def _createUi(self):
        self.embed = GtkClutter.Embed()
        self.embed.get_accessible().set_name("timeline canvas")  # for dogtail
        self.stage = self.embed.get_stage()

        self.timeline = TimelineStage(self)
        self.controls = ControlContainer(self.timeline)
        self.zoomBox = ZoomBox(self)
        self.shiftMask = False
        self.controlMask = False

        # TODO: make the bg a gradient from (0, 0, 0, 255) to (50, 50, 50, 255)
        self.stage.set_background_color(Clutter.Color.new(31, 30, 33, 255))
        self.timeline.set_position(CONTROL_WIDTH, 0)
        self.controls.set_position(0, 0)
        self.controls.set_z_position(2)

        self.stage.add_child(self.controls)
        self.stage.add_child(self.timeline)

        self.stage.connect("destroy", quit_)
        self.stage.connect("button-press-event", self._clickedCb)
        self.stage.connect("button-release-event", self._releasedCb)
        self.embed.connect("scroll-event", self._scrollEventCb)
        if self.gui:
            self.gui.connect("key-press-event", self._keyPressEventCb)
            self.gui.connect("key-release-event", self._keyReleaseEventCb)

        self.embed.connect("enter-notify-event", self._enterNotifyEventCb)

        self.point = Clutter.Point()
        self.point.x = 0
        self.point.y = 0

        self.scrolled = 0

        self.zoomed_fitted = True
        self.pressed = False

        self._packScrollbars(self)
        self.stage.show()
Example #6
0
    def __init__(self, app):
        Gtk.ApplicationWindow.__init__(self,
                                       title='ClutterBrowser',
                                       application=app)

        self.build_treeview()

        self.embed = GtkClutter.Embed()

        container = Clutter.Actor()
        self.embed.get_stage().add_child(container)

        self.actors = []

        for i in range(BROWSERS):
            actor = GtkClutter.Actor()
            #actor.set_x(i * 700)

            da = Gtk.DrawingArea()
            da.connect('draw', self.on_draw)

            actor.get_widget().add(da)
            container.add_child(actor)
            self.actors.append(actor)

        scw = Gtk.ScrolledWindow()
        scw.set_size_request(200, -1)
        scw.add(self._treeview)

        pane = Gtk.Paned()
        pane.add1(scw)
        pane.add2(self.embed)

        container.save_easing_state()
        container.set_easing_mode(Clutter.AnimationMode.EASE_IN_OUT_CUBIC)
        container.set_easing_duration(1500)

        self._container = container

        self.add(pane)
Example #7
0
GtkClutter.init([])
Gst.init([])
Clutter.init([])
ClutterGst.init([])

window = Gtk.Window()

texture = Clutter.Texture.new()
sink = Gst.ElementFactory.make("cluttersink", None)
sink.props.texture = texture
src = Gst.ElementFactory.make("videotestsrc", None)
pipeline = Gst.Pipeline()
pipeline.add(src, sink)
src.link(sink)

embed = GtkClutter.Embed()
embed.set_size_request(320, 240)

stage = embed.get_stage()
stage.add_child(texture)

stage.set_size(320, 240)
stage.show_all()

window.add(embed)
window.connect("delete-event", Gtk.main_quit)

window.show_all()

pipeline.set_state(Gst.State.PLAYING)
Example #8
0
    def main(self):
        #    Clutter.init(sys.argv)
        Gtk.init(sys.argv)
        GtkClutter.init(sys.argv)

        window = Gtk.Window()
        window.resize(800, 600)
        window.set_title("Clutter tests window")  # Window's title
        window.move(100, 100)
        window.connect('destroy',
                       lambda x: Gtk.main_quit())  # Connect signal 'destroy'
        window.set_decorated(False)

        self.screen = window.get_screen()

        self.visual = self.screen.get_rgba_visual()
        if self.visual and self.screen.is_composited():
            window.set_visual(self.visual)
        window.set_app_paintable(True)
        window.connect("draw", area_draw)

        box = Gtk.VBox()
        box.set_margin_top(30)
        box.set_margin_bottom(30)
        box.set_margin_left(30)
        box.set_margin_right(30)
        make_transparent(box)
        window.add(box)

        embed = GtkClutter.Embed()
        make_transparent(embed)
        box.add(embed)

        stage = embed.get_stage()
        #    stage = Clutter.Stage()     # Create the Stage
        color = Clutter.Color.new(77, 75, 69, 0.9 * 255)
        stage.set_use_alpha(True)
        stage.set_color(color)
        #stage.set_opacity(128)
        stage.set_size(800, 600)
        stage.set_title("Clutter tests stage")  # Window's title
        #stage.set_fullscreen(True)

        layout = Clutter.BinLayout()
        stage.set_layout_manager(layout)
        #
        folder = '/d/Pics/Wallpapers/Favorites/'
        images = [
            os.path.join(folder, f) for f in os.listdir(folder)
            if f.endswith('.jpg')
        ]
        self.current = images[1]

        self.current_texture = get_texture(self.current)
        stage.add_actor(self.current_texture)

        web_view = WebKit.WebView()
        web_view.set_transparent(True)
        make_transparent(web_view)
        web_view.set_can_focus(True)
        web_view.load_string(
            "<html><body style='background: rgba(100, 0, 0, 0.5); color: white;'>AAAAAAAAAAA</body></html>",
            "text/html", "UTF-8", "file://" + os.path.dirname(__file__) + "/")
        web_view_actor = GtkClutter.Actor.new_with_contents(web_view)
        #        web_view_actor.set_width(800)
        make_transparent(web_view_actor.get_widget())
        layout.add(web_view_actor, Clutter.BinAlignment.FILL,
                   Clutter.BinAlignment.END)
        #        web_view_actor.set_opacity(0)
        #        web_view_actor.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 1000, ["opacity"], [255])

        #    stage.show_all()
        window.show_all()

        def go(*args):
            self.current = images[(images.index(self.current) + 1) %
                                  len(images)]
            nextt = get_texture(self.current)
            nextt.set_opacity(0)
            nextt.set_x((stage.get_width() - nextt.get_width()) / 2)
            nextt.set_y((stage.get_height() - nextt.get_height()) / 2)
            stage.add_actor(nextt)

            def a():
                a1 = self.current_texture.animatev(
                    Clutter.AnimationMode.EASE_OUT_SINE, 250, ["opacity"], [0])
                nextt.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 250,
                               ["opacity"], [255])
                previoust = self.current_texture
                self.current_texture = nextt
                a1.connect('completed', lambda x: previoust.destroy())
                stage.raise_child(web_view_actor, None)

            GObject.idle_add(a)

        stage.connect('button-press-event', go)

        #    Clutter.main()                   # Start the application
        Gtk.main()  # Start the application
Example #9
0
    def on_contextmenu_tag_location(self, widget, plugin_api):
        wTree = Gtk.glade.XML(self.glade_file, "TagLocation")
        dialog = wTree.get_widget("TagLocation")
        plugin_api.set_parent_window(dialog)

        btn_zoom_in = wTree.get_widget("btn_zoom_in")
        btn_zoom_out = wTree.get_widget("btn_zoom_out")
        vbox_map = wTree.get_widget("vbox_map")

        tag = plugin_api.get_tagpopup_tag()
        dialog.set_title(tag.get_attribute("name") + "'s Location")

        # get the tag's location
        try:
            tag_location = eval(tag.get_attribute("location"))
        except:
            tag_location = None

        # get the tag's color
        try:
            tag_color = self.HTMLColorToRGB(tag.get_attribute("color"))
        except:
            tag_color = None

        champlain_view = champlain.View()
        champlain_view.set_property("scroll-mode",
                                    champlain.SCROLL_MODE_KINETIC)

        layer = MarkerLayer()

        marker_tag = None
        if tag_location:
            marker_tag = layer.add_marker(tag.get_attribute("name"),
                                          tag_location[0], tag_location[1],
                                          tag_color)
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    marker_tag = layer.add_marker(tag.get_attribute("name"),
                                                  self.location['latitude'],
                                                  self.location['longitude'],
                                                  tag_color)
            except:
                marker_tag = layer.add_marker(tag.get_attribute("name"), None,
                                              None)

        champlain_view.add_layer(layer)

        embed = GtkClutter.Embed()
        embed.set_size_request(400, 300)

        champlain_view.set_reactive(True)
        champlain_view.connect("button-release-event",
                               self.champlain__tag_change_marker,
                               champlain_view, marker_tag)

        layer.show_all()

        if tag_location:
            champlain_view.set_property("zoom-level", 9)
        elif self.location:
            champlain_view.set_property("zoom-level", 5)
        else:
            champlain_view.set_property("zoom-level", 1)

        vbox_map.add(embed)

        embed.realize()
        stage = embed.get_stage()
        champlain_view.set_size(400, 300)
        stage.add(champlain_view)

        # connect the toolbar buttons for zoom
        btn_zoom_in.connect("clicked", self.zoom_in, champlain_view)
        btn_zoom_out.connect("clicked", self.zoom_out, champlain_view)
        dialog.connect("response", self.tag_location_close, tag, marker_tag)

        dialog.show_all()

        if tag_location:
            champlain_view.center_on(marker_tag.get_property('latitude'),
                                     marker_tag.get_property('longitude'))
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    champlain_view.center_on(self.location['latitude'],
                                             self.location['longitude'])
            except:
                pass
Example #10
0
    def set_task_location(self, widget, plugin_api, location=None):
        wTree = Gtk.glade.XML(self.glade_file, "SetTaskLocation")
        dialog = wTree.get_widget("SetTaskLocation")
        plugin_api.set_parent_window(dialog)

        btn_zoom_in = wTree.get_widget("btn_zoom_in")
        btn_zoom_out = wTree.get_widget("btn_zoom_out")

        dialog_action_area_btn = wTree.get_widget("dialog_action_area_btn")
        btn_ok = wTree.get_widget("btn_ok")
        btn_cancel = wTree.get_widget("btn_cancel")
        btn_close = wTree.get_widget("btn_close")

        self.radiobutton1 = wTree.get_widget("radiobutton1")
        self.radiobutton2 = wTree.get_widget("radiobutton2")
        self.txt_new_tag = wTree.get_widget("txt_new_tag")
        self.cmb_existing_tag = wTree.get_widget("cmb_existing_tag")

        tabela = wTree.get_widget("tabela_set_task")

        vbox_map = wTree.get_widget("vbox_map")
        vbox_opt = wTree.get_widget("vbox_opt")

        champlain_view = champlain.View()
        champlain_view.set_property("scroll-mode",
                                    champlain.SCROLL_MODE_KINETIC)
        # champlain_view.set_property("zoom-on-double-click", False)

        # create a list of the tags and their attributes
        tag_list = []
        for tag in plugin_api.get_tags():
            tmp_tag = {}
            for attr in tag.get_all_attributes():
                if attr == "color":
                    color = self.HTMLColorToRGB(tag.get_attribute(attr))
                    tmp_tag[attr] = color
                    tmp_tag['has_color'] = "yes"
                elif attr == "location":
                    tmp_tag[attr] = eval(tag.get_attribute(attr))
                else:
                    tmp_tag[attr] = tag.get_attribute(attr)
            tag_list.append(tmp_tag)

        # checks if there is one tag with a location
        task_has_location = False
        for tag in tag_list:
            for key, item in list(tag.items()):
                if key == "location":
                    task_has_location = True
                    break

        # set the markers
        layer = MarkerLayer()

        self.marker_list = []
        if task_has_location:
            for tag in tag_list:
                for key, item in list(tag.items()):
                    if key == "location":
                        color = None
                        try:
                            if tag['has_color'] == "yes":
                                color = tag['color']
                        except:
                            # PROBLEM: the tag doesn't have color
                            # Possibility, use a color from another tag
                            pass

                        self.marker_list.append(
                            layer.add_marker(plugin_api.get_task_title(),
                                             tag['location'][0],
                                             tag['location'][1], color))
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    self.marker_list.append(
                        layer.add_marker(plugin_api.get_task_title(),
                                         self.location['latitude'],
                                         self.location['longitude']))
            except:
                self.marker_list.append(
                    layer.add_marker(plugin_api.get_task_title(), None, None))

        champlain_view.add_layer(layer)

        embed = GtkClutter.Embed()
        embed.set_size_request(400, 300)

        if not task_has_location:
            # method that will change the marker's position
            champlain_view.set_reactive(True)
            champlain_view.connect("button-release-event",
                                   self.champlain_change_marker,
                                   champlain_view)

        layer.show_all()

        if task_has_location:
            champlain_view.set_property("zoom-level", 9)
        elif self.location:
            champlain_view.set_property("zoom-level", 5)
        else:
            champlain_view.set_property("zoom-level", 1)

        vbox_map.add(embed)

        embed.realize()
        stage = embed.get_stage()
        champlain_view.set_size(400, 300)
        stage.add(champlain_view)

        # connect the toolbar buttons for zoom
        btn_zoom_in.connect("clicked", self.zoom_in, champlain_view)
        btn_zoom_out.connect("clicked", self.zoom_out, champlain_view)

        if task_has_location:
            dialog_action_area_btn.remove(btn_ok)
            dialog_action_area_btn.remove(btn_cancel)
            dialog.connect("response", self.task_location_close)
        else:
            dialog_action_area_btn.remove(btn_close)
            # show a close button or the ok/cancel
            dialog.connect("response", self.set_task_location_close,
                           plugin_api)

        # if there is no location set, we want to set it
        if not task_has_location:
            self.location_defined = False
            if len(plugin_api.get_tags()) > 0:
                liststore = Gtk.ListStore(str)
                self.cmb_existing_tag.set_model(liststore)
                for tag in plugin_api.get_tags():
                    liststore.append([tag.get_attribute("name")])
                self.cmb_existing_tag.set_text_column(0)
                self.cmb_existing_tag.set_active(0)
            else:
                # remove radiobutton2 and the comboboxentry
                tabela.remove(self.radiobutton1)
                tabela.remove(self.radiobutton2)
                tabela.remove(self.cmb_existing_tag)
                label = Gtk.Label()
                label.set_text("Associate with new tag: ")
                tabela.attach(label, 0, 1, 0, 1)
                label.show()
        else:
            self.location_defined = True
            vbox_opt.remove(tabela)
            dialog.set_title("View the task's location")

        dialog.show_all()

        if task_has_location:
            champlain_view.center_on(
                self.marker_list[0].get_property('latitude'),
                self.marker_list[0].get_property('longitude'))
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    champlain_view.center_on(self.location['latitude'],
                                             self.location['longitude'])
            except:
                pass
Example #11
0
import gi
import sys

gi.require_version('Gtk', '3.0')
gi.require_version('Clutter', '1.0')
gi.require_version('GtkClutter', '1.0')
from gi.repository import GtkClutter, Gtk

GtkClutter.init(sys.argv)
window = Gtk.Window(title="Cluter Gtk Example")
embed = GtkClutter.Embed(width_request=640, height_request=480)
window.add(embed)

edit = Gtk.TextView(width_request=640,
                    height_request=480,
                    wrap_mode=Gtk.WrapMode.CHAR)
edit.get_buffer().set_text("Edit me!")
embed.get_stage().add_child(GtkClutter.Actor.new_with_contents(edit))

window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()
Example #12
0
    def __init__(self):
        signal.signal(signal.SIGINT, self._quit)
        signal.signal(signal.SIGTERM, self._quit)
        # SIGSEGV as a fail-safe
        signal.signal(signal.SIGSEGV, self._quit)

        # Initialize
        GtkClutter.init()
        ClutterGst.init()
        create_dir(VIDEO_WALLPAPER_PATH)

        self.config_handler = ConfigHandler(self._on_config_modified)
        self.config = self.config_handler.config
        self.current_video_path = self.config.video_path
        self.user_pause_playback = False
        self.is_any_maximized, self.is_any_fullscreen = False, False

        # Monitor Detect
        self.width, self.height = self.monitor_detect()

        # Actors initialize
        self.embed = GtkClutter.Embed()
        self.main_actor = self.embed.get_stage()
        self.main_actor.set_background_color(Clutter.Color.get_static(Clutter.StaticColor.BLACK))

        # Video initialize
        self.video_playback = ClutterGst.Playback()
        self.video_content = ClutterGst.Content()
        self.video_content.set_player(self.video_playback)

        # Playback settings
        self.video_playback.set_filename(self.config.video_path)
        self.video_playback.set_audio_volume(0.0 if self.config.mute_audio else self.config.audio_volume)
        self.video_playback.set_playing(True)
        self.video_playback.connect('eos', self._on_eos)
        self.main_actor.set_content(self.video_content)

        # Window settings
        self.window = Gtk.Window()
        self.window.add(self.embed)
        self.window.set_type_hint(Gdk.WindowTypeHint.DESKTOP)
        self.window.set_size_request(self.width, self.height)

        # button event
        self._build_context_menu()
        self.window.connect('button-press-event', self._on_button_press_event)
        self.window.show_all()

        self.active_handler = ActiveHandler(self._on_active_changed)
        self.window_handler = WindowHandler(self._on_window_state_changed)
        self.static_wallpaper_handler = StaticWallpaperHandler()
        self.static_wallpaper_handler.set_static_wallpaper()

        if self.config.video_path == '':
            # First time
            ControlPanel().run()
        elif not os.path.isfile(self.config.video_path):
            self._on_file_not_found(self.config.video_path)

        self.file_list = scan_dir()
        random.shuffle(self.file_list)
        self.current = 0
        if self.config.video_path in self.file_list:
            self.current = self.file_list.index(self.config.video_path)
        Gtk.main()
Example #13
0
    def run(self):
        self.running = True

        self.window = Gtk.Window()

        self.load_options()  # loads from config file
        self.parse_options()  # parses the command-line arguments, these take precedence over the saved config
        self.save_options()
        self.prepare_file_queues()

        self.window.set_title(self.options.title)
        self.screen = self.window.get_screen()

        self.embed = GtkClutter.Embed()
        self.window.add(self.embed)
        self.embed.set_visible(True)

        self.stage = self.embed.get_stage()
        self.stage.set_color(Clutter.Color.get_static(Clutter.StaticColor.BLACK))
        if self.options.mode == "fullscreen":
            self.stage.hide_cursor()

        self.texture = Clutter.Texture.new()
        self.next_texture = None
        self.prev_texture = None
        self.data_queue = Queue()

        self.connect_signals()

        self.will_enlarge = random.choice((True, False))

        self.window.resize(600, 400)
        self.move_to_monitor(self.options.monitor)

        self.current_mode = self.options.mode
        self.mode_was_changed = False
        if self.options.mode == "fullscreen":
            self.window.fullscreen()
            self.window.set_skip_taskbar_hint(True)
        elif self.options.mode == "maximized":
            self.window.maximize()
        elif self.options.mode == "desktop":
            self.window.maximize()
            self.window.set_decorated(False)
            self.window.set_keep_below(True)

            # ensure window will get deiconified (i.e. unminimized) after "Show Desktop" button/shortcut
            def _window_state_changed(window, event, *args):
                if event.new_window_state & Gdk.WindowState.ICONIFIED:
                    self.window.deiconify()
                    self.window.present()

            self.window.connect("window-state-event", _window_state_changed)

        elif self.options.mode == "undecorated":
            self.window.set_decorated(False)

        if self.options.hide_from_taskbar:
            self.window.set_skip_taskbar_hint(True)

        def after_show(*args):
            def f():
                self.move_to_monitor(self.options.monitor)
                self.prepare_next_data()
                self.go_next()

            GObject.timeout_add(200, f)

        self.window.connect("show", lambda *args: GObject.idle_add(after_show))
        self.window.show()
        Gtk.main()