# 定义默认工作区的名称,稍后我们将在其中配置键绑定。 # 我们使用变量来避免在多个地方重复使用名称。 set $ws1 "1: Terminal" set $ws2 "2: Firefox" set $ws3 "3: VMWare" set $ws4 "4: Spotify" set $ws5 "5: Shutter" set $ws6 "6" set $ws7 "7" set $ws8 "8" set $ws9 "9" set $ws10 "10"
# 定义默认工作区的名称,稍后我们将在其中配置键绑定。 # 我们使用变量来避免在多个地方重复使用名称。 set $ws1 "1: Terminal" set $ws2 "2: Firefox" set $ws3 "3: VMWare" set $ws4 "4: Spotify" set $ws5 "5: Shutter" set $ws6 "6" set $ws7 "7" set $ws8 "8" set $ws9 "9" set $ws10 "10"
不要担心它看起来可怕!
完成后,使用 Mod + e 退出 i3,然后再次登录以应用你刚刚所做的更改。
我的效果如下图所示:
字体看起来太小?是时候解决这个问题了!
在 i3 中更改标题窗口和状态栏的字体
首先,让我们安装新的字体(我将在这里使用 Ubuntu 字体)。
要在 Arch 上安装 Ubuntu 字体,请执行以下操作:
1 2
sudo pacman -S ttf-ubuntu-font-family
如果你使用的是 Ubuntu,你已经安装了这些字体!
安装完成后,打开配置文件:
1 2
nano ~/.config/i3/config
在配置文件中,找到 font pango:monospace 8 这一行,这是默认字体。
找到那行后,添加字体名称和大小,如下所示:
1 2
font pango:Ubuntu Regular 14
然后,使用 Mod + Shift + r 重新启动窗口管理器,这样就完成了工作:
在 i3 窗口管理器中分配应用程序到工作区
在给工作区命名之后,你会想要将特定的软件分配到相应的工作区中。
例如,如果我将第二个工作区命名为 “Firefox”,那么我只想在该工作区中使用 Firefox。
那么要如何实现呢?
为了做到这一点,你需要找到每个要分配的应用程序的类名。
听起来复杂? 让我告诉你如何做。
首先,将应用程序和终端并排打开。例如,在这个例子中,我将 Firefox 和终端并排打开:
现在,在终端中执行 xprop 命令,它会改变鼠标指针的形状:
1 2
xprop
接下来,将鼠标悬停在应用程序上,并在应用程序窗口内的任何位置单击,如图所示:
类名将在以下行的最后一个字符串中找到:
1 2
WM_CLASS(STRING) = "Navigator", "firefox"
在我的情况下,Firefox 浏览器的类名将是 firefox。
对所有你想要分配到工作区的应用程序重复这个过程。
一旦你知道每个你想要分配到工作区的应用程序的类名,打开配置文件:
1 2
nano ~/.config/i3/config
使用 Alt + / 将 nano 定位到文件末尾,并使用以下语法将应用程序分配到工作区:
1 2 3
# 分配应用到工作区 for_window [class="类名"] move to workspace $[工作区变量]
#!/usr/bin/env sh DIR="${DIR:-$BLOCK_INSTANCE}" DIR="${DIR:-$HOME}" ALERT_LOW="${ALERT_LOW:-$1}" ALERT_LOW="${ALERT_LOW:-10}" # color will turn red under this value (default: 10%)
LOCAL_FLAG="-l" if [ "$1" = "-n" ] || [ "$2" = "-n" ]; then LOCAL_FLAG="" fi
df -h -P $LOCAL_FLAG "$DIR" | awk -v label="$LABEL" -v alert_low=$ALERT_LOW ' /\/.*/ { # full text print label $4 # short text print label $4 use=$5 # no need to continue parsing exit 0 } END { gsub(/%$/,"",use) if (100 - use < alert_low) { # color print "#FF0000" } } '
parser = argparse.ArgumentParser(description='Check for pacman updates') parser.add_argument( '-b', '--base_color', default = _default('BASE_COLOR', 'green'), help='base color of the output(default=green)' ) parser.add_argument( '-u', '--updates_available_color', default = _default('UPDATE_COLOR', 'yellow'), help='color of the output, when updates are available(default=yellow)' ) parser.add_argument( '-a', '--aur', action = 'store_const', const = True, default = _default('AUR', 'False', strbool), help='Include AUR packages. Attn: Yaourt must be installed' ) parser.add_argument( '-y', '--aur_yay', action = 'store_const', const = True, default = _default('AUR_YAY', 'False', strbool), help='Include AUR packages. Attn: Yay must be installed' ) parser.add_argument( '-q', '--quiet', action = 'store_const', const = True, default = _default('QUIET', 'False', strbool), help = 'Do not produce output when system is up to date' ) parser.add_argument( '-w', '--watch', nargs='*', default = _default('WATCH', arg_type=strlist), help='Explicitly watch for specified packages. ' 'Listed elements are treated as regular expressions for matching.' ) return parser.parse_args()
def get_updates(): output = '' try: output = check_output(['checkupdates']).decode('utf-8') except subprocess.CalledProcessError as exc: # checkupdates exits with 2 and no output if no updates are available. # we ignore this case and go on if not (exc.returncode == 2 and not exc.output): raise exc if not output: return []
updates = [line.split(' ')[0] for line in output.split('\n') if line]
return updates
def get_aur_yaourt_updates(): output = '' try: output = check_output(['yaourt', '-Qua']).decode('utf-8') except subprocess.CalledProcessError as exc: # yaourt exits with 1 and no output if no updates are available. # we ignore this case and go on if not (exc.returncode == 1 and not exc.output): raise exc if not output: return []
aur_updates = [line.split(' ')[0] for line in output.split('\n') if line.startswith('aur/')]
return aur_updates
def get_aur_yay_updates(): output = check_output(['yay', '-Qua']).decode('utf-8') if not output: return []
aur_updates = [line.split(' ')[0] for line in output.split('\n') if line]
return aur_updates
def matching_updates(updates, watch_list): matches = set() for u in updates: for w in watch_list: if re.match(w, u): matches.add(u)
#!/usr/bin/env bash if [[ -z "$MIXER" ]] ; then MIXER="default" if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then # pulseaudio is running, but not all installations use "pulse" if amixer -D pulse info >/dev/null 2>&1 ; then MIXER="pulse" fi fi [ -n "$(lsmod | grep jack)" ] && MIXER="jackplug" MIXER="${2:-$MIXER}" fi if [[ -z "$SCONTROL" ]] ; then SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1 )}" fi
# The first parameter sets the step to change the volume by (and units to display) # This may be in in % or dB (eg. 5% or 3dB) if [[ -z "$STEP" ]] ; then STEP="${1:-5%}" fi
NATURAL_MAPPING=${NATURAL_MAPPING:-0} if [[ "$NATURAL_MAPPING" != "0" ]] ; then AMIXER_PARAMS="-M" fi
capability() { # Return "Capture" if the device is a capture device amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p" }
volume() { amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability) }
# gaps set $mode_gaps Gaps: (o)uter, (i)nner, (h)orizontal, (v)ertical, (t)op, (r)ight, (b)ottom, (l)eft set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_horiz Horizontal Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_verti Vertical Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_top Top Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_right Right Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_bottom Bottom Gaps: +|-|0 (local), Shift + +|-|0 (global) set $mode_gaps_left Left Gaps: +|-|0 (local), Shift + +|-|0 (global) bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" { bindsym o mode "$mode_gaps_outer" bindsym i mode "$mode_gaps_inner" bindsym h mode "$mode_gaps_horiz" bindsym v mode "$mode_gaps_verti" bindsym t mode "$mode_gaps_top" bindsym r mode "$mode_gaps_right" bindsym b mode "$mode_gaps_bottom" bindsym l mode "$mode_gaps_left" bindsym Return mode "$mode_gaps" bindsym Escape mode "default" }
mode "$mode_gaps_outer" { bindsym plus gaps outer current plus 5 bindsym minus gaps outer current minus 5 bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5 bindsym Shift+minus gaps outer all minus 5 bindsym Shift+0 gaps outer all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_inner" { bindsym plus gaps inner current plus 5 bindsym minus gaps inner current minus 5 bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5 bindsym Shift+minus gaps inner all minus 5 bindsym Shift+0 gaps inner all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_horiz" { bindsym plus gaps horizontal current plus 5 bindsym minus gaps horizontal current minus 5 bindsym 0 gaps horizontal current set 0
bindsym Shift+plus gaps horizontal all plus 5 bindsym Shift+minus gaps horizontal all minus 5 bindsym Shift+0 gaps horizontal all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_verti" { bindsym plus gaps vertical current plus 5 bindsym minus gaps vertical current minus 5 bindsym 0 gaps vertical current set 0
bindsym Shift+plus gaps vertical all plus 5 bindsym Shift+minus gaps vertical all minus 5 bindsym Shift+0 gaps vertical all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_top" { bindsym plus gaps top current plus 5 bindsym minus gaps top current minus 5 bindsym 0 gaps top current set 0
bindsym Shift+plus gaps top all plus 5 bindsym Shift+minus gaps top all minus 5 bindsym Shift+0 gaps top all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_right" { bindsym plus gaps right current plus 5 bindsym minus gaps right current minus 5 bindsym 0 gaps right current set 0
bindsym Shift+plus gaps right all plus 5 bindsym Shift+minus gaps right all minus 5 bindsym Shift+0 gaps right all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_bottom" { bindsym plus gaps bottom current plus 5 bindsym minus gaps bottom current minus 5 bindsym 0 gaps bottom current set 0
bindsym Shift+plus gaps bottom all plus 5 bindsym Shift+minus gaps bottom all minus 5 bindsym Shift+0 gaps bottom all set 0
bindsym Return mode "$mode_gaps" bindsym Escape mode "default" } mode "$mode_gaps_left" { bindsym plus gaps left current plus 5 bindsym minus gaps left current minus 5 bindsym 0 gaps left current set 0
bindsym Shift+plus gaps left all plus 5 bindsym Shift+minus gaps left all minus 5 bindsym Shift+0 gaps left all set 0