惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
S
Schneier on Security
The Hacker News
The Hacker News
P
Proofpoint News Feed
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
I
Intezer
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Schneier on Security
Schneier on Security
Security Latest
Security Latest
AWS News Blog
AWS News Blog
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
有赞技术团队
有赞技术团队
博客园 - 叶小钗
The Last Watchdog
The Last Watchdog
O
OpenAI News
月光博客
月光博客
Hacker News: Ask HN
Hacker News: Ask HN
阮一峰的网络日志
阮一峰的网络日志
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Latest news
Latest news
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
U
Unit 42
PCI Perspectives
PCI Perspectives
博客园 - 聂微东
SecWiki News
SecWiki News
宝玉的分享
宝玉的分享
Forbes - Security
Forbes - Security
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Troy Hunt's Blog
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
WordPress大学
WordPress大学
D
Darknet – Hacking Tools, Hacker News & Cyber Security

蚊帐

用树莓派给 iMac 加上 Face ID 链接 小米 YU7 三个月驾乘体验 波分单线复用笑传之Custom Combo Broadband 新柏石KNX协议智能家居网关接入 HomeAssistant 双方无公网状态下 RouterOS 基于 WireGuard 的组网方案 广东联通 IPTV 鉴权&抓源脚本(以及碎碎念) 广东电信 IPTV 自助鉴权 + 获取播放列表 为什么我们要拒绝 PON 方案的 FTTR 把 Windows 11/10 不完全转换为 Windows Server 2022 高通410随身WiFi的进阶USB网络共享和IPv6配置 ThinkBook 14+ 锐龙版上手体验 ArchLinux + KDE 一周使用小结 轻松抓取并解析广东电信 IPTV 全部直播源 虚拟显示器终极解决方案 IndirectDisplay 基于PVE的新网络架构 - 踩坑回顾 蚊子
修复 Edge/Chrome 在 GNOME 分数缩放下的窗口位置问题
蚊子 · 2021-11-27 · via 蚊帐

修复 Edge/Chrome 在 GNOME 分数缩放下的窗口位置问题

从上周开始,老莱弄了个“Daily Driver CHALLENGE”的挑战,还弄出了装个 Steam 把桌面卸掉了的笑话,弄得众人都发笑起来 —— 当然,笑的是 Pop!_OS,不是老莱。毕竟能让一个普通用户装个包就自动把桌面卸掉,怎么想都不合理。

于是从11月22日开始,我也学老莱进行了 Linux 挑战,把 Linux(确切地说是 Ubuntu 21.10)作为台式的主力系统使用30天。更多细节暂时按下不表,改日再写文章细细道来。这篇文章是要介绍分数缩放下 GNOME 的一个坑,并且给出解决办法。

分数缩放引发的各种BUG是咱们的老熟人了,不管是Windows还是Linux,你要是但敢开125%或者150%或者225%这种缩放,那就等着被无穷无尽的BUG淹没吧:轻则画面模糊,重则弄崩桌面。这次遇到的问题是“越开越小的窗口”:在 非整数倍缩放的时候。Edge 没办法正确记忆窗口大小。准确地说,他记忆了,然后打开的时候忘了按倍数缩放...结果关了在打开,越打开越小... 看下面的视频你就明白了

一开始我写了个脚本用 wmctrl 在 Edge 打开的时候自动把窗口放大到原来的2倍,但是如果关闭前Edge窗口为最大化状态,再次启动时就没办法放大,因为本来就是最大化。所以换了一个思路,直接修改Edge的配置文件里记录的窗口大小和位置,启动前修改好或者关闭后修改都行。

#!/bin/bash
wininfo=$(cat ~/.config/microsoft-edge/Default/Preferences)
top=$(jq -r .browser.window_placement.top <<< "$wininfo")
bottom=$(jq -r .browser.window_placement.bottom <<< "$wininfo")
left=$(jq -r .browser.window_placement.left <<< "$wininfo")
right=$(jq -r .browser.window_placement.right <<< "$wininfo")
#echo $top,$bottom,$left,$right
if [[ ! $top -le 0 ]]; then
  top=$((top*2))
else
  top=$((top/2))
fi
if [[ ! $left -le 0 ]]; then
  left=$((left*2))
else
  left=$((left/2))
fi
cat ~/.config/microsoft-edge/Default/Preferences | jq '.browser.window_placement.top='$top' | .browser.window_placement.left='$left' | .browser.window_placement.right='$((right*2))' | .browser.window_placement.bottom='$((bottom/100*199)) > ~/.config/microsoft-edge/Default/PreferencesGen
mv  ~/.config/microsoft-edge/Default/PreferencesGen  ~/.config/microsoft-edge/Default/Preferences

想办法让上面的代码在 Edge 关闭后或者启动前运行即可,我是直接改了 /usr/bin/microsoft-edge 这个脚本。希望这个 BUG 能早日被修复。

2021年11月29日更新:Edge升级到96版本之后该BUG已经消失,脚本仅服役了2天就正式退役 23333