首页 > 解决方案 > 多个桌面在 bspwm 中不工作 | bspwmrc 没有被读取?

问题描述

我正在使用带有 Gnome 桌面环境的 Ubuntu 20.04.1 LTS。

几天前,我决定尝试 bspwm,它工作正常,除了一件事......我不能使用多个桌面(类似于 Windows 中的工作区)。我进行了一些研究,现在看来 bspwm 并没有首先读取我的 bspwmrc。

我已将我的配置设置为{HOME}/.config/bspwm/bspwmrc并且{HOME}/.config/sxhkd/sxhkdrc它们都是可执行文件。

在某些地方,我发现提到了 xinitrc,但我没有在那里配置任何东西。首先,我的主目录中没有 xinitrc。我在这里找到了一个/etc/X11/xinit/xinitrc,它有这个:-

#!/bin/sh

# /etc/X11/xinit/xinitrc
#
# global xinitrc file, used by all X sessions started by xinit (startx)

# invoke global X session script
. /etc/X11/Xsession

我将它复制到我的主目录并添加了几行。现在它是这样写的:-

#!/bin/sh

# /etc/X11/xinit/xinitrc
#
# global xinitrc file, used by all X sessions started by xinit (startx)

# invoke global X session script
#. /etc/X11/Xsession

sxhkd &
exec bspwm

我的 bspwmrc 文件(顺便说一句,目前没有被读取)是这样的:-

#! /bin/sh

pkill sxhkd
sxhkd &
pkill compton
compton &
pkill feh 
feh --randomize --bg-fill ~/Pictures/Wallpapers/ &

pkill polybar
polybar example

bspc monitor -d 1 2 3 4 5 6 

bspc config border_width         2
bspc config window_gap          12

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      true

bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Chromium desktop='^2'
bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off

如果我运行这个

bspc monitor -d 1 2 3 4 5 6

在终端中,我可以在顶部栏中看到这些桌面,并且可以轻松地在它们之间切换。

但问题是为什么我的 bspwmrc 首先没有被 bspwm 读取?请帮忙!!

编辑:我注意到我的 bspwmrc 正在被 bspwm 读取,因为每当我尝试对我的 bspwmrc 进行一些更改(在这种情况下,我使用fehbspwmrc 文件中的配置)时,除了监视器之外,所有这些更改都会被反映!!

请帮我解决这个问题。

标签: linuxubuntu

解决方案


我在 Reddit 上找到了答案。要阅读所有内容,请查看内容。

我添加eDP-1到我的 bspc 监视器行,现在是这样的:-

bspc monitor eDP-1 -d I II III IV V VI VII VIII IX X

但即使这样也无济于事,所以我尝试在bspwmrc的帮助下记录 stderr

set -xv
exec 2>>/tmp/bspwm.log

我发现问题实际上出在我的 polybar 配置上(我刚刚复制了默认的 polybar 配置,现在有了"polybar example"),因此 bspwmrc 的其余部分没有被完全读取。polybar 配置产生了这样的错误,

polybar|warn:  Dropping unmatched character  (U+e0ca) in ''
polybar|warn:  Dropping unmatched character  (U+e016) in ''
polybar|warn:  Dropping unmatched character  (U+e10c) in ''

所以,我只是在启动 polybar 之前移动了 bspc 监视器线,然后它工作得非常好。现在,我的 bspwmrc 是这样的,

#! /bin/sh

set -xv
exec 2>>/tmp/bspwm.log

bspc query -M --names
bspc monitor eDP-1 -d I II III IV V VI VII VIII IX X

pkill sxhkd
sxhkd &
pkill compton
compton &
pkill feh 
feh --randomize --bg-fill ~/Pictures/Wallpapers/ &

pkill polybar
polybar example

bspc config border_width         2
bspc config window_gap          12

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      true

bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Chromium desktop='^2'
bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off

现在我只需要稍微调整一下我的 polybar 配置,它也可以正常工作。


推荐阅读