I've made myself a script that adds/removes a magenta outline to the active layer — so every transparent pixel becomes visible — and I have it assigned to F4.

Limitation is that it'll freak out if there are several strokes already on the layer or remove an existing stroke effect.
To use it save this to a name.jsx
to your Photoshop/Presets/Scripts
folder, restart PS and you'll find name
in the File > Scripts
menu. And it's possible to assign a shortcut to it via Edit > Edit Keyboard Shortcuts
menu.
function main() {
if ( checkIfHasStrokeFX() ) {
removeFX();
} else {
addStroke({
width: 1, // width of the stroke
color: [255, 0, 255] // color in r, g, b
});
}
function checkIfHasStrokeFX(_data) {
if (_data == void(0)) _data = {};
try {
var ref = new ActionReference();
ref.putProperty(charIDToTypeID("Prpr"), charIDToTypeID("Lefx"));
ref.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
try {
var desc = executeActionGet(ref)
.getObjectValue(charIDToTypeID("Lefx"))
.getList(stringIDToTypeID("frameFXMulti"));
var tempBool = false;
for (var i = 0; i < desc.count; i++) {
if (desc.getObjectValue(i).getBoolean(charIDToTypeID("enab"))) tempBool = true;
break
}
desc = tempBool
} catch (e) {
var desc = executeActionGet(ref)
.getObjectValue(charIDToTypeID("Lefx"))
.getObjectValue(charIDToTypeID("FrFX"))
.getBoolean(charIDToTypeID("enab"));
}
return desc
} catch (e) {
return false
}
};
function addStroke(_data) {
if (_data == void(0)) _data = {};
if (_data.color == void(0)) _data.color = [255, 0, 255];
if (_data.opacity == void(0)) _data.opacity = 100;
if (_data.width == void(0)) _data.width = 1;
if (_data.position == void(0)) _data.position = 'OutF';
var desc16 = new ActionDescriptor();
var ref3 = new ActionReference();
ref3.putProperty(charIDToTypeID('Prpr'), charIDToTypeID('Lefx'));
ref3.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
desc16.putReference(charIDToTypeID('null'), ref3);
var desc17 = new ActionDescriptor();
desc17.putUnitDouble(charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 100.000000);
var desc18 = new ActionDescriptor();
desc18.putBoolean(charIDToTypeID('enab'), true);
desc18.putBoolean(stringIDToTypeID('present'), true);
desc18.putBoolean(stringIDToTypeID('showInDialog'), true);
desc18.putEnumerated(charIDToTypeID('Styl'), charIDToTypeID('FStl'), charIDToTypeID('OutF'));
desc18.putEnumerated(charIDToTypeID('PntT'), charIDToTypeID('FrFl'), charIDToTypeID('SClr'));
desc18.putEnumerated(charIDToTypeID('Md '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml'));
desc18.putUnitDouble(charIDToTypeID('Opct'), charIDToTypeID('#Prc'), _data.opacity);
desc18.putUnitDouble(charIDToTypeID('Sz '), charIDToTypeID('#Pxl'), _data.width);
var desc19 = new ActionDescriptor();
desc19.putDouble(charIDToTypeID('Rd '), _data.color[0]);
desc19.putDouble(charIDToTypeID('Grn '), _data.color[1]);
desc19.putDouble(charIDToTypeID('Bl '), _data.color[2]);
desc18.putObject(charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc19);
desc18.putBoolean(stringIDToTypeID('overprint'), false);
desc17.putObject(charIDToTypeID('FrFX'), charIDToTypeID('FrFX'), desc18);
desc16.putObject(charIDToTypeID('T '), charIDToTypeID('Lefx'), desc17);
executeAction(charIDToTypeID('setd'), desc16, DialogModes.NO);
}
function removeFX(_data) {
if (_data == void(0)) _data = {};
if (_data.all == void(0)) _data.all = false;
try {
var desc20 = new ActionDescriptor();
var ref4 = new ActionReference();
_data.all || ref4.putIndex(charIDToTypeID('FrFX'), 3);
ref4.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
desc20.putReference(charIDToTypeID('null'), ref4);
executeAction(charIDToTypeID(_data.all ? 'dlfx' : 'dsfx'), desc20, DialogModes.NO);
return true
} catch (e) {
return false;
}
};
}
app.activeDocument.suspendHistory("check if has FX", "main()");