Yes, the easiest way would be to use the selection
module.
var { Hotkey } = require("sdk/hotkeys");
var selection = require("sdk/selection");
var showHotKey = Hotkey({
combo: "accel-f1",
onPress: function() {
console.error(selection.text);
}
});
If you require something more complex, have a look at tabs.activeTab.attach()
, which has an example showing how to interact with the active tab in general.