Ubuntu 19.04,在同一桌面创建自定义快捷方式,如 SUPER + NUM(最喜欢的应用程序创建 | 显示)快捷方式
Ubuntu 19.04, Make custom shortcut like SUPER + NUM (favorite app create | show) shortcut in same desktop
创建显示或隐藏任何我想要在同一个桌面上显示或隐藏的 window,而不是默认的 SUPER + NUM 功能。
I want to remove the default (old) one too.
删除默认快捷方式:
通过终端命令
gsettings set org.gnome.shell.extensions.dash-to-dock hot-keys false
gsettings set org.gnome.shell.keybindings switch-to-application-1 []
gsettings set org.gnome.shell.keybindings switch-to-application-2 []
gsettings set org.gnome.shell.keybindings switch-to-application-3 []
gsettings set org.gnome.shell.keybindings switch-to-application-4 []
gsettings set org.gnome.shell.keybindings switch-to-application-5 []
gsettings set org.gnome.shell.keybindings switch-to-application-6 []
gsettings set org.gnome.shell.keybindings switch-to-application-7 []
gsettings set org.gnome.shell.keybindings switch-to-application-8 []
gsettings set org.gnome.shell.keybindings switch-to-application-9 []
通过 Dconf-Editor
的 GUI
- 安装dconf-editor
sudo apt get install dconf-editor
- 启动编辑器
dconf-editor
- 移动
org.gnome.shell.keybindings
然后单击并设置“[]”(删除可能)
创建自定义快捷方式
- 首先,安装依赖[=15=]
- 复制下面我的脚本中的所有文本
- 打开终端并输入
gedit ~/Tools/ywm.sh
并粘贴您的剪贴板内容
- 授予可执行权限
sudo chmod u+x '~/Tools/ywm.sh'
- 按SUPER键并输入
Shortcut
- 滚动到 window 的底部单击
+
按钮
- 键入这些命令(只是示例)并设置您喜欢的快捷方式
- 对于终端,
bash -c "bash ~/Tools/ywm.sh gnome-terminal"
- 对于googlechrome,
bash -c "bash ~/Tools/ywm.sh google-chrome"
- 对于Vscode、
bash -c "bash ~/Tools/ywm.sh code"
- 对于文件资源管理器,
bash -c "bash ~/Tools/ywm.sh nautilus"
- 对于文本编辑器,
bash -c "bash ~/Tools/ywm.sh gedit"
我的脚本
# !/bin/bash
# Window manager script
# Show, hide or create window in the current workspace with It's WM_CLASS
# , WM_CLASS
# , Optional command
# Copyright © ~ Yunus Emre Ak
# Suppose that these script written in '~/Tools/ywm.sh'
# # Need permission to work as shurtcut
# chmod u+x '~/Tools/ywm.sh'
# Getting windows id if exist
if [ ${#1} -gt 0 ]; then
# Work only in the current workspace
WID=$(xdotool search --desktop $(xdotool get_desktop) --classname )
if [ ${#WID} -gt 0 ]; then
# If opened more, find focused one and hide
if [[ "$WID" =~ "$(xdotool getwindowfocus)" ]]; then
xdotool windowminimize $(xdotool getwindowfocus)
else
# Open first windows if not, then try second
let "WID1 = $(echo $WID | awk '{print }')"
let "WID2 = $(echo $WID | awk '{print }')"
xdotool windowactivate $WID1 || xdotool windowactivate $WID2
fi
else
# If optional exec not exist, execute WM_CLASS
if [ ${#2} -gt 0 ]; then
else
fi
fi
else
echo "Need to get parameter which are 'WM_CLASS' and optional Exec"
echo "Ex: 'bash ywm.sh chrome google-chrome'"
fi
# Shortcuts for favorite app
# bash -c "bash ~/Tools/ywm.sh gnome-terminal" # SUPER + 1
# bash -c "bash ~/Tools/ywm.sh google-chrome" # SUPER + 2
# bash -c "bash ~/Tools/ywm.sh code" # SUPER + 3
# bash -c "bash ~/Tools/ywm.sh nautilus" # SUPER + 4
# bash -c "bash ~/Tools/ywm.sh gedit" # SUPER + 4
创建显示或隐藏任何我想要在同一个桌面上显示或隐藏的 window,而不是默认的 SUPER + NUM 功能。
I want to remove the default (old) one too.
删除默认快捷方式:
通过终端命令
gsettings set org.gnome.shell.extensions.dash-to-dock hot-keys false
gsettings set org.gnome.shell.keybindings switch-to-application-1 []
gsettings set org.gnome.shell.keybindings switch-to-application-2 []
gsettings set org.gnome.shell.keybindings switch-to-application-3 []
gsettings set org.gnome.shell.keybindings switch-to-application-4 []
gsettings set org.gnome.shell.keybindings switch-to-application-5 []
gsettings set org.gnome.shell.keybindings switch-to-application-6 []
gsettings set org.gnome.shell.keybindings switch-to-application-7 []
gsettings set org.gnome.shell.keybindings switch-to-application-8 []
gsettings set org.gnome.shell.keybindings switch-to-application-9 []
通过 Dconf-Editor
的 GUI- 安装dconf-editor
sudo apt get install dconf-editor
- 启动编辑器
dconf-editor
- 移动
org.gnome.shell.keybindings
然后单击并设置“[]”(删除可能)
创建自定义快捷方式
- 首先,安装依赖[=15=]
- 复制下面我的脚本中的所有文本
- 打开终端并输入
gedit ~/Tools/ywm.sh
并粘贴您的剪贴板内容 - 授予可执行权限
sudo chmod u+x '~/Tools/ywm.sh'
- 按SUPER键并输入
Shortcut
- 滚动到 window 的底部单击
+
按钮 - 键入这些命令(只是示例)并设置您喜欢的快捷方式
- 对于终端,
bash -c "bash ~/Tools/ywm.sh gnome-terminal"
- 对于googlechrome,
bash -c "bash ~/Tools/ywm.sh google-chrome"
- 对于Vscode、
bash -c "bash ~/Tools/ywm.sh code"
- 对于文件资源管理器,
bash -c "bash ~/Tools/ywm.sh nautilus"
- 对于文本编辑器,
bash -c "bash ~/Tools/ywm.sh gedit"
- 对于终端,
我的脚本
# !/bin/bash
# Window manager script
# Show, hide or create window in the current workspace with It's WM_CLASS
# , WM_CLASS
# , Optional command
# Copyright © ~ Yunus Emre Ak
# Suppose that these script written in '~/Tools/ywm.sh'
# # Need permission to work as shurtcut
# chmod u+x '~/Tools/ywm.sh'
# Getting windows id if exist
if [ ${#1} -gt 0 ]; then
# Work only in the current workspace
WID=$(xdotool search --desktop $(xdotool get_desktop) --classname )
if [ ${#WID} -gt 0 ]; then
# If opened more, find focused one and hide
if [[ "$WID" =~ "$(xdotool getwindowfocus)" ]]; then
xdotool windowminimize $(xdotool getwindowfocus)
else
# Open first windows if not, then try second
let "WID1 = $(echo $WID | awk '{print }')"
let "WID2 = $(echo $WID | awk '{print }')"
xdotool windowactivate $WID1 || xdotool windowactivate $WID2
fi
else
# If optional exec not exist, execute WM_CLASS
if [ ${#2} -gt 0 ]; then
else
fi
fi
else
echo "Need to get parameter which are 'WM_CLASS' and optional Exec"
echo "Ex: 'bash ywm.sh chrome google-chrome'"
fi
# Shortcuts for favorite app
# bash -c "bash ~/Tools/ywm.sh gnome-terminal" # SUPER + 1
# bash -c "bash ~/Tools/ywm.sh google-chrome" # SUPER + 2
# bash -c "bash ~/Tools/ywm.sh code" # SUPER + 3
# bash -c "bash ~/Tools/ywm.sh nautilus" # SUPER + 4
# bash -c "bash ~/Tools/ywm.sh gedit" # SUPER + 4