ワークスペースモジュールがPolybar i3に表示されません。

ワークスペースモジュールがPolybar i3に表示されません。

私はデフォルトのi3バーからポリバーの使用に切り替えました(Fedora 30、i3-gapsを実行)。このガイドに従ってPolybarをインストールしました。https://computingforgeeks.com/install-polybar-status-bar-on-fedora/。まず、Polybarのデフォルト設定を実行してみましたが、ワークスペースがあるはずの左側に何もないことを除いてうまくいきました。私はそれを試してみて動作しようとしましたが、私が出会ったフォーラムの誰も同じような状況に遭遇しなかったようです。

私はこの回答で提供されたPolybar設定をコピーしました。なぜなら、彼らが私がしたのと同じ方法でi3設定でワークスペースを設定したようだったからです。https://computingforgeeks.com/install-polybar-status-bar-on-fedora/しかし、結果は同じです。私のPolybarにワークスペースモジュールが表示されません。

私のマルチポール構成ファイルは次のとおりです。

[global/wm]
margin-top = 100
margin-bottom = 100

[colors]
fg = ${xrdb:color7}
modfg = ${xrdb:color1}
bg = ${xrdb:color0}

white = #d1d1d1
gray = #585858
black = #ce1d1d1d
red = #c795ae
blue = #95aec7
yellow = #c7ae95
green = #aec795


[bar/bar1]
width = 100%
height = 41
top = true
;margin-top = 100

border-top-size = 1  # creating top border space
offset-y = -3   # aligning tray icons with rest of bar
monitor = ${env:MONITOR:}

;background = #141021
background = #000f0f0f # This is the hexcode for transparency (also used in powermenu)
foreground = #c4b7c5


fixed-center = false

font-0 = FontAwesome:pixelsize=10;0
font-1 = PragmataPro Nerd Font:pixelsize=10;0
font-2 = "Font Awesome 5 Free:style=Regular:pixelsize=10;1"
font-3 = "Font Awesome 5 Free:style=Solid:pixelsize=10;1"
font-4 = "Font Awesome 5 Brands:pixelsize=10;1"

modules-left = i3
modules-center = date
modules-right = wireless-network cpu memory filesystem temperature pulseaudio backlight battery powermenu

tray-position = right
;tray-maxsize = 41
tray-background = #000f0f0f
tray-foreground= #000f0f0f

scroll-up = i3wm-wsnext
scroll-down = i3wm-wsprev


overline-size = 2
overline-color = ${colors.white}
underline-size = 4
underline-color = ${colors.white}

;override-redirect = true
;wm-restack = i3


[module/i3]
type = internal/i3

pin-workspaces = false
strip-wsnumbers = true
index-sort = false 
enable-scroll = false

format = <label-state> 
format-padding-right = 2

label-unfocused-foreground = #8a7f8f
label-unfocused-padding = 1

label-focused-foreground = #c16772
label-focused-padding = 1

label-urgent-foreground = #e4b226
label-urgent-padding = 1


[module/filesystem]
type = internal/fs

; Mountpoints to display
mount-0 = /

label-mounted =  %free%
format-mounted-padding = 2

; Seconds to sleep between updates
; Default: 30
; interval = 10

; Display fixed precision values
; Default: false
fixed-values = true

; Spacing between entries
; Default: 2
spacing = 6




[module/filesystem2]
type = internal/fs

; Mountpoints to display
mount-0 = /media/<my_name>/Data

label-mounted =  %free%
format-mounted-padding = 2

; Seconds to sleep between updates
; Default: 30
; interval = 10

; Display fixed precision values
; Default: false
fixed-values = true

; Spacing between entries
; Default: 2
spacing = 6





[module/cpu]
type = internal/cpu

interval = 1

format = <label>
format-padding = 2

label =  %percentage%%


[module/memory]
type = internal/memory

interval = 1

format = <label>
format-padding = 2

label =  %gb_used% (%percentage_used%%)


[module/temperature]
type = internal/temperature

interval = 1

thermal-zone = 0

warn-temperature = 74

format = <ramp> <label>
format-padding = 2

