Optional argument "-m | hide GUI on startup" doesn't work
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the issue with electrum gui -m, then inspect main_window.py around load_wallet() and bring_to_top(), and __init__.py around start_new_window(). The change is done when -m leaves the wallet window hidden for both encrypted and unencrypted wallets, while selecting Show from the tray still permits the password prompt and window to appear.
Written by the indexing model from the issue text.
Description
Running electrum 3.1 compiled from git today on Arch Linux with GNOME Shell 3.26.2.
Objective: set up electrum to autostart on login without opening any window, just the tray icon.
$ electrum help gui
[...]
optional arguments:
-m hide GUI on startup
However, it doesn't work. I tried removing the wallet encryption, because I thought it was the password prompt that skewed the hiding of the GUI, but without wallet encryption it just straight opens the wallet anyways.
Step to reproduce the error (assuming everything is already configured):
$ electrum gui -m
Research:
The problem apparently relies on bring_to_top() [main_window.py:276] function being called - probably from __init__ - after this code in load_wallet() [main_window:338] that's supposed to make the -m flag work:
if self.config.get('hide_gui') and self.gui_object.tray.isVisible():
self.hide()
else:
self.show()
Commenting out w.bring_to_top() [__init__.py:236] in start_new_window)() [__init__.py:187] makes it work as intended:
def start_new_window(self, path, uri):
'''Raises the window for the wallet if it is open. Otherwise
opens the wallet and creates a new window for it'''
[...]
if uri:
w.pay_to_URI(uri)
#w.bring_to_top()
w.setWindowState(w.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
[...]
return w
But, of course, just generates more problems. That probably means we need another check for self.config.get('hide_gui') in __init__.py, I did it like this:
if not self.config.get('hide_gui'):
w.bring_to_top()
That solved the problem for me, but only for unencrypted wallets. If the wallet is encrypted electrum still pops up for the password, which would be nice if it only did when you selected "Show" on the tray icon menu.
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 3.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 61
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spesmilo/electrum
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
build/packaging 📦 OS-linux 🐧
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
OS-android🤖
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
All issues in spesmilo/electrum
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100