# Place a copy of this config to ~/.dwmac.toml
# After that, you can edit ~/.dwmac.toml to your liking

# General Settings {{{
# You can use it to add commands that run after Dwmac startup.
# 'after-startup-command' is run after 'after-login-command'
# Available commands : https://hillyu.github.io/Dwmac/commands
after-startup-command = [
    # 'exec-and-forget /opt/homebrew/opt/sketchybar/bin/sketchybar',
    ]

# Notify Sketchybar about workspace change
exec-on-workspace-change = [
    # '/bin/bash',
    # '-c',
    # '/opt/homebrew/opt/sketchybar/bin/sketchybar --trigger dwmac_workspace_change DWMAC_FOCUSED_WORKSPACE=$DWMAC_FOCUSED_WORKSPACE DWMAC_PREV_WORKSPACE=$DWMAC_PREV_WORKSPACE',
]

# Start Dwmac at login
start-at-login = true

# Mouse follows focus when focused monitor changes
# Drop it from your config, if you don't like this behavior
# See https://hillyu.github.io/Dwmac/guide#on-focus-changed-callbacks
# See https://hillyu.github.io/Dwmac/commands#move-mouse
# Fallback value (if you omit the key): on-focused-monitor-changed = []
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']

# You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag
# Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-mod-h key
# Also see: https://hillyu.github.io/Dwmac/goodies#disable-hide-app
automatically-unhide-macos-hidden-apps = true

default-mfact=0.6
attach-below = true
center-floating-windows = true
# Possible values: (qwerty|dvorak|colemak)
# See https://hillyu.github.io/Dwmac/guide#key-mapping


mod = 'rcmd'
# }}}

# Key Mapping {{{
[key-mapping]
preset = 'qwerty'
# }}}

# Gaps {{{
# Gaps between windows (inner-*) and between monitor edges (outer-*).
# Possible values:
# - Constant:     gaps.outer.top = 8
# - Per monitor:  gaps.outer.top = [{ monitor.main = 16 }, { monitor."some-pattern" = 32 }, 24]
#                 In this example, 24 is a default value when there is no match.
#                 Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'.
#                 See:
#                 https://hillyu.github.io/Dwmac/guide#assign-workspaces-to-monitors
[gaps]
inner.horizontal = 10
inner.vertical =   10
outer.left =       20
outer.bottom =     10
outer.top =        10
# outer.top = [
#         # Minimal gap on internal display
#         { monitor."^built-in retina display$" = 10 },
#         # Larger gap on all other displays
#         30,]
outer.right =      20
# }}}

# Main Mode Bindings {{{
# 'main' binding mode declaration
# See: https://hillyu.github.io/Dwmac/guide#binding-modes
# 'main' binding mode must be always presented
# Fallback value (if you omit the key): mode.main.binding = {}
[mode.main.binding]

# All possible keys:
# - Letters.        a, b, c, ..., z
# - Numbers.        0, 1, 2, ..., 9
# - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9
# - F-keys.         f1, f2, ..., f20
# - Special keys.   minus, equal, period, comma, slash, backslash, quote, semicolon,
#                   backtick, leftSquareBracket, rightSquareBracket, space, enter, esc,
#                   backspace, tab, pageUp, pageDown, home, end, forwardDelete,
#                   sectionSign (ISO keyboards only, european keyboards only)
# - Keypad special. keypadClear, keypadDecimalMark, keypadDivide, keypadEnter, keypadEqual,
#                   keypadMinus, keypadMultiply, keypadPlus
# - Arrows.         left, down, up, right

# All possible modifiers: cmd, mod, ctrl, shift

# All possible commands: https://hillyu.github.io/Dwmac/commands

# Launchers & Config {{{
# See: https://hillyu.github.io/Dwmac/commands#exec-and-forget
# You can uncomment the following lines to open up terminal with mod + enter shortcut
# (like in i3)
# mod-enter = '''exec-and-forget osascript -e '
# tell application "Terminal"
#     do script
#     activate
# end tell'
# '''

mod-enter = 'exec-and-forget osascript $HOME/bin/ghostty_launcher_macosa'
mod-t = 'exec-and-forget osascript $HOME/bin/ghostty_quickterm_macosa'
mod-c ='exec-and-forget open -na Ghostty --args --title="mfloating" -e nvim .config/dwmac/dwmac.toml'
# mod-t ='exec-and-forget /Applications/Alacritty.app/Contents/MacOS/alacritty -e ~/bin/tmux_run.sh'
mod-shift-e = 'reload-config'
cmd-q ='close --quit-if-last-window'

# See: https://hillyu.github.io/Dwmac/commands#mode
mod-shift-semicolon = 'mode service'
# }}}

# Window Focus & Layout {{{
# See: https://hillyu.github.io/Dwmac/commands#layout
mod-shift-space = 'layout floating tiling'
mod-f ='macos-native-fullscreen'
rcmd-z ='fullscreen' # zoom window

# See: https://hillyu.github.io/Dwmac/commands#focus
mod-semicolon = 'focus-master-or-back' 
mod-j = 'focus next'
mod-k = 'focus prev'
mod-h = 'mfact -0.1'
mod-l = 'mfact +0.1'
# }}}

# Window Movement {{{
# See: https://hillyu.github.io/Dwmac/commands#move
mod-space ='move-node-to-master'
mod-shift-j = 'swap next'
mod-shift-k = 'swap prev'

