Skip to content

Commit

Permalink
Add autotype instructions and button
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten committed Dec 26, 2023
1 parent 46a14ef commit e71dd91
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
16 changes: 13 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,21 @@ Run a command with injected environment variables
goldwarden run -- <command>
```

Autofill (Flatpak Only)
#### Autofill (Flatpak Only)

To set up a shortcut (CTRL+u) on Gnome:
```
dbus-send --type=method_call --dest=com.quexten.goldwarden /com/quexten/goldwarden com.quexten.goldwarden.Autofill.autofill
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gwautofill/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gwautofill/ name 'Goldwarden Autofill'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gwautofill/ command 'dbus-send --type=method_call --dest=com.quexten.Goldwarden.autofill /com/quexten/Goldwarden com.quexten.Goldwarden.Autofill.autofill'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/gwautofill/ binding '<Ctrl>u'
```
(Create a hotkey for this depending on your desktop environment)

On other Desktop environments this will work differently, just makes sure that:
`dbus-send --type=method_call --dest=com.quexten.Goldwarden.autofill /com/quexten/Goldwarden com.quexten.Goldwarden.Autofill.autofill`
gets called.

This will be changed once desktop environments implement the global hotkey portal.

#### SSH Agent
[goldwarden_ssh.webm](https://github.com/quexten/goldwarden/assets/11866552/9058f734-60e0-4dd3-b9f8-1d77f7cf4c65)
Expand Down
13 changes: 10 additions & 3 deletions ui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
from gi.repository import Gtk, Adw, GLib
import goldwarden
from threading import Thread

hidden = False
import subprocess

class SettingsWinvdow(Gtk.ApplicationWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

print("init settings window")
self.stack = Gtk.Stack()
self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
self.set_child(self.stack)
Expand Down Expand Up @@ -85,6 +83,13 @@ def __init__(self, *args, **kwargs):
self.action_preferences_group.set_title("Actions")
self.preferences_page.add(self.action_preferences_group)

self.autotype_button = Gtk.Button()
self.autotype_button.set_label("Autotype")
self.autotype_button.set_margin_top(10)
self.autotype_button.connect("clicked", lambda button: subprocess.Popen(["python3", "/app/bin/autofill.py"], start_new_session=True))
self.autotype_button.get_style_context().add_class("suggested-action")
self.action_preferences_group.add(self.autotype_button)

self.login_button = Gtk.Button()
self.login_button.set_label("Login")
self.login_button.connect("clicked", lambda button: show_login())
Expand Down Expand Up @@ -130,6 +135,7 @@ def update_labels():
locked = status["locked"]
self.login_button.set_sensitive(pin_set and not locked)
self.set_pin_button.set_sensitive(not pin_set or not locked)
self.autotype_button.set_sensitive(not locked)
self.status_row.set_subtitle(str("Unlocked" if not locked else "Locked"))
self.login_row.set_subtitle(str(status["loginEntries"]))
self.notes_row.set_subtitle(str(status["noteEntries"]))
Expand Down Expand Up @@ -159,6 +165,7 @@ def on_activate(self, app):
self.settings_win = SettingsWinvdow(application=app)
self.settings_win.present()

app = MyApp(application_id="com.quexten.Goldwarden")

def show_login():
dialog = Gtk.Dialog(title="Goldwarden")
Expand Down

0 comments on commit e71dd91

Please sign in to comment.