ThinkPad T480s Debian Stretchでi3wmを設定したときのメモ
ThinkPad T480sを購入して、Debian Stretchをインストールして使っています。
ウインドウマネージャーはi3wmを使っているのですが、色々と設定して少しづつ形になってきたので、今までやってきたことをメモしておく。
随時更新する予定です。
更新
2019-01-09
Backportsの設定
を更新しました。
ThinkPad特有の問題(/etc/default/grub)
ThinkPad T480s だけではないようですが、XF86MonBrightnessUp
やXF86MonBrightnessDown
などのキーが、認識しないようです。
ググると、以下のように設定すればよい、とかいてあるので試したら無事設定できた。
参考リンク
設定
vimで開く。
1sudo vim /etc/default/grub
以下のquiet
を
1GRUB_CMDLINE_LINUX_DEFAULT="quiet"
quiet splash thinkpad-acpi.brightness_enable=1 acpi_backlight=vendor
と変更する。
1GRUB_CMDLINE_LINUX_DEFAULT="quiet splash thinkpad-acpi.brightness_enable=1 acpi_backlight=vendor"
updateする。
1sudo update-grub
最終的には、以下のような感じになった。
1/etc/default/grub
2
3# If you change this file, run 'update-grub' afterwards to update
4# /boot/grub/grub.cfg.
5# For full documentation of the options in this file, see:
6# info -f grub -n 'Simple configuration'
7
8GRUB_DEFAULT=0
9GRUB_TIMEOUT=5
10GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
11GRUB_CMDLINE_LINUX_DEFAULT="quiet splash thinkpad-acpi.brightness_enable=1 acpi_backlight=vendor"
12GRUB_CMDLINE_LINUX=""
13
14# Uncomment to enable BadRAM filtering, modify to suit your needs
15# This works with Linux (no patch required) and with any kernel that obtains
16# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
17#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
18
19# Uncomment to disable graphical terminal (grub-pc only)
20#GRUB_TERMINAL=console
21
22# The resolution used on graphical terminal
23# note that you can use only modes which your graphic card supports via VBE
24# you can see them in real GRUB with the command `vbeinfo'
25#GRUB_GFXMODE=640x480
26
27# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
28#GRUB_DISABLE_LINUX_UUID=true
29
30# Uncomment to disable generation of recovery mode menu entries
31#GRUB_DISABLE_RECOVERY="true"
32
33# Uncomment to get a beep at grub start
34#GRUB_INIT_TUNE="480 440 1"
Backportsの設定(/etc/apt/sources.list.d/stretch-backports.list)
参考リンク
設定
オフィシャルの内容の通りに設定する。
1/etc/apt/sources.list.d/stretch-backports.list
2
3deb http://ftp.debian.org/debian stretch-backports main contrib non-free
更新(2019-01-09)
Twitterで「ftp.debian.org
ではなくftp.jp.debian.org
がいいですよ。」と教えて頂いたので、修正しました。
ミラーは https://t.co/Dm9X9UnnjU じゃなくて日本国内なら https://t.co/i2yrDSeepZ の方が、それ以外・頻繁に移動が発生する場合は https://t.co/xPo963saEX のほうがいいですよ
— henrich (@henrich) January 7, 2019
1/etc/apt/sources.list.d/stretch-backports.list
2
3deb http://ftp.jp.debian.org/debian stretch-backports main contrib non-free
SDカードのマウント(/etc/fstab)
参考リンク
設定
DebianのWikiの通りに設定する。
1/etc/fstab
2
3# /etc/fstab: static file system information.
4#
5# Use 'blkid' to print the universally unique identifier for a
6# device; this may be used with UUID= as a more robust way to name devices
7# that works even if disks are added and removed. See fstab(5).
8#
9# <file system> <mount point> <type> <options> <dump> <pass>
10# / was on /dev/nvme0n1p2 during installation
11UUID=e6ff3dca-fab9-4a9f-b515-da2c54b2031d / ext4 errors=remount-ro 0 1
12# /boot/efi was on /dev/nvme0n1p1 during installation
13UUID=DD05-11E9 /boot/efi vfat umask=0077 0 1
14# swap was on /dev/nvme0n1p3 during installation
15UUID=139e15f9-b78b-4418-a25c-169a9f694db2 none swap sw 0 0
16# / was on /dev/sda1 during installation
17UUID=fa0490b7-b591-4538-aa36-a02e0883b609 /media/sdcard ext4 errors=remount-ro 0 1
トラックポイントとタッチパットの設定(/usr/share/X11/xorg.conf.d/30-touchpad.conf)
参考リンク
設定
作る。
1/usr/share/X11/xorg.conf.d/30-touchpad.conf
2
3Section "InputClass"
4 Identifier "trackpoint catchall"
5 Driver "libinput"
6 MatchIsPointer "true"
7 MatchProduct "Elantech Touchpad|TrackPoint"
8 MatchDevicePath "/dev/input/event*"
9 Option "NaturalScrolling" "true"
10EndSection
11
12Section "InputClass"
13 Identifier "touchpad catchall"
14 Driver "libinput"
15 MatchIsTouchpad "true"
16 MatchProduct "Elantech Touchpad|TrackPoint"
17 MatchDevicePath "/dev/input/event*"
18 Option "Tapping" "on"
19 Option "NaturalScrolling" "true"
20EndSection
xinputを使って設定
xinputコマンドでも設定できる。
例として、TouchpadのNaturalScrollingを設定する。
1(cmd) ~ $ xinput
2⎡ Virtual core pointer id=2 [master pointer (3)]
3⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
4⎜ ↳ ETPS/2 Elantech Touchpad id=11 [slave pointer (2)]
5⎜ ↳ ETPS/2 Elantech TrackPoint id=12 [slave pointer (2)]
6⎣ Virtual core keyboard id=3 [master keyboard (2)]
7 ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
8 ↳ Power Button id=6 [slave keyboard (3)]
9 ↳ Video Bus id=7 [slave keyboard (3)]
10 ↳ Sleep Button id=8 [slave keyboard (3)]
11 ↳ Integrated Camera id=9 [slave keyboard (3)]
12 ↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
13 ↳ ThinkPad Extra Buttons id=13 [slave keyboard (3)]
14 ↳ 08:EB:ED:9C:C4:FF id=14 [slave keyboard (3)]
15
16(cmd) ~ $ xinput list-props 11
17Device 'ETPS/2 Elantech Touchpad':
18 Device Enabled (139): 1
19 Coordinate Transformation Matrix (141): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
20 libinput Tapping Enabled (274): 1
21 libinput Tapping Enabled Default (275): 0
22 libinput Tapping Drag Enabled (276): 1
23 libinput Tapping Drag Enabled Default (277): 1
24 libinput Tapping Drag Lock Enabled (278): 0
25 libinput Tapping Drag Lock Enabled Default (279): 0
26 libinput Tapping Button Mapping Enabled (280): 1, 0
27 libinput Tapping Button Mapping Default (281): 1, 0
28 libinput Accel Speed (282): 0.000000
29 libinput Accel Speed Default (283): 0.000000
30 libinput Natural Scrolling Enabled (284): 1
31 libinput Natural Scrolling Enabled Default (285): 0
32 libinput Send Events Modes Available (259): 1, 1
33 libinput Send Events Mode Enabled (260): 0, 0
34 libinput Send Events Mode Enabled Default (261): 0, 0
35 libinput Left Handed Enabled (286): 0
36 libinput Left Handed Enabled Default (287): 0
37 libinput Scroll Methods Available (288): 1, 1, 0
38 libinput Scroll Method Enabled (289): 1, 0, 0
39 libinput Scroll Method Enabled Default (290): 1, 0, 0
40 libinput Click Methods Available (291): 1, 1
41 libinput Click Method Enabled (292): 1, 0
42 libinput Click Method Enabled Default (293): 1, 0
43 libinput Middle Emulation Enabled (294): 0
44 libinput Middle Emulation Enabled Default (295): 0
45 libinput Disable While Typing Enabled (296): 1
46 libinput Disable While Typing Enabled Default (297): 1
47 Device Node (262): "/dev/input/event2"
48 Device Product ID (263): 2, 14
49 libinput Drag Lock Buttons (298): <no items>
50 libinput Horizontal Scroll Enabled (299): 1
51
52(cmd) ~ $ xinput set-prop 11 "libinput Natural Scrolling Enabled" 0
xbacklightでエラーになるため設定(/usr/share/X11/xorg.conf.d/20-intel.conf)
以下のようなコマンドを実行するとno outputs have backlight properties
とでるので、設定する。
1(cmd) ~ $ xbacklight -inc 5
2(cmd) ~ $ xbacklight -dec 5
参考リンク
- xbacklight: No outputs have backlight property - No /sys/class/backlight folder
- xbacklight - No outputs have backlight property
設定
作る。
1/usr/share/X11/xorg.conf.d/20-intel.conf
2
3Section "Device"
4 Identifier "Backlight fix"
5 Driver "intel"
6 Option "Backlight" "intel_backlight"
7EndSection
fcitxを使う設定(~/.inputrc)
im-config
で、自動で作成されるみたい。
1~/.inputrc
2
3# im-config(8) generated on Fri, 21 Dec 2018 21:56:16 +0900
4run_im fcitx
5# im-config signature: a0820a046c134d6459275e7ce49f57a2 -
rofiやdmenu_runにシェルスクリプトを追加する設定(~/.Xsessionrc)
rofiやdmenu_runの中に自分で作成したシェルスクリプトを追加するために、作る。
.bashrc
や.profile
の$PATH
とは別のようなので、設定する。
source $HOME/.bashrc
などでも良いと思う。
キーリピートの設定はお好みで。
1~/.Xsessionrc
2
3if [ -d "$HOME/bin" ] ; then
4 PATH="$HOME/bin:$PATH"
5fi
6
7# key repeat
8xset r rate 250 90
キーマップの設定(~/.Xmodmap)
参考リンク
- SwapControlAltAndCapsLock
- Linux: Swap CapsLock Escape Keys
- How do I swap Left Ctrl with Left Alt on my keyboard?
- I see how to have Left Alt swapped with Left Win; Can I have Right Alt swapped with Right Win?
設定
以下のようなキーマップに変更している。
1CapsLock -> Control_L
2Alt_R -> Super_R
3Alt_L -> Control_L
4Super_L -> Alt_L
5Control_L -> Super_L
作る。
起動時に読み込まれる。
1~/.Xmodmap
2
3! -*- coding: utf-8 -*-
4! 2019-01-01
5
6! swap Ctrl and Alt keys
7
8! output taken from:
9! xmodmap -pke | egrep '(Control|Super|Alt|Menu)'
10! Use to set keycodes correctly below. List reordered to match
11! keys from left to right.
12
13! keycode 37 = Control_L NoSymbol Control_L
14! keycode 64 = Alt_L Meta_L Alt_L Meta_L
15! keycode 66 = CapsLock
16! keycode 105 = Control_R NoSymbol Control_R
17! keycode 108 = Alt_R Meta_R Alt_R Meta_R
18! keycode 133 = Super_L NoSymbol Super_L
19! keycode 134 = Super_R NoSymbol Super_R
20! keycode 135 = Menu
21
22! First clear all modifiers, caps lock & control
23clear lock
24clear control
25clear mod1
26clear mod4
27
28keycode 37 = Super_L NoSymbol Super_L
29keycode 64 = Control_L NoSymbol Control_L
30keycode 66 = Control_L NoSymbol Control_L
31keycode 105 = Control_R NoSymbol Control_R
32keycode 108 = Super_R NoSymbol Super_R
33keycode 133 = Alt_L Meta_L Alt_L Meta_L
34keycode 134 = Alt_R Meta_R Alt_R Meta_R
35
36! We need to set keycodes first, as some programs (emacs!) read
37! the key names and seem to ignore what's below.
38add mod1 = Alt_R Alt_L Meta_R Meta_L
39add mod4 = Super_R Super_L Menu
40add control = Control_R Control_L
i3wmの設定(~/.config/i3/config)
i3lock.sh
などは、.Xsessionrc
でパスを通している。
1~/.config/i3/config
2
3# This file has been auto-generated by i3-config-wizard(1).
4# It will not be overwritten, so edit it as you like.
5#
6# Should you change your keyboard layout some time, delete
7# this file and re-run i3-config-wizard(1).
8#
9
10# i3 config file (v4)
11#
12# Please see http://i3wm.org/docs/userguide.html for a complete reference!
13
14set $mod Mod4
15
16# Font for window titles. Will also be used by the bar unless a different font
17# is used in the bar {} block below.
18#font pango:monospace 8
19font pango:Ricty Diminished Regular 11
20
21# This font is widely installed, provides lots of unicode glyphs, right-to-left
22# text rendering and scalability on retina/hidpi displays (thanks to pango).
23#font pango:DejaVu Sans Mono 8
24
25# Before i3 v4.8, we used to recommend this one as the default:
26# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
27# The font above is very space-efficient, that is, it looks good, sharp and
28# clear in small sizes. However, its unicode glyph coverage is limited, the old
29# X core fonts rendering does not support right-to-left and this being a bitmap
30# font, it doesn’t scale on retina/hidpi displays.
31
32# Use Mouse+$mod to drag floating windows to their wanted position
33floating_modifier $mod
34
35# start a terminal
36bindsym $mod+Return exec gnome-terminal
37
38# kill focused window
39bindsym $mod+Shift+q kill
40
41# start dmenu (a program launcher)
42bindsym $mod+d exec --no-startup-id ~/bin/i3rofi.sh
43bindsym control+space exec --no-startup-id ~/bin/i3rofi.sh
44
45# There also is the (new) i3-dmenu-desktop which only displays applications
46# shipping a .desktop file. It is a wrapper around dmenu, so you need that
47# installed.
48# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
49
50# change focus
51bindsym $mod+h focus left
52bindsym $mod+j focus down
53bindsym $mod+k focus up
54bindsym $mod+l focus right
55
56# alternatively, you can use the cursor keys:
57#bindsym $mod+Left focus left
58#bindsym $mod+Down focus down
59#bindsym $mod+Up focus up
60#bindsym $mod+Right focus right
61
62# move focused window
63bindsym $mod+Shift+h move left
64bindsym $mod+Shift+j move down
65bindsym $mod+Shift+k move up
66bindsym $mod+Shift+l move right
67
68# alternatively, you can use the cursor keys:
69#bindsym $mod+Shift+Left move left
70#bindsym $mod+Shift+Down move down
71#bindsym $mod+Shift+Up move up
72#bindsym $mod+Shift+Right move right
73
74# split in horizontal orientation
75#bindsym $mod+h split h
76
77# split in vertical orientation
78bindsym $mod+v split v
79
80# enter fullscreen mode for the focused container
81bindsym $mod+f fullscreen toggle
82
83# change container layout (stacked, tabbed, toggle split)
84bindsym $mod+s layout stacking
85bindsym $mod+w layout tabbed
86bindsym $mod+e layout toggle split
87
88# toggle tiling / floating
89bindsym $mod+Shift+space floating toggle
90
91# change focus between tiling / floating windows
92bindsym $mod+space focus mode_toggle
93
94# focus the parent container
95bindsym $mod+a focus parent
96
97# focus the child container
98#bindsym $mod+d focus child
99
100# switch to workspace
101bindsym $mod+1 workspace 1
102bindsym $mod+2 workspace 2
103bindsym $mod+3 workspace 3
104bindsym $mod+4 workspace 4
105bindsym $mod+5 workspace 5
106bindsym $mod+6 workspace 6
107bindsym $mod+7 workspace 7
108bindsym $mod+8 workspace 8
109bindsym $mod+9 workspace 9
110bindsym $mod+0 workspace 10
111
112# move focused container to workspace
113bindsym $mod+Shift+1 move container to workspace 1
114bindsym $mod+Shift+2 move container to workspace 2
115bindsym $mod+Shift+3 move container to workspace 3
116bindsym $mod+Shift+4 move container to workspace 4
117bindsym $mod+Shift+5 move container to workspace 5
118bindsym $mod+Shift+6 move container to workspace 6
119bindsym $mod+Shift+7 move container to workspace 7
120bindsym $mod+Shift+8 move container to workspace 8
121bindsym $mod+Shift+9 move container to workspace 9
122bindsym $mod+Shift+0 move container to workspace 10
123
124# reload the configuration file
125bindsym $mod+Shift+c reload
126# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
127bindsym $mod+Shift+r restart
128# exit i3 (logs you out of your X session)
129bindsym $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'"
130
131# Screen brightness controls
132bindsym XF86MonBrightnessUp exec xbacklight -inc 5
133bindsym XF86MonBrightnessDown exec xbacklight -dec 5
134
135# Pulse Audio controls
136bindsym XF86AudioRaiseVolume exec --no-startup-id i3audio.sh up #increase sound volume
137bindsym XF86AudioLowerVolume exec --no-startup-id i3audio.sh down #decrease sound volume
138bindsym XF86AudioMute exec --no-startup-id i3audio.sh toggle # mute sound
139
140# print
141bindsym Print exec --no-startup-id kazam
142
143# Sleep key
144#bindsym XF86Sleep exec --no-startup-id systemctl suspend
145
146# resize window (you can also use the mouse for that)
147mode "resize" {
148 # These bindings trigger as soon as you enter the resize mode
149
150 # Pressing left will shrink the window’s width.
151 # Pressing right will grow the window’s width.
152 # Pressing up will shrink the window’s height.
153 # Pressing down will grow the window’s height.
154 bindsym h resize shrink width 10 px or 10 ppt
155 bindsym j resize grow height 10 px or 10 ppt
156 bindsym k resize shrink height 10 px or 10 ppt
157 bindsym l resize grow width 10 px or 10 ppt
158
159 # same bindings, but for the arrow keys
160 bindsym Left resize shrink width 10 px or 10 ppt
161 bindsym Down resize grow height 10 px or 10 ppt
162 bindsym Up resize shrink height 10 px or 10 ppt
163 bindsym Right resize grow width 10 px or 10 ppt
164
165 # back to normal: Enter or Escape
166 bindsym Return mode "default"
167 bindsym Escape mode "default"
168}
169bindsym $mod+r mode "resize"
170
171# move floating windows with keys
172mode "move" {
173 bindsym $mod+Tab focus right
174
175 bindsym Left move left
176 bindsym Down move down
177 bindsym Up move up
178 bindsym Right move right
179
180 bindsym h move left
181 bindsym j move down
182 bindsym k move up
183 bindsym l move right
184
185 # back to normal: Enter or Escape
186 bindsym Return mode "default"
187 bindsym Escape mode "default"
188}
189bindsym $mod+m mode "move" focus floating
190
191# Start i3bar to display a workspace bar (plus the system information i3status
192# finds out, if available)
193bar {
194 status_command i3status
195 font pango:Ricty Diminished Regular 12
196 position top
197 tray_output primary
198 tray_padding -2
199}
200
201# all kill
202# Close all windows on all workspaces (any class string)
203#bindsym $mod+Shift+q [class=”.*”] kill
204
205# title bar
206new_window none
207new_float none
208for_window [class="^.*"] border none
209
210# lock
211bindsym Control+Shift+l exec --no-startup-id i3lock.sh
212
213# for key bind emacs
214exec --no-startup-id gnome-settings-daemon
215
216# display
217exec --no-startup-id ~/.screenlayout/2048x1152.sh
218
219# wallpaper
220exec --no-startup-id feh --bg-scale /home/teruhiro/.config/i3/images/1920x1080_FullHD_v2.jpg
221
222# autolock
223exec --no-startup-id xautolock -detectsleep -time 5 -locker i3lock.sh
i3statusの設定(~/.config/i3status/config)
nmcliでネットワークを確認する。
1(cmd) ~ $ nmcli
2docker0: connected to docker0
3 bridge, 02:42:DD:C0:DB:BF, sw, mtu 1500
4 inet4 172.17.0.1/16
5
6wlp61s0: connected to z5j5zb82ds-network-5GHz 6
7 "Intel Sunrise Point-LP PCI Express Root Port"
8 wifi (iwlwifi), 98:3B:8F:B3:61:04, hw
9 ip4 default
10 inet4 192.168.100.3/24
11 route4 169.254.0.0/16
12 inet6 fe80::e647:cb7:436e:a0d2/64
13
14enp0s31f6: unavailable
15 "Intel Ethernet Connection (4) I219-V"
16 ethernet (e1000e), E8:6A:64:6C:05:E1, hw, mtu 1500
17
18vmnet1: unmanaged
19 ethernet (unknown), 00:50:56:C0:00:01, hw, mtu 1500
20
21vmnet8: unmanaged
22 ethernet (unknown), 00:50:56:C0:00:08, hw, mtu 1500
23
24lo: unmanaged
25 loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
26
27DNS configuration:
28 servers: 192.168.100.1
29 interface: wlp61s0
30
31Use "nmcli device show" to get complete information about known devices and
32"nmcli connection show" to get an overview on active connection profiles.
33
34Consult nmcli(1) and nmcli-examples(5) manual pages for complete usage details.
(もしくは)ipでネットワークを確認する。
1(ins) ~ $ ip link
21: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
3 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
42: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
5 link/ether e8:6a:64:6c:05:e1 brd ff:ff:ff:ff:ff:ff
63: wlp61s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
7 link/ether 98:3b:8f:b3:61:04 brd ff:ff:ff:ff:ff:ff
84: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
9 link/ether 02:42:dd:c0:db:bf brd ff:ff:ff:ff:ff:ff
105: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
11 link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
126: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
13 link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
設定
上で調べたネットワークを指定する。
1~/.config/i3status/config
2
3general {
4 output_format = "i3bar"
5 #output_format = "dzen2"
6 colors = true
7 color_good = '#88b090'
8 color_degraded = '#ccdc90'
9 color_bad = '#e89393'
10 interval = 5
11 separator = " "
12}
13
14#order += "ipv6"
15order += "disk /"
16order += "run_watch DHCP"
17#order += "run_watch VPNC"
18#order += "path_exists VPN"
19order += "wireless wlp61s0"
20order += "ethernet enp0s31f6"
21order += "battery 0"
22#order += "cpu_temperature 0"
23order += "load"
24order += "tztime local"
25#order += "tztime berlin"
26
27wireless wlp61s0 {
28 #format_up = "W: (%quality at %essid, %bitrate) %ip"
29 format_up = "W: (%quality at %essid) %ip"
30 format_down = "W: down"
31}
32
33ethernet enp0s31f6 {
34 # if you use %speed, i3status requires the cap_net_admin capability
35 format_up = "E: %ip (%speed)"
36 format_down = "E: down"
37}
38
39battery 0 {
40 #format = "%status %percentage %remaining %emptytime"
41 format = "%status %percentage %remaining"
42 format_down = "No battery"
43 status_chr = "⚡ CHR"
44 status_bat = "🔋 BAT"
45 status_unk = "? UNK"
46 status_full = "☻ FULL"
47 path = "/sys/class/power_supply/BAT%d/uevent"
48 low_threshold = 10
49}
50
51run_watch DHCP {
52 pidfile = "/var/run/dhclient*.pid"
53}
54
55run_watch VPNC {
56 # file containing the PID of a vpnc process
57 pidfile = "/var/run/vpnc/pid"
58}
59
60path_exists VPN {
61 # path exists when a VPN tunnel launched by nmcli/nm-applet is active
62 path = "/proc/sys/net/ipv4/conf/tun0"
63}
64
65tztime local {
66 format = "%Y-%m-%d %H:%M:%S"
67}
68
69tztime berlin {
70 format = "%Y-%m-%d %H:%M:%S %Z"
71 timezone = "Europe/Berlin"
72}
73
74load {
75 format = "%5min"
76}
77
78cpu_temperature 0 {
79 format = "T: %degrees °C"
80 path = "/sys/devices/platform/coretemp.0/temp1_input"
81}
82
83disk "/" {
84 format = "%free"
85}
オーディオ関連の設定(~/bin/i3audio.sh)
最初は、pasystrayを使っていましたが、接続のたびにアイコンを操作するのがつかれるので、シェルスクリプトを作った。
まずはpacmdの使い方を覚える
sinkの一覧を表示する。
以下の例では、3つ接続している状態。
- Built-in Audio Analog Stereo
- Soundcore Liberty Air
- Pixel USB-C earbuds Analog Stereo
ちなみに、Soundcore Liberty Air
に接続している。
1(cmd) ~ $ pacmd list-sinks
23 sink(s) available.
3 index: 0
4 name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
5 driver: <module-alsa-card.c>
6 flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
7 state: SUSPENDED
8 suspend cause: IDLE
9 priority: 9959
10 volume: front-left: 3242 / 5% / -78.34 dB, front-right: 3242 / 5% / -78.34 dB
11 balance 0.00
12 base volume: 65536 / 100% / 0.00 dB
13 volume steps: 65537
14 muted: no
15 current latency: 0.00 ms
16 max request: 0 KiB
17 max rewind: 0 KiB
18 monitor source: 0
19 sample spec: s16le 2ch 48000Hz
20 channel map: front-left,front-right
21 Stereo
22 used by: 0
23 linked by: 0
24 configured latency: 0.00 ms; range is 0.50 .. 1837.50 ms
25 card: 0 <alsa_card.pci-0000_00_1f.3>
26 module: 6
27 properties:
28 alsa.resolution_bits = "16"
29 device.api = "alsa"
30 device.class = "sound"
31 alsa.class = "generic"
32 alsa.subclass = "generic-mix"
33 alsa.name = "ALC257 Analog"
34 alsa.id = "ALC257 Analog"
35 alsa.subdevice = "0"
36 alsa.subdevice_name = "subdevice #0"
37 alsa.device = "0"
38 alsa.card = "0"
39 alsa.card_name = "HDA Intel PCH"
40 alsa.long_card_name = "HDA Intel PCH at 0xe8348000 irq 145"
41 alsa.driver_name = "snd_hda_intel"
42 device.bus_path = "pci-0000:00:1f.3"
43 sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
44 device.bus = "pci"
45 device.vendor.id = "8086"
46 device.vendor.name = "Intel Corporation"
47 device.product.id = "9d71"
48 device.form_factor = "internal"
49 device.string = "front:0"
50 device.buffering.buffer_size = "352800"
51 device.buffering.fragment_size = "176400"
52 device.access_mode = "mmap+timer"
53 device.profile.name = "analog-stereo"
54 device.profile.description = "Analog Stereo"
55 device.description = "Built-in Audio Analog Stereo"
56 alsa.mixer_name = "Realtek ALC257"
57 alsa.components = "HDA:10ec0257,17aa2258,00100001 HDA:8086280b,80860101,00100000"
58 module-udev-detect.discovered = "1"
59 device.icon_name = "audio-card-pci"
60 ports:
61 analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
62 properties:
63 device.icon_name = "audio-speakers"
64 analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
65 properties:
66 device.icon_name = "audio-headphones"
67 active port: <analog-output-speaker>
68 * index: 3
69 name: <bluez_sink.08_EB_ED_9C_C4_FF.a2dp_sink>
70 driver: <module-bluez5-device.c>
71 flags: HARDWARE DECIBEL_VOLUME LATENCY FLAT_VOLUME
72 state: RUNNING
73 suspend cause:
74 priority: 9430
75 volume: front-left: 13062 / 20% / -42.03 dB, front-right: 13062 / 20% / -42.03 dB
76 balance 0.00
77 base volume: 65536 / 100% / 0.00 dB
78 volume steps: 65537
79 muted: no
80 current latency: 30.12 ms
81 max request: 2 KiB
82 max rewind: 0 KiB
83 monitor source: 4
84 sample spec: s16le 2ch 44100Hz
85 channel map: front-left,front-right
86 Stereo
87 used by: 1
88 linked by: 1
89 fixed latency: 39.51 ms
90 card: 3 <bluez_card.08_EB_ED_9C_C4_FF>
91 module: 25
92 properties:
93 bluetooth.protocol = "a2dp_sink"
94 device.description = "Soundcore Liberty Air"
95 device.string = "08:EB:ED:9C:C4:FF"
96 device.api = "bluez"
97 device.class = "sound"
98 device.bus = "bluetooth"
99 device.form_factor = "headphone"
100 bluez.path = "/org/bluez/hci0/dev_08_EB_ED_9C_C4_FF"
101 bluez.class = "0x240418"
102 bluez.alias = "Soundcore Liberty Air"
103 device.icon_name = "audio-headphones-bluetooth"
104 ports:
105 headphone-output: Headphone (priority 0, latency offset 0 usec, available: yes)
106 properties:
107
108 active port: <headphone-output>
109 index: 4
110 name: <alsa_output.usb-Google_Pixel_USB-C_earbuds_00000087QAJ52920-00.analog-stereo>
111 driver: <module-alsa-card.c>
112 flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY FLAT_VOLUME DYNAMIC_LATENCY
113 state: SUSPENDED
114 suspend cause: IDLE
115 priority: 9049
116 volume: front-left: 19656 / 30% / -31.38 dB, front-right: 19656 / 30% / -31.38 dB
117 balance 0.00
118 base volume: 65536 / 100% / 0.00 dB
119 volume steps: 65537
120 muted: no
121 current latency: 0.00 ms
122 max request: 0 KiB
123 max rewind: 0 KiB
124 monitor source: 5
125 sample spec: s16le 2ch 44100Hz
126 channel map: front-left,front-right
127 Stereo
128 used by: 0
129 linked by: 0
130 configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
131 card: 4 <alsa_card.usb-Google_Pixel_USB-C_earbuds_00000087QAJ52920-00>
132 module: 26
133 properties:
134 alsa.resolution_bits = "16"
135 device.api = "alsa"
136 device.class = "sound"
137 alsa.class = "generic"
138 alsa.subclass = "generic-mix"
139 alsa.name = "USB Audio"
140 alsa.id = "USB Audio"
141 alsa.subdevice = "0"
142 alsa.subdevice_name = "subdevice #0"
143 alsa.device = "0"
144 alsa.card = "1"
145 alsa.card_name = "Pixel USB-C earbuds"
146 alsa.long_card_name = "Google Pixel USB-C earbuds at usb-0000:3c:00.0-1, full speed"
147 alsa.driver_name = "snd_usb_audio"
148 device.bus_path = "pci-0000:3c:00.0-usb-0:1:1.0"
149 sysfs.path = "/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/0000:05:02.0/0000:3c:00.0/usb3/3-1/3-1:1.0/sound/card1"
150 udev.id = "usb-Google_Pixel_USB-C_earbuds_00000087QAJ52920-00"
151 device.bus = "usb"
152 device.vendor.id = "18d1"
153 device.vendor.name = "Google Inc."
154 device.product.id = "5033"
155 device.product.name = "Pixel USB-C earbuds"
156 device.serial = "Google_Pixel_USB-C_earbuds_00000087QAJ52920"
157 device.string = "front:1"
158 device.buffering.buffer_size = "352800"
159 device.buffering.fragment_size = "176400"
160 device.access_mode = "mmap+timer"
161 device.profile.name = "analog-stereo"
162 device.profile.description = "Analog Stereo"
163 device.description = "Pixel USB-C earbuds Analog Stereo"
164 alsa.mixer_name = "USB Mixer"
165 alsa.components = "USB18d1:5033"
166 module-udev-detect.discovered = "1"
167 device.icon_name = "audio-card-usb"
168 ports:
169 analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: unknown)
170 properties:
171 device.icon_name = "audio-headphones"
172 active port: <analog-output-headphones>
Pixel USB-C earbuds Analog Stereo
を使うために、indexを設定する。
1(ins) ~ $ pacmd set-default-sink 4
これで、Soundcore Liberty Air
からPixel USB-C earbuds Analog Stereo
に切り替わる。
以下のようにすれば、音量の変更や、ミュートにできる。
1(ins) ~ $ pactl set-sink-volume 4 +5%
2(ins) ~ $ pactl set-sink-volume 4 -5%
3(ins) ~ $ pactl set-sink-mute 4 toggle
シェルスクリプトを作った
1~/bin/i3audio.sh
2
3
4#!/usr/bin/env bash
5set -Ceuo pipefail
6
7TARGET="$1"
8
9AUDIOPATH="/var/tmp/i3audio.txt"
10
11# check param
12if [ x$TARGET = "x" ]; then
13 exit 1
14fi
15
16# check audio index
17if [ -f "$AUDIOPATH" ]; then
18 # exists
19 INDEX=$(cat "$AUDIOPATH")
20else
21 # not exists
22 echo -n "0" > "$AUDIOPATH"
23 INDEX="0"
24fi
25
26# set index
27if [ $TARGET = "index" ]; then
28 # echo pacmd list-sinks
29 CNT=0
30 pacmd list-sinks | while read LINE
31 do
32 CNT=$(expr $CNT + 1)
33 if [ "`echo $LINE | grep -e 'index:'`" ]; then
34 echo "$LINE"
35 elif [ "`echo $LINE | grep -e 'state:' -e 'volume:' -e 'device.description ='`" ]; then
36 echo " $LINE"
37 fi
38 done
39 # read index number
40 while :
41 do
42 read -p "Input index number (number or c=cancel): " DATA
43 # check input number
44 if [ "$DATA" = "c" ]; then
45 echo "Canceled."
46 break
47 else
48 expr "$DATA" + 1 > /dev/null 2>&1
49 if [ $? -lt 2 ]; then
50 # is Numeric
51 echo -n "$DATA" >| "$AUDIOPATH"
52 pacmd set-default-sink "$DATA"
53 echo "Done."
54 break
55 else
56 # is not Numeric
57 break
58 fi
59 fi
60 done
61fi
62
63# volume up
64if [ $TARGET = "up" ]; then
65 pactl set-sink-volume $INDEX +5%
66fi
67
68# volume down
69if [ $TARGET = "down" ]; then
70 pactl set-sink-volume $INDEX -5%
71fi
72
73# volume toggle
74if [ $TARGET = "toggle" ]; then
75 pactl set-sink-mute $INDEX toggle
76fi
シェルスクリプトの使い方
簡単なので、説明は不要だと思いますが、いちおう…
var/tmp/i3audio.txt
にindexを記録するようにしているだけです。
i3audio.sh index
と実行すると、indexとdeviceを表示するので、数字を入力すればよい。という感じです。
どうやら@DEFAULT_SINK@
なるものがあるようなのですが、うまいこと機能しなかったので作りました。
1(cmd) ~ $ cat /var/tmp/i3audio.txt
23
1(ins) ~ $ i3audio.sh index
2index: 0
3 state: SUSPENDED
4 volume: front-left: 3242 / 5% / -78.34 dB, front-right: 3242 / 5% / -78.34 dB
5 base volume: 65536 / 100% / 0.00 dB
6 device.description = "Built-in Audio Analog Stereo"
7* index: 3
8 state: RUNNING
9 volume: front-left: 13062 / 20% / -42.03 dB, front-right: 13062 / 20% / -42.03 dB
10 base volume: 65536 / 100% / 0.00 dB
11 device.description = "Soundcore Liberty Air"
12index: 4
13 state: SUSPENDED
14 volume: front-left: 19656 / 30% / -31.38 dB, front-right: 19656 / 30% / -31.38 dB
15 base volume: 65536 / 100% / 0.00 dB
16 device.description = "Pixel USB-C earbuds Analog Stereo"
17Input index number (number or c=cancel): 4
18Done.
1(cmd) ~ $ cat /var/tmp/i3audio.txt
24
参考リンク
- Yet another post about volume keybind issues
- How to change the systems volume?
- How can I switch between different audio output hardware using the shell?
- How to use command line to change volume?
@DEFAULT_SINK@の例
1(cmd) ~ $ cat /var/tmp/i3audio.txt
24
3bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10%
4bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10%
5bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
Bluetoothの設定(bluetoothctl)
最初はblueman
を使っていましたが、現在はbluetoothctl
を使っています。
1(ins) ~ $ bluetoothctl
2[NEW] Controller 98:3B:8F:B3:61:08 debian [default]
3[NEW] Device 08:EB:ED:9C:C4:FF Soundcore Liberty Air
4
5(ins) [Soundcore Liberty Air]# disconnect
6Attempting to disconnect from 08:EB:ED:9C:C4:FF
7[CHG] Device 08:EB:ED:9C:C4:FF ServicesResolved: no
8Successful disconnected
9[CHG] Device 08:EB:ED:9C:C4:FF Connected: no
10
11(ins) [bluetooth]# connect 08:EB:ED:9C:C4:FF
12Attempting to connect to 08:EB:ED:9C:C4:FF
13[CHG] Device 08:EB:ED:9C:C4:FF Connected: yes
14Connection successful
15[CHG] Device 08:EB:ED:9C:C4:FF ServicesResolved: yes
16
17(ins) [Soundcore Liberty Air]#
1(ins) [bluetooth]# help
2Available commands:
3 list List available controllers
4 show [ctrl] Controller information
5 select <ctrl> Select default controller
6 devices List available devices
7 paired-devices List paired devices
8 power <on/off> Set controller power
9 pairable <on/off> Set controller pairable mode
10 discoverable <on/off> Set controller discoverable mode
11 agent <on/off/capability> Enable/disable agent with given capability
12 default-agent Set agent as the default one
13 advertise <on/off/type> Enable/disable advertising with given type
14 set-advertise-uuids [uuid1 uuid2 ...] Set advertise uuids
15 set-advertise-service [uuid][data=[xx xx ...] Set advertise service data
16 set-advertise-manufacturer [id][data=[xx xx ...] Set advertise manufacturer data
17 set-advertise-tx-power <on/off> Enable/disable TX power to be advertised
18 set-scan-filter-uuids [uuid1 uuid2 ...] Set scan filter uuids
19 set-scan-filter-rssi [rssi] Set scan filter rssi, and clears pathloss
20 set-scan-filter-pathloss [pathloss] Set scan filter pathloss, and clears rssi
21 set-scan-filter-transport [transport] Set scan filter transport
22 set-scan-filter-clear Clears discovery filter.
23 scan <on/off> Scan for devices
24 info [dev] Device information
25 pair [dev] Pair with device
26 trust [dev] Trust device
27 untrust [dev] Untrust device
28 block [dev] Block device
29 unblock [dev] Unblock device
30 remove <dev> Remove device
31 connect <dev> Connect device
32 disconnect [dev] Disconnect device
33 list-attributes [dev] List attributes
34 set-alias <alias> Set device alias
35 select-attribute <attribute> Select attribute
36 attribute-info [attribute] Select attribute
37 read Read attribute value
38 write <data=[xx xx ...]> Write attribute value
39 notify <on/off> Notify attribute value
40 register-profile <UUID ...> Register profile to connect
41 unregister-profile Unregister profile
42 version Display version
43 quit Quit program
ネットワークの設定(nmcli)
最初はnm-applet
を使っていましたが、現在はnmcli
を使っています。
1(cmd) ~ $ nmcli device wifi list
2* SSID MODE CHAN RATE SIGNAL BARS SECURITY
3 z5j5zb82ds-network Infra 6 54 Mbit/s 82 ▂▄▆█ WPA2
4* z5j5zb82ds-network-5GHz Infra 100 54 Mbit/s 60 ▂▄▆_ WPA2
5 AirPort23728 Infra 5 54 Mbit/s 59 ▂▄▆_ WPA1 WPA2
6 Game23728 Infra 5 54 Mbit/s 59 ▂▄▆_ WEP
7 wx03-0d7465 Infra 6 54 Mbit/s 54 ▂▄__ WPA1 WPA2
8 FS030W_P25856 Infra 11 54 Mbit/s 52 ▂▄__ WPA2
9 pwr-q9526fa-1 Infra 6 54 Mbit/s 45 ▂▄__ WPA2
10 0024A5D76337-1 Infra 6 54 Mbit/s 42 ▂▄__ WPA1
11 -- Infra 6 54 Mbit/s 42 ▂▄__ WEP
12 2400BACA560A-2G Infra 8 54 Mbit/s 42 ▂▄__ WPA1 WPA2
13 Buffalo-G-AD78 Infra 6 54 Mbit/s 37 ▂▄__ WPA1 WPA2
14 2400BACA560A-5G Infra 116 54 Mbit/s 35 ▂▄__ WPA1 WPA2
15 HUMAX-7FF3C-A Infra 136 54 Mbit/s 35 ▂▄__ WPA1 WPA2
16 HUMAX-34C66 Infra 1 54 Mbit/s 34 ▂▄__ WPA1 WPA2
17 pr500m-aa1e02-2 Infra 11 54 Mbit/s 34 ▂▄__ WPA2
18 pr500m-aa1e02-1 Infra 11 54 Mbit/s 30 ▂___ WPA2
19 HUMAX-7FF3C Infra 1 54 Mbit/s 29 ▂___ WPA1 WPA2
20 aterm-9de1e8-g Infra 1 54 Mbit/s 29 ▂___ WPA1 WPA2
21 Buffalo-G-DB48 Infra 11 54 Mbit/s 29 ▂___ WPA1 WPA2
22 Extender-G-7258 Infra 11 54 Mbit/s 29 ▂___ WPA2
1(ins) ~ $ nmcli device wifi connect
2-- 2400BACA560A-5G Buffalo-G-AD78 FS030W_P25856 HUMAX-7FF3C pr500m-aa1e02-2 z5j5zb82ds-network
30024A5D76337-1 AirPort23728 Buffalo-G-DB48 Game23728 HUMAX-7FF3C-A pwr-q9526fa-1 z5j5zb82ds-network-5GHz
42400BACA560A-2G aterm-9de1e8-g Extender-G-7258 HUMAX-34C66 pr500m-aa1e02-1 wx03-0d7465
5
6(ins) ~ $ nmcli device wifi connect z5 <-タブで補完される
7z5j5zb82ds-network z5j5zb82ds-network-5GHz
8
9(ins) ~ $ nmcli device wifi connect z5j5zb82ds-network password HOGE
10Device 'wlp61s0' successfully activated with '8e11011c-11a1-4446-be23-13a6a19acb6b'.
1(ins) ~ $ nmcli help
2Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
3
4OPTIONS
5 -t[erse] terse output
6 -p[retty] pretty output
7 -m[ode] tabular|multiline output mode
8 -c[olors] auto|yes|no whether to use colors in output
9 -f[ields] <field1,field2,...>|all|common specify fields to output
10 -e[scape] yes|no escape columns separators in values
11 -a[sk] ask for missing parameters
12 -s[how-secrets] allow displaying passwords
13 -w[ait] <seconds> set timeout waiting for finishing operations
14 -v[ersion] show program version
15 -h[elp] print this help
16
17OBJECT
18 g[eneral] NetworkManager's general status and operations
19 n[etworking] overall networking control
20 r[adio] NetworkManager radio switches
21 c[onnection] NetworkManager's connections
22 d[evice] devices managed by NetworkManager
23 a[gent] NetworkManager secret agent or polkit agent
24 m[onitor] monitor NetworkManager changes
i3lock(~/bin/i3lock.sh)
1~/bin/i3lock.sh
2
3#!/bin/sh
4i3lock -e -i ~/.config/i3/images/background.png
-e
オプションはお好みで。
1 -e, --ignore-empty-password
2 When an empty password is provided by the user, do not validate it. Without this option, the empty password will be provided to PAM and, if invalid, the user will have to wait a few seconds before another
3 try. This can be useful if the XF86ScreenSaver key is used to put a laptop to sleep and bounce on resume or if you happen to wake up your computer with the enter key.
キーマップの設定(~/bin/i3setxkb.sh)
最初は、これでやってたが.Xmodmap
を使っているため、使わなくなった。
1~/bin/i3setxkb.sh
2
3#!/bin/sh
4setxkbmap -option "caps:ctrl_modifier,ctrl:swap_lalt_lctl_lwin,terminate:ctrl_alt_bksp,altwin:swap_alt_win"
ディスプレイの設定(~/.screenlayout/2048x1152.sh)
arandr
というコマンドがおすすめです。
GUIアプリで、マルチディスプレイの設定も比較的うまいことできます。
設定を保存すると、以下のようなシェルスクリプトが生成されます。
i3のconfigで、起動時に以下のシェルスクリプトを実行しています。
1~/.screenlayout/2048x1152.sh
2
3#!/bin/sh
4xrandr --output VIRTUAL1 --off --output eDP1 --mode 2048x1152 --pos 0x0 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output DP2 --off
スクリーンショット、画面録画(kazam)
simplescreenrecorder
が良いって記事を見るけど、個人的にはkazam
の方が良いので、使っている。
1sudo aptitude show kazam
aptのhistoryの場所
1/var/log/apt/history.log
2/var/log/apt/history.log.1.gz
3/var/log/dpkg.log
4/var/log/dpkg.log.1
インストールしたパッケージや使っているコマンドなど
- go
- fzf
- vim
- font(いろいろ)
- vmware player
- nodebrew
- yarn
- ternjs
- JetBrains Toolbox
- Sublime Text
- VSCode
- xsel
- sheetskv(自分で作ったCLIツール)
- oathtool
- aptitude
- Google Chrome
- Firefox
- KeePassXC
- skicka
- aws CLI
- gcp CLI
- i3status
- i3lock
- curl
- httpie
- lightdm
- blueman(bluetoothctlコマンドを使っているので、使っていない)
- nm-applet(nmcliコマンドを使っているので、使っていない)
- pasystray(i3audio.shを使っているので、使っていない)
- docker
- zeal
- dconf-editor
- firmware-iwlwifi
- feh
- tig
- trash-cli
- tmux
- parcellite
- VirtulBox
- gparted
- cmake
- ffmpeg
- mps-youtube(cmusに移行したので、使っていない)
- youtube-dl
- weechat
- simplescreenrecorder(kazamの方がよい)
- tree
- mplayer
- strongswan
- xl2tpd
- xautolock
- exuberant-ctags
- kazam
- vokoscreen
- obs-studio
- gtk-recordmydesktop
- recordmydesktop
- mutt
- lightdm-gtk-greeter-settings
- jq
- cmus
- xdotool
- bluez-tools
- screenfetch
- rxvt-unicode-256color
- xinput
- libinput-tools
- debian-keyring
あとがき
Debianもi3wmも、まだまだビギナーなので、これからも使っていきたい。