标签:gist

浏览模式: 标准 | 列表 | 图文
升级到MacOS 12后。Moom打不开了

升级到MacOS 12后。Moom打不开了

系统升级到12后。Moom打不开了,在命令行直接open,显示Bus Error,一下子想不到怎么弄,干脆,不用了,换成hammorspoon,然后单独配置。

由于我用moom其实主要就是用了5组窗口(其实常见7种),1、左右 各50%,2:40:60,3、4/13,9/13,4:100%

1、50:50,用于放微信和QQ窗口
2、40:60,用于放便签和word,在高分屏下,word,如果全屏,反而字很小,干脆放60%左右
3、4/13和9/13,用于放终端和IDE,还有一组是MAC模拟器和Code(写flutter的时候用得上)
4、100%,用于给浏览器使用

配置,我把0.4的去掉了。
配置如下:

hs.window.animationDuration = 0
units = {
right50 = { x = 0.50, y = 0.00, w = 0.50, h = 1.00 },
left50 = { x = 0.00, y = 0.00, w = 0.50, h = 1.00 },
left_4_13 = { x = 0.00, y = 0.00, w = 4/13, h = 1.00 },
right_9_13 = { x = 4/13, y = 0.00, w = 9/13, h = 1.00 },
maximum = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 }
}
hs.hotkey.bind({"alt" }, "1", function()
hs.window.focusedWindow():move(units.left50, nil, true)
end)
hs.hotkey.bind({"alt" }, "2", function()
hs.window.focusedWindow():move(units.right50, nil, true)
end)

hs.hotkey.bind({"alt" }, "5", function()
hs.window.focusedWindow():move(units.left_4_13, nil, true)
end)

hs.hotkey.bind({"alt" }, "6", function()
hs.window.focusedWindow():move(units.right_9_13, nil, true)
end)

hs.hotkey.bind({"alt" }, "0", function()
hs.window.focusedWindow():move(units.maximum, nil, true)
end)

代码里没有0.4/0.6的,自己配一下就可以了,上述命令其实是:alt+数字,为什么用这个,是因为这个快捷键的冲突比较小(几乎没有见到有冲突)

如果复制不方便,还可以看这个gist:https://gist.github.com/neatstudio/ec8a26ed237e4a98667a878d8fd3c8cd

试用gist

其实gist功能早就见过了。类似功能的网站也非常多,但那些是不要注册 的。不过github这个gist嘛,注册了也有好处。自己把自己曾经写过的代码,还算好的代码,或者有想法的代码缓存下来。对自己以后 回顾的时候也有好处。

毕竟存在自己的电脑上也容易丢掉。这样多了一个碎片的管理,多少也有点好处。
比如,我就有这样一段:

<?php

$str = "101|1;0|4;1|0;0|0;0|0";

//第一种

$array = explode(';', $str);

$items = array();

foreach ($array as $v) {

list($k, $v) = explode('|', $v);

if (emptyempty($v)) {

continue;

}

$items[$v] = $k;

}

echo "<pre>";

print_r($items);

echo "</pre>";

//第二种

parse_str(preg_replace(array('/\d+\|0/','/;/','/\|/'),array("","&","="),$str),$result);

echo "<pre>";

print_r($result);

echo "</pre>";

看上去有点乱。不过。。。到:https://gist.github.com/4405542看就好很多了。。
我看看在代码里能不能引用: