我将在Gentoo系统上部署基于WayLand的定制桌面环境
最近,我决定第二次重新尝试Wayland桌面布局,再加上我的系统实在是太乱了,决定重装系统的同时开始考虑自己的桌面系统
在你 的gentoo的 /etc/portage/make.conf
增加如下USE:
gles2 wayland xwayland vulkan
增加如下 VIDEO_CARDS
:
intel nvidia
增加如下 INPUT_DEVICES
:
libinput
编辑/etc/portage/make.conf
:
USE="${USE} waybar gles2 bluetooth screencast wayland xwayland vulkan pipewire "
VIDEO_CARDS="intel nvidia"
INPUT_DEVICES="libinput"
然后执行以下命令:
emerge --ask --changed-use --newuse --deep --with-bdeps=y --update @world
emerge --ask wayland xwayland vulkan xorg-server
等待执行完毕即可。
执行命令拉取:
eselect repository enable wayland-desktop
emaint sync -r wayland-desktop
emerge --ask --verbose hyprland
完成后编辑 .config/hypr/yyprland.conf
:
########################################################################################
AUTOGENERATED HYPR CONFIG.
PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
########################################################################################
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#
#autogenerated = 1 # remove this line to remove the warning
# See https://wiki.hyprland.org/Configuring/Monitors/
#monitor=,preferred,auto,1
monitor=, 2048x1080@60,0x0,1
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
exec-once = waybar -c ~/.config/waybar/config.bottom
exec-once = waybar -c ~/.config/waybar/config.top
exec-once = /opt/upwork-wayland/screenshot_adapter.py
exec-once = hyprpaper
exec-once = sleep 10 && fcitx5
exec-once = gentoo-pipewire-launcher >/dev/null 2>&1
exec-once = gsettings set org.gnome.desktop.interface gtk-theme "Dexy-GTK"
exec-once = gsettings set org.gnome.desktop.interface icon-theme "Dexy-GTK"
exec-once = gsettings set org.gnome.desktop.interface font-name "SourceSerif4 10"
exec-once = /usr/libexec/xdg-desktop-portal-gtk -r
exec-once = /usr/libexec/xdg-desktop-portal-wlr -r
exec-once = /usr/libexec/xdg-desktop-portal -r
exec-once = flameshot
#exec-once = dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment DISPLAY=$DISPLAY WAYLAND_DISPLAY=$WAYLAND_DISPLAY SWAYSOCK=$SWAYSOCK
#exec-once = XDG_CURRENT_DESKTOP=sway flameshot &
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
"wlr/workspaces": {
"format": "{icon}",
"on-scroll-up": "hyprctl dispatch workspace e+1",
"on-scroll-down": "hyprctl dispatch workspace e-1",
"on-click": "activate"
}
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
touchpad {
natural_scroll = no
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 5
gaps_out = 20
border_size = 2
col.active_border = rgba(1affffee)
col.inactive_border = rgba(595959aa)
layout = dwindle
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur = yes
blur_size = 3
blur_passes = 1
blur_new_optimizations = on
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
device:epic mouse V1 {
sensitivity = -0.5
}
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrule=nofocus
windowrule=float,^(rofi)$
windowrule=workspace name:work, title:Upwork
windowrule=workspace name:Telegram, title:Telegram
windowrule=workspace name:work, title:Skype
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, Return, exec, konsole
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, F, exec, firefox
bind = $mainMod, Print, exec, flameshot gui
#bind = $mainMod + SHIFT, Print, exec, XDG_CURRENT_DESKTOP=sway flameshot gui -r | wl-copy
bind = $mainMod, F2, exec, fcitx5-configtool
bind = $mainMod, T, exec, Telegram
bind = $mainMod, E, exec, dolphin
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, rofi -show drun
bind = $mainMod + SHIFT, KP_Subtract , exec, fish -c "set_main_mute 5%-"
bind = $mainMod + SHIFT, KP_Add, exec, fish -c "set_main_mute 5%+"
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
bind = $mainMod, F3, exec, QT_QPA_PLATFORM=xcb Applications/Ultimaker-Cura-5.0.0-beta+1-linux_c714ec65293e8f948ace6fd69440b1d4.AppImage
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
bind = $mainMod, K, togglegroup,
bind = $mainMod, Tab, changegroupactive, f
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
bind = $mainMod, F11, movetoworkspace, special
bind = $mainMod, F12, togglespecialworkspace
配置文件已经过修改,按照自己情况即可
编辑/etc/portage/package.use/base
:
gui-apps/waybar experimental wifi tray
在您的系统执行:
sudo emerge --ask waybar
sudo cp -r /etc/sway ~/.config/sway
编辑配置文件 .config/waybar/config.top
:
{
"layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": [],
"modules-center": ["hyprland/window"],
"modules-right": [],
"hyprland/window": {
"format": " {}",
"separate-outputs": true
},
}
配置文件经过修改
编辑配置文件 .config/waybar/config.top
:
{
"layer": "top",
"position": "bottom",
"height": 30,
"spacing": 4,
// Choose the order of the modules
"modules-left": ["wlr/workspaces"],
"modules-center": [],
"modules-right": ["custom/login", "custom/pipewire", "cpu", "memory", "temperature", "backlight", "clock", "tray"],
// Modules configuration
//"wlr/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
//},
"custom/login": {
"exec": ".config/waybar/login.fish",
"interval": "once",
"singal": 9,
"return-type": "text"
},
"custom/pipewire": {
"exec": "pw-volume status",
"return-type": "json",
"interval": 2,
"signal": 8,
"format": " {icon} {percentage}% ",
"format-icons": {
"mute": "",
"default": ["", "", ""]
}
},
"tray": {
// "icon-size": 21,
"spacing": 10,
"interval": 2
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""]
}
}
{
"layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": [],
"modules-center": ["hyprland/window"],
"modules-right": [],
"hyprland/window": {
"format": "👉 {}",
"separate-outputs": true
},
}
修改 .config/waybar/style.css
:
#custom-pipewire {
background-color: #66ccff;
color: #000000;
}
#workspaces button.active {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
有两种方法:
从 portage
中安装:
sudo emerge --ask nerd-fonts
手动安装
git clone https://github.com/ryanoasis/nerd-fonts --depth 1
cd nerd-fonts
sudo ./install.sh -S # 将字体安装到系统,默认是用户路径,推荐加-S
执行如下命令安装:
sudo emerge --ask powerline-symbols
执行如下指令安装fish:
sudo emerge --ask fish
现在我们需要安装 oh-my-fish
:
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
安装 bobthefish
主题:
omf install bobthefish
编辑.config/fish/config.fish
:
if status is-interactive
# Commands to run in interactive sessions can go here
set -g theme_display_git yes
set -g theme_display_git_dirty yes
set -g theme_display_git_untracked yes
set -g theme_display_git_ahead_verbose yes
set -g theme_display_git_dirty_verbose yes
set -g theme_display_git_stashed_verbose yes
set -g theme_display_git_default_branch yes
set -g theme_git_default_branches master main
set -g theme_git_worktree_support no
set -g theme_use_abbreviated_branch_name no
set -g theme_display_vagrant yes
set -g theme_display_docker_machine yes
set -g theme_display_k8s_context yes
set -g theme_display_hg yes
set -g theme_display_virtualenv yes
set -g theme_display_nix yes
set -g theme_display_ruby yes
set -g theme_display_node yes
set -g theme_display_user ssh
set -g theme_display_hostname ssh
set -g theme_display_vi no
set -g theme_display_date yes
set -g theme_display_cmd_duration yes
set -g theme_title_display_process yes
set -g theme_title_display_path yes
set -g theme_title_display_user yes
set -g theme_title_use_abbreviated_path no
set -g theme_date_format "+%a %H:%M"
set -g theme_date_timezone Asia/Shanghai
set -g theme_avoid_ambiguous_glyphs yes
set -g theme_powerline_fonts yes
set -g theme_nerd_fonts yes
set -g theme_show_exit_status yes
set -g theme_display_jobs_verbose yes
set -g default_user jack
#set -g theme_color_scheme agnoster
set -g fish_prompt_pwd_dir_length 0
set -g theme_project_dir_length 0
set -g theme_newline_cursor yes
set -g theme_newline_prompt '$ '
# fish color theme
set -g fish_color_normal normal
set -g fish_color_command 00BF32
set -g fish_color_quote 206676
set -g fish_color_redirection 7CB02C
set -g fish_color_end 8EEB00
set -g fish_color_error 60B9CE
set -g fish_color_param 04819E
set -g fish_color_comment 5C9900
set -g fish_color_match --background=brblue
set -g fish_color_selection white --bold --background=brblack
set -g fish_color_search_match bryellow --background=brblack
set -g fish_color_history_current --bold
set -g fish_color_operator 00a6b2
set -g fish_color_escape 00a6b2
set -g fish_color_cwd green
set -g fish_color_cwd_root red
set -g fish_color_valid_path --underline
set -g fish_color_autosuggestion 64DF85
set -g fish_color_user brgreen
set -g fish_color_host normal
set -g fish_color_cancel --reverse
set -g fish_pager_color_prefix normal --bold --underline
set -g fish_pager_color_progress brwhite --background=cyan
set -g fish_pager_color_completion normal
set -g fish_pager_color_description B3A06D
set -g fish_pager_color_selected_background --background=brblack
set -g fish_pager_color_background
set -g fish_color_host_remote
set -g fish_color_keyword
set -g fish_pager_color_selected_prefix
set -g fish_pager_color_secondary_description
set -g fish_pager_color_secondary_completion
set -g fish_color_option
set -g fish_pager_color_secondary_background
set -g fish_pager_color_secondary_prefix
# Colorscheme: Seaweed
set -g fish_color_normal normal
set -g fish_pager_color_selected_description
set -g fish_color_command 00BF32
set -g fish_pager_color_selected_completion
set -g fish_color_quote 206676
set -g fish_color_redirection 7CB02C
set -g fish_color_end 8EEB00
set -g fish_color_error 60B9CE
set -g fish_color_param 04819E
set -g fish_color_comment 5C9900
set -g fish_color_match --background=brblue
set -g fish_color_selection white --bold --background=brblack
set -g fish_color_search_match bryellow --background=brblack
set -g fish_color_history_current --bold
set -g fish_color_operator 00a6b2
set -g fish_color_escape 00a6b2
set -g fish_color_cwd green
set -g fish_color_cwd_root red
set -g fish_color_valid_path --underline
set -g fish_color_autosuggestion 64DF85
set -g fish_color_user brgreen
set -g fish_color_host normal
set -g fish_color_cancel --reverse
set -g fish_pager_color_prefix normal --bold --underline
set -g fish_pager_color_progress brwhite --background=cyan
set -g fish_pager_color_completion normal
set -g fish_pager_color_description B3A06D
set -g fish_pager_color_selected_background --background=brblack
set -g fish_pager_color_background
set -g fish_color_host_remote
set -g fish_color_keyword
set -g fish_pager_color_selected_prefix
set -g fish_pager_color_secondary_description
set -g fish_pager_color_secondary_completion
set -g fish_color_option
set -g fish_pager_color_secondary_background
set -g fish_pager_color_secondary_prefix
set -g fish_pager_color_selected_description
set -g fish_pager_color_selected_completion
# custom abbr
abbr ll ls -l
abbr rm rm -I
abbr rmi rm -i
abbr dd dd status=progress
abbr tar tar xvf
abbr rmdir rm -I -r
abbr start_wayland dbus-launch --exit-with-session Hyprland
abbr get_workspaces hyprctl workspaces
abbr switch_workspace hyprctl dispatch workspace
switch (random 0 1)
case 0
cpufetch
case 1
hyfetch
end
end
配置.config/fish/functions/bobthefish_colors.fish
:
function bobthefish_colors --description 'My Color' --no-scope-shadowing
set -l grey 808080 616161 595959 424242
set -l red FF4050 F0524F B82421 772E2C
set -l green 4FC414 5C962C 458500 39511F
set -l yellow E5BF00 A68A0D A87B00 5C4F17
set -l blue 1FB0FF 3993D4 1778BD 245980
set -l white F9F9F4 B7C3D0
set -x color_initial_segment_exit $white[2] $red[3] --bold
set -x color_initial_segment_private $white[2] $grey[4]
set -x color_initial_segment_su $white[2] $green[3] --bold
set -x color_initial_segment_jobs $white[2] $blue[3] --bold
set -x color_path $blue[4] $white[2]
set -x color_path_basename $blue[4] $white[1] --bold
set -x color_path_nowrite $blue[4] $red[2]
set -x color_path_nowrite_basename $blue[4] $red[1] --bold
set -x color_repo $green[3] $white[2] --bold
set -x color_repo_work_tree $grey[4] $grey[4] --bold
set -x color_repo_dirty $red[3] $grey[4]
set -x color_repo_staged $yellow[3] $grey[4]
set -x color_vi_mode_default $grey[4] $yellow[2] --bold
set -x color_vi_mode_insert $green[2] $grey[4] --bold
set -x color_vi_mode_visual $yellow[2] $grey[4] --bold
set -x color_vagrant $blue[2] $green[1] --bold
set -x color_k8s $green[2] $grey[4] --bold
set -x color_aws_vault $blue[2] $grey[4] --bold
set -x color_aws_vault_expired $blue[2] $red[1] --bold
set -x color_username $grey[4] $blue[2] --bold
set -x color_hostname $grey[4] $blue[1]
set -x color_rvm $red[2] $grey[4] --bold
set -x color_node $green[3] $white[2] --bold
set -x color_virtualfish $blue[2] $grey[4] --bold
set -x color_virtualgo $blue[2] $grey[4] --bold
set -x color_desk $blue[2] $grey[4] --bold
set -x color_nix $blue[2] $grey[4] --bold
end
编辑.config/fish/functions/set_main_mute.fish
:
function set_main_mute
amixer sset Master $argv[1] unmute
pkill -RTMIN+8 waybar
end
编辑/etc/environment
:
WLR_RENDERER=vulkan
XDG_SESSION_TYPE=wayland
QT_QPA_PLATFORM=wayland
QT_QPA_PLATFORMTHEME=qt5ct
#QT_STYLE_OVERRIDE=kvantum
#WLR_DRM_DEVICES=/dev/dri/card1
MOZ_ENABLE_WAYLAND=1
MOZ_USE_XINPUT2=1
# input
INPUT_METHOD=fcitx5
XIM=fcitx5
XMODIFIERS="@im=xim"
GTK_IM_MODULE="fcitx5"
QT_IM_MODULE="fcitx5"
#GBM_BACKEND=nvidia-drm
#__GLX_VENDOR_LIBRARY_NAME=nvidia
# Flameshot
SDL_VIDEODRIVER=wayland
_JAVA_AWT_WM_NONREPARENTING=1
XDG_CURRENT_DESKTOP=sway
LD_LIBRARY_PATH=/opt/cuda/lib64/
pipewire
编辑/etc/portage/package.use/base
:
media-video/pipewire extra echo-cancel pipewire-alsa sound-server
执行如下命令:
sudo emerge --ask pipewire
执行如下命令:
sudo emerge --ask bluez-alsa
sudo emerge --ask xdg-desktop-portal
sudo emerge --ask xdg-desktop-portal-wlr
sudo emerge --ask xdg-desktop-portal-gtk
设置开机启动:
sudo rc-update add bluetooth default
编辑/etc/portage/package.use/base
:
sys-auth/seatd server
执行以下命令:
dbus-launch --exit-with-session Hyprland
或者:
Hyprland
或者:
start_wayland