Merge pull request #114 from quexten/feature/pin-cache
Improved keyboard navigation on ui
This commit is contained in:
commit
20e71663e3
|
@ -17,12 +17,12 @@ finish-args:
|
||||||
- --talk-name=org.gnome.ScreenSaver
|
- --talk-name=org.gnome.ScreenSaver
|
||||||
- --talk-name=org.freedesktop.ScreenSaver
|
- --talk-name=org.freedesktop.ScreenSaver
|
||||||
|
|
||||||
|
# Lock on idle
|
||||||
|
- --talk-name=org.gnome.Mutter.IdleMonitor
|
||||||
|
|
||||||
# Notifications
|
# Notifications
|
||||||
- --talk-name=org.freedesktop.Notifications
|
- --talk-name=org.freedesktop.Notifications
|
||||||
|
|
||||||
# Home directory access to setup browser ipc, can posibly restrict this further if requried by listing each browser's nativehost directory separately
|
|
||||||
- --filesystem=home
|
|
||||||
|
|
||||||
# pinentry & approval
|
# pinentry & approval
|
||||||
- --talk-name=org.gnome.keyring.SystemPrompter
|
- --talk-name=org.gnome.keyring.SystemPrompter
|
||||||
# biometric / user password auth
|
# biometric / user password auth
|
||||||
|
@ -51,7 +51,7 @@ modules:
|
||||||
- name: goldwarden-core-daemon
|
- name: goldwarden-core-daemon
|
||||||
buildsystem: simple
|
buildsystem: simple
|
||||||
build-commands:
|
build-commands:
|
||||||
- install -D goldwarden /app/bin/src/goldwarden
|
- install -D goldwarden /app/bin/goldwarden
|
||||||
sources:
|
sources:
|
||||||
- type: file
|
- type: file
|
||||||
path: ./goldwarden
|
path: ./goldwarden
|
|
@ -52,12 +52,12 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
# on type func
|
# on type func
|
||||||
def on_type(entry):
|
def on_type(entry):
|
||||||
if len(entry.get_text()) > 1:
|
if len(entry.get_text()) > 1:
|
||||||
self.history_list.show()
|
self.results_list.show()
|
||||||
else:
|
else:
|
||||||
self.history_list.hide()
|
self.results_list.hide()
|
||||||
|
|
||||||
while self.history_list.get_first_child() != None:
|
while self.results_list.get_first_child() != None:
|
||||||
self.history_list.remove(self.history_list.get_first_child())
|
self.results_list.remove(self.results_list.get_first_child())
|
||||||
|
|
||||||
self.filtered_logins = list(filter(lambda i: entry.get_text().lower() in i["name"].lower(), self.logins))
|
self.filtered_logins = list(filter(lambda i: entry.get_text().lower() in i["name"].lower(), self.logins))
|
||||||
if len( self.filtered_logins) > 10:
|
if len( self.filtered_logins) > 10:
|
||||||
|
@ -77,25 +77,39 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
action_row.uuid = i["uuid"]
|
action_row.uuid = i["uuid"]
|
||||||
action_row.uri = i["uri"]
|
action_row.uri = i["uri"]
|
||||||
action_row.totp = i["totp"]
|
action_row.totp = i["totp"]
|
||||||
self.history_list.append(action_row)
|
self.results_list.append(action_row)
|
||||||
self.starts_with_logins = None
|
self.starts_with_logins = None
|
||||||
self.other_logins = None
|
self.other_logins = None
|
||||||
self.text_view.connect("changed", lambda entry: on_type(entry))
|
self.text_view.connect("changed", lambda entry: on_type(entry))
|
||||||
self.box.append(self.text_view)
|
self.box.append(self.text_view)
|
||||||
|
|
||||||
self.history_list = Gtk.ListBox()
|
self.results_list = Gtk.ListBox()
|
||||||
# margin'
|
# margin'
|
||||||
self.history_list.set_margin_start(10)
|
self.results_list.set_margin_start(10)
|
||||||
self.history_list.set_margin_end(10)
|
self.results_list.set_margin_end(10)
|
||||||
self.history_list.set_margin_top(10)
|
self.results_list.set_margin_top(10)
|
||||||
self.history_list.set_margin_bottom(10)
|
self.results_list.set_margin_bottom(10)
|
||||||
self.history_list.hide()
|
self.results_list.hide()
|
||||||
|
|
||||||
keycont = Gtk.EventControllerKey()
|
keycont = Gtk.EventControllerKey()
|
||||||
def handle_keypress(cotroller, keyval, keycode, state, user_data):
|
def handle_keypress(cotroller, keyval, keycode, state, user_data):
|
||||||
# if ctrl is pressed
|
# if ctrl is pressed
|
||||||
if state == 4:
|
if state == 4:
|
||||||
print("ctrl")
|
print("ctrl")
|
||||||
|
|
||||||
|
if keycode == 9:
|
||||||
|
print("esc")
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
|
if keyval == 65364:
|
||||||
|
# focus results
|
||||||
|
if self.results_list.get_first_child() != None:
|
||||||
|
self.results_list.get_first_child().grab_focus()
|
||||||
|
self.results_list.select_row(self.results_list.get_first_child())
|
||||||
|
|
||||||
|
if keyval == 113:
|
||||||
|
return False
|
||||||
|
|
||||||
if keycode == 36:
|
if keycode == 36:
|
||||||
print("enter")
|
print("enter")
|
||||||
self.hide()
|
self.hide()
|
||||||
|
@ -103,16 +117,16 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
goldwarden.autotype(username, password)
|
goldwarden.autotype(username, password)
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
autotypeThread = Thread(target=do_autotype, args=(self.history_list.get_selected_row().username, self.history_list.get_selected_row().password,))
|
autotypeThread = Thread(target=do_autotype, args=(self.results_list.get_selected_row().username, self.results_list.get_selected_row().password,))
|
||||||
autotypeThread.start()
|
autotypeThread.start()
|
||||||
print(self.history_list.get_selected_row().get_title())
|
print(self.results_list.get_selected_row().get_title())
|
||||||
if keyval == 112:
|
if keyval == 112:
|
||||||
print("copy password")
|
print("copy password")
|
||||||
clipboard.write(self.history_list.get_selected_row().password)
|
clipboard.write(self.results_list.get_selected_row().password)
|
||||||
Notify.Notification.new("Goldwarden", "Password Copied", "dialog-information").show()
|
Notify.Notification.new("Goldwarden", "Password Copied", "dialog-information").show()
|
||||||
elif keyval == 117:
|
elif keyval == 117:
|
||||||
print("copy username")
|
print("copy username")
|
||||||
clipboard.write(self.history_list.get_selected_row().username)
|
clipboard.write(self.results_list.get_selected_row().username)
|
||||||
notification=Notify.Notification.new("Goldwarden", "Username Copied", "dialog-information")
|
notification=Notify.Notification.new("Goldwarden", "Username Copied", "dialog-information")
|
||||||
notification.set_timeout(5)
|
notification.set_timeout(5)
|
||||||
notification.show()
|
notification.show()
|
||||||
|
@ -121,25 +135,28 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
environment = goldwarden.get_environment()
|
environment = goldwarden.get_environment()
|
||||||
if environment == None:
|
if environment == None:
|
||||||
return
|
return
|
||||||
item_uri = environment["vault"] + "#/vault?itemId=" + self.history_list.get_selected_row().uuid
|
item_uri = environment["vault"] + "#/vault?itemId=" + self.results_list.get_selected_row().uuid
|
||||||
Gtk.show_uri(None, item_uri, Gdk.CURRENT_TIME)
|
Gtk.show_uri(None, item_uri, Gdk.CURRENT_TIME)
|
||||||
elif keyval == 108:
|
elif keyval == 108:
|
||||||
print("launch")
|
print("launch")
|
||||||
print(self.history_list.get_selected_row().uri)
|
print(self.results_list.get_selected_row().uri)
|
||||||
Gtk.show_uri(None, self.history_list.get_selected_row().uri, Gdk.CURRENT_TIME)
|
Gtk.show_uri(None, self.results_list.get_selected_row().uri, Gdk.CURRENT_TIME)
|
||||||
elif keyval == 116:
|
elif keyval == 116:
|
||||||
print("copy totp")
|
print("copy totp")
|
||||||
totp_code = totp.totp(self.history_list.get_selected_row().totp)
|
totp_code = totp.totp(self.results_list.get_selected_row().totp)
|
||||||
clipboard.write(totp_code)
|
clipboard.write(totp_code)
|
||||||
notification=Notify.Notification.new("Goldwarden", "Totp Copied", "dialog-information")
|
notification=Notify.Notification.new("Goldwarden", "Totp Copied", "dialog-information")
|
||||||
notification.set_timeout(5)
|
notification.set_timeout(5)
|
||||||
notification.show()
|
notification.show()
|
||||||
|
elif keyval == 102:
|
||||||
|
# focus search
|
||||||
|
self.text_view.grab_focus()
|
||||||
|
|
||||||
keycont.connect('key-pressed', handle_keypress, self)
|
keycont.connect('key-pressed', handle_keypress, self)
|
||||||
self.add_controller(keycont)
|
self.add_controller(keycont)
|
||||||
|
|
||||||
self.history_list.get_style_context().add_class("boxed-list")
|
self.results_list.get_style_context().add_class("boxed-list")
|
||||||
self.box.append(self.history_list)
|
self.box.append(self.results_list)
|
||||||
self.set_default_size(700, 700)
|
self.set_default_size(700, 700)
|
||||||
self.set_title("Goldwarden Quick Access")
|
self.set_title("Goldwarden Quick Access")
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,15 @@ class SettingsWinvdow(Gtk.ApplicationWindow):
|
||||||
self.launch_web_vault_shortcut_row.set_subtitle("V")
|
self.launch_web_vault_shortcut_row.set_subtitle("V")
|
||||||
self.shortcut_preferences_group.add(self.launch_web_vault_shortcut_row)
|
self.shortcut_preferences_group.add(self.launch_web_vault_shortcut_row)
|
||||||
|
|
||||||
|
self.focus_search_shortcut_row = Adw.ActionRow()
|
||||||
|
self.focus_search_shortcut_row.set_title("Focus Search Shortcut")
|
||||||
|
self.focus_search_shortcut_row.set_subtitle("F")
|
||||||
|
self.shortcut_preferences_group.add(self.focus_search_shortcut_row)
|
||||||
|
|
||||||
|
self.quit_shortcut_row = Adw.ActionRow()
|
||||||
|
self.quit_shortcut_row.set_title("Quit Shortcut")
|
||||||
|
self.quit_shortcut_row.set_subtitle("Esc")
|
||||||
|
self.shortcut_preferences_group.add(self.quit_shortcut_row)
|
||||||
|
|
||||||
self.vault_status_preferences_group = Adw.PreferencesGroup()
|
self.vault_status_preferences_group = Adw.PreferencesGroup()
|
||||||
self.vault_status_preferences_group.set_title("Vault Status")
|
self.vault_status_preferences_group.set_title("Vault Status")
|
||||||
|
|
|
@ -3,6 +3,8 @@ import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from shutil import which
|
||||||
|
import sys
|
||||||
|
|
||||||
is_flatpak = os.path.exists("/.flatpak-info")
|
is_flatpak = os.path.exists("/.flatpak-info")
|
||||||
log_directory = str(Path.home()) + "/.local/share/goldwarden"
|
log_directory = str(Path.home()) + "/.local/share/goldwarden"
|
||||||
|
@ -17,19 +19,18 @@ BINARY_PATHS = [
|
||||||
str(Path.home()) + "/go/src/github.com/quexten/goldwarden/goldwarden"
|
str(Path.home()) + "/go/src/github.com/quexten/goldwarden/goldwarden"
|
||||||
]
|
]
|
||||||
|
|
||||||
BINARY_PATH = ""
|
|
||||||
BINARY_PATH = None
|
BINARY_PATH = None
|
||||||
for path in BINARY_PATHS:
|
for path in BINARY_PATHS:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
BINARY_PATH = path
|
BINARY_PATH = path
|
||||||
break
|
break
|
||||||
|
|
||||||
if BINARY_PATH == None:
|
if BINARY_PATH is None:
|
||||||
BINARY_PATH = which('goldwarden')
|
BINARY_PATH = which('goldwarden')
|
||||||
if isinstance(BINARY_PATH,str):
|
if isinstance(BINARY_PATH,str):
|
||||||
BINARY_PATH = BINARY_PATH.strip()
|
BINARY_PATH = BINARY_PATH.strip()
|
||||||
|
|
||||||
if BINARY_PATH == None:
|
if BINARY_PATH is None:
|
||||||
print("goldwarden executable not found")
|
print("goldwarden executable not found")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue