# i3 config file (v4)
# Windows key on most keyboards
set $mod Mod1
set $term alacritty

font pango:IPAGothic 10, DejaVu Sans Mono 9

set $ws10 10
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

# Meta key bindings
# Move window with mod+mouse drag
    floating_modifier $mod
# Kill focused window with mod+shift+q
    bindsym $mod+Shift+q kill
# Toggle fullscreen with mod+f
    bindsym $mod+f fullscreen
    bindsym $mod+Escape exec xkill
# change focus with mod+hjkl or mod+arrow
    bindsym $mod+h focus left
    bindsym $mod+j focus down
    bindsym $mod+k focus up
    bindsym $mod+l focus right
    bindsym $mod+Left focus left
    bindsym $mod+Down focus down
    bindsym $mod+Up focus up
    bindsym $mod+Right focus right
    bindsym $mod+g focus next
    bindsym $mod+Shift+g focus prev

    bindsym $mod+Mod1+h workspace prev_on_output
    bindsym $mod+Mod1+l workspace next_on_output
    bindsym $mod+Mod1+Left workspace prev_on_output
    bindsym $mod+Mod1+Right workspace next_on_output
# move focused window with mod+shift+hjkl
    bindsym $mod+Shift+h move left
    bindsym $mod+Shift+j move down
    bindsym $mod+Shift+k move up
    bindsym $mod+Shift+l move right
    bindsym $mod+Shift+Left move left
    bindsym $mod+Shift+Down move down
    bindsym $mod+Shift+Up move up
    bindsym $mod+Shift+Right move right
# switch to workspace with mod+1234567890
    bindsym $mod+1 workspace $ws1
    bindsym $mod+2 workspace $ws2
    bindsym $mod+3 workspace $ws3
    bindsym $mod+4 workspace $ws4
    bindsym $mod+5 workspace $ws5
    bindsym $mod+6 workspace $ws6
    bindsym $mod+7 workspace $ws7
    bindsym $mod+8 workspace $ws8
    bindsym $mod+9 workspace $ws9
    bindsym $mod+0 workspace $ws10

    bindsym $mod+Tab exec aworkspace switch
# move container to workspace with meta+shift+1234567890
    bindsym $mod+Shift+1 move container to workspace $ws1
    bindsym $mod+Shift+2 move container to workspace $ws2
    bindsym $mod+Shift+3 move container to workspace $ws3
    bindsym $mod+Shift+4 move container to workspace $ws4
    bindsym $mod+Shift+5 move container to workspace $ws5
    bindsym $mod+Shift+6 move container to workspace $ws6
    bindsym $mod+Shift+7 move container to workspace $ws7
    bindsym $mod+Shift+8 move container to workspace $ws8
    bindsym $mod+Shift+9 move container to workspace $ws9
    bindsym $mod+Shift+0 move container to workspace $ws10

    bindsym $mod+Control+Mod1+h move container to workspace prev_on_output
    bindsym $mod+Control+Mod1+l move container to workspace next_on_output
    bindsym $mod+Control+Mod1+Left move container to workspace prev_on_output
    bindsym $mod+Control+Mod1+Right move container to workspace next_on_output

    bindsym $mod+Shift+Tab exec aworkspace move
# vim-style window splits and resizing after hitting mod+w
    mode "window" {
        bindsym s split v; mode "default"
        bindsym v split h; mode "default"
        bindsym Shift+comma resize shrink width 10 ppt or 10 px
        bindsym Shift+period resize grow width 10 ppt or 10 px
        bindsym Shift+equal resize grow height 10 ppt or 10 px
        bindsym minus resize shrink height 10 ppt or 10 px
    # Leave window mode with return/escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
    }
    bindsym $mod+w mode "window"
# Change layouts with mod+,./
    bindsym $mod+comma layout stacking
    bindsym $mod+period layout tabbed
    bindsym $mod+slash layout toggle split
# Toggle floating with mod+shift+space
    bindsym $mod+Shift+space floating toggle
