属于自己的 manjaro i3

我的环境

为什么选择manjaro i3

它并不是官方出的一个发行版,而是一个社区版,我为什么选择它呢?因为manjaro本身是基于arch,但是比arch更稳定的发行版,它的功能更加齐全,不需要像arch一样,很多东西都要自己来适配。它的兼容性比arch又好了许多,可以自己选择驱动、内核。manjaro i3附带了已经配置好了的i3,直接开箱即用,即便还是很丑,可以省去大把时间。

i3配置

虽然manjaro i3 已经是配置好了的,但是还是不是很美观,毕竟众口难调嘛,所以作者只是简单的修了一下边福。

配置文件

  • 位置:~/.i3/config

打开它如果,如果你习惯它的快捷键配置就不要用去改它的快捷键了,直接用更好的一些工具去替换它的一些工具。下面我们就去修改他默认的工具。

polybar

  • 默认:i3status
  • 替换:polybar

比i3tatus强大,而且更好看

安装polybar

sudo pacman -S polybar

使用polybar

需要在~/.config/polybar文件夹里面建立一个launch.sh脚本文件。

# Basic script to kill all old bars and launch new.

# Terminate already running bad instances
killall -q polybar

# Wait until the processes have been shut down
# while grep -x polybar >/dev/null; do sleep 1; done
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

# Launch the example bar
polybar main_bar
  • 修改i3配置文件 ~/.i3/config

删除i3配置文件的这些部分

bar {
    #code...
}

添加为

exec_always --no-startup-id $HOME/.config/polybar/launch.sh

win+shift+r重启i3,不出意外,你就能看见了。如果没有显示,不要慌,接着看。

polybar不显示

如果遇到polybar不显示,打开终端输入如下命令

polybar -m

这条命令会输出你显示屏的通信接口类型,类似eDP1这样的。替换polybar配置文件中的如下部分

monitor = ${env:MONITOR:eDP1} //eDP1为终端输出的部分

然后重启i3你就能看见polybar了。

美化

你可以去网上找各种配置,都很好看的,不嫌弃的话也可以使用我的。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;  Fonts you may want if changing the font         ;;;;;;;;
;;;;;;;;      --- ttf-font-awesome                        ;;;;;;;;
;;;;;;;;      --- ttf-material-icons                      ;;;;;;;;
;;;;;;;;      --- nerd-fonts-complete                     ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;             Colours
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


[colors]
background = #1010100
foreground = #EFF0F1
urgent     = #E64141
blue       = #1793D1
b-alt      = #00131313
green       = #037713
g-alt       = #087717




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;            Bars
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[settings]
throttle-output = 5
throttle-output-for = 10
throttle-input-for = 30
compositing-background = over
compositing-foreground = over
compositing-overline = over
compositing-underline = over
compositing-border = over
screenchange-reload = true

[global/wm]
; Adjust the _NET_WM_STRUT_PARTIAL top value
;   Used for top aligned bars
margin-top = 5
margin-bottom = 5

[bar/main_bar]
; Use  xrandr -q | grep " connected" | cut -d ' ' -f1
; for a list of connected monitors
monitor = ${env:MONITOR:eDP1}
monitor-strict = false
override-redirect = false
width = 100%
height = 20
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}

font-0 = Ubuntu Nerd Font:size=11;2
;font-1 = FontAwesome:pixelsize=12;2
;font-2 = MaterialIcons:size=12;2
;font-3 = Fira Sans:size=10:weight=thin;2

modules-left = menu workspaces
modules-center = weather xtitle filesystem temp cpu memory trash
modules-right = data battery

module-margin = 0
padding-right = 0
padding-left = 0
bottom = false
underline-size = 2

tray-position = right
tray-padding = 9
tray-transparent = false
tray-offset-y = 0%
tray-offset-x = 0%
tray-maxsize = 18
tray-detached = false
tray-background = ${colors.background}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;              Modules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



[module/data]
type = internal/date
format = <label>
label-padding-right = 0
format-background = ${colors.b-alt}

interval = 2
time = %R
label = %{A1:gsimplecal & disown:} %{A3:gsimplecal & disown:} %time% %{A}%{A}
label-padding = 3


; Openbox specific

[module/menu]
type = custom/menu
format-spacing = 1
format-background = ${colors.b-alt}
label-open = "   "
label-open-foreground = ${colors.foreground}
label-open-background = ${colors.b-alt}
label-close = "    "
label-close-foreground = ${colors.urgent}
label-separator = " | "
label-separator-foreground = ${colors.foreground}
# Top level
menu-0-0 = "  "
menu-0-0-exec = menu-open-1
menu-0-1 = "    |"
menu-0-1-exec = menu-open-2
# 1
menu-1-0 = "  "
menu-1-0-exec = exo-open --launch WebBrowser
menu-1-1 = "  "
menu-1-1-exec = i3-scrot -s
menu-1-2 = "    |"
menu-1-2-exec = exo-open --launch FileManager
# 3
menu-2-0 = "  "
menu-2-0-exec = menu-open-0
menu-2-1 = "   "
menu-2-1-exec = blurlock
menu-2-2 = "   "
menu-2-2-exec = i3exit logout
menu-2-3 = "   "
menu-2-3-exec = systemctl reboot
menu-2-4 = "      |"
menu-2-4-exec = systemctl poweroff


[module/workspaces]
type = internal/xworkspaces
enable-click = true
enable-scroll = true
format-padding = 0
Additional formatting
icon-0 = 1;
icon-1 = 2;
icon-2 = 3;
icon-3 = 4;
icon-4 = 5;
icon-5 = 6;
icon-6 = 7;
icon-7 = 8;
icon-8 = 9;
icon-9 = 10;
icon-10 = 
;icon-default = 

