我只想打开一个 chrome , 如果 chrome 已经存在,那么直接激活当前的 chrome 即可? 有这方面的拓展吗?
我只想打开一个 chrome , 如果 chrome 已经存在,那么直接激活当前的 chrome 即可? 有这方面的拓展吗?
|
L4LinuxMar 20, 2024 via Android
1
为什么不改.desktop 文件?
|
|
mephistoMar 20, 2024 via iPad
2
你可以看看我写的一个隐藏和呼出终端的文章,但是不是 Gnome 下的,Gnome 很多东西是锁死的,有利有弊
|
|
passiveMar 21, 2024 via Android
3
没用过 wayland 。如果是 X ,在 Chrome.desktop 里填 StartupWMClass 。
|
|
june4Mar 21, 2024
4
设置中心>键盘>Custom Shortcuts ,里面可以为任意程序指定快捷键,写上 chrome 的命令行地址就行
|
|
vcn8yjOogELMar 21, 2024
5
Chrome 放到 Dash 上, 然后按 Super+数字键
|
|
kuanatMar 21, 2024
6
`Run or raise`
https://github.com/CZ-NIC/run-or-raise https://extensions.gnome.org/extension/1336/run-or-raise/ PS 不依赖扩展的方式就是楼上说的 Super+数字,上面的插件里也提到了。 再 PS tiling wm 环境里这个功能非常好实现,可以借鉴一下思路。绑定快捷键就用 Gnome 自带的 Keyboard shortcuts ,执行一个 bash -c "command" 命令。这个命令脚本用来判定运行程序和判定焦点,然后通过某个接口去操作窗口管理器。X11 的话,wmctrl 就可以。Wayland 需要通过 D-Bus 调用。 |
|
huangmingyouMar 22, 2024
7
gnome 用 xdotool 写脚本,用快捷键绑定脚本。 kde 可以直接用 kwin 规则实现,fvwm 也可以直接实现。不用 xdotool
|
|
8
|
|
9
@huangmingyou kde 貌似在 wayland 上面渲染有些问题, 弃用了。
|
|
mutex369Mar 23, 2024
10
以 Ubuntu20 为例:Settings -> Keyboard -> View and Customize Shortcuts -> Custom Shortcuts -> Add Custom Shortcut
在 Command 一行加入如下代码: ``` /bin/bash -c 'if ps -A | grep 那个程序可能的名字; then wmctrl -a 那个程序可能显示的窗体名字; else 运行那个程序的命令 ; fi;' ``` ---------- 但我现在也遇到了一个问题,wmctlr -l 显示的窗体里没有 firefox ,虽然它已经打开了。有人能教导一下吗? |
|
mutex369Mar 26, 2024
11
@mutex369 找到原因了,https://www.reddit.com/r/Ubuntu/comments/nu8bij/issue_with_wmctrl_and_firefox_after_upgrading_to/。
新版 firefox 默认使用 wayland 启动了,而 wmctrl 只能操纵 X11 的窗口。 |