适用于 Mac OS X 的 Ubuntu 风格多桌面

适用于 Mac OS X 的 Ubuntu 风格多桌面

可以在 Mac 上设置多个桌面吗?

答案1

出色地,空间是那样的。

虽然我不知道“Ubuntu风格的多桌面”是什么。

答案2

正如已经指出的,Spaces 可以做到这一点。超空间增强它(共享软件)。

答案3

Ubuntu(X 窗口管理器)风格的多桌面意味着您将获得新的桌面来整理。我在 MacOS 上使用一个简单的 shell 脚本实现了它(如下)。它确实需要 root 访问权限才能进行配置。(使用符号链接到包含真实桌面文件夹的文件夹来制造假象)。我使用 Automator 将 shell 脚本映射到四个热键。

我发现的唯一缺点是左侧查找器列中的“桌面”别名需要替换为真实桌面文件夹的别名,例如名为 Desktop1、Desktop2 等的文件夹。

我不喜欢空间,因为它所做的只是在查看同一个杂乱的桌面时提供不同的窗口来隔离正在运行的应用程序。

如果您使用我的脚本并且同时想使用 Spaces,我建议修改我的脚本以将脚本的桌面命名为 DesktopA、DesktopB 等,因为空间名称为 Desktop1、Desktop2 等,以尽量减少对您所在位置(或放置物品)的混淆。

这是脚本。(我建议在尝试之前先有一些使用 Unix sysAd 的经验或获得 hep。)我在 High Sierra 和 Mojave 上使用它已经快一年了,没有遇到任何问题。)

# Jeff Bloomfield - 2/23/2021
# [email protected]

#
# Setup Instructions:
# 1. Make the directory $DESKTOP_DIRS as $USER with rwxr-xr-x permissions.
# 2. As root, mv $HOME/Desktop $DESKTOP_DIRS
#    Root needed because of existing extended permissions "everyone deny delete".
#    You can see extended permissions with ls -led.
#    The mv should keep the directory permissions and ownership as they are.
# 3. As $USER, make the empty directories for your new alternate desktops in
#    $DESKTOP_DIRS
#    Name the alternate desktop directories DesktopN, where N is the desktop
#    number (or character, I suppose) you intend to pass in chdt's argument.
# 4. You might want to give your alternate desktops the same extended perms as
#    your original Desktop directory. See ls(1) for pointers to more information
#    on this [squirrley] topic.
# 5. You can map chdt to hot keys using Automator workflow scripts.

#    Usage:
#       chdt N
#    where N is the desktop number or suffix
#
#    Example:
#       chdt 2
#    Changes the active desktop to the contents of $DESKTOP_DIRS/${DESKTOP_NAME}2

    PROG=$(basename $0)

    DESKTOP_SYMLINK=$HOME/Desktop
    DESKTOP_DIRS=$HOME/Desktops
    DESKTOP_NAME=Desktop    # Used here to set the basename of the desktop
                            # as in Desktop1, Desktop2...DesktopN, etc.

    DesktopNum=$1

# Catch some errors and exit with an error message:

    # Warn me in case the OS does some sneaky things like recreate the Desktop
    # directory or some other untoward behavior I don't know about yet.
    if [ ! -L $DESKTOP_SYMLINK ]; then
        echo "$PROG: $DESKTOP_SYMLINK is not symlink or does not exist."
        exit 1
    fi

    if [ ! "$DesktopNum" ]; then echo "$PROG: Missing desktop argument:"; \
                                 echo "        $PROG desktop"
        exit 1
    fi

    if [ ! -d $DESKTOP_DIRS/$DESKTOP_NAME${DesktopNum} ]; then
        echo "$PROG: Desktop${DesktopNum} is not a directory or does not exist."
        echo exiting...
        exit 1
    fi

# Do the work:

    if ! /bin/rm $DESKTOP_SYMLINK; then
        echo "$PROG: Failed to remove symlink \"$DESKTOP_SYMLINK\""
        echo exiting...
        exit 1
    fi

    if ! /bin/ln -s $DESKTOP_DIRS/$DESKTOP_NAME${DesktopNum} $HOME/Desktop; then
        echo "$PROG: Failed to create symlink $DESKTOP_DIRS/$DesktopNum -> $DESKTOP_SYMLINK"
        exit 1
    fi

    sleep 1     # Avoid possible race conditions w/the Finder on fast machines
    if ! killall Finder; then
        echo "$PROG: Failed to restart the Finder for possibly unknown reason to point to Desktop${DesktopNum}"
        echo exiting...
        exit 1
    fi

    exit 0  #success

相关内容