format = <label-state>

label-active = "  %icon%  "
label-active-foreground = ${colors.g-alt}
label-active-background = ${colors.b-alt}
label-active-underline = ${colors.g-alt}

label-occupied = "  %icon%  "
label-occupied-underline = ${colors.blue}
label-occupied-background = ${colors.b-alt}
label-occupied-foreground = ${colors.foreground}

label-urgent = "  %icon%   "
label-urgent-foreground = ${colors.urgent}
label-urgent-background = ${colors.b-alt}
label-urgent-underline = ${colors.urgent}

label-empty = "  %icon%   "
label-empty-foreground = ${colors.foreground}
label-empty-background = ${colors.b-alt}






; Extra modules



[module/battery]
type = internal/battery
full-at = 98

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT0
adapter = ACAD

poll-interval = 5
time-format = %H:%M
format-charging = <animation-charging><label-charging>
format-discharging = <ramp-capacity>
format-full = <ramp-capacity>
format-padding = 0
label-charging = "  "
label-charging-background = ${colors.b-alt}
label-discharging-background = ${colors.b-alt}
format-charging-background = ${colors.b-alt}
format-discharging-background = ${colors.b-alt}
format-full-background = ${colors.b-alt}
ramp-capacity-0 = "  "
ramp-capacity-1 = "  "
ramp-capacity-2 = "  "
ramp-capacity-3 = "  "
ramp-capacity-4 = "  "
ramp-capacity-background = ${colors.b-alt}
bar-capacity-width = 10
animation-charging-0 = " "
animation-charging-1 = " "
animation-charging-2 = " "
animation-charging-3 = " "
animation-charging-4 = " "
animation-charging-framerate = 750
animation-charging-background = ${colors.b-alt}



[module/trash]
label-foreground = ${colors.green}
label-background = ${colors.b-alt}
interval = 3
type = custom/script
exec = $HOME/.config/polybar/scripts/trash
format-prefix = "  "
format-prefix-foreground = ${colors.green}
format-prefix-background = ${colors.b-alt}
format-background = ${colors.b-alt}
click-right = rm -rf $HOME/.local/share/Trash/files/*
click-left = exo-open --launch FileManager $HOME/.local/share/Trash/files


[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = |<    %percentage_used%%
label-padding-left = 5
label-mounted-foreground = ${colors.foreground}
label-mounted-background = ${colors.b-alt}
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.blue}
label-unmounted-background = ${colors.b-alt}
label-padding = 2


[module/rofi]
type = custom/script
exec = echo "    "
click-left = rofi-apps
label-foreground = ${colors.foreground}
label-background = ${colors.b-alt}


[module/temp]
type = internal/temperature
interval = 3
thermal-zone = 0
warn-temp = 70
format = <label>
format-padding = 2
label-foreground = ${colors.foreground}
label-background = ${colors.b-alt}
label-warn-foreground = ${colors.urgent}
label = " %temperature% "
label-warn = " %temperature% "


[module/memory]
type = internal/memory
interval = 3
format = <label>
format-padding = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
format-prefix-background = ${colors.b-alt}
label = %{A1:termite --geometry=750x550 --exec=htop & disown:}%percentage_used%%%{A}
label-foreground = ${colors.foreground}
label-background = ${colors.b-alt}


[module/cpu]
type = internal/cpu
interval = 3
format-padding = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
format-prefix-background = ${colors.b-alt}
label = %{A1:termite --geometry=750x550 --exec=htop & disown:}%percentage%%%{A}
label-background = ${colors.b-alt}

[module/weather]
type = custom/script
interval = 10
format = <label>
label-padding-right = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
exec = ~/.config/polybar/scripts/weather.sh

label-background = ${colors.b-alt}

[module/xtitle]
type = internal/xwindow
interval = 1
label = %title%
label-maxlen = 40 label = %{A1:skippy-xd --toggle-window-picker:}
exec = echo "$(xtitle)"
format = <label>
format-backround = #ooffffff
format-prefix = " >|   "
format-prefix-foreground = ${colors.foreground}
format-padding = 1

复制后,你可能无法使用,文章开头我的配置进入我的GIthub 下载

Rofi

  • 默认:dmenu
  • 替换:rofi

rofi比dmenu更好用,更快捷,更方便,更美观

安装Rofi

sudo pacman -S rofi

使用Rofi

这个比较简单,直接在i3配置文件里面修改

  • 原文件为
# start program launcher
bindsym $mod+d exec --no-startup-id dmenu_recency
  • 修改为
# start drofi dmenu
bindsym $mod+Tab exec --no-startup-id rofi -show window
bindsym $mod+Shift+d exec --no-startup-id rofi -show run
bindsym $mod+d exec --no-startup-id rofi -show drun

美化

/home/angus/.extend.Xresources文件最下方加入如下配置

! ROFI SETUP HERE !

! Enable the extended coloring options
rofi.color-enabled: true
!                  bg       border   separator
rofi.color-window: #1E272B, #9D6A47, #9D6A47
!                  bg       fg       bg-alt   hl-bg    hl-fg
rofi.color-normal: #1E272B, #EAD49B, #1E272B, #1E272B, #78824B
rofi.color-active: #1E272B, #EAD49B, #1E272B, #1E272B, #78824B
rofi.color-urgent: #1E272B, #EAD49B, #1E272B, #1E272B, #78824B

rofi.separator-style: solid
rofi.sidebar-mode: false
rofi.lines: 5
rofi.font: Hack Regular 12
rofi.bw: 1
rofi.columns: 2
rofi.padding: 5
rofi.fixed-num-lines: true
rofi.hide-scrollbar: true

重启i3后使用win+d呼出rofi。

晒图

我的桌面

Edit with markdown