Archlinux下i3wm与urxvt的配置

Archlinux下i3wm与urxvt的配置
1 urxvt的基本配置
1.1 安装及配置⽂件
urxvt是⼀个轻量级的终端,功能不是很多,但是⽤着很舒服。在Archlinux下安装它的命令为:
#pacman -S urxvt
它的配置⽂件在$HOME/.Xresources这个⽂件中。
1.2 配置⽂件代码
1 !!$HOME/.Xresources
2 URxvt.preeditType:Root
3 !!调整此处设置输⼊法
4 URxvt.inputMethod:fcitx
5 !!颜⾊设置
6 URxvt.depth:32
7 !!中括号内数表⽰透明度
8 URxvt.inheritPixmap:true
建国方略读后感
9 URxvt.background:#000000
10 URxvt.foreground:#ffffff
lorBD:Gray95
lorUL:Green
lor1:Red2
lor4:RoyalBlue
lor5:Magenta2
lor8:Gray50
lor10:Green2
lor12:DodgerBlue
lor14:Cyan2
lor15:Gray95
常德水表厂
21 !!URL操作
22 URxvt.urlLauncher:chromium
23 URxvt.matcher.button:1
24 Urxvt.perl-ext-common:matcher
25 !!滚动条设置
26 URxvt.scrollBar:False
27 URxvt.scrollBar_floating:False
28 URxvt.scrollstyle:plain
29 !!滚屏设置
useWheelScrollPage:True
31 URxvt.scrollTtyOutput:False
32 URxvt.scrollWithBuffer:True
33 URxvt.scrollTtyKeypress:True
34 !!光标闪烁
35 URxvt.cursorBlink:True
36 URxvt.saveLines:3000
37 !!边框
38 URxvt.borderLess:False
39 !!字体设置
40 Xft.dpi:96
41 URxvt.font:xft:Source Code Pro:antialias=True:pixelsize=18,xft:WenQuanYi Zen Hei:pixelsize=18
42 URxvt.boldfont:xft:Source Code Pro:antialias=True:pixelsize=18,xft:WenQuanYi Zen Hei:pixelsize=18
View Code
1.3 终端提⽰符配置
写完.Xresources⽂件后,urxvt的终端提⽰符是⿊⽩的,如何将提⽰符变成彩⾊的呢?详情参考我的另⼀篇博客:
我的设置如下($HOME/.bashrc):
PS1='\[\033[31m\]\h\[\033[34m\]@\u:\[\033[0;32m\]\w\[\033[33m\]>>> \[\033[0m\]'
1.4 ⽣效
改完了以上的内容,还缺少⼀步,让这个设置⽣效。我是直接把这个命令写进i3wm的启动配置⽂件$HOME/.xinitrc⾥了: xrdb -load ~/.Xresources
现在除了透明,其他都不错的。
2 i3wm的配置
2.1 安装及配置⽂件
i3wm是⼀个平铺式桌⾯管理器,Archlinux下载如下:
#pacman -S i3wm
它的配置⽂件是$HOME/.config/i3/config。它的语法规则可以查看。
2.2 配置⽂件代码
如果你没有到这个config⽂件,则把/etc/i3/config这个⽂件复制过去,或者是直接运⾏命令
#i3-config-wizard
这时候$HOME/.config/i3/config⽂件⾥的配置是⽐较基本的,这⾥介绍⼀下我添加的⼀些功能,或者是美化的部分。
⾸先要清楚的是i3wm的特⾊是可以绑定各种快捷键,当然⼤部分是与mod有关,mod键可以由⽤户设定,可以是alt(Mod1)或者是win(Mod4)。
介绍⼏种实⽤的改进:
•设置win键为mod键,在配置⽂件⾥添加:
set $mod Mod4
•win+enter键启动urxvt,透明启动哦!
这⾥如果要想urxvt透明,先得安装compton,并且在配置⽂件⾥设置⾃启,安装如下
#pacman -S compton
透明启动urxvt,在配置⽂件⾥添加:
exec --no-startup-id compton -b #开机⾃启
bindsym $mod+Return exec urxvt -sh40 #透明参数0-100
•设置壁纸,⾸先安装feh,同样的pacman,这⾥不再赘述,安装完成后添加:
exec_always --no-startup-id feh --bg-scale "/path/xxx.jpg"
•按键盘上的print键全屏截图,按win+print键⽤户⾃选区域截图,需要安装shutter,pacman搞定,然后添加:
bindsym Print exec shutter -f -e -o ~/Pictures/shot/%Y-%m-%d-%T.png
bindsym $mod+Print exec shutter -s -e -o ~/Pictures/shot/%Y-%m-%d-%T.png
这⾥表⽰将截图保存在~/Picture/shot/⽂件夹⾥,名字为年-⽉-⽇-时间.png格式,当然了这些⾃⼰随便设定。
•⿊屏时间设定,即多久⽤户⽆操作⿊屏i3wm的⿊屏和屏保是⼀个意思,但是都得设置,如下:
先把屏保功能关了:
exec --no-startup-id xset s 0
然后⿊屏、睡眠、断电时间分别设为6000s,8000s,9000s,也可以只写前⼀个,不必三个都写
exec --no-startup-id xset dpms 600080009000
•win+shift+减号实现隐藏⼀个窗⼝,win+减号重新打开
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show
还有很多基本的功能,请参照i3wm官⽹⼿册来⾃⼰写。下⾯介绍三处较⼤改进的地⽅。
2.3 ⼯作区的配置
下⾯的代码可以实现将我⽐较常⽤的软件在⽤户设定的⼯作区打开,下⾯是代码:
1 #打开URxvt的同时切换到tab模式
2 for_window [class="URxvt"] layout tabbed
3
4 #打开软件时⾃动移⾄相应⼯作区
5 assign [class="URxvt"] $WS1
6 assign [class="Thunar"] $WS1
7 assign [class="Firefox"] $WS2
8 assign [class="Zathura"] $WS3
9 assign [class="Gvim"] $WS4
10 assign [class="Ise"] $WS5
11 assign [class="VirtualBox"] $WS6
View Code
2.4 电源管理
win+c可以调出选项,你可以选择锁屏(L),注销(O),重启(R),关机(S),退出选项(Esc)。
1 #*********************************************电源管理*************************************
2 set $mode_system  lock(L) logout(O) reboot(R) shutdown(S) exit(Esc)
3 bindsym $mod+c mode "$mode_system"
4 mode "$mode_system" {
5    bindsym l exec --no-startup-id i3lock -c '#000000', mode "default"
6    bindsym o exec --no-startup-id i3-msg exit, mode "default"
7    bindsym r exec --no-startup-id systemctl reboot, mode "default"
8    bindsym s exec --no-startup-id systemctl poweroff, mode "default"
9    bindsym Escape mode "default"
10 }
View Code
2.5 主题设置
将i3bar美化,这⾥要⽤到脚本⽂件jconky以及i3bar美化⽂件conkyrc,后⾯我会贴下载地址,当然也可以按照下⾯的代码写⼀份。⽂件需要移⾄$HOME/.config/i3/下。
注意:这⾥需要安装ttf-font-awesome字体(),AUR⾥有。且这⾥要安装conky
jconky:
1 #!/bin/sh
2
3 # Send the header so that i3bar knows we want to use JSON:
4echo'{"version":1}'
5
6 # Begin the endless array.
7echo'['
8
9 # We send an empty first array of blocks to make the loop simpler:
10echo'[],'
11
12 # Now send blocks with information forever:
13 exec conky -c ~/.config/i3/conkyrc
View Code
conkyrc
1 out_to_x no
2 out_to_console yes
3 background no
4 double_buffer no
5 update_interval 1
6 total_run_times 0
7 override_utf8_locale no
8 short_units yes
9 if_up_strictness address
10 cpu_avg_samples 2
11
12 TEXT
13 [
14 #{ "full_text" : "  ", "color": "\#BADA55"},
15 #{ "full_text": "  ${exec curl icanhazip}"},
16 { "full_text" : ${if_up eno1}"    ${upspeed eno1}/s  ${downspeed eno1}/s"${else}""${endif}, "color" : "\#94F397" },
17 { "full_text" : ${if_up wlo1}"    ${upspeed wlo1}/s  ${downspeed wlo1}/s"${else}""${endif}, "color" : "\#94F397" },
18 { "full_text" : "  ${cpu cpu0}%" , "color" : "\#8BC3E7" },
19 { "full_text" : "  ${mem}" , "color" : "\#B987D9" },
20 { "full_text" : "  ${fs_used_perc /}%" , "color" : "\#FF9D17" },
6639321 { "full_text" : "  ${battery_percent}%" , "color" : "\#A4DC6A" },
22 { "full_text" : "  ${time %Y/%m/%d %a}" , "color" : "\#ff797b" },
23 { "full_text" : "  ${time %H:%M}" , "color" : "\#8BADF9" }
24 ],
View Code
config代码
1 #**************************************************主题设置*********************************************
2 # 窗⼝颜⾊边框背景⽂字提⽰
3 client.focused          #333333 #333333 #FFFFFF #333333
4 client.focused_inactive #999999 #999999 #FFFFFF #3399FF
5 client.unfocused        #999999 #999999 #FFFFFF #3399FF
6 client.urgent          #990000 #990000 #FFFFFF #990000
7 client.placeholder      #000000 #000000 #FFFFFF #000000
8 client.background      #FFFFFF
9
10 #i3bar设置
11 bar {
12    i3bar_command i3bar -t
13    height 28
摩托罗拉e37514    #禁⽌systemtray
15    tray_output none
16    # i3bar调⽤
17    status_command ~/.config/i3/jconky
18    # 显⽰位置top/bottom
19    position bottom
20    # 是否隐藏
21    #mode hide
22    # 拆解⼯作区名(隐藏前⾯的1:2:3:……)
23    strip_workspace_numbers yes
24    # 定义分隔符∥
25    separator_symbol "    "
26
纳什均衡解
27    colors {
28        background #10101000
29        statusline #FFFFFF
30        separator  #3399FF
31        # ⼯作区颜⾊边框背景⽂字
32        focused_workspace  #3297FD #11111100 #FFFFFF
33        active_workspace  #FFFFFF #FFFFFF00 #FFFFFF
34        inactive_workspace #111111 #11111100 #FFFFFF
35        urgent_workspace  #990000 #11111100 #FFFFFF
36        binding_mode      #990000 #99000000 #FFFFFF
37    }
38 }
View Code
注:i3bar_command i3bar -t的-t参数实现i3bar的透明,前提是安装了i3gap,没有则不⽤-t。
2.6 i3gaps
安装具体如下:
•⾸先在github下载⽂件,在bash中执⾏
#git clone github/Airblader/i3 ~/i3-gaps --将⽂件下载到~/i3-gaps⽂件夹中•进⼊i3-gaps⽬录,进⾏编译,执⾏:
#make && make install
安装完成后,贴下config设置:
1 #********************************************i3-gaps*********************************
2 for_window [class="^.*"] border pixel 0
3 gaps inner 8
4 gaps outer 6
5 set $mode_gaps Gaps: (o) outer, (i) inner
6 set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
7 set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
8 bindsym $mod+Shift+g mode "$mode_gaps"
9
10 mode "$mode_gaps" {
11        bindsym o      mode "$mode_gaps_outer"
12        bindsym i      mode "$mode_gaps_inner"
13        bindsym Return mode "default"
14        bindsym Escape mode "default"
15 }
16
17 mode "$mode_gaps_inner" {
18        bindsym plus  gaps inner current plus 5
19        bindsym minus gaps inner current minus 5
20        bindsym 0    gaps inner current set 0
21
22        bindsym Shift+plus  gaps inner all plus 5
23        bindsym Shift+minus gaps inner all minus 5
24        bindsym Shift+0    gaps inner all set 0
25
26        bindsym Return mode "default"
27        bindsym Escape mode "default"
28 }
29 mode "$mode_gaps_outer" {
30        bindsym plus  gaps outer current plus 5
31        bindsym minus gaps outer current minus 5
32        bindsym 0    gaps outer current set 0
33
34        bindsym Shift+plus  gaps outer all plus 5
35        bindsym Shift+minus gaps outer all minus 5
36        bindsym Shift+0    gaps outer all set 0
37
38        bindsym Return mode "default"
39        bindsym Escape mode "default"
40 }
View Code
3 效果图
说了这么多,终于到了秀桌⾯的时候了么,这些都是shutter截的图哦!各个⼯作区截图:
⼯作区1,urxvt和thunar
⼯作区2,firefox

本文发布于:2024-09-23 05:15:53,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/692947.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:安装   配置   作区   设置   选项   透明   功能   启动
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议