我在 Manjaro 上使用 i3。我試圖讓某些鍵綁定以浮動方式啟動內容,而其他鍵則不能。到目前為止我已經嘗試了幾件事:
1. 直接floating toggle
與bindsym
# in i3/config
bindsym $mod+p exec $term -e python
bindsym $mod+Shift+p exec $term -e python; floating toggle
不幸的是,這會以正常(拆分/選項卡式/堆疊)模式啟動 Python,無論我在啟動 Python 之前關注什麼。
2.將每個啟動的Python置於bindsym
浮動狀態
# in i3/config
for_window [title="python"] floating toggle
bindsym $mod+p exec $term -e python
這實際上可以在浮動模式下自動啟動 Python!然而,任何和每一個Python 視窗以bindsym
浮動模式啟動...
3.自訂視窗標題
# in i3/config
for_window [title="[.*]_floating"] floating toggle
bindsym $mod+p exec --title "python_floating" $term -e python
不幸的是,exec
似乎沒有標誌,--title
所以bindsym
根本不起作用。
我嘗試過閱讀文件但man i3
到目前為止還沒有找到任何有幫助的東西。這似乎還沒有解決。我在谷歌上找到了 3 個類似的帖子[1] [2] [3]看起來像我的解決方案#2;
鑑於我建議的解決方案尚未完全解決這個問題,我如何啟動只有某些bindsym
以浮動模式啟動的東西?
答案1
你的第三個選擇非常接近。正如 i3 常見問題中所提到的這裡既烏爾克斯VT和xterm您可以使用該-name
參數。然後您可以根據以下條件定義它是否浮動實例。
例如,你的浮動/非浮動Python可以這樣完成:
set $term urxvt
# floating python
for_window [class="URxvt" instance="floating"] floating toggle resize set 1500 1000, move position 100 200
bindsym $mod+Shift+P exec $term -name 'floating' -e python
# not floating
bindsym $mod+Shift+O exec $term -name 'not' -e python