如何在登录时禁用 GNOME 工作区选择?

如何在登录时禁用 GNOME 工作区选择?

会话开始后,GNOME 希望您从可用工作区之一中进行选择,即使只有一个工作区。

我宁愿完全禁用此选项,或者可能自动“选择”第一个选项。我的意思是,即使只是点击一下,对我来说也没用,而且很烦人。

这可以做到吗?这个“功能”叫什么?我找不到任何与调整或设置相关的选项(也许是 dconf?)。

答案1

如果您使用具有默认行为的 GNOME 42,那么您看到的是“活动概述”。它实际上并不是要求您选择一个工作区,而是要求您打开您打算启动的任何应用程序。

GNOME 开发人员被问及这个问题,并且有2021 年 GNOME Discourse 上发生的一场冗长的讨论。最后,他们指出他们无意更改默认行为或添加切换它的功能。

不管。如果您想禁用它并让它转到桌面,请尝试“启动时无概述”shell 扩展

答案2

如果您使用仪表板扩展程序,则可以在以下位置进行配置:

extensions -> dash to panel -> settings -> behavior -> overview -> disable show overview on start up

答案3

我开发了一种不基于 shell 扩展的不同解决方案(因此应该更能适应新的 gnome 版本和未来的不兼容性)。

该解决方案可以在系统范围内实施,也可以仅影响用户,具体取决于文件的放置位置。 OBS:请注意,第一个文件必须是可执行的,chmod 755 /usr/libexec/no-overview-at-startup或者chmod 755 ${HOME}/bin/no-overview-at-startup取决于您是否将使用系统范围或用户特定的方法。

首先,如果您选择系统范围的方法,则要使用的文件:

文件1: /usr/libexec/no-overview-at-startup

#!/usr/bin/sh

# Monitoring time in tenths of seconds
MTIME=50
for ((i=0; i<${MTIME}; i++)); do
  read -r DUMMY DUMMY IS_OVERVIEW <<< "$(dbus-send --print-reply=literal --session --dest=org.gnome.Shell --type=method_call /org/gnome/Shell org.freedesktop.DBus.Properties.Get string:org.gnome.Shell string:OverviewActive)"
  if [[ "${IS_OVERVIEW}" = "true" ]] ; then
    /usr/bin/dbus-send --session --dest=org.gnome.Shell --type=method_call /org/gnome/Shell org.freedesktop.DBus.Properties.Set string:org.gnome.Shell string:OverviewActive variant:boolean:false
    exit
  fi
  sleep 0.1
done

文件2: /etc/xdg/autostart/no-overview-at-startup.desktop

[Desktop Entry]
Type=Application
Exec=/usr/libexec/no-overview-at-startup
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=No Overview at Start-up
Name=No Overview at Start-up
Comment[en_US]=Disable overview mode right after login
Comment=Disable overview mode right after login

或者,为了使其仅影响用户,文件应放置在不同的目录中,并且需要更改文件 2:

文件 1 位置:${HOME}/bin/no-overview-at-startup.

文件 2 位置:${HOME}/.config/autostart/no-overview-at-startup.desktop.

重要的:文件 2 必须将以 开头的行EXEC=...更改为EXEC=${HOME}/bin/no-overview-at-startup

最后,如果您使用 Fedora 并且有构建 RPMS 的经验,这里有一个.spec用于此目的的文件(仅对系统范围的方法有效):

文件3gnome-shell-no-overview.spec

Name:       gnome-shell-no-overview
Summary:    Disable the overview mode on startup
Version:    0.1
Release:    1%{?dist}
License:    freeware
Source0:    %{name}-%{version}.tar.gz

BuildArch:  noarch
Requires:   gnome-shell

%description
gnome-shell-no-overview is a bundle of startup app and script designed to disable the initial overview mode imposed by gnome in recent 4x releases.  This is accomplished by a script that monitors if the overview mode is activated in the first 5 seconds after the startup and sends a dbus message changing it back to the desktop mode

%prep
%setup -q

%build
true

%files
%doc
/usr/libexec/no-overview-at-startup
/etc/xdg/autostart/no-overview-at-startup.desktop

%install
install -D -m 755 %{_builddir}/%{name}-%{version}/no-overview-at-startup %{buildroot}/usr/libexec/no-overview-at-startup
install -D -m 644 %{_builddir}/%{name}-%{version}/no-overview-at-startup.desktop %{buildroot}/etc/xdg/autostart/no-overview-at-startup.desktop

如果您需要构建 Fedora 软件包的帮助,请在评论中给我留言,我可以为您提供更多详细信息。

相关内容