ubuntu-mate / mate-menu

An Advanced Menu for the MATE Desktop
GNU General Public License v2.0
37 stars 18 forks source link

Desktop file Path= directive changes working dir DE-wide #83

Open drws opened 3 years ago

drws commented 3 years ago

75 fix, implemented in #76, unfortunately introduced a new bug. While the fix allows for a proper launching of certain applications, it unfortunately changes the mate-menu's execution context for every application until another launcher containing Path= directive is used. In my case majority of desktop files do not have it leading to launching applications in wrong working directiories after one with a Path= directive is used.

This can be easily demonstrated by launching an application with a desktop launcher containing Path= directive from mate-menu first and launching mate-terminal from mate-menu afterwards. It starts in path of the first launcher instead of shell default one (typically user's home directory)!

A better way to change working directory only for the spawned process probably needs to be implemented. Executing the launched application in a subshell comes to mind: (cd $WD_COMMAND; command) while removing the os.chdir() call in the execution environment. Alternatively (cd $WD_COMMAND && command)can be used for execution to fail if Path=-specified directory doesn't exist.