Last active
July 25, 2022 07:35
-
-
Save py7hon/236d8aef02e1c27131c86b51cef8e2e6 to your computer and use it in GitHub Desktop.
Revisions
-
py7hon revised this gist
Mar 17, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,6 +83,7 @@ class WaterMark(Gtk.Window): self.connect("delete-event", Gtk.main_quit) self.show_all() self.set_keep_above(True) self.set_property("skip-taskbar-hint", True) w_width, w_height = self.get_size() logging.info("Window-size: " + repr(w_width) + "x" + repr(w_height)) self.move(root_width - w_width - 90, root_height - w_height - 70) -
py7hon revised this gist
Mar 17, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -82,6 +82,7 @@ class WaterMark(Gtk.Window): self.connect("delete-event", Gtk.main_quit) self.show_all() self.set_keep_above(True) w_width, w_height = self.get_size() logging.info("Window-size: " + repr(w_width) + "x" + repr(w_height)) self.move(root_width - w_width - 90, root_height - w_height - 70) -
py7hon revised this gist
Mar 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -66,7 +66,7 @@ class WaterMark(Gtk.Window): label_bawah = Gtk.Label() label_bawah.set_text("Go to Settings to activate Windows.") #Change this fd = Pango.FontDescription("Arial 10") label_bawah.set_alignment(0, 1) label_bawah.modify_font(fd) -
py7hon created this gist
Mar 17, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Watermark ## Dependences: - python-gobject ## Usage: `chmod +x watermark` `./watermark` ## Screenshots:  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,104 @@ #!/usr/bin/env python # -.- encoding: utf-8 -.- ''' Dependences: python-gobject ''' import os import ctypes import platform import logging import signal import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, Pango import cairo def set_name(new_name): if platform.system() != 'Linux': logging.warning('Rename process:Unsupported platform') try: libc = ctypes.CDLL('libc.so.6') libc.prctl(15, new_name, 0, 0, 0) return True except: logging.warning("Rename process failed :PID: " + repr(os.getpid())) return False class WaterMark(Gtk.Window): def __init__(self): super(WaterMark, self).__init__() self.setup() self.init_ui() def setup(self): self.set_app_paintable(True) self.set_type_hint(Gdk.WindowTypeHint.DOCK) self.set_keep_below(True) screen = self.get_screen() visual = screen.get_rgba_visual() if visual and screen.is_composited(): self.set_visual(visual) def init_ui(self): self.connect("draw", self.on_draw) self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10) self.box.set_homogeneous(False) self.add(self.box) label_atas = Gtk.Label() text = "Activate Windows" #Change this label_atas.set_text(text) fd = Pango.FontDescription("Arial 15") label_atas.set_alignment(0, 1) label_atas.modify_font(fd) label_atas.modify_fg(Gtk.StateFlags.NORMAL, Gdk.color_parse("#A9A9A9")) self.box.pack_start(label_atas, True, True, 0) label_bawah = Gtk.Label() lbtn.set_text("Go to Settings to activate Windows.") #Change this fd = Pango.FontDescription("Arial 10") label_bawah.set_alignment(0, 1) label_bawah.modify_font(fd) label_bawah.modify_fg(Gtk.StateFlags.NORMAL, Gdk.color_parse("#A9A9A9")) self.box.pack_start(label_bawah, True, True, 0) root_win = Gdk.get_default_root_window() root_height = root_win.get_height() root_width = root_win.get_width() logging.info("Desktop-size: " + repr(root_width) + "x" + repr(root_height)) self.connect("delete-event", Gtk.main_quit) self.show_all() w_width, w_height = self.get_size() logging.info("Window-size: " + repr(w_width) + "x" + repr(w_height)) self.move(root_width - w_width - 90, root_height - w_height - 70) def on_draw(self, wid, cr): cr.set_operator(cairo.OPERATOR_CLEAR) cr.paint() cr.set_operator(cairo.OPERATOR_OVER) def main(): logging.basicConfig(level=logging.DEBUG) WaterMark() Gtk.main() if __name__ == "__main__": signal.signal(signal.SIGINT, signal.SIG_DFL) main()