format-warn = <ramp> <label-warn>
format-warn-padding = 2

label = %temperature-c%

label-warn = %temperature-c%
label-warn-foreground = #e4b226

ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
ramp-4 = 


[module/date]
type = internal/date

interval = 1

date = %a %b %d, 
time = %H:%M:%S

date-alt = %A, %d %B %Y
time-alt = %H:%M:%S

format = <label>
format-padding = 2

label =  %date% %time%


[module/battery]
; Note - if battery isn't showing, try BAT0 or BAT1, etc.
type = internal/battery

full-at = 95

battery = BAT1
adapter = ACAD

poll-interval = 5

format-charging = <animation-charging> <label-charging>
format-charging-padding = 2

format-discharging = <ramp-capacity> <label-discharging>
format-discharging-padding = 2

format-full = <ramp-capacity> <label-full>
format-full-padding = 2

label-charging = %percentage%%

label-discharging = %percentage%%

label-full = %percentage%%

ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 

animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-framerate = 500


[module/backlight]
type = internal/backlight

card = intel_backlight

format = <label>
format-padding = 2

label =  %percentage%%


[module/pulseaudio]
type = internal/pulseaudio
; List sinks via `pactl list sinks` and look at the Name field

sink = alsa_output.pci-0000_00_1b.0.analog-stereo
;interval = 1

format-volume-padding = 2
format-volume = <ramp-volume> <label-volume>
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 

format-muted-padding = 2
label-muted =  0%


[module/powermenu]
type = custom/menu

label-open =   

label-close = cancel

label-close-background = #000f0f0f
label-close-foreground = #ffeefc
label-open-padding-left = 4
label-open-padding-right = 3
label-close-padding = 3

menu-0-0 = lock
menu-0-0-exec = ~/scripts/lock.sh
menu-0-0-background = #000f0f0f
menu-0-0-foreground = #c05c47
menu-0-0-padding-right = 3

menu-0-1 = reboot
menu-0-1-exec = menu-open-1
menu-0-1-background = #000f0f0f
menu-0-1-foreground = #c05c47
menu-0-1-padding-right = 3

menu-0-2 = power off
menu-0-2-exec = menu-open-2
menu-0-2-background = #000f0f0f
menu-0-2-foreground = #c05c47
menu-0-2-padding-right = 3

menu-1-0 = reboot?  
menu-1-0-exec = reboot
menu-1-0-background = #000f0f0f
menu-1-0-foreground = #e4b226
menu-1-0-padding-right = 3

menu-2-0 = power off?  
menu-2-0-exec = poweroff
menu-2-0-background = #000f0f0f
menu-2-0-foreground = #e4b226
menu-2-0-padding-right = 3


[module/wireless-network]
type = internal/network

; Look at ifconfig for interface
interface = wlo1

format-connected = <label-connected>
format-connected-padding = 2

format-disconnected = <label-disconnected>
format-disconnected-padding = 2

label-connected =  %essid%

label-disconnected =  None

私のi3設定は次のとおりです

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:System San Francisco Display 10

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.


# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec gnome-terminal #i3-sensible-terminal
#start a browser
bindsym $mod+numbersign exec firefox

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1:" 
set $ws2 "2:" 
set $ws3 "3:" 
set $ws4 "4:" 
#set $ws5 "5:<span font='SVGFont1 12' rise='-2000'>a</span>"
set $ws6 "6:"
set $ws7 "7:"
set $ws8 "8:"
set $ws9 "9:"
set $ws10 "10:"
set $ws11 "11:"
#set $ws1 "1" 
#set $ws2 "2" 
#set $ws3 "3" 
#set $ws4 "4" 
set $ws5 "5"
#set $ws6 "6"
#set $ws7 "7"
#set $ws8 "8"
#set $ws9 "9"
#set $ws10 "10"
#set $ws11 "11"

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
bindsym $mod+Control+1 workspace $ws11

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
bindsym $mod+Shift+Control+1 move container to workspace $ws11


# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode

        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon resize grow width 10 px or 10 ppt

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 10 px or 10 ppt
        bindsym Down resize grow height 10 px or 10 ppt
        bindsym Up resize shrink height 10 px or 10 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

