Compare commits

...

7 Commits

Author SHA1 Message Date
Clement Lefebvre
7f920dfb72 5.9.1.2 2020-03-31 12:37:49 +01:00
Clement Lefebvre
cb9d4875f3 Fix launching pkexec applications (#248)
When launching mintsources, timeshift or an app which Exec field (in the desktop file)
starts with pkexec, nothing happens and the output states:

"Refusing to render service to dead parents."

For some reason this does not happen on fresh LMDE 4 and Mint 19.3 installations,
but it happens on LMDE 3 -> LMDE 4 and 19.1 -> 19.3 upgrades.

Similar bugs were fixed in nemo and cinnamon. Pkexec is known to cause issues
depending on how it's launched.

Specifying DO_NOT_REAP_CHILD in the spawn flags helps here. Afaik it makes it so
we're the parent of the pkexec process during launch. Pkexec fails to launch
otherwise.

gather_pid_callback() does nothing, it's just there to ack the pid callback. Afaik
this helps preventing zombie [defunct] processes when they terminate.
2020-03-31 12:37:09 +01:00
Andrew
20a98cd287 Fix broke running with "xdg-su" in exec field (#200) 2020-03-31 12:36:19 +01:00
gm10
df1460d7c5 Applications: Fix keypress event handler (#205)
* Applications: Fix keypress event handler

* further fix and simplify the keypress handler

* disconnect the keyPress handler when destroying the plugin
2020-03-31 12:36:16 +01:00
gm10
02f49184ed Places: Don't hardcode file browser (#204) 2020-03-31 12:36:03 +01:00
Clement Lefebvre
30579e0b41 5.9.1.1 2020-03-19 11:04:57 +00:00
Clement Lefebvre
dfa0758153 Inject the app version during the build 2020-03-19 11:04:17 +00:00
7 changed files with 81 additions and 84 deletions

20
debian/changelog vendored
View File

@ -1,3 +1,23 @@
mintmenu (5.9.1.2) debbie; urgency=medium
[ gm10 ]
* Places: Don't hardcode file browser (#204)
* Applications: Fix keypress event handler (#205)
[ Andrew ]
* Fix broke running with "xdg-su" in exec field (#200)
[ Clement Lefebvre ]
* Fix launching pkexec applications (#248)
-- Clement Lefebvre <root@linuxmint.com> Tue, 31 Mar 2020 12:37:33 +0100
mintmenu (5.9.1.1) debbie; urgency=medium
* Inject the app version during the build
-- Clement Lefebvre <root@linuxmint.com> Thu, 19 Mar 2020 11:04:38 +0000
mintmenu (5.9.1) tessa; urgency=medium mintmenu (5.9.1) tessa; urgency=medium
* Change default menu icon * Change default menu icon

11
debian/rules vendored
View File

@ -1,4 +1,13 @@
#!/usr/bin/make -f #!/usr/bin/make -f
DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
%: %:
dh ${@} --with python2 dh ${@} --with-python2
# Inject version number in the code
override_dh_installdeb:
dh_installdeb
for pkg in $$(dh_listpackages -i); do \
find debian/$$pkg -type f -exec sed -i -e s/__DEB_VERSION__/$(DEB_VERSION)/g {} +; \
done

View File

@ -679,9 +679,7 @@ class MenuWin( object ):
about = Gtk.AboutDialog() about = Gtk.AboutDialog()
about.set_name("mintMenu") about.set_name("mintMenu")
import commands about.set_version("__DEB_VERSION__")
version = commands.getoutput("/usr/lib/linuxmint/common/version.py mintmenu")
about.set_version(version)
try: try:
h = open('/usr/share/common-licenses/GPL','r') h = open('/usr/share/common-licenses/GPL','r')
s = h.readlines() s = h.readlines()

View File

@ -215,7 +215,7 @@ class pluginclass( object ):
self.filterTimer = None self.filterTimer = None
self.menuChangedTimer = None self.menuChangedTimer = None
# Hookup for text input # Hookup for text input
self.content_holder.connect( "key-press-event", self.keyPress ) self.keyPress_handler = self.mintMenuWin.window.connect( "key-press-event", self.keyPress )
self.favoritesBox.connect( "drag-data-received", self.ReceiveCallback ) self.favoritesBox.connect( "drag-data-received", self.ReceiveCallback )
@ -324,6 +324,8 @@ class pluginclass( object ):
self.categoriesBox.destroy() self.categoriesBox.destroy()
self.favoritesBox.destroy() self.favoritesBox.destroy()
self.mintMenuWin.window.disconnect(self.keyPress_handler)
self.settings.notifyRemoveAll() self.settings.notifyRemoveAll()
def changePluginSize( self, settings, key, args ): def changePluginSize( self, settings, key, args ):
@ -843,23 +845,11 @@ class pluginclass( object ):
self.searchEntry.set_text( "" ) self.searchEntry.set_text( "" )
self.Filter( widget, category ) self.Filter( widget, category )
# Forward all text to the search box
def keyPress( self, widget, event ): def keyPress( self, widget, event ):
""" Forward all text to the search box """
if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace: if event.string.strip() or event.keyval == Gdk.KEY_space:
self.searchEntry.grab_focus()
self.searchEntry.set_position( -1 )
self.searchEntry.event( event ) self.searchEntry.event( event )
return True return True
if event.keyval == Gdk.KEY_space:
self.searchEntry.event( event )
return True
if event.keyval == Gdk.KEY_Down and self.searchEntry.is_focus():
self.applicationsBox.get_children()[0].grab_focus()
return False return False
def favPopup( self, widget, event ): def favPopup( self, widget, event ):

View File

@ -377,7 +377,7 @@ class ApplicationLauncher( easyButton ):
cmd = "mate-terminal -e \"" + self.appExec + "\"" cmd = "mate-terminal -e \"" + self.appExec + "\""
Execute(cmd, self.appPath) Execute(cmd, self.appPath)
else: else:
Execute(self.appExec, self.appPath) Execute(None, desktopFile=self.desktopFile)
def uninstall (self, *args ): def uninstall (self, *args ):
Execute("mint-remove-application " + self.desktopFile) Execute("mint-remove-application " + self.desktopFile)

View File

@ -1,46 +1,49 @@
#!/usr/bin/python2 #!/usr/bin/python2
import os import os
from gi.repository import Gio, GLib
def RemoveArgs(Execline): def RemoveArgs(Execline):
NewExecline = [] if isinstance(Execline, list):
Specials=["\"%c\"", "%f","%F","%u","%U","%d","%D","%n","%N","%i","%c","%k","%v","%m","%M", "-caption", "/bin/sh", "sh", "-c", "STARTED_FROM_MENU=yes"] Execline = ' '.join(Execline)
for elem in Execline:
elem = elem.replace("'","") Specials = ["%f", "%F", "%u", "%U", "%d", "%D", "%n", "%N", "%i", "%c", "%k", "%v", "%m", "%M",
elem = elem.replace("\"", "") "STARTED_FROM_MENU=yes"]
if elem not in Specials: for spec in Specials:
print elem if spec in Execline:
NewExecline.append(elem) Execline = Execline.replace(spec, "")
return NewExecline
return Execline
def dummy_child_watch (pid, status, data):
# Do nothing, this is just to ensure we don't double fork
# and break pkexec: https://bugzilla.gnome.org/show_bug.cgi?id=675789
pass
def gather_pid_callback(appinfo, pid, data):
GLib.child_watch_add(pid, dummy_child_watch, None)
# Actually execute the command # Actually execute the command
def Execute( cmd , commandCwd=None): def Execute(cmd , commandCwd=None, desktopFile=None):
if not commandCwd: if desktopFile:
cwd = os.path.expanduser( "~" ); launcher = Gio.DesktopAppInfo.new_from_filename(desktopFile)
else: retval = launcher.launch_uris_as_manager(uris=[], launch_context=None, spawn_flags=GLib.SpawnFlags.SEARCH_PATH|GLib.SpawnFlags.DO_NOT_REAP_CHILD, \
tmpCwd = os.path.expanduser( commandCwd ); user_setup=None, user_setup_data=None, pid_callback=gather_pid_callback, pid_callback_data=None)
return retval
cwd = os.path.expanduser("~")
if commandCwd:
tmpCwd = os.path.expanduser(commandCwd)
if (os.path.exists(tmpCwd)): if (os.path.exists(tmpCwd)):
cwd = tmpCwd cwd = tmpCwd
if isinstance( cmd, str ) or isinstance( cmd, unicode):
if (cmd.find("ubiquity") >= 0) or (cmd.find("/home/") >= 0) or (cmd.find("su-to-root") >= 0) or (cmd.find("xdg-su") >= 0) or (cmd.find("\"") >= 0):
print "running manually..."
try:
os.chdir(cwd)
os.system(cmd + " &")
return True
except Exception, detail:
print detail
return False
cmd = cmd.split()
cmd = RemoveArgs(cmd) cmd = RemoveArgs(cmd)
try: try:
os.chdir(cwd) os.chdir(cwd)
string = ' '.join(cmd) os.system(cmd + " &")
string = string + " &"
os.system(string)
return True return True
except Exception, detail: except Exception as err:
print detail print err
return False return False

View File

@ -135,19 +135,13 @@ class pluginclass( object ):
if ( self.showcomputer == True ): if ( self.showcomputer == True ):
Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 ) Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 )
if self.de == "mate": Button1.connect( "clicked", self.ButtonClicked, "xdg-open computer:" )
Button1.connect( "clicked", self.ButtonClicked, "caja computer:" )
else:
Button1.connect( "clicked", self.ButtonClicked, "xdg-open /" )
Button1.show() Button1.show()
self.placesBtnHolder.pack_start( Button1, False, False, 0) self.placesBtnHolder.pack_start( Button1, False, False, 0)
self.mintMenuWin.setTooltip( Button1, _("Browse all local and remote disks and folders accessible from this computer") ) self.mintMenuWin.setTooltip( Button1, _("Browse all local and remote disks and folders accessible from this computer") )
if ( self.showhomefolder == True ): if ( self.showhomefolder == True ):
Button2 = easyButton( "user-home", self.iconsize, [_("Home Folder")], -1, -1 ) Button2 = easyButton( "user-home", self.iconsize, [_("Home Folder")], -1, -1 )
if self.de == "mate":
Button2.connect( "clicked", self.ButtonClicked, "caja %s " % home )
else:
Button2.connect( "clicked", self.ButtonClicked, "xdg-open %s " % home ) Button2.connect( "clicked", self.ButtonClicked, "xdg-open %s " % home )
Button2.show() Button2.show()
self.placesBtnHolder.pack_start( Button2, False, False, 0) self.placesBtnHolder.pack_start( Button2, False, False, 0)
@ -160,9 +154,6 @@ class pluginclass( object ):
Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1) Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1)
else: else:
Button3 = easyButton( "network-workgroup", self.iconsize, [_("Network")], -1, -1) Button3 = easyButton( "network-workgroup", self.iconsize, [_("Network")], -1, -1)
if self.de == "mate":
Button3.connect( "clicked", self.ButtonClicked, "caja network:" )
else:
Button3.connect( "clicked", self.ButtonClicked, "xdg-open network:" ) Button3.connect( "clicked", self.ButtonClicked, "xdg-open network:" )
Button3.show() Button3.show()
self.placesBtnHolder.pack_start( Button3, False, False, 0) self.placesBtnHolder.pack_start( Button3, False, False, 0)
@ -182,9 +173,6 @@ class pluginclass( object ):
except Exception, detail: except Exception, detail:
print detail print detail
Button4 = easyButton( "desktop", self.iconsize, [_("Desktop")], -1, -1 ) Button4 = easyButton( "desktop", self.iconsize, [_("Desktop")], -1, -1 )
if self.de == "mate":
Button4.connect( "clicked", self.ButtonClicked, "caja \"" + desktopDir + "\"")
else:
Button4.connect( "clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"") Button4.connect( "clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"")
Button4.show() Button4.show()
self.placesBtnHolder.pack_start( Button4, False, False, 0) self.placesBtnHolder.pack_start( Button4, False, False, 0)
@ -192,11 +180,6 @@ class pluginclass( object ):
if ( self.showtrash == True ): if ( self.showtrash == True ):
self.trashButton = easyButton( "user-trash", self.iconsize, [_("Trash")], -1, -1 ) self.trashButton = easyButton( "user-trash", self.iconsize, [_("Trash")], -1, -1 )
if self.de == "xfce":
self.trashButton.connect( "clicked", self.ButtonClicked, "thunar trash:" )
elif self.de == "mate":
self.trashButton.connect( "clicked", self.ButtonClicked, "caja trash:" )
else:
self.trashButton.connect( "clicked", self.ButtonClicked, "xdg-open trash:" ) self.trashButton.connect( "clicked", self.ButtonClicked, "xdg-open trash:" )
self.trashButton.show() self.trashButton.show()
self.trashButton.connect( "button-release-event", self.trashPopup ) self.trashButton.connect( "button-release-event", self.trashPopup )
@ -208,9 +191,6 @@ class pluginclass( object ):
for index in range( len(self.custompaths) ): for index in range( len(self.custompaths) ):
path = self.custompaths[index] path = self.custompaths[index]
path = path.replace("~", home) path = path.replace("~", home)
if self.de == "mate":
command = ( "caja \"" + path + "\"")
else:
command = ( "xdg-open \"" + path + "\"") command = ( "xdg-open \"" + path + "\"")
currentbutton = easyButton( "folder", self.iconsize, [self.customnames[index]], -1, -1 ) currentbutton = easyButton( "folder", self.iconsize, [self.customnames[index]], -1, -1 )
currentbutton.connect( "clicked", self.ButtonClicked, command ) currentbutton.connect( "clicked", self.ButtonClicked, command )
@ -249,9 +229,6 @@ class pluginclass( object ):
def launch_gtk_bookmark (self, widget, path): def launch_gtk_bookmark (self, widget, path):
self.mintMenuWin.hide() self.mintMenuWin.hide()
if self.de == "mate":
os.system("caja \"%s\" &" % path)
else:
os.system("xdg-open \"%s\" &" % path) os.system("xdg-open \"%s\" &" % path)
def trashPopup( self, widget, event ): def trashPopup( self, widget, event ):