dotfiles/dot_config/i3/config.tmpl

450 lines
15 KiB
Cheetah
Raw Normal View History

2024-01-14 19:54:58 +09:00
#####################################################
# i3 config
# -> https://i3wm.org/docs/userguide.html
#####################################################
# Font (TODO: Unnecessary?)
font pango:Source Han Code JP M 7
# Special Keys
set $m Mod4
set $a Mod1
set $c Control
set $s Shift
# kill focused window
bindsym $m+$s+q kill
# Floating
floating_modifier $m
focus_follows_mouse no
# workspace layout (default|stacking|tabbed)
default_border pixel 1
# class border backgr. text
client.focused #ffd75f #ffd75f #121212
client.focused_inactive #222222 #222222 #888888
client.unfocused #222222 #222222 #888888
client.urgent #2f343a #900000 #ffffff
client.placeholder #000000 #0c0c0c #ffffff
client.background #ffffff
# 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 $ws0 "0"
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"
set $ws_media "8"
set $ws_util "9"
set $ws_game "10"
2024-01-14 20:01:32 +09:00
{{- if eq .chezmoi.hostname "arch" }}
2024-01-14 19:54:58 +09:00
set $DELL "primary"
set $BenQ "HDMI-0"
workspace $ws0 output $BenQ
workspace $ws1 output $BenQ
workspace $ws2 output $DELL
workspace $ws3 output $DELL
workspace $ws4 output $DELL
workspace $ws5 output $DELL
workspace $ws6 output $DELL
workspace $ws7 output $DELL
workspace $ws8 output $BenQ
workspace $ws9 output $BenQ
workspace $ws10 output $DELL
{{- end }}
2024-01-14 19:54:58 +09:00
# switch to workspace
bindsym $m+Escape workspace $ws0
bindsym $m+a workspace $ws1
bindsym $m+s workspace $ws2
bindsym $m+d workspace $ws3
bindsym $m+f workspace $ws4
bindsym $m+g workspace $ws5
bindsym $m+z workspace $ws6
bindsym $m+x workspace $ws7
bindsym $m+c workspace $ws8
bindsym $m+v workspace $ws9
bindsym $m+b workspace $ws10
# move focused container to workspace
bindsym $m+$s+Escape move container to workspace $ws0
bindsym $m+$s+a move container to workspace $ws1
bindsym $m+$s+s move container to workspace $ws2
bindsym $m+$s+d move container to workspace $ws3
bindsym $m+$s+f move container to workspace $ws4
bindsym $m+$s+g move container to workspace $ws5
bindsym $m+$s+z move container to workspace $ws6
bindsym $m+$s+x move container to workspace $ws7
bindsym $m+$s+c move container to workspace $ws8
bindsym $m+$s+v move container to workspace $ws9
bindsym $m+$s+b move container to workspace $ws10
# change focus
bindsym $m+h focus left
bindsym $m+j focus down
bindsym $m+k focus up
bindsym $m+l focus right
# alternatively, you can use the cursor keys:
bindsym $m+Left focus left
bindsym $m+Down focus down
bindsym $m+Up focus up
bindsym $m+Right focus right
# move focused window
bindsym $m+$s+h move left 20 px
bindsym $m+$s+Left move left 20 px
bindsym $m+$s+j move down 20 px
bindsym $m+$s+Down move down 20 px
bindsym $m+$s+k move up 20 px
bindsym $m+$s+Up move up 20 px
bindsym $m+$s+l move right 20 px
bindsym $m+$s+Right move right 20 px
bindsym $m+$s+Tab move scratchpad
bindsym $m+Tab scratchpad show
# Change split orientation - horizontal/vertical
bindsym $m+backslash split h
bindsym $m+minus split v
# enter fullscreen mode for the focused container
bindsym $m+o fullscreen toggle
# Change layout (stacked, tabbed, toggle split)
bindsym $m+y layout stacking
bindsym $m+u layout tabbed
bindsym $m+i layout toggle split
# toggle tiling / floating
bindsym $m+$s+p floating toggle
# change focus between tiling / floating windows
bindsym $m+p focus mode_toggle
# reload the configuration file
bindsym $m+$s+$c+$a+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $m+$s+$c+$a+r restart
# exit i3 (logs you out of your X session)
bindsym $m+$s+$c+$a+q 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)
bindsym --release $m+r mode "resize"
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 2 px
bindsym j resize shrink height 2 px
bindsym k resize grow height 2 px
bindsym l resize grow width 2 px
bindsym $s+h resize shrink width 10 px
bindsym $s+j resize shrink height 10 px
bindsym $s+k resize grow height 10 px
bindsym $s+l resize grow width 10 px
# back to normal: Enter or Escape or $m+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $c+bracketleft mode "default"
bindsym $c+c mode "default"
bindsym $c+g mode "default"
bindsym $m+r mode "default"
}
bindsym XF86Launch7 resize shrink width 10 px
bindsym XF86Launch8 resize grow width 10 px
bindsym XF86TouchpadToggle resize shrink height 10 px
bindsym XF86TouchpadOn resize grow height 10 px
bindsym $m+bracketleft move left; resize set width 20 ppt
bindsym $m+bracketright move right; resize set width 80 ppt
#############################################
# Launch terminal
#############################################
## Alacritty
bindsym $m+comma exec --no-startup-id launch-console; workspace $ws2
bindsym $m+$s+comma exec --no-startup-id launch-console tmp
2024-03-06 16:52:25 +09:00
bindsym $m+$s+period exec --no-startup-id launch-console emacs; workspace $ws3
2024-01-14 19:54:58 +09:00
##############################################
# Control Audio - mpd(mpc) & pulseaudio
##############################################
# Volume control
# bindsym $a+grave exec --no-startup-id pamixer -t # toggle mute/unmute
# bindsym $a+Up exec --no-startup-id pamixer -i 1 # increase volume 1%
# bindsym $a+k exec --no-startup-id pamixer -i 1 # increase volume 1%
# bindsym $a+Down exec --no-startup-id pamixer -d 1 # decrease volume 1%
# bindsym $a+j exec --no-startup-id pamixer -d 1 # decrease volume 1%
bindsym $m+apostrophe exec --no-startup-id launch-pavucontrol
bindsym $m+$s+quotedbl exec --no-startup-id qpwgraph
# bindsym $m+$a+n exec --no-startup-id start-music-console
bindsym $m+$a+j exec --no-startup-id mpc --host 10.0.2.1 volume -2
bindsym $m+$a+k exec --no-startup-id mpc --host 10.0.2.1 volume +2
bindsym $m+$a+l exec --no-startup-id mpc --host 10.0.2.1 seek +00:00:05
bindsym $m+$a+h exec --no-startup-id mpc --host 10.0.2.1 seek -00:00:05
bindsym $m+$a+m exec --no-startup-id mpc --host 10.0.2.1 volume 0
bindsym $m+$a+Return exec --no-startup-id mpc --host 10.0.2.1 toggle
bindsym $m+$a+comma exec --no-startup-id mpc --host 10.0.2.1 prev
bindsym $m+$a+period exec --no-startup-id mpc --host 10.0.2.1 next
bindsym $m+$a+slash exec --no-startup-id nowplaying
#####################################
# Application Launchers
#####################################
# Browser
bindsym $m+m exec --no-startup-id open-brave; workspace $ws1
bindsym $m+$s+m exec --no-startup-id open-librewolf-private; workspace $ws1
bindsym $m+n exec --no-startup-id open-firefox-dev
2024-01-14 19:54:58 +09:00
# Calendar/Tasks/Mail
bindsym $m+period exec --no-startup-id open-emacs; workspace $ws3
bindsym $m+slash exec --no-startup-id open-emacs-org-capture; workspace $ws3
2024-01-14 19:54:58 +09:00
# File manager
bindsym $m+grave exec --no-startup-id pcmanfm
# Dictionary
bindsym $m+$s+slash exec --no-startup-id goldendictxdg.sh
# Rofi
# bindsym $m+space exec "rofi -show run -modi 'run,calc' -calc-command 'echo {result} | xsel -ib'"
bindsym $m+Return exec --no-startup-id rofi -show combi
# bindsym $m+Tab exec --no-startup-id "rofi -matching fuzzy -show window"
# bindsym $c+semicolon exec --no-startup-id clipcat-menu --finder custom
# bindsym $m+semicolon exec --no-startup-id rofi-copyq
bindsym $m+semicolon exec --no-startup-id "copyq show"
bindsym $m+$s+semicolon exec --no-startup-id "rofimoji"
# Color pikcer
bindsym $m+$c+$s+a exec --no-startup-id gpick
#screen shot
bindsym $m+$c+$s+s exec --no-startup-id flameshot screen --path "$XDG_PICTURES_DIR/screenshots/" --clipboard
bindsym $m+$c+$s+d exec --no-startup-id flameshot gui
bindsym $c+$s+F11 exec --no-startup-id flameshot gui
bindsym $m+$c+$s+t exec --no-startup-id screencast.sh toggle
bindsym --release $m+BackSpace exec --no-startup-id "$XDG_CONFIG_HOME/polybar/toggle.sh"
# bindsym --release $m+$c+$s+Delete exec --no-startup-id systemctl suspend
bindsym --release $m+$c+$s+$a+Escape exec --no-startup-id systemctl suspend
bindsym --release $m+$s+$c+$a+z exec --no-startup-id slock
# ^^^^^^^^^ Won't work without this.
# See: https://www.reddit.com/r/i3wm/comments/cae4o8/debian_10_slock_keybind_wont_lock_screen/
## Notification: dunst
bindsym $m+$c+w exec dunstctl close-all
bindsym $m+$c+h exec dunstctl history-pop
## mozc
bindsym $m+$c+t exec /usr/lib/mozc/mozc_tool --mode=dictionary_tool
bindsym $m+$c+r exec /usr/lib/mozc/mozc_tool --mode=word_register_dialog
## Force window floating
# See: https://i3wm.org/docs/userguide.html#list_of_commands
## 16:9 ratio
# 160 : 90
# 320 : 180
# 480 : 270
# 640 : 360
# 800 : 450
# 960 : 540
# 1120 : 630
# 1280 : 720
# 1440 : 810
for_window [class="my-gtk-app"] floating enable, move position center
for_window [class="discord|Signal|thunderbird"] title_window_icon padding 4px
for_window [class="Brave-browser|LibreWolf|firefoxdeveloperedition"] title_window_icon padding 4px
for_window [class="^.*"] title_format "%class | %title" # : %title"
for_window [class="^.*"] border pixel 1
for_window [class="Yad"] floating enable, resize set 640 900, move position center
for_window [class=".*mpv"] floating enable, resize set 1440 810
for_window [class="(p|P)cmanfm"] floating enable, resize set 800 560, move position center
for_window [class="feh"] floating enable #, resize set 800 600
for_window [class="Sxiv"] floating enable #, resize set 800 600
for_window [class="Pavucontrol"] floating enable, resize set 720 560
for_window [class="QjackCtl"] floating enable, resize set 420 100, move position right
for_window [class="QjackCtl" title="Graph.*"] floating enable, resize set 1280 1280, move position center
for_window [class="qpwgraph"] floating enable, resize set 1440 960, move position center
for_window [class="Nvidia-settings"] floating enable, resize set 720 560
for_window [class="Bitwarden"] floating enable, resize set 900 560, move position center
for_window [class="Blueman-manager"] floating enable, resize set 900 560, move position center
for_window [class="Anki" title="(Add|Edit).*"] floating enable, resize set 800 600, move position center
for_window [class="Gpick"] floating enable #, resize set 800 600
for_window [class="flameshot"] floating enable
for_window [window_role="GtkFileChooserDialog"] floating enable, resize set 800 600
for_window [window_role="ECompEditorEvent-.*"] floating enable, resize set 800 600
for_window [class="copyq"] floating enable, move position center
for_window [title="FreeTube Mini-Player:.*"] floating enable, resize set 800 450
for_window [title="FreeTube"] layout tabbed
for_window [class="vlc"] layout tabbed
for_window [class="discord"] layout tabbed
for_window [class="Brave-browser" instance="www.evernote.com__client_web"] layout tabbed
for_window [class="Homebank"] floating enable, resize set 1200 900, move position center
for_window [class="Homebank" title="Budget*"] floating enable, resize set 840 750, move position center
for_window [title="Edit metadata.*" class="calibre.*"] floating enable, resize set 1000 800
for_window [title="Alacritty@tmux:tmp"] floating enable, resize set 800 800, move position center
for_window [title="Alacritty@tmux:emacs"] move position left, resize set width 20 ppt
for_window [class="org.remmina.Remmina"] floating enable, resize set 1000 750, move position center
## assign application to specific workspace
### Tips: Run `xprop` (command line tool) to retrieve class, instance and title.
# Terminal
assign [title="Alacritty@tmux:default"] $ws2
assign [title="Alacritty@tmux:emacs"] $ws3
assign [class="Emacs"] $ws3
# VirtualBox setting
assign [class="VirtualBox Machine"] $ws4
assign [class="VirtualBox Manager"] $ws4
assign [class="Virt-manager"] $ws4
# Accounting Software
assign [class="Homebank"] $ws5
# Photo Editing
assign [class="Rawtherapee"] $ws7
# Music Applications
assign [class="(g|G)podder"] $ws_media
assign [class=".*Celluloid"] $ws_media
assign [class="Blanket"] $ws_media
assign [class="spot"] $ws_media
assign [class="Spotify"] $ws_media
assign [class="vlc"] $ws_media
assign [title="FreeTube Mini-Player:.*"] $ws_media
assign [title="FreeTube"] $ws_media
# Chat & Todo Applications
assign [class="discord"] $ws_util
assign [class="(s|S)lack"] $ws_util
for_window [class="Signal" instance="signal"] move to workspace $ws_util, layout tabbed
# Games
assign [class="steam|steamwebhelper"] $ws0
assign [class="retroarch"] $ws_game
assign [class="steam_app_.*" instance="steam_app_.*"] $ws_game
for_window [class="steam_app_.*" instance="steam_app_.*"] move to workspace $ws_game
assign [class="Hexcells Infinite.x86_64" instance="Hexcells Infinite.x86_64" title="Hexcells Infinite"] $ws_game
assign [class="steam_app_1172470" instance="steam_app_1172470" title="Apex Legends"] $ws_game
2024-01-14 19:54:58 +09:00
## KEY_INSERT_GAME_ASSIGN # Don't change left string. See ~/.config/fish/function/i3-assign-games.fish
#######################################################
# Auto Exec
#######################################################
# Power saving (xidlehook)
exec --no-startup-id powersave-on
# xss-lock (hook systend-suspend)
exec --no-startup-id xss-lock -- slock
# Auto-hide mouse cursor
exec --no-startup-id unclutter --timeout 1 --ignore-scrolling &
# Key repeat rate
# exec_always --no-startup-id xset r rate 200 60
# compositor
exec_always --no-startup-id picom -b > /dev/null 2>&1
# Notification
exec --no-startup-id dunst
# Watch plug
exec --no-startup-id udiskie &
# Japanese Input
exec --no-startup-id fcitx5 -d
# Clipboard Manager
# exec_always --no-startup-id clipcatd -r
exec_always --no-startup-id copyq
# Wallpaper
exec --no-startup-id nitrogen --restore
exec_always --no-startup-id $HOME/.config/conky/start.sh
# # Launch terminal
# exec --no-startup-id launch-console
exec --no-startup-id emacs --daemon
# Note
# exec --no-startup-id note.sh
# exec --no-startup-id setsid sync-vimwiki.sh > /dev/null &
# Util
exec --no-startup-id goldendictxdg.sh
exec --no-startup-id flameshot > /dev/null 2>&1
# Audio
exec --no-startup-id start-mpd
exec --no-startup-id shairport-sync -o=pa
# redshift (like f.lux)
exec --no-startup-id redshift
# Polybar
exec --no-startup-id "$XDG_CONFIG_HOME/polybar/toggle.sh"
# Transmission
exec --no-startup-id "transmission-daemon"
{{ if eq .chezmoi.hostname "buzz" }}
exec --no-startup-id "kmonad $XDG_CONFIG_HOME/kmonad/thinkpad.kbd"
{{ end }}
2024-01-14 19:54:58 +09:00
#######################################################
# i3-gaps
#######################################################
gaps inner 0
smart_gaps on
smart_borders on