set $bg-color            #44444480
set $inactive-bg-color   #44444480
set $text-color          #f3f4f5
set $inactive-text-color #676E7D
set $urgent-bg-color     #E53935
set $ws-focused-bg   #ffc553

# window colors
#                       border              background         text                 indicator
client.focused          $bg-color           $bg-color          $text-color          #00ff00
client.unfocused        $inactive-bg-color  $inactive-bg-color $inactive-text-color #00ff00
client.focused_inactive $inactive-bg-color  $inactive-bg-color $inactive-text-color #00ff00
client.urgent       $urgent-bg-color    $urgent-bg-color   $text-color      #00ff00

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
#bar {
#   strip_workspace_numbers yes
#   status_command i3status
#   colors {
#          background $bg-color
#              separator #757575
##                                border             background         text
#          focused_workspace  $ws-focused-bg     $ws-focused-bg     $text-color
#          inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
#          urgent_workspace   $urgent-bg-color   $urgent-bg-color   $text-color
#       }
#}
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
exec compton -f -I 0.06 -O 0.6

#GAPS!!!
gaps inner 10
for_window [class=".*"] border pixel 0

#touchpad touch-ups:
exec_always "~/.config/i3/touchpad_options"

#key swaps:
exec_always ~/.config/i3/key_mappings

#media
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 10 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 10 # decrease screen brightness

# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
#bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

#HARRY'S COMMANDS:
#desktop background
exec_always feh --bg-fill ~/Pictures/desktop-photos/roundabout-darkened.png

#lock shortcut:
bindsym $mod+shift+x exec i3lock -c 222222

#set dpi for i3 toolbars
exec_always xrdb -merge ~/.Xresources
exec_always xrandr --dpi 120

編集:さらにトラブルシューティングを行ったところ、問題がPolybarのインストールにあることがわかりました。端末で実行すると、内部/ i3の基本サポートがないことを示すメッセージが表示されます。 Polybar -v コマンドは以下を提供しました。

polybar 3.3.0-101-gf0c65e6

Features: +alsa +curl -i3 +mpd +network(libnl) +pulseaudio +xkeyboard

これはまさにガイド(上にリンクされており、Fedoraにi3wmをインストールするためのものであると主張する)から私が受け取らなければならないと言う出力ですが、-i3は(論理的に)i3サポートが不足していることを意味するようです(参照:https://github.com/polybar/polybar/issues/526)。インストールを正しく実行する方法は正確にはわかりませんが、Polybarをアンインストールしてインストールを実行する方法についてのより良いドキュメントを探してみましょう。

ベストアンサー1

Ubuntu 18.04でも同じ問題が発生しました(ワークスペースは表示されません)。その理由は、libjsoncpp-devデフォルトのパッケージストアが古すぎるためです(1.7.4対1.7.7)。 cmakeの出力に注意を払う必要があります。バージョンが古すぎる場合は、静的ライブラリの最小必須バージョンを独自にビルドします。これは私が最初に得たものです。

./build.sh
...
-- Checking for module 'jsoncpp>=1.7.7'
--   Requested 'jsoncpp >= 1.7.7' but version of jsoncpp is 1.7.4
You may find new versions of jsoncpp at https://github.com/open-source-parsers/jsoncpp
-- Could not find jsoncpp>=1.7.7 -- building static lib...
-- JsonCpp Version: 1.7.7

次に、推奨URLに従って最新バージョン1.9をダウンロードしてインストールし、システムリポジトリからパッケージを削除します./build.sh。それから私は得ます

-- Checking for module 'jsoncpp>=1.7.7'
--   Found jsoncpp, version 1.9.0

ただし、再起動後もワークスペースIDは表示されません。

編集すると、当然i3モジュールを有効にする必要がありました。サンプル Polybar 構成の一部ではありませんが、正しく実行されたかどうか問題があります。しなければならない

...
modules-left = i3
...

これにより、手動でインストールしなくても正常に動作しますjsoncpp。いいね!

おすすめ記事