在 xfce 中获取工作区切换的视觉反馈

int*_*ted 8 xfce xubuntu workspaces

不确定这是否是该站点的合适问题,因为它并不是真正特定于 Ubuntu。那些认为不是的人可能应该在 Unix 和 Linux stackexchange 站点上回复我的交叉帖子。抱歉有任何混淆,我仍在协商这些站点(和 superuser.com,我也在那里交叉发布)之间的边界。我想我们都是。

我大量使用工作区,并且有很多(6x4 网格)。我通常运行 openbox,但目前我使用的机器没有设置 openbox,所以我使用 xfce,因为它已经按照我的喜好进行了大部分配置。当我切换工作区时,我已经习惯于获得视觉反馈,向我展示我刚刚搬到哪个工作区,并且发现自己在 xfce 中有点迷失方向。在 openbox 中,这是一个大的平视显示器,非常理想。我知道工作区切换器面板小程序会突出显示活动工作区,但这似乎只适用于显示一些桌面空间的工作区;因为我通常将所有窗口都最大化,所以这不是很有帮助。

在 xfce 中切换工作区时,有没有办法启用显示新工作区的视觉反馈?

Isa*_*soa 10

我写了一个小代码,显示有关工作区切换操作的通知。此代码需要 libnotify 和 libwnck

要编译它,请使用以下命令:

gcc -O2 -o wsnd `pkg-config  --cflags --libs libnotify --libs libwnck` wsn.c
Run Code Online (Sandbox Code Playgroud)

如果您发现使用上述命令编译错误,请尝试以下命令:

gcc -O2 -DWNCK_I_KNOW_THIS_IS_UNSTABLE -o wsnd `pkg-config  --cflags --libs libnotify --libs libwnck-1.0` wsn.c
Run Code Online (Sandbox Code Playgroud)

从终端测试它:./wsnd

将其包含为 XFCE 启动应用程序:在 XFCE 中,您需要在设置-管理器-> 会话和启动 -> 应用程序自动启动上将其添加为启动应用程序

编码:

//////////////////////////////////////////////////////////////////////////////////////
// Workspace Switch Notifier                                                        //
// Shows a OSD with workspace name on workspace switching action                    //
//                                                                                  //
// wsn.c -                                                                          //
//                                                                                  //
// Authors:                                                                         //
//    Isaac Maia Pessoa                                                             //
//                                                                                  //
// This program is free software: you can redistribute it and/or modify it          //
// under the terms of the GNU General Public License version 3, as published        //
// by the Free Software Foundation.                                                 //
//                                                                                  //
// This program is distributed in the hope that it will be useful, but              //
// WITHOUT ANY WARRANTY; without even the implied warranties of                     //
// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR               //
// PURPOSE.  See the GNU General Public License for more details.                   //
//                                                                                  //
// You should have received a copy of the GNU General Public License along          //
// with this program.  If not, see <http://www.gnu.org/licenses/>.                  //
//////////////////////////////////////////////////////////////////////////////////////

#include <libnotify/notify.h>
#include <libwnck/libwnck.h>

#define N_SUMMARY "Workspace Changed"
#define N_ICON    "dialog-information"
#define N_APPNAME "workspace switch notifier"
#define N_TIMEOUT 2000 /*2000ms = 2s */

static NotifyNotification * m_notification = NULL;

static void
on_active_workspace_changed (WnckScreen    *screen,
                             WnckWorkspace *space,
                             gpointer      data)
{

  WnckWorkspace * active_workspace = wnck_screen_get_active_workspace(screen);
  const char * w_name = wnck_workspace_get_name (active_workspace);

  notify_notification_update(m_notification, N_SUMMARY, w_name, N_ICON);
  notify_notification_show(m_notification, NULL);
}

int main(int argc, char ** argv)
{

   GMainLoop *loop;   
   WnckScreen *screen;

   if (notify_init(N_APPNAME))
       m_notification = notify_notification_new(N_SUMMARY, "" , N_ICON);
   else
       fprintf(stderr, "Failed to init notifications\n");
   notify_notification_set_timeout(m_notification, N_TIMEOUT);

   gdk_init (&argc, &argv);

   loop = g_main_loop_new (NULL, FALSE);
   screen = wnck_screen_get_default();

   g_signal_connect (screen, "active-workspace-changed",
                    G_CALLBACK (on_active_workspace_changed), NULL);

   g_main_loop_run (loop);

   g_main_loop_unref (loop);    

   return 0;
}
Run Code Online (Sandbox Code Playgroud)


Rol*_*Xor 1

我唯一能想到的就是为每个桌面使用单独的壁纸(我相信这是可能的,但我无法确认,因为我不是每天都使用 xfce)。如果您不介意使用 compiz,您可以将其配置为类似于 xfwm 的工作方式,并安装工作区命名器插件,该插件允许您在切换时显示每个工作区的名称。


Hab*_*ual 1

你可以安装conky

将其保存到文件中...

# Static and Variable Values used by Habitual/John Jones

# Static Values
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
use_xft yes
draw_outline no
draw_borders no
uppercase no
draw_shades no
draw_shades yes
double_buffer yes
border_width 0
text_buffer_size 2048
default_color white
update_interval 1.0

# Variable Values # These values are the ONLY thing that change from widget to widget
alignment bm
gap_x 5
gap_y 44
minimum_size 50 1
maximum_width 100

TEXT
${desktop_number}
Run Code Online (Sandbox Code Playgroud)

在 Xfce 中运行它。(终端)-> with conky -c /path/to/file &

图标/启动器 conky -c /路径/到/文件

每次切换桌面时,屏幕上都会显示桌面的编号。

“alignment bm”值控制桌面放置。bm 是中下。

有关 DOC,请参阅http://conky.sourceforge.net/docs.html