# Swap focus between tiling windows and floating windows
    bindsym $mod+space focus mode_toggle
# Move focus to parent container with mod+a
    bindsym $mod+a focus parent
# Move windows in and out of the scratchpad with mod+(shift)+t
    bindsym $mod+Shift+t move scratchpad
    bindsym $mod+t scratchpad show
# Cycle through border styles with mod+b
    bindsym $mod+b border toggle
# reload the configuration file
    bindsym $mod+Shift+c reload
# restart i3 inplace with mod+shift+r
    bindsym $mod+Shift+r restart
# exit i3 with mod+shift+e
    bindsym $mod+Shift+e exit
# Run terminal with mod+enter
    bindsym $mod+Return exec $term
    bindsym $mod+Shift+Return exec urxvt
# File manager with mod+e
    bindsym $mod+e exec nautilus
# Clipboard -> sr.ht with mod+shift+p
    bindsym $mod+Shift+p exec srht -p
# Screenshots
    bindsym Print exec swaygrab ~/Pictures/screenshots/$(date +"%Y-%m-%d_%H:%M:%S.png")
    bindsym $mod+Print exec sleep 0.1 && srht
    bindsym $mod+Shift+Print exec sleep 0.1 && srht -s
# dmenu with mod+d for arbituary programs
    bindsym $mod+d exec dmenu_path | dmenu -p "Run:" -l 10 | xargs swaymsg exec
# passwords
    bindsym $mod+p exec pass-dmenu
# mako
    bindsym $mod+n exec makoctl dismiss
    bindsym $mod+Shift+n exec makoctl dismiss -a
# volume controls (special keys on keyboard)
    bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -2%
    bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +2%
# music controls (special keys on keyboard)
    bindsym XF86AudioNext exec stewdio skip
    bindsym XF86AudioPlay exec stewdio play
    bindsym XF86AudioPrev exec stewdio dmenu-search
    bindsym $mod+XF86AudioPlay exec stewdio qfav
    bindsym $mod+XF86AudioNext exec stewdio dmenu-queue
# i3-lock on mod+pause
    bindsym XF86Sleep exec swaylock -i `wallpaper` --scaling fill
    bindsym $mod+XF86Sleep exec swaylock -c 00000000
    bindsym XF86ScreenSaver exec swaylock -i `wallpaper` --scaling fill
    bindsym $mod+Pause exec swaylock -i `wallpaper` --scaling fill

    bindsym $mod+i mode "j: japanese; k: korean; v: vietnamese; esc: english"

    mode "j: japanese; k: korean; v: vietnamese; esc: english" {
        bindsym j exec ibus engine anthy; mode "default"
        bindsym k exec ibus engine hangul; mode "default"
        bindsym v exec ibus engine Unikey; mode "default"
        bindsym Return exec ibus engine xkb:us::eng; mode "default"
        bindsym Escape exec ibus engine xkb:us::eng; mode "default"
    }

set $blue #285577
set $gray #333333
set $red #900000

bar {
        status_command custom_statusbar
        position top
        pango_markup disabled
        font pango:IPAGothic 11, DejaVu Sans Mono 10
        strip_workspace_numbers yes
        colors {
            background $gray
            inactive_workspace $gray $gray #888888
            active_workspace $gray $gray #ffffff
            urgent_workspace $red $red #ffffff
            focused_workspace $blue $blue #ffffff
            urgent_workspace $red $red #ffffff
        }
}

client.focused $blue $blue #ffffff $blue $blue
client.unfocused $gray $gray #ffffff $gray $gray
client.focused_inactive $gray $gray #ffffff $gray $gray

seat seat0 hide_cursor 1000

default_border pixel 4

for_window [title=".*"] title_format %title (class=%class instance=%instance shell=%shell)

focus_on_window_activation urgent

include /etc/sway/config.d/*
include ~/.config/sway/config.d/*
include ~/.config/sway/`hostname`
exec startup sway remote
