-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Included same feature as master e729d4e but for shell version from 2.…
…8 to 3.5
- Loading branch information
Showing
7 changed files
with
189 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,22 @@ | ||
const AppDisplay = imports.ui.appDisplay; | ||
const GLib = imports.gi.GLib; | ||
|
||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const Me = ExtensionUtils.getCurrentExtension(); | ||
const PermissionsHandler = Me.imports.permissionsHandler; | ||
const MyLog = Me.imports.myLog.MyLog; | ||
const ShortcutMaker = Me.imports.shortcutMaker; | ||
|
||
// var because accessed elsewhere | ||
var DESKTOP_DIRECTORY = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP); | ||
|
||
// Save the standard Menu globally to be able to reset it | ||
var ParentMenu; | ||
// Saves the standard Menu globally to be able to reset it on disable | ||
var parentMenu = null; | ||
|
||
function init () { | ||
ParentMenu = AppDisplay.AppIconMenu; | ||
MyLog("init completed"); | ||
} | ||
|
||
function insertCustomEntry(menu) { | ||
// Add the "Add to Desktop" entry to the menu | ||
menu._appendSeparator(); | ||
let item = menu._appendMenuItem("Add to Desktop"); | ||
item.connect('activate', () => { | ||
let appPath = menu._source.app.get_app_info().get_filename(); // get the .desktop file complete path | ||
MyLog(appPath); | ||
let handler = new PermissionsHandler.PermissionsHandler(appPath); | ||
handler.start(); | ||
}); | ||
} | ||
|
||
function enable () { | ||
// AppIconMenu is the var which contains the class used to instantiate the context menu | ||
// Assigning my own custom menu that extends the standard menu so the custom will be used for instantiate | ||
AppDisplay.AppIconMenu = class customMenu extends ParentMenu { | ||
_redisplay() { | ||
super._redisplay(); | ||
insertCustomEntry(this); | ||
} | ||
} | ||
|
||
MyLog("DESKTOP_DIRECTORY = " + DESKTOP_DIRECTORY); | ||
MyLog("enable completed"); | ||
parentMenu = AppDisplay.AppIconMenu; | ||
ShortcutMaker.addShortcutButton(parentMenu); | ||
} | ||
|
||
function disable () { | ||
// Reset the menu to the standard one (not customized) | ||
AppDisplay.AppIconMenu = ParentMenu; | ||
MyLog("disable completed"); | ||
// Reset the menu to the standard one (without new item) | ||
AppDisplay.AppIconMenu = parentMenu; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.