1

在同一桌面上创建显示或隐藏我想要的任何窗口,而不是默认SUPER+NUM功能。

我也想删除默认(旧)的。

4

1 回答 1

1

删除默认快捷方式:

通过终端命令

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 编辑器sudo apt get install dconf-editor
  • 启动编辑器dconf-editor
  • 移动org.gnome.shell.keybindings然后单击并设置'[]'(可能会删除)

制作自定义快捷方式

  • 一、安装依赖sudo apt install xdotool
  • 复制下面我的脚本中的所有文本
  • 打开终端并输入gedit ~/Tools/ywm.sh并粘贴剪贴板内容
  • 授予可执行权限sudo chmod u+x '~/Tools/ywm.sh'
  • 按键SUPER并输入Shortcut
  • 滚动到窗口底部单击+按钮
  • 键入这些命令(只是示例)并设置您喜欢的快捷方式
    • 对于终端,bash -c "bash ~/Tools/ywm.sh gnome-terminal"
    • 对于谷歌浏览器,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
# $1, WM_CLASS
# $2, 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 $1)
    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 $1}')"
            let "WID2 = $(echo $WID | awk '{print $2}')"
            xdotool windowactivate $WID1 || xdotool windowactivate $WID2
        fi
    else
        # If optional exec not exist, execute WM_CLASS
        if [ ${#2} -gt 0 ]; then
            $2
        else
            $1
        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
于 2019-05-27T14:10:23.923 回答