mirror of
https://github.com/quexten/goldwarden.git
synced 2024-11-27 11:02:46 +03:00
Add browser biometrics setup window
This commit is contained in:
parent
623fdcb719
commit
13bd29dbf9
53
gui/src/gui/browserbiometrics.py
Normal file
53
gui/src/gui/browserbiometrics.py
Normal file
@ -0,0 +1,53 @@
|
||||
import gi
|
||||
gi.require_version('Gtk', '4.0')
|
||||
gi.require_version('Adw', '1')
|
||||
import gc
|
||||
import time
|
||||
from gi.repository import Gtk, Adw, GLib, Notify, Gdk
|
||||
from threading import Thread
|
||||
import sys
|
||||
import os
|
||||
from . import components
|
||||
|
||||
class MyApp(Adw.Application):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.connect('activate', self.on_activate)
|
||||
|
||||
def on_activate(self, app):
|
||||
self.pinentry_window = MainWindow(application=app)
|
||||
self.pinentry_window.present()
|
||||
self.app = app
|
||||
|
||||
class MainWindow(Gtk.ApplicationWindow):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# vertical box
|
||||
self.box = Gtk.Box()
|
||||
self.box.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
self.set_child(self.box)
|
||||
|
||||
self.stack = Gtk.Stack()
|
||||
self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
|
||||
self.box.append(self.stack)
|
||||
|
||||
self.preferences_page = Adw.PreferencesPage()
|
||||
self.preferences_page.set_title("General")
|
||||
self.stack.add_named(self.preferences_page, "preferences_page")
|
||||
|
||||
self.register_browser_biometrics_group = Adw.PreferencesGroup()
|
||||
self.register_browser_biometrics_group.set_title("Register Browser Biometrics")
|
||||
self.register_browser_biometrics_group.set_description("Run the following command in your terminal to set up the browser biometrics integration")
|
||||
self.preferences_page.add(self.register_browser_biometrics_group)
|
||||
|
||||
self.setup_command_row = Adw.ActionRow()
|
||||
self.setup_command_row.set_subtitle("flatpak run --filesystem=home --command=goldwarden com.quexten.Goldwarden setup browserbiometrics")
|
||||
self.setup_command_row.set_subtitle_selectable(True)
|
||||
self.register_browser_biometrics_group.add(self.setup_command_row)
|
||||
|
||||
self.set_default_size(700, 400)
|
||||
self.set_title("Goldwarden Browser Biometrics Setup")
|
||||
|
||||
app = MyApp(application_id="com.quexten.Goldwarden.browserbiometrics")
|
||||
app.run(sys.argv)
|
@ -31,6 +31,11 @@ def ssh_button_clicked():
|
||||
p.stdin.write(f"{token}\n".encode())
|
||||
p.stdin.flush()
|
||||
|
||||
def browserbiometrics_button_clicked():
|
||||
p = subprocess.Popen(["python3", "-m", "src.gui.browserbiometrics"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=root_path, start_new_session=True)
|
||||
p.stdin.write(f"{token}\n".encode())
|
||||
p.stdin.flush()
|
||||
|
||||
def add_action_row(parent, title, subtitle, icon=None):
|
||||
row = Adw.ActionRow()
|
||||
row.set_title(title)
|
||||
@ -154,6 +159,11 @@ class SettingsWinvdow(Gtk.ApplicationWindow):
|
||||
action.connect("activate", lambda action, parameter: ssh_button_clicked())
|
||||
self.add_action(action)
|
||||
menu.append("SSH Agent", "win.ssh")
|
||||
|
||||
action = Gio.SimpleAction.new("browserbiometrics", None)
|
||||
action.connect("activate", lambda action, parameter: browserbiometrics_button_clicked())
|
||||
self.add_action(action)
|
||||
menu.append("Browser Biometrics", "win.browserbiometrics")
|
||||
|
||||
self.hamburger = Gtk.MenuButton()
|
||||
self.hamburger.set_popover(self.popover)
|
||||
|
Loading…
Reference in New Issue
Block a user