Skip to content

Commit

Permalink
single instance for both flatpak and system, open exe from cli and fi…
Browse files Browse the repository at this point in the history
…lemanager. Release 0.5
  • Loading branch information
fastrizwaan committed Jul 25, 2024
1 parent 6072895 commit 95944fc
Show file tree
Hide file tree
Showing 6 changed files with 4,028 additions and 254 deletions.
1 change: 1 addition & 0 deletions .flatpak-builder/ccache/disabled/ccache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disable = true
52 changes: 52 additions & 0 deletions adw_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python3

import gi
import time
import threading

gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw, GLib

class SimpleAdwApp(Adw.Application):
def __init__(self):
super().__init__(application_id='com.example.SimpleAdwApp')
self.window = None
self.status_bar = None

def do_activate(self):
if not self.window:
self.window = Adw.ApplicationWindow(application=self)
self.window.set_title("Simple Adw App")
self.window.set_default_size(400, 200)

vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.window.set_content(vbox)

button = Gtk.Button(label="Show Message")
button.connect("clicked", self.on_button_clicked)
vbox.append(button)

self.status_bar = Adw.StatusPage()
vbox.append(self.status_bar)

self.window.present()

def on_button_clicked(self, button):
self.show_status_message("This is a status message!")

def show_status_message(self, message):
self.status_bar.set_description(message)
self.status_bar.set_visible(True)
GLib.timeout_add_seconds(10, self.hide_status_message)

def hide_status_message(self):
self.status_bar.set_visible(False)
return False

def main():
app = SimpleAdwApp()
return app.run(None)

if __name__ == "__main__":
main()
46 changes: 46 additions & 0 deletions boxlist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python3

import gi

gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw

class SimpleAdwApp(Adw.Application):
def __init__(self):
super().__init__(application_id='com.example.SimpleAdwApp')
self.connect("activate", self.on_activate)

def on_activate(self, app):
window = Adw.ApplicationWindow(application=self)
window.set_title("Simple Adw App")
window.set_default_size(400, 300)

content = Adw.Bin()

boxed_list = Gtk.ListBox()
boxed_list.set_selection_mode(Gtk.SelectionMode.NONE)
boxed_list.add_css_class("boxed-list")

for i in range(10):
row = Gtk.ListBoxRow()
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
label = Gtk.Label(label=f"Item {i + 1}")
box.append(label)
row.set_child(box)
boxed_list.append(row)

scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scrolled_window.set_child(boxed_list)

content.set_child(scrolled_window)
window.set_content(content)
window.present()

def main():
app = SimpleAdwApp()
return app.run()

if __name__ == "__main__":
main()
Loading

0 comments on commit 95944fc

Please sign in to comment.