-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to enable automounting on Sway/Wayland. #215
Comments
Hi, I can reproduce the behaviour. I added some debug output to check what's going on and it looks that udiskie is enabling/deactivating the automount state internally as expected. It's just that the checkboxes aren't shown - even though they are appropriately created as GtkCheckMenuItem, and the Looks like a bug somewhere in one of sway/wayland/appindicator to me. The whole trayicon matter seems to be broken on wayland :( see also #199 Edit: Do you have any other program that shows checkboxes in their appindicator menu? If so, we could look there for workarounds. Best, Thomas |
(Otherwise, I can for now change it to read "Disable" or "Enable", depending on the status) |
Unfortunately (Or maybe fortunately...) I do not have any programs that have checkboxes in their appindicator menu.
I did notice that I would like to help as much as possible. Is there anything you would like me to do? Post any debug logs or something? Edit: My apologies for the late response btw. School's been kicking my ass, got exams all week. |
Did you start with
Since the behaviour is the same for both Gtk/AppIndicator3 and Qt/QSystemTrayIcon, I think it's probably an issue with the sway implementation, but I could be wrong. Anyway, you could report the issue to https://github.com/swaywm/sway/issues, they should know where to fix it. I'm currently too lazy to fill out their issue form. You can show them the following example code: Gtk/AppIndicator3: from gi import require_version
require_version('Gtk', '3.0')
require_version('AppIndicator3', '0.1')
import signal
from gi.repository import Gtk
from gi.repository import AppIndicator3
def main():
indicator = AppIndicator3.Indicator.new(
'checkbox-test-app', 'dialog-error',
AppIndicator3.IndicatorCategory.OTHER)
indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
indicator.set_menu(build_menu())
signal.signal(signal.SIGINT, signal.SIG_DFL)
Gtk.main()
def build_menu():
check = Gtk.CheckMenuItem('CheckMenuItem')
check.connect('activate', on_menuitem_check)
quit = Gtk.MenuItem('Quit')
quit.connect('activate', lambda _: Gtk.main_quit())
menu = Gtk.Menu()
menu.append(check)
menu.append(quit)
menu.show_all()
return menu
def on_menuitem_check(item):
print("active:", item.get_active())
if __name__ == '__main__':
main() and Qt/QSystemTrayIcon: from PyQt5.QtWidgets import QAction, QApplication, QMenu, QSystemTrayIcon
import signal
import sys
def main():
app = QApplication(sys.argv)
style = app.style()
signal.signal(signal.SIGINT, signal.SIG_DFL)
trayicon = QSystemTrayIcon(style.standardIcon(style.SP_MessageBoxCritical))
trayicon.setVisible(True)
trayicon.setContextMenu(build_menu(trayicon))
trayicon.show()
app.exec_()
def build_menu(parent, menu=None):
check = QAction('CheckMenuItem', parent)
check.setCheckable(True)
check.triggered.connect(on_menuitem_check)
quit = QAction('&Quit', parent)
quit.setMenuRole(QAction.QuitRole)
quit.triggered.connect(QApplication.quit)
menu = menu or QMenu()
menu.addAction(check)
menu.addAction(quit)
return menu
def on_menuitem_check(checked):
print("active:", checked)
if __name__ == '__main__':
main() FWIW, I also checked that it isn't a problem in all menus: checkmenuitems in window menus are shown correctly, as can be verified by inserting the following in the qt main: window = QMainWindow()
build_menu(window, window.menuBar().addMenu('&File'))
window.show()
Not late at all :) |
FYI, I have added a workaround that uses an ImageMenuItem to display checkboxes. If you have installed an icon theme that provides @LiterallyJohnny It would nontheless be amazing to report the above minimal example to sway if you can spare the time! |
Yeah, I'll report it to them. I'll try and get it done today if I have time to spare. Question: The code you provided above, did you make that or is that code from Sway or uDiskie? |
awesome, thanks! Best also post in this thread here a link to the sway issue.
I created it as a minimal example to show that there is a general problem with checkboxes in tray menus on sway. |
Ah, alright. Sounds good to me, I'll be sure to report the issue soon. |
FYI: I opened Alexays/Waybar#1148 |
I recently switched to Sway/Wayland, and I noticed that the Udiskie status bar applet doesn't allow me to check the boxes. They are unchecked, and checking it closes that dialog but when I go to check it, it's still unchecked.
The text was updated successfully, but these errors were encountered: