使用Waybar在Fedora上设置Sway Tiling Window Manager

Sway是平铺的Wayland合成器,与现有的i3配置完全兼容。您可以轻松替换i3并将Wayland用作显示协议。自将Linux发行版从Arch Linux切换到Fedora Silverblue以来,我一直在使用Sway。本指南描述了如何在Fedora上安装和配置Sway tile窗口管理器。

开始之前添加所需的存储库。创建一个新文件。

sudo vim /etc/yum.repos.d/sway-deps.repo

添加以下copr存储库:

[copr:copr.fedorainfracloud.org:alebastr:waybar]
name=Copr repo for waybar owned by alebastr
baseurl=https://copr-be.cloud.fedoraproject.org/results/alebastr/waybar/fedora-$releasever-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/alebastr/waybar/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

[copr:copr.fedorainfracloud.org:skidnik:termite]
name=Copr repo for termite owned by skidnik
baseurl=https://copr-be.cloud.fedoraproject.org/results/skidnik/termite/fedora-$releasever-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/skidnik/termite/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

[copr:copr.fedorainfracloud.org:evana:fira-code-fonts]
name=Copr repo for fira-code-fonts owned by evana
baseurl=https://copr-be.cloud.fedoraproject.org/results/evana/fira-code-fonts/fedora-$releasever-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/evana/fira-code-fonts/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

在Fedora上安装摇摆平铺窗口

在许多Linux发行版的官方上游存储库中都可以找到Sway。在Fedora中,软件包为“摇一摇-Fedora工作站和Silverblue。

--- Fedora Workstation ---
$ sudo dnf -y install sway

--- Fedora Silverblue ---
$ rpm-ostree install sway

安装Sway操作的依赖项

您还需要安装一些软件包,以确保在Fedora Desktop中获得完整的平铺窗口管理体验。 i3中使用的某些软件包可以替代sway。

使用的工具是:

  • wl-剪贴板:Wayland命令行复制/粘贴实用程序。
  • 摇动:高度可定制的Wayland栏,用于基于Sway和Wlroots的合成器。
  • woman女人 –轻量级Wayland通知守护程序
  • 轻便 –控制GNU / Linux背光(和其他硬件灯)的程序
  • mpd(音乐播放器守护程序) –播放各种音乐形式的守护程序。
  • mpv –命令行的免费(免费)媒体播放器
  • ncmpcpp –受ncmpc启发的基于ncurses的功能性MPD客户端
  • pavucontrol(PulseAudio音量控制) –一个简单的基于GTK的音量控制工具(“混音器”) PulseAudio声音服务器
  • 单位 –受VIM启发的控制台文件管理器
  • 洛菲 -替换窗口切换器,应用程序启动器,dmenu
  • 斯威洛克 – Wayland屏幕锁
  • 白蚁 –基于键盘的基于VTE的终端。旨在用于支持窗口管理器中的平铺和制表。
  • 电源线字体 –电力线用户的修补字体。
  • 头晕 –(制作图像)是用于获取桌面截图的实用程序。目的是克服阴囊的缺点,并以几种方式表现更好。
  • nn –功能齐全的终端文件管理器。它很小,几乎为0配置,并提供了令人难以置信的性能。
  • 严重的 –从Wayland合成器获取图像的工具。
  • 耳光 –在Wayland合成器中选择一个区域并打印到标准输出。适用于 严重的

安装sway使用的这些标准软件包。

sudo dnf -y install feh 
fira-code-fonts 
fontawesome-fonts 
powerline-fonts 
light 
mako 
ncmpcpp 
pavucontrol 
ranger 
rofi 
swaylock 
termite 
waybar 
wl-clipboard 
mpc 
mpd 
mpv 
grim 
slurp

如果是Silverblue,请交换 须藤dnf -y rpm-ostree。

rpm-ostree install --idempotent feh 
fira-code-fonts 
fontawesome-fonts 
powerline-fonts 
light 
mako 
ncmpcpp 
pavucontrol 
ranger 
rofi 
swaylock 
termite 
waybar 
wl-clipboard 
mpc 
mpd 
mpv 
grim 
slurp

配置Sway Window Manager

如果您现有i3wm配置文件,则可以将其移植到Sway。将i3配置复制到〜/ .config / sway / config。

sway的默认配置路径是 ~/.config/sway/config。如果该文件不存在,sway将检查安装程序添加的配置。 /etc/sway/config

这是我的配置文件 〜/ .Config / sway / config

# //computingforgeeks.com/
# Please see https://github.com/swaywm/sway/wiki for a complete reference!
#

set $mod Mod4
set $mod1 Mod1

# Set your terminal
set $terminal termite

# i3-gaps
# for_window [class="^.*"] border pixel 0
gaps inner 4
gaps outer 4
smart_gaps on
default_border pixel 1
#smart_borders on
#set $borderwidth 1
hide_edge_borders both

set $gnome-schema org.gnome.desktop.interface
# exec_always gsettings set $gnome-schema gtk-theme 'Arc-Dark'
# Set colors
set $bg-color            #333333
set $inactive-bg-color   #333333
set $text-color          #f3f4f5
set $inactive-text-color #676E7D
set $urgent-bg-color     #E53935
set $focus-text-color    #87CEEB

set $black       #282828
set $darkblack   #1d2021
set $transparent #000000AA

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.

# 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: Inconsolata 12

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

# start a terminal
bindsym $mod+Return exec $terminal
bindsym $mod+x exec $terminal

# Custom bindsyms
bindsym $mod+p exec ~/.config/i3/bin/logout
bindsym $mod+Shift+x exec ~/.config/i3/bin/screen

# kill focused window
bindsym $mod+q kill

# start dmenu (a program launcher)

bindsym $mod+d exec --no-startup-id rofi -show run  -m -1 

# 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+t 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

# Workspace Variables

set $ws1 "1:   "
set $ws2 "2:   "
set $ws3 "3:   "
set $ws4 "4:   "
set $ws5 "5:   "
set $ws6 "6:   "
set $ws7 "7: " "


# 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 9
bindsym $mod+0 workspace 10

# 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 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# 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 sway (logs you out of your X session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'Do you really want to exit sway' -b 'Yes, exit sway' 'swaymsg exit'

# Hibernate
bindsym $mod+Shift+z exec swaynag -t warning -m 'Sleepy time?!?!' -b 'ZzZz...' 'systemctl hibernate'

# resize window (you can also use the mouse for that)
mode "resize" {
        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 Up resize grow height 10 px or 10 ppt
        bindsym Down resize shrink height 10 px or 10 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"
bindsym $mod+Shift+f exec ~/.config/i3/bin/rofi_finder

# Custom bind keys

bindsym $mod+l exec swaylock -i ~/Pictures/wallpaper-04.png 

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)


# Pulse Audio controls
# run pactl list sinks

bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5% # Raise
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5% # Lower
bindsym XF86AudioMute exec pactl set-sink-mute  $(pacmd list-sinks |awk '/* index:/{print $3}') toggle # Mute

# Sreen brightness controls -- # https://github.com/haikarainen/light
bindsym XF86MonBrightnessUp exec light -A 5    # increase screen brightness
bindsym XF86MonBrightnessDown exec light -U 5  # decrease screen brightness

# multimedia keys
bindsym XF86AudioPlay  exec "mpc toggle"
bindsym XF86AudioStop  exec "mpc stop"
bindsym XF86AudioNext  exec "mpc next"
bindsym XF86AudioPrev  exec "mpc prev"
bindsym XF86AudioPause exec "mpc pause"


bar {
  swaybar_command waybar
  workspace_buttons yes
}

# Startup programs
exec --no-startup-id mpd  

exec_always feh --bg-scale ~/Pictures/bestFriend-wallpaper-07-1920x1200.png
exec --no-startup-id /usr/lib/gsd-xsettings

# Bind App to workspace
# Check class by : xprop
# swaymsg -t get_tree
assign [class="Google-chrome"] $ws2
assign [class="KeePass2"] $ws3
assign [class="Pcmanfm"] $ws4
assign [class="Firefox"] $ws6
assign [class="Remmina"] $ws3
assign [class="Skype"] $ws7

# Custom Keybinds
bindsym $mod+c exec google-chrome-stable

# Press $mod+o followed by either f, t, Esc or Return to launch firefox,
# thunderbird or return to the default mode, respectively.
set $mode_launcher Launcher
bindsym $mod+o mode "$mode_launcher"

mode "$mode_launcher" {
    bindsym m exec terminator
    bindsym n exec nautilus
    bindsym v exec virt-manager 
    bindsym d exec deepin-screenshot 
    bindsym Return mode "default"
}

# Shutdown, Reboot, Lock Screen, and Logout 

set $power_mode "power"
bindsym $mod+Shift+q      mode $power_mode
mode $power_mode {
    bindsym p         exec systemctl poweroff
    bindsym r         exec systemctl reboot 
    bindsym l         exec swaylock -i ~/Pictures/wallpaper-04.png , mode "default"
    bindsym q         exec --no-startup-id i3-msg exit, mode "default"
    bindsym h         exec systemctl hibernate 
    #bindsym s        exec sudo  /lib/systemd/systemd-sleep hybrid-sleep 
    bindsym s         exec pm-suspend

    bindsym Return    mode "default"
    bindsym Escape    mode "default"
}

# Floating windows

for_window [window_role="pop-up"] floating enable
for_window [window_role="bubble"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [window_role="Preferences"] floating enable

for_window [window_role="task_dialog|bubble|page-info|Preferences|pop-up"] floating enable
for_window [window_role="Open Files"] floating enable sticky
for_window [window_role="File Operation Progress"] floating enable sticky
for_window [window_role="Save As"] floating enable

for_window [class="qBittorrent" window_role="pop-up"] floating enable
for_window [class="mtp-ng-qt" window_role="Open"] floating enable
for_window [window_type="dialog"] floating enable
for_window [window_type="menu"] floating enable
#for_window [class="VirtualBox"] floating enable

# Sticky window
for_window [instance="file_progress"]  sticky enable
for_window [class="info|Mate-color-select|gcolor2|timesup|QtPass|GtkFileChooserDialog"] sticky enable

# Teamviewer
for_window [instance="TeamViewer.exe"] floating enable
for_window [class="TeamViewer"] floating enable
#for_window [instance="Qt-subapplication" title="TeamViewer"] move scratchpad

# Focus window settings
no_focus [window_role="pop-up"]
focus_on_window_activation focus 
#for_window [class="(?i)"] focus 

# Rename workspace with i3-input using numbers and text

bindsym $mod+n exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: '

for_window [class="chromium" instance="chromium"] border none


# screenshot
bindsym --release Print exec --no-startup-id "maim -p 0 -c 0.96,0.5,0.09 $HOME/Pictures/screenshot-$(date +%Y-%m-%d_%H-%M-%S).png"
bindsym --release Shift+Print exec --no-startup-id "maim -s -p 0 -c 0.96,0.5,0.09 $HOME/Pictures/screenshot-$(date +%Y-%m-%d_%H-%M-%S).png"

# Configure outputs here
# How to get outputs configurable - $ swaymsg -t get_outputs
output eDP-1 {
                background ~/Pictures/bestFriend-wallpaper-07-1920x1200.png fill
                resolution 1920x1080
		scale 1.4
           }

# Inputs - Get your inputs with the command:
# swaymsg -t get_inputs
input 1267:35:Elan_Touchpad {
    tap enabled
    natural_scroll enabled
}

配置Waver

推荐参观 组成和风格 有关配置和可用模块的详细信息,请参见Wiki页面。

Waybar配置文件的有效目录为:

  • ~/.config/waybar/
  • ~/waybar/
  • /etc/xdg/waybar/

将导航栏设置放在下面 〜/ .Config /导航栏/ config。这是我的配置文件。您需要创建自己的作品或自定义可以为您工作的人。

{
    "layer": "bottom",
    "position": "top",
    "height": 30,
    "modules-left": ["sway/workspaces", "sway/mode"],
    "modules-center": ["mpd", "custom/storage-root", "custom/storage-home"],
    "modules-right": ["memory", "cpu", "network", "pulseaudio", "battery", "backlight", "custom/time", "clock"],

    "sway/mode": {
        "format": " {}"
    },
    "sway/workspaces": {
        "format": "{name}",
        "disable-scroll-wraparound": true,
        "enable-bar-scroll": true,
        "smooth-scrolling-threshold": 30
    },
    "sway/window": {
        "max-length": 80,
        "tooltip": false
    },
    "mpd": {
        //"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})  ",
        "format": "{stateIcon} {consumeIcon}",
        "format-disconnected": "Disconnected",
        "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
        "unknown-tag": "N/A",
        "interval": 2,
        "consume-icons": {
            "on": " "
        },
        "random-icons": {
            "off": " ",
            "on": " "
        },
        "repeat-icons": {
            "on": " "
        },
        "single-icons": {
            "on": "1 "
        },
        "state-icons": {
            "paused": "",
            "playing": ""
        },
        "tooltip-format": "MPD (connected)",
        "tooltip-format-disconnected": "MPD (disconnected)"
    },

    "clock": {
        //"format": "{:%d.%m.%y %a / W: %V}",
        "format": "{:%d.%m.%y %a}",
        "tooltip": false
    },
    "battery": {
        "format": "{icon} {capacity}%",
        "format-icons": ["", "", "", "", ""],
        "format-charging": " {capacity}%",
        "interval": 30,
        "states": {
            "warning": 25,
            "critical": 10
        },
        "tooltip": false
    },
    "pulseaudio": {
        "format": "{volume} {icon}",
        "format-alt": "{volume} {icon}",
        "format-alt-click": "click-right",
        "format-muted": "",
        "format-icons": {
            "headphones": "",
            "handsfree": "",
            "headset": "",
            "phone": "",
            "portable": "",
            "car": "",
            "default": ["", "", ""]
        },
        "scroll-step": 5,
        "on-click": "pavucontrol",
        "tooltip": false
    },
    "custom/storage-root": {
        "format": " {}",
        "format-alt": " {percentage}%",
        "format-alt-click": "click-right",
        "return-type": "json",
        "interval": 60,
        "exec": "~/.config/waybar/modules/storage-root.sh"
    },
    "custom/storage-home": {
        "format": " {}",
        "format-alt": " {percentage}%",
        "format-alt-click": "click-right",
        "return-type": "json",
        "interval": 60,
        "exec": "~/.config/waybar/modules/storage-home.sh",
        "on-click": "ranger"
    },
    "backlight": {
        "format": "{icon} {percent}%",
        "format-alt-click": "click-right",
        //"format-icons": ["", ""],
        //"format-icons": ["", ""],
        "format-icons": ["", ""],
        "on-scroll-down": "light -A 1",
        "on-scroll-up": "light -U 1"
    },
    "custom/time": {
        "format": " {}",
        "interval": 5,
        "return-type": "json",
        "exec": "~/.config/waybar/modules/time.sh"
    },
    "tray": {
        "icon-size": 18
    },
    "cpu": {
        "tooltip": false,
        "format": " {}%"
    },
    "memory": {
        "tooltip": false,
        "format": " {}%"
        // "format": "{used} / {total}  "
    },
    "network": {
        "format-wifi": " {essid} ({signalStrength}%)",
        "format-ethernet": " {ifname}: {ipaddr}/{cidr}",
        "format-linked": " {ifname} (No IP)",
        "format-disconnected": "Disconnected ⚠",
        "format-alt": "{ifname}: {ipaddr}/{cidr}"
    }
}

我的 style.css 文件

* {
    border:        none;
    border-radius: 0;
    font-family:   Inconsolata;
    font-size:     17px;
    font-weight:     bold;
    box-shadow:    none;
    text-shadow:   none;
    transition-duration: 0s;
}

window {
    color:      rgba(217, 216, 216, 1);
    background: rgba(1, 1, 1, 0.40);
}

window#waybar.solo {
    background: rgba(1, 1, 1, 0.40);
}

#workspaces {
    border-radius: 10px;
    background: rgba(40, 42, 54, 0.85);
    transition: none;
}

#workspaces button {
    transition: none;
    color:      rgba(217, 216, 216, 0.4);
    background: transparent;
}

#workspaces button.visible {
    color:      rgba(217, 216, 216, 1);
}

#workspaces button.focused {
    border-top: 3px solid #9aedfe;
    color: #9aedfe;
}

#workspaces button:hover {
    border-top: 3px solid #ff79c6;
    transition: none;
    box-shadow: inherit;
    text-shadow: inherit;
    color: #ff79c6;
}

#workspaces button.urgent {
    color:      rgba(238, 46, 36, 1);
}

#mode, #battery, #cpu, #memory, #network, #pulseaudio, #idle_inhibitor, #backlight, #custom-storage, #custom-spotify, #custom-weather, #custom-mail {
    margin:     0px 6px 0px 5px;
    min-width:  25px;
}

#clock {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(107, 142, 35, 0.85);
}

#custom-notif {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgb(238,130,238);
}

#backlight {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(188, 143, 143, 0.85);
}

#battery.warning {
   color:       rgba(255, 210, 4, 1);
}

#battery.critical {
    color:      rgba(238, 46, 36, 1);
}

#battery.charging {
    color:      rgba(217, 216, 216, 1);
}

#custom-tidepool {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
}

#custom-tidepool.red {
    background: rgba(205, 92, 92, 0.85);
}

#custom-tidepool.orange {
    background: rgba(243, 156, 18, 0.85);
}

#custom-tidepool.yellow {
    background: rgba(252, 214, 112, 0.85);
}

#custom-tidepool.green {
    background: rgba(154, 205, 50, 0.85);
}

#custom-time {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(154, 205, 50, 0.85);
}

#custom-weather {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(218, 112, 214, 0.85);
}

#custom-unsync {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(154, 237, 254, 0.85);
}

#custom-storage-home {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(154, 237, 254, 0.85);
}

#custom-storage-root {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(154, 237, 254, 0.85);
}

#custom-snapcount {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(154, 237, 254, 0.85);
}

#pulseaudio {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(189, 183, 107, 0.85);
}

#network {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(189, 183, 107, 0.85);
}

#cpu {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(205, 92, 92, 0.85);
}

#battery {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(176, 196, 222, 0.85);
}

#memory {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(222, 184, 135, 0.85);
}

#mpd {
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 10px;
    transition: none;
    color: #4d4d4d;
    background: rgba(119, 136, 153, 0.85);
}

#custom-storage.warning {
    color:      rgba(255, 210, 4, 1);
}

#custom-storage.critical {
    color:      rgba(238, 46, 36, 1);
}

使用的模块:

  • 〜/ .Config / waybar /模块/storage-home.sh
#!/bin/sh

mount="/var/home"
warning=20
critical=10

df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical '
//.*/ {
  text=$4
  tooltip="Filesystem: "$1"rSize: "$2"rUsed: "$3"rAvail: "$4"rUse%: "$5"rMounted on: "$6
  use=$5
  exit 0
}
END {
  class=""
  gsub(/%$/,"",use)
  if ((100 - use) < critical) {
    class="critical"
  } else if ((100 - use) < warning) {
    class="warning"
  }
  print "{"text":""text"", "percentage":"use","tooltip":""tooltip"", "class":""class""}"
}
'
  • 〜/ .Config / waybar /模块/storage-root.sh
#!/bin/sh

mount="/"
warning=20
critical=10

df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical '
//.*/ {
  text=$4
  tooltip="Filesystem: "$1"rSize: "$2"rUsed: "$3"rAvail: "$4"rUse%: "$5"rMounted on: "$6
  use=$5
  exit 0
}
END {
  class=""
  gsub(/%$/,"",use)
  if ((100 - use) < critical) {
    class="critical"
  } else if ((100 - use) < warning) {
    class="warning"
  }
  print "{"text":""text"", "percentage":"use","tooltip":""tooltip"", "class":""class""}"
}
'
  • 〜/ .Config /导航栏/模块/ time.sh
#!/bin/bash
timez=$(date +%H:%M:%S)
echo -e "{"text":""$timez""}"

配置登录管理器

一些登录管理器支持Wayland,而另一些则不支持。如果你有
使用出现问题的登录管理器时的第一步
ログイン按照下面的说明禁用登录管理器并运行 man 1 sway。如果可行,请将错误报告给登录管理器,而不要沮丧。

例如,您可以在没有登录管理器的情况下自动启动,而无需添加登录管理器。 .bash_profile

# If running from tty1 start sway
if [ "$(tty)" = "/dev/tty1" ]; then
	exec sway
fi

完成所有配置后,注销并重新登录,然后在Fedora上使用Sway和Waybar。这些配置不仅与Fedora发行版相关。如果该依赖项安装在另一个Linux发行版上,则配置工作正常。

其他指南:

在Linux上配置i3pystatus

如何在Fedora上安装Polybar状态栏

如何从Linux终端复制和粘贴文本内容

如何从Linux终端连接到蓝牙设备

如何从Linux终端搜索Google

适用于Linux的最佳控制台/终端文件管理器

Sidebar