Context Menu (Right Click) keyboard shortcut in Mac OS X
Solution 1
After doing extensive research on this topic, I can confirm that there is no built-in mechanism that enables context menu either by direct shortcut or right mouse click simulation. This is due to technical limitations of the operating system, which prevents from determining coordinates of the current selection (e.g., selected element).
Fortunately, in some applications it is possible to use Apple Script to facilitate such action, but this is a strictly application-specific approach.
Solution 2
User vitor on the Alfred forums wrote this AppleScript which works in Finder on Catalina:
tell application "System Events" to set frontApp to name of first process whose frontmost is true
if (frontApp = "Finder") then
tell application "System Events"
tell application process "Finder"
set _selection to value of attribute "AXFocusedUIElement"
tell _selection to perform action "AXShowMenu"
end tell
end tell
end if
You can save it as a service and set it to activate with a keyboard shortcut.
Solution 3
While the contextual activation is lacking, in OS X you can activate and access the top menu bar using the keyboard, which will give you access to all of the commands in the contextual menu, and more
http://www.cnet.com/news/access-menus-via-the-keyboard-in-os-x/
Solution 4
It appears that every post I can find online is either wrong or merely outdated.
In Catalina, you can use System preferences -> Accessibility --> Pointer Control --> Alternate Control methods --> check Enable alternate control methods.
You can reassign the shortcut by clicking on the corresponding options button.
Update by another writer: here is that Dialog Box: this is brilliantly useful for me!
F12
brings up the context menu very close to the cursor (though not precisely as in Windows). This is great.
Solution 5
Some applications such as Power BI on a browser will use the combination Shift + F10
Related videos on Youtube
![czerwin](https://i.stack.imgur.com/MxVdq.jpg?s=256&g=1)
czerwin
Updated on September 18, 2022Comments
-
czerwin almost 2 years
I have the following code:
var canvas = document.getElementById('nokey'), can_w = parseInt(canvas.getAttribute('width')), can_h = parseInt(canvas.getAttribute('height')), ctx = canvas.getContext('2d'); // console.log(typeof can_w); var ball = { x: 0, y: 0, vx: 0, vy: 0, r: 0, alpha: 1, phase: 0 }, ball_color = { r: 207, g: 255, b: 4 }, R = 2, balls = [], alpha_f = 0.03, alpha_phase = 0, // Line link_line_width = 0.8, dis_limit = 260, add_mouse_point = true, mouse_in = false, mouse_ball = { x: 0, y: 0, vx: 0, vy: 0, r: 0, type: 'mouse' }; // Random speed function getRandomSpeed(pos){ var min = -1, max = 1; switch(pos){ case 'top': return [randomNumFrom(min, max), randomNumFrom(0.1, max)]; break; case 'right': return [randomNumFrom(min, -0.1), randomNumFrom(min, max)]; break; case 'bottom': return [randomNumFrom(min, max), randomNumFrom(min, -0.1)]; break; case 'left': return [randomNumFrom(0.1, max), randomNumFrom(min, max)]; break; default: return; break; } } function randomArrayItem(arr){ return arr[Math.floor(Math.random() * arr.length)]; } function randomNumFrom(min, max){ return Math.random()*(max - min) + min; } console.log(randomNumFrom(0, 10)); // Random Ball function getRandomBall(){ var pos = randomArrayItem(['top', 'right', 'bottom', 'left']); switch(pos){ case 'top': return { x: randomSidePos(can_w), y: -R, vx: getRandomSpeed('top')[0], vy: getRandomSpeed('top')[1], r: R, alpha: 1, phase: randomNumFrom(0, 10) } break; case 'right': return { x: can_w + R, y: randomSidePos(can_h), vx: getRandomSpeed('right')[0], vy: getRandomSpeed('right')[1], r: R, alpha: 1, phase: randomNumFrom(0, 10) } break; case 'bottom': return { x: randomSidePos(can_w), y: can_h + R, vx: getRandomSpeed('bottom')[0], vy: getRandomSpeed('bottom')[1], r: R, alpha: 1, phase: randomNumFrom(0, 10) } break; case 'left': return { x: -R, y: randomSidePos(can_h), vx: getRandomSpeed('left')[0], vy: getRandomSpeed('left')[1], r: R, alpha: 1, phase: randomNumFrom(0, 10) } break; } } function randomSidePos(length){ return Math.ceil(Math.random() * length); } // Draw Ball function renderBalls(){ Array.prototype.forEach.call(balls, function(b){ if(!b.hasOwnProperty('type')){ ctx.fillStyle = 'rgba('+ball_color.r+','+ball_color.g+','+ball_color.b+','+b.alpha+')'; ctx.beginPath(); ctx.arc(b.x, b.y, R, 0, Math.PI*2, true); ctx.closePath(); ctx.fill(); } }); } // Update balls function updateBalls(){ var new_balls = []; Array.prototype.forEach.call(balls, function(b){ b.x += b.vx; b.y += b.vy; if(b.x > -(50) && b.x < (can_w+50) && b.y > -(50) && b.y < (can_h+50)){ new_balls.push(b); } // alpha change b.phase += alpha_f; b.alpha = Math.abs(Math.cos(b.phase)); // console.log(b.alpha); }); balls = new_balls.slice(0); } // loop alpha function loopAlphaInf(){ } // Draw lines function renderLines(){ var fraction, alpha; for (var i = 0; i < balls.length; i++) { for (var j = i + 1; j < balls.length; j++) { fraction = getDisOf(balls[i], balls[j]) / dis_limit; if(fraction < 1){ alpha = (1 - fraction).toString(); ctx.strokeStyle = 'rgba(150,150,150,'+alpha+')'; ctx.lineWidth = link_line_width; ctx.beginPath(); ctx.moveTo(balls[i].x, balls[i].y); ctx.lineTo(balls[j].x, balls[j].y); ctx.stroke(); ctx.closePath(); } } } } // calculate distance between two points function getDisOf(b1, b2){ var delta_x = Math.abs(b1.x - b2.x), delta_y = Math.abs(b1.y - b2.y); return Math.sqrt(delta_x*delta_x + delta_y*delta_y); } // add balls if there a little balls function addBallIfy(){ if(balls.length < 20){ balls.push(getRandomBall()); } } // Render function render(){ ctx.clearRect(0, 0, can_w, can_h); renderBalls(); renderLines(); updateBalls(); addBallIfy(); window.requestAnimationFrame(render); } // Init Balls function initBalls(num){ for(var i = 1; i <= num; i++){ balls.push({ x: randomSidePos(can_w), y: randomSidePos(can_h), vx: getRandomSpeed('top')[0], vy: getRandomSpeed('top')[1], r: R, alpha: 1, phase: randomNumFrom(0, 10) }); } } // Init Canvas function initCanvas(){ canvas.setAttribute('width', window.innerWidth); canvas.setAttribute('height', window.innerHeight); can_w = parseInt(canvas.getAttribute('width')); can_h = parseInt(canvas.getAttribute('height')); } window.addEventListener('resize', function(e){ console.log('Window Resize...'); initCanvas(); }); function goMovie(){ initCanvas(); initBalls(30); window.requestAnimationFrame(render); } goMovie(); // Mouse effect canvas.addEventListener('mouseenter', function(){ console.log('mouseenter'); mouse_in = true; balls.push(mouse_ball); }); canvas.addEventListener('mouseleave', function(){ console.log('mouseleave'); mouse_in = false; var new_balls = []; Array.prototype.forEach.call(balls, function(b){ if(!b.hasOwnProperty('type')){ new_balls.push(b); } }); balls = new_balls.slice(0); }); canvas.addEventListener('mousemove', function(e){ var e = e || window.event; mouse_ball.x = e.pageX; mouse_ball.y = e.pageY; // console.log(mouse_ball); });
*{ -webkit-box-sizing: border-box; box-sizing: border-box; } body{ height: 100%; margin: 0; padding: 0; background-color: transparent; overflow: hidden; } canvas{ z-index: -1; position: absolute; background-color: transparent; }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>repl.it</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <canvas id="nokey" width="800" height="800"> </canvas> <script src="script.js"></script> </body> </html>
I want the animation to be the height of the browser window, but the problem is I have different sections for each part of the content and each section is separated with
<section> and </section>
so is there a way I can make the animation the height of the whole browser window? I tried changing the height to 100% but it doesn't work. Also, is there someplace I should put the HTML code in my file? like at the top somewhere? Thanks-
Admin almost 10 yearsFor Finder (at least), a user has made a workflow for Alfred to do it successfully without requiring the mouse to hover over the current selected file/folder! I've tested it in Mavericks 10.9.4 and it works even on the Desktop, despite what people say on that Alfred thread. (that may be because I have XtraFinder installed, or because Apple fixed the bug in one of the recent Mavericks revisions) :). So just open the .alfredworkflow file, assign a hotkey to it, and away you go!
-
-
Sergei Basharov almost 10 yearsHow can it be they call the OS the most friendly but can't make some obvious expected things?
-
czerwin almost 10 yearsExcellent question. I wish I could know then answer to this one... I think Apple does not bother because there is no 'magic' (specific) question to perform this action.
-
WestCoastProjects over 9 yearsMac is NOT the most friendly O/S. Ask any keyboardist. It is hogwash.
-
dazonic about 9 yearsI use a mouth stick, physically can't use a mouse. There's a few things I wish were there, but still OS X is leagues better than Windows, Gnome or KDE, trust me.
-
Pat about 8 yearsWhich doesn't help when the context menu is provided by an app inside another app, e.g. websites with custom context menus :/
-
Forethinker almost 4 yearsQuestion reads: I don't want to depend on the position of the mouse cursor.
-
Shachar Har-Shuv almost 4 yearsAnd than they are saying mac has good UX....
-
Admin over 3 yearsDoes the HTML code go at the top of the website? If so, where should I put it?
-
learningtoanimate over 3 yearsIt depends if you're doing everything inline
-
Admin over 3 yearsWdym? For the animation to work for the whole website, is there not a specific place I should put the HTML code in?
-
jakub.g over 2 years
Shift-F10
is a typical Windows way to do this, and it seems on MacOS this works only in Microsoft apps. -
Admin about 2 yearsAny tip on how to do this for Chrome? -Alex