ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

i3wm配置记录

2022-08-07 13:33:45  阅读:183  来源: 互联网

标签:i3wm bindsym exec -- 配置 no 记录 id mod


在此记录一下i3wm和i3status的配置

i3wm

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

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

# 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:DejaVu Sans Mono 8

# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
# exec --no-startup-id dex --autostart --environment i3

# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.

# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork

# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet

# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status

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

# start a terminal
# bindsym $mod+Return exec i3-sensible-terminal

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
# bindsym $mod+d exec --no-startup-id dmenu_run
# A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop

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

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10

# move Focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10

# 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 i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode

        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        # bindsym j resize shrink width 1 px or 1 ppt
        # bindsym k resize grow height 1 px or 1 ppt
        # bindsym l resize shrink height 1 px or 1 ppt
        # bindsym semicolon resize grow width 1 px or 1 ppt

        # same bindings, but for the arrow keys
		# shift + 方向键 进行像素级微调
		# 单方向键进行百分比调整
        bindsym Left resize shrink width 1 px or 1 ppt
        bindsym Down resize grow height 1 px or 1 ppt
        bindsym Up resize shrink height 1 px or 1 ppt
        bindsym Right resize grow width 1 px or 1 ppt
		bindsym Shift+Left resize shrink width 1 px
        bindsym Shift+Down resize grow height 1 px
        bindsym Shift+Up resize shrink height 1 px
        bindsym Shift+Right resize grow width 1 px

        # back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
		id bar-1
		tray_output primary
		workspace_buttons yes
		status_command i3status
		
		# 通过右键工作区栏来截图
   	 	# bindsym --release button3 exec --no-startup-id import /tmp/latest-screenshot.png
		# 通过右键工具栏切换随机壁纸
		bindsym --release button3 exec --no-startup-id feh --randomize --no-fehbg --bg-fill /home/zzt/图片/壁纸/
        #position top
        #status_command i3blocks
        #status_command /home/zzt/i3/contrib/net-speed.sh
        #mode hide
        #hidden_state hide
}

# user add list

# 设置窗口边框等等
new_window none
new_float normal
hide_edge_borders both

#设置窗口间距
gaps inner 0
gaps outer 0

bindsym $mod+Return exec konsole
# bindsym $mod+p exec --no-startup-id firefox
bindsym $mod+o exec --no-startup-id dolphin
bindsym $mod+m exec --no-startup-id electron-netease-cloud-music
bindsym $mod+t exec --no-startup-id xsensors

# exec_always --no-startup-id remmina
exec_always --no-startup-id "/home/zzt/bin/yakuake_start.sh"
exec_always --no-startup-id feh --randomize --no-fehbg --bg-fill /home/zzt/图片/壁纸/
#登录时启动fcitx5
exec_always --no-startup-id fcitx5
#支持透明
exec_always --no-startup-id picom

#程序目录
bindsym $mod+d exec "rofi -modi drun,run,window -show-icons true -show drun run window -theme my-config"

#设置背光亮度
#bindsym XF86MonBrightnessUp exec "xbacklight -inc 5; notify-send 'brightness up 5%'"
#bindsym XF86MonBrightnessDown exec "xbacklight -dec 5; notify-send 'brightness down 5%'"
bindsym XF86MonBrightnessUp exec "/home/zzt/bin/brightness.sh up && $refresh_i3status"
bindsym XF86MonBrightnessDown exec "/home/zzt/bin/brightness.sh down && $refresh_i3status"

#自动布局
exec_always --no-startup-id "autotiling -w 1 2 3 4 5 6 7 8 9"

#方案二  经测试后面的值为6550+- 刚好每次加减音量10%,如果有强迫证建议修改
#bindsym XF86AudioRaiseVolume exec amixer set Master playback 5000+
#bindsym XF86AudioLowerVolume exec amixer set Master playback 5000-
#bindsym XF86AudioMute exec amixer set Master toglde

#设置应用程序所属默认位置
## 终端
assign [class="URxvt"] $ws1
assign [class="konsole"] $ws1
assign [class="Terminator"] $ws1
assign [class="XTerm"] $ws1
assign [class="Alacritty"] $ws1

## vscode
assign [class="Code"] $ws2
###assign [class="Notepadqq"] $ws2

## 浏览器界面
assign [class="firefox"] $ws3
assign [class="Chromium"] $ws3
assign [class="Microsoft-edge-dev"] $ws3

## 思源笔记
assign [class="SiYuan"] $ws4

## freeplane思维导图
assign [class="org-knopflerfish-framework-BundleThread"] $ws5

assign [class="mpv"] $ws9
assign [class="vlc"] $ws9

assign [class="qv2ray"] $ws10

# win+数字切换工作区,第二次返回之前的工作区
workspace_auto_back_and_forth yes
# 循环切换工作区
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev

#锁屏配置
#bindsym $mod+l exec "i3lock -i /home/zzt/图片/壁纸.png"
#使用模糊进行锁屏
bindsym $mod+l exec "i3lockr -p 1 -b 15"
#10分钟自动锁屏
#exec_always "xautolock -time 10 -locker 'i3lock -i /home/zzt/图片/壁纸.png'"
exec_always --no-startup-id "xautolock -time 10 -locker 'i3lockr -p 1 -b 15'"

#关机操作表
set $mode_system 注消(O)|休眠(L)|重启(R)|关机(S)|退出(Esc)
bindsym $mod+minus mode "$mode_system"
mode "$mode_system" {
    bindsym o exec --no-startup-id i3-msg exit
    bindsym l exec --no-startup-id i3exit suspend, mode "default"
    bindsym r exec --no-startup-id systemctl reboot
    bindsym s exec --no-startup-id systemctl poweroff
    bindsym Escape mode "default"
}

#浏览器操作表
set $mode_s Edge(E)|火狐(F)|谷歌(C)|退出(Esc)
bindsym $mod+p mode "$mode_s"
mode "$mode_s" {
	bindsym e exec --no-startup-id microsoft-edge-dev; mode "default"
    bindsym f exec --no-startup-id firefox; mode "default"
    bindsym Return exec --no-startup-id microsoft-edge-dev; mode "default"
    bindsym c exec --no-startup-id chromium; mode "default"
    # back to normal: Enter or Escape or $mod+p
    bindsym Escape mode "default"
    bindsym $mod+p mode "default"
}

#键盘锁显示
exec "/home/zzt/bin/lock_key_status.sh"
bindsym Caps_Lock exec "sleep 200e-3;/home/zzt/bin/lock_key_dunstify.sh c && $refresh_i3status"
##bindsym Num_Lock exec "home/zzt/bin/lock_key_dunstify.sh n && $refresh_i3status"

#通知
exec_always --no-startup-id dunst

#自动护眼模式
exec_always --no-startup-id "/home/zzt/bin/xflux_my.sh"

#xed编辑器快捷键
bindsym $mod+x exec xed

#系统监视器
bindsym $mod+i exec systemmonitor
bindsym $mod+u exec st glances

#网速显示
exec_always --no-startup-id "/home/zzt/bin/net_speed_zzt.sh"

#粘贴板管理器
exec_always --no-startup-id "klipper"

#使能壁纸自动切换脚本
exec "/home/zzt/bin/wallpaper.sh"

i3status

general {
	output_format = i3bar
	colors = true
	interval = 1
	color_good = "#fcf16e" #黄檗色
	color_bad = "#f05b72" #蔷薇色
	color_degraded = "#afb4db" #藤色
}

# order += "ipv6"
#order += "read_file light"
order += "read_file keyLock"
order += "read_file netSpeed"
## 显示cpu温度
order += "cpu_temperature 0"
order += "cpu_usage"
order += "memory"
## 取消显示硬盘使用情况
# order += "disk /"
# order += "disk /home"
## 无线网络信息使用默认参数 _first_ 可能无法找到无线信息,这里直接制定我的无线网络的名称,可以使用 ip addr查看,相当于ifconfig
#order += "wireless _first_"
order += "wireless wlp8s0"
order += "wireless enp9s0f1"
#order += "ethernet _first_"
#order += "load"
order += "battery all"
order += "volume master"
order += "time"

## 定制无线网络信息
wireless wlp8s0 {
	format_up = "ᯤ⁶%ip"
	###format_up = "ᯤ⁶%quality,%essid,%bitrate,%frequency,%ip"
	format_down = "ᯤ⁶未连接"
}

wireless enp9s0f1 {
	format_up = "

标签:i3wm,bindsym,exec,--,配置,no,记录,id,mod
来源: https://www.cnblogs.com/myswy/p/16558914.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有