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
* Change default menu icon

11
debian/rules vendored
View File

@ -1,4 +1,13 @@
#!/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.set_name("mintMenu")
import commands
version = commands.getoutput("/usr/lib/linuxmint/common/version.py mintmenu")
about.set_version(version)
about.set_version("__DEB_VERSION__")
try:
h = open('/usr/share/common-licenses/GPL','r')
s = h.readlines()

View File

@ -215,7 +215,7 @@ class pluginclass( object ):
self.filterTimer = None
self.menuChangedTimer = None
# 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 )
@ -250,7 +250,7 @@ class pluginclass( object ):
print detail
self.currentFavCol = 0
self.favorites = []
self.content_holder.set_size_request( self.width, self.height )
self.categoriesBox.set_size_request( self.width / 3, -1 )
self.applicationsBox.set_size_request( self.width / 2, -1 )
@ -283,7 +283,7 @@ class pluginclass( object ):
self.icon_theme = Gtk.IconTheme.get_default();
self.icon_theme.connect("changed", self.on_icon_theme_changed)
def refresh_apt_cache(self):
if self.useAPT:
os.system("mkdir -p %s/.linuxmint/mintMenu/" % home)
@ -324,6 +324,8 @@ class pluginclass( object ):
self.categoriesBox.destroy()
self.favoritesBox.destroy()
self.mintMenuWin.window.disconnect(self.keyPress_handler)
self.settings.notifyRemoveAll()
def changePluginSize( self, settings, key, args ):
@ -843,23 +845,11 @@ class pluginclass( object ):
self.searchEntry.set_text( "" )
self.Filter( widget, category )
# Forward all text to the search box
def keyPress( self, widget, event ):
if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace:
self.searchEntry.grab_focus()
self.searchEntry.set_position( -1 )
""" Forward all text to the search box """
if event.string.strip() or event.keyval == Gdk.KEY_space:
self.searchEntry.event( event )
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
def favPopup( self, widget, event ):
@ -1481,7 +1471,7 @@ class pluginclass( object ):
self.favoritesReorder( favButton.position, position )
self.favoritesSave()
def favoritesRemove( self, position ):
tmp = self.favorites[ position ]
self.favorites.remove( self.favorites[ position ] )

View File

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

View File

@ -1,46 +1,49 @@
#!/usr/bin/python2
import os
from gi.repository import Gio, GLib
def RemoveArgs(Execline):
NewExecline = []
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"]
for elem in Execline:
elem = elem.replace("'","")
elem = elem.replace("\"", "")
if elem not in Specials:
print elem
NewExecline.append(elem)
return NewExecline
if isinstance(Execline, list):
Execline = ' '.join(Execline)
Specials = ["%f", "%F", "%u", "%U", "%d", "%D", "%n", "%N", "%i", "%c", "%k", "%v", "%m", "%M",
"STARTED_FROM_MENU=yes"]
for spec in Specials:
if spec in Execline:
Execline = Execline.replace(spec, "")
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
def Execute( cmd , commandCwd=None):
if not commandCwd:
cwd = os.path.expanduser( "~" );
else:
tmpCwd = os.path.expanduser( commandCwd );
def Execute(cmd , commandCwd=None, desktopFile=None):
if desktopFile:
launcher = Gio.DesktopAppInfo.new_from_filename(desktopFile)
retval = launcher.launch_uris_as_manager(uris=[], launch_context=None, spawn_flags=GLib.SpawnFlags.SEARCH_PATH|GLib.SpawnFlags.DO_NOT_REAP_CHILD, \
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)):
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)
try:
os.chdir( cwd )
string = ' '.join(cmd)
string = string + " &"
os.system(string)
os.chdir(cwd)
os.system(cmd + " &")
return True
except Exception, detail:
print detail
except Exception as err:
print err
return False

View File

@ -135,20 +135,14 @@ class pluginclass( object ):
if ( self.showcomputer == True ):
Button1 = easyButton( "computer", self.iconsize, [_("Computer")], -1, -1 )
if self.de == "mate":
Button1.connect( "clicked", self.ButtonClicked, "caja computer:" )
else:
Button1.connect( "clicked", self.ButtonClicked, "xdg-open /" )
Button1.connect( "clicked", self.ButtonClicked, "xdg-open computer:" )
Button1.show()
self.placesBtnHolder.pack_start( Button1, False, False, 0)
self.mintMenuWin.setTooltip( Button1, _("Browse all local and remote disks and folders accessible from this computer") )
if ( self.showhomefolder == True ):
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()
self.placesBtnHolder.pack_start( Button2, False, False, 0)
self.mintMenuWin.setTooltip( Button2, _("Open your personal folder") )
@ -160,10 +154,7 @@ class pluginclass( object ):
Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1)
else:
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()
self.placesBtnHolder.pack_start( Button3, False, False, 0)
self.mintMenuWin.setTooltip( Button3, _("Browse bookmarked and local network locations") )
@ -182,22 +173,14 @@ class pluginclass( object ):
except Exception, detail:
print detail
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()
self.placesBtnHolder.pack_start( Button4, False, False, 0)
self.mintMenuWin.setTooltip( Button4, _("Browse items placed on the desktop") )
if ( self.showtrash == True ):
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.connect( "button-release-event", self.trashPopup )
self.refreshTrash()
@ -208,10 +191,7 @@ class pluginclass( object ):
for index in range( len(self.custompaths) ):
path = self.custompaths[index]
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.connect( "clicked", self.ButtonClicked, command )
currentbutton.show()
@ -249,10 +229,7 @@ class pluginclass( object ):
def launch_gtk_bookmark (self, widget, path):
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 ):
if event.button == 3: