Поиск по сайту:

Настройка оконного менеджера Sway Tiling в Fedora с помощью Waybar |


Sway — это тайловый композитор Wayland, полностью совместимый с существующей конфигурацией i3. Это позволяет легко заменить i3 и использовать Wayland в качестве протокола отображения. Я использую Sway с тех пор, как переключил свой дистрибутив Linux с Arch Linux на Fedora Silverblue. В этом руководстве мы обсудим, как установить и настроить оконный менеджер Sway в Fedora.

Прежде чем начать, добавьте необходимые репозитории. Создайте новый файл.

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

Добавьте ниже репозитории копра.

[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

Установка окна Sway Tiling Window в Fedora

Sway доступен во многих официальных репозиториях дистрибутивов Linux. В Fedora пакет называется «sway» — как Fedora Workstation, так и Silverblue.

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

### Fedora Silverblue ###
rpm-ostree install sway

Установите зависимости работы Sway

Нам также необходимо установить ряд пакетов, которые обеспечат полнофункциональное управление окнами в нашей Fedora Desktop. Некоторые пакеты, используемые в i3, имеют замены для Sway.

Вот инструменты, которые мы будем использовать:

  • wl-clipboard: утилиты копирования и вставки командной строки для Wayland.
  • Waybar: настраиваемая панель Wayland для композиторов на базе Sway и Wlroots.
  • miko — облегченный демон уведомлений Wayland.
  • Light — программа для управления подсветкой (и другим аппаратным освещением) в GNU/Linux.
  • mpd (Music Player Daemon) – Демон для воспроизведения музыки различного формата.
  • mpv — бесплатный (как во Freedom) медиаплеер для командной строки
  • ncmpcpp — функциональный MPD-клиент на основе ncurses, вдохновленный ncmpc.
  • pavucontrol (PulseAudio Volume Control) — простой инструмент регулировки громкости («микшер») на базе GTK для звукового сервера PulseAudio.
  • Ranger — файловый менеджер для консоли в стиле VIM.
  • Rofi – переключатель окон, средство запуска приложений и замена dmenu.
  • swaylock – шкафчик экрана для Wayland
  • termite — терминал на базе VTE, ориентированный на клавиатуру, предназначенный для использования в оконном менеджере с поддержкой плиток и/или табуляции.
  • Шрифты Powerline — исправленные шрифты для пользователей Powerline.
  • maim – (Make Image) – утилита, делающая снимки экрана вашего рабочего стола. Он предназначен для преодоления недостатков Scrot и работает лучше по нескольким причинам.
  • nnn – Полнофункциональный файловый менеджер терминала. Он крошечный, почти без конфигурации и с невероятной производительностью.
  • grim — инструмент для получения изображений из композитора Wayland.
  • slurp — выберите регион в композиторе Wayland и выведите его на стандартный вывод. Хорошо работает с мрачным.

Установите эти стандартные пакеты, которые будут использоваться со всеми преимуществами.

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 замените sudo 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

Если у вас есть файл конфигурации i3wm, вы можете перенести его в Sway. Скопируйте конфигурацию i3 в ~/.config/sway/config.

Путь конфигурации по умолчанию для Sway — ~/.config/sway/config. Если файл не существует, Sway проверит конфигурацию, добавленную установщиком, а именно /etc/sway/config.

Вот мой файл конфигурации для Sway, расположенный в ~/.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
}

Настроить Вэйбар

Я рекомендую вам посетить вики-страницу «Конфигурация и стиль», чтобы получить полную информацию о конфигурации и доступных модулях.

Допустимые каталоги для файла конфигурации Waybar:

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

Поместите конфигурацию Waybar в ~/.config/waybar/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": "<span color=\"#f53c3c\"></span> ",
            "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/modules/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/modules/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/waybar/modules/time.sh
#!/bin/bash
timez=$(date +%H:%M:%S)
echo -e "{\"text\":\""$timez"\"}"

Настроить диспетчер входа

Некоторые менеджеры входа поддерживают Wayland, а другие нет. Если у вас есть

Вы можете запустить Sway автоматически без менеджера входа, например, добавив это в свой .bash_profile:

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

После того, как вы все настроите, выйдите из системы и снова войдите в нее, чтобы насладиться использованием Sway и Waybar в Fedora. Эти конфигурации не привязаны только к дистрибутиву Fedora. Если зависимости установлены в любом другом дистрибутиве Linux, конфигурации будут работать нормально.

Еще руководства:

  • Настройте i3pystatus в Linux
  • Как установить строку состояния Polybar в Fedora
  • Как скопировать и вставить текстовый контент из терминала Linux
  • Как подключиться к устройству Bluetooth из терминала Linux
  • Как выполнить поиск в Google из терминала Linux
  • Лучшие файловые менеджеры консоли/терминала для Linux

Статьи по данной тематике: