Skip to content

Instantly share code, notes, and snippets.

@satyr
Created February 21, 2009 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyr/68094 to your computer and use it in GitHub Desktop.
Save satyr/68094 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name toprightmost
// @namespace http://d.hatena.ne.jp/murky-satyr/
// @description Puts Firefox at toprightmost position with specified sizes.
// @include main
// @version 2010-04-02
// ==/UserScript==
var toprightmost = let(off = 1, x, y, w, h) function trm(width, height){
if(off ^= 1) return moveTo(x, y), resizeTo(w, h);
x = screenX, y = screenY, w = outerWidth, h = outerHeight;
var borderWidth = outerWidth - innerWidth >> 1,
captionHeight = outerHeight - innerHeight - borderWidth;
moveTo(screen.availWidth - width + borderWidth, 1 - captionHeight);
resizeTo(width, height);
};
let(W = 1140, H = 800){
let cmd = 'toprightmost('+ W +','+ H +')';
let key = (document.getElementById('mainKeyset')
.appendChild(document.createElement('key')));
for each(let [k, v] in Iterator({
oncommand: cmd, label: cmd,
modifiers: 'accel', key: 'M',
id: 'key_toprightmost'})) key.setAttribute(k, v);
toprightmost(W, H);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment