I3WM設定ファイル

i3 WM の設定ファイル

i3 WM を使い始めて、mateを辞めたのが2017.03だから9ヶ月ほど。 師走なんで、現状確認してみた。なお Debian stretch では一つ古い version になる。
i3 version 4.13 (2016-11-08) © 2009 Michael Stapelberg and contributors
最新安定版(201812)は 4.14 で、更新を推奨してるみたいだが、base になる部分だから、 素人は debian package のまましばらく使う。

~/.config/i3/config

現状[2017-12-02]の config 。 コメントは排除。 使ってない設定とかもあって、考えてしまう。
set $mod Mod4

# work space 移動の機能拡張のため
# [https://github.com/benkaiser/i3-wm-config] にある スクリプトを使わせてもらっている。
set $controlw ~/.config/i3/workspace_controller.py

# Set workspace icons    # 設定していない。番号だけでよい

# Hybrid colors 古いT510の発色が微妙で、イメージと違う。
set $black  #002B36
set $white  #839496
set $gray   #CCCCCC
set $darkgray   #666666
set $green  #799F26
set $blue   #4D73AA
set $purple #8473A7
set $red    #B58900
set $orange #E59847
set $cyan   #2AA198
set $dark   #00252E

font pango:DejaVu Sans Mono for Powerline, IPAGothic 12px

floating_modifier $mod

bindsym $mod+Return exec urxvtc
# urxvtc に変更。(server形式にした。以下がネタ元)
# [urxvt こと rxvt-unicode を使うことのメモ | Jenemal Notes]
# (http://malkalech.com/urxvt_terminal_emulator)

bindsym $mod+Shift+q kill

#  dmenu を rofi で置き換えるからコメントアウト
# bindsym $mod+d exec dmenu_run
# bindsym $mod+d 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 condition
bindsym $mod+h split h
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 `d` -> `c`
bindsym $mod+c focus child

# switch to workspace  `10` -> `0`
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 0

# move focused container to workspace   `10` -> `0`
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 0

# WS の 変更 移動 を 拡張
#  $controlw を使う

bindsym $mod+Control+Left exec $controlw prev go
bindsym $mod+Control+Right exec $controlw next go
bindsym $mod+Control+Up exec $controlw up go
bindsym $mod+Control+Down exec $controlw down go
#
bindsym $mod+Shift+Control+Left exec $controlw prev move
bindsym $mod+Shift+Control+Right exec $controlw next move
bindsym $mod+Shift+Control+Up exec $controlw up move
bindsym $mod+Shift+Control+Down exec $controlw down move

# move to last workspace
bindsym $mod+z workspace back_and_forth

# 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 (サイズ変更を少し細かめに設定)
mode "resize" {
        bindsym j resize shrink width 6 px or 6 ppt
        bindsym k resize grow height 6 px or 6 ppt
        bindsym l resize shrink height 6 px or 6 ppt
        bindsym semicolon resize grow width 6 px or 6 ppt

        bindsym Left resize shrink width 6 px or 6 ppt
        bindsym Down resize grow height 6 px or 6 ppt
        bindsym Up resize shrink height 6 px or 6 ppt
        bindsym Right resize grow width 6 px or 6 ppt

        bindsym Return mode "default"
        bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

# move floating windows(floating window の移動)
mode "moveit" {
    bindsym Up move up 20px
    bindsym Left move left 20px
    bindsym Down move down 20px
    bindsym Right move right 20px
    bindsym Mod4+m mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+m focus floating; mode "moveit"

# レイアウトの復元   WS1に3つのターミナル
bindsym $mod+g exec ~/.config/i3/load_layout.sh
# レイアウトの復元   WS11に小さめfontで2つのターミナル
bindsym $mod+t exec ~/.config/i3/load_layout_11.sh

# Mouse
focus_follows_mouse yes

# Start i3bar
bar {
       status_command i3blocks -c ~/.config/i3/i3blocks.conf
       font xft:FontAwesome 14px
     }

# Audio volume   mpd(local) を mpc でコントロール。
bindsym XF86AudioRaiseVolume exec mpc volume +5
bindsym XF86AudioLowerVolume exec mpc volume -5

bindsym XF86AudioNext exec mpc next
bindsym XF86AudioPrev exec mpc prev
bindsym XF86AudioPlay exec mpc play
bindsym XF86AudioStop exec mpc pause

# 画面の輝度調整
bindsym XF86MonBrightnessUp exec xbacklight -inc 10
bindsym XF86MonBrightnessDown exec xbacklight -dec 10

# screen capture
bindsym Print exec scrot '%Y-%m-%d_%T_scrot.png' -e 'mv $f ~/Pictures/capture/'

# rofi bindings(dmenuの代替え)
bindsym $mod+d exec rofi -show run
bindsym F12 exec rofi -show window

# qlipper から copyq に変更。 keybind は rofi の裏
bindsym Shift+F12 exec copyq toggle

# ikhal(カレンダーのポップアップ floting に設定したmltermを使う)
bindsym $mod+i exec mlikhal

# startup

# compton (20180124)
exec --no-startup-id compton --config ~/.config/compton.conf -b

# 背景をランダムに
exec --no-startup-id feh --randomize --bg-scale /home/hoge/Pictures/wall_papers/*

# screen lock
exec --no-startup-id xset s 1200
exec --no-startup-id xset dpms 0 0 1200
exec --no-startup-id xautolock -time 18 -locker 'i3lock -i /home/hoge/.config/i3/triangle_shape.png'

exec --no-startup-id touchpad off
exec --no-startup-id fcitx-autostart
exec --no-startup-id urxvtd -q -f

exec --no-startup-id devmon
exec --no-startup-id owncloud
exec --no-startup-id nm-applet
exec --no-startup-id copyq

# おとなしい配色
# class                     border  backgr. text    indicator
client.focused              $white  $white  $dark    $dark
client.unfocused            $dark   $dark   $white   $white
client.focused_inactive $dark   $dark   $white   $dark
client.urgent               $orange $orange $dark    $white

# WSを固定するアプリ

assign [class="Thunderbird"] → 9
assign [class="Emacs"] → 2
assign [class="Firefox"] → 8
assign [class="Google-chrome"] → 6
assign [class="josm"] → 7
assign [class="KeePass2"] → 0

# floating - 位置固定 で
for_window [class="(?i)gnome-calculator"] floating enable move position +1240 +500
for_window [class="mlterm"] floating enable move position +700 +50, resize set 800 410
for_window [class="(?i)geeqie"] floating enable move absolute position 640 px 200 px, resize set 900 580

# floating - おまかせ
for_window [class="(?i)Shutter"] floating enable, resize set 840 480
for_window [class="(?i)Fcitx-config"] floating enable
for_window [class="Zathura"] floating enable
for_window [class="MuPDF"] floating enable
for_window [class="PdfMod"] fullscreen
for_window [class="qutebrowser"] floating enable, resize set 840 580
for_window [class="Luakit"] floating enable, resize set 840 580
for_window [class="FBReader"] floating enable
for_window [class="copyq"] floating enable, resize set 840 410
for_window [class="mpv"] floating enable, resize set 840 410
for_window [class="XDvi"] floating enable

for_window [title="(?i)tomaatti" class="(?i)tk"] floating enable move position center urgent

# firefox だけ tabbed mode
for_window [class="Firefox"] layout tabbed

# 以下、有効なのか不明
for_window [window_role="pop-up"] floating enable
for_window [window_role="dialog"] floating enable
for_window [window_role="menu"] floating enable
for_window [window_role="Preferences"] floating enable

popup_during_fullscreen smart

i3blocks.conf

# i3blocks config file
#
# Global properties
align=center
color=#839496
command=/usr/share/i3blocks/$BLOCK_NAME
#  debian では ここ
markup=none

[MPD]
label=
command=/home/hoge/.config/i3/i3blocks-mpd
# デフォにないコマンドだから
color=#88aa00
interval=15

[volume]
label=
instance=Master
interval=once
signal=10
separator=true
color=#a43300

[memory]
label=
instance=mem;free
interval=30

[disk]
label=
interval=30

[iface]
color=#22BBBB
interval=10

[wifi]
interval=10
separator=false

[bandwidth]
interval=5

[cpu_usage]
label=
interval=10
min_width=CPU:00.0%

[battery2]
interval=30

[pomodoro]
interval=5
command=tomaatti
color=#88aa00

[time]
command=date '+%y/%m/%d(%a)%R'
interval=30
color=#FFFF99

[temperature]
instance=Core
interval=30

load_layout_11.sh

#!/bin/bash
i3-msg 'workspace 11; append_layout /home/hoge/.config/i3/workspace-11.json'
(urxvtc -name leftwin11 -fn xft:"DejaVu Sans Mono for Powerline:pixelsize=13",xft:"Cica-Regular:pixelsize=13" &)
(urxvtc -name rightwin11 -fn xft:"DejaVu Sans Mono for Powerline:pixelsize=11",xft:"Cica-Regular:pixelsize=11" &)

workspace-11.json

{
  "border": "normal",
  "current_border_width": 2,
  "floating": "auto_off",
  "layout": "splith",
  "name": "hoge@hoge:WS11_L",
  "percent": 0.68,
  "type": "con",
  "nodes": [
      {"border": "normal",
       "current_border_width": 2,
       "floating": "auto_off",
       "percent": 1,
       "name": "hoge@hoge:",
       "swallows": [{"class": "^URxvt$",
                     "instance": "^leftwin11$"}],
       "type": "con"
       }]
}
{
  "border": "normal",
  "current_border_width": 2,
  "floating": "auto_off",
  "name": "hoge@hoge: /home/hoge",
  "percent": 0.32,
  "type": "con",
  "nodes": [
      {"border": "normal",
       "current_border_width": 2,
       "floating": "auto_off",
       "percent": 1,
       "name": "hoge@hoge:WS11_R",
       "swallows": [{"class": "^URxvt$",
                     "instance": "^rightwin11$"}],
       "type": "con"
       }]
}

i3blocks-mpd

#!/bin/bash

# https://github.com/zlsun/dotfiles/blob/master/files/bin/i3blocks-mpd

SHOWNAME_PATH=~/.config/i3/i3block-mpd-showname

exec-mpc() {
    mpc $* &> /dev/null
}

showname=$([ -f $SHOWNAME_PATH ] && cat $SHOWNAME_PATH || echo 0)

case $BLOCK_BUTTON in
  1) exec-mpc toggle ;;
  2) showname=$((!$showname)); echo $showname > $SHOWNAME_PATH ;;
  3) exec-mpc stop   ;;
  4) exec-mpc 'volume +5' ;;
  5) exec-mpc 'volume -5' ;;
  6) exec-mpc pre    ;;
  7) exec-mpc next   ;;
esac

playing=
 paused=
stopped=

if [ $showname = '1' ]; then
  mpc current | awk -F ' - ' '{printf "[%s / %s ]", $1, $2}'
fi

status=$(mpc status | sed -n 's/^\[\([^])]*\)\].*$/\1/p')
case $status in
  playing) echo -n $playing ;;
  paused)  echo -n $paused  ;;
  *)       echo -n $stopped ;;
esac

Emacs の lsp の設定、なう(202310)

前回さらしてから、さらに1年。そう、3年めになる。 が、今回は一段と自信がない。 環境は、 Debian GNU/Linux 12 (bookworm) + emacs(29.1)。consult + company。 embark は未だに使ってない。 用途は、メモ と ...