mod-u = 'move down'
mod-i = 'move up'
mod-y = 'move left'
mod-o = 'move right'
# }}}

# Window Resize {{{
mod-shift-h = 'resize smart -10'
mod-shift-l = 'resize smart +10'

mod-shift-u = 'resize height +10'
mod-shift-i = 'resize height -10'
mod-shift-y = 'resize width -10'
mod-shift-o = 'resize width +10'

# See: https://hillyu.github.io/Dwmac/commands#resize
mod-minus = 'resize smart -50'
mod-equal = 'resize smart +50'
# }}}

# Workspace Management {{{
# See: https://hillyu.github.io/Dwmac/commands#workspace
mod-1 = 'workspace 1'
mod-2 = 'workspace 2'
mod-3 = 'workspace 3'
mod-4 = 'workspace 4'
mod-5 = 'workspace 5'
mod-6 = 'workspace 6'
mod-7 = 'workspace 7'
mod-8 = 'workspace 8'
mod-9 = 'workspace 9'
# mod-a = 'workspace A' # In your config, you can drop workspace bindings that you don't need
# mod-b = 'workspace B'
# mod-c = 'workspace C'
# mod-d = 'workspace D'
# mod-e = 'workspace E'
# mod-f = 'workspace F'
# mod-g = 'workspace G'
# mod-i = 'workspace I'
# mod-m = 'workspace M'
# mod-n = 'workspace N'
# mod-o = 'workspace O'
# mod-p = 'workspace P'
# mod-q = 'workspace Q'
# mod-r = 'workspace R'
# mod-s = 'workspace S'
# mod-t = 'workspace T'
# mod-u = 'workspace U'
# mod-v = 'workspace V'
# mod-w = 'workspace W'
# mod-x = 'workspace X'
# mod-y = 'workspace Y'
# mod-z = 'workspace Z'

# See: https://hillyu.github.io/Dwmac/commands#move-node-to-workspace
mod-shift-1 = 'move-node-to-workspace 1'
mod-shift-2 = 'move-node-to-workspace 2'
mod-shift-3 = 'move-node-to-workspace 3'
mod-shift-4 = 'move-node-to-workspace 4'
mod-shift-5 = 'move-node-to-workspace 5'
mod-shift-6 = 'move-node-to-workspace 6'
mod-shift-7 = 'move-node-to-workspace 7'
mod-shift-8 = 'move-node-to-workspace 8'
mod-shift-9 = 'move-node-to-workspace 9'
# mod-shift-a = 'move-node-to-workspace A'
# mod-shift-b = 'move-node-to-workspace B'
# mod-shift-c = 'move-node-to-workspace C'
# mod-shift-d = 'move-node-to-workspace D'
# mod-shift-e = 'move-node-to-workspace E'
# mod-shift-f = 'move-node-to-workspace F'
# mod-shift-g = 'move-node-to-workspace G'
# mod-shift-i = 'move-node-to-workspace I'
# mod-shift-m = 'move-node-to-workspace M'
# mod-shift-n = 'move-node-to-workspace N'
# mod-shift-o = 'move-node-to-workspace O'
# mod-shift-p = 'move-node-to-workspace P'
# mod-shift-q = 'move-node-to-workspace Q'
# mod-shift-r = 'move-node-to-workspace R'
# mod-shift-s = 'move-node-to-workspace S'
# mod-shift-t = 'move-node-to-workspace T'
# mod-shift-u = 'move-node-to-workspace U'
# mod-shift-v = 'move-node-to-workspace V'
# mod-shift-w = 'move-node-to-workspace W'
# mod-shift-x = 'move-node-to-workspace X'
# mod-shift-y = 'move-node-to-workspace Y'
# mod-shift-z = 'move-node-to-workspace Z'
#
# See: https://hillyu.github.io/Dwmac/commands#workspace-back-and-forth
mod-tab = 'workspace-back-and-forth'
# }}}

# Monitor Management {{{
# See: https://hillyu.github.io/Dwmac/commands#move-workspace-to-monitor
mod-period = 'focus-monitor next'
mod-comma = 'focus-monitor prev'
mod-shift-period = 'move-node-to-monitor --wrap-around next'
mod-shift-comma = 'move-node-to-monitor --wrap-around prev'
# }}}
# }}}

# Window Rules {{{
# on-window-detected events are like window rules:
# [[on-window-detected]]
# if.app-name-regex-substring = 'settings'
# run = 'layout floating'
[[on-window-detected]]
if.app-name-regex-substring = 'finder'
run = 'layout floating'
[[on-window-detected]]
if.app-name-regex-substring = 'exe'
run = 'layout floating'
[[on-window-detected]]
if.window-title-regex-substring = 'mfloating'
run = 'layout floating'
# }}}


# Service Mode Bindings {{{
# 'service' binding mode declaration.
# See: https://hillyu.github.io/Dwmac/guide#binding-modes
[mode.service.binding]
esc = ['reload-config', 'mode main']
# r = ['index', 'mode main'] # reset layout
f = ['layout floating tiling', 'mode main'] # Toggle between floating and tiling layout
backspace = ['close-all-windows-but-current', 'mode main']

# sticky is not yet supported https://github.com/hillyu/Dwmac/issues/2
#s = ['layout sticky tiling', 'mode main']


down = 'volume down'
up = 'volume up'
shift-down = ['volume set 0', 'mode main']
# }}}

# vim: set foldmethod=marker foldlevel=0: