#
# Window Management
#

# Alt(+Shift)+Tab
Mod1 Tab       :NextWindow {groups} (workspace=[current])
Mod1 Shift Tab :PrevWindow {groups} (workspace=[current])

# Alt+F(N)
Mod1       F2  :Exec fbrun
Mod1       F3  :WindowMenu
Mod1       F4  :Close
Mod1 Shift F4  :Kill
Mod1       F5  :Shade
Mod1 Shift F5  :If {Matches (Layer!=Bottom)} {SetLayer Bottom} {SetLayer Normal}
Mod1       F6  :Stick
Mod1 Shift F6  :If {Matches (Layer!=Top)}    {SetLayer Top}    {SetLayer Normal}
Mod1       F7  :KeyMode MoveMode
Mod1 Shift F7  :SetAlpha -32 -32
Mod1       F8  :KeyMode ResizeMode
Mod1 Shift F8  :SetAlpha +32 +32
Mod1       F9  :Minimize
Mod1       F10 :Maximize
Mod1       F11 :Fullscreen
Mod1 Shift F11 :ToggleDecor
Mod1       F12 :Exec ps -C skippy-xd 1>/dev/null 2>&1 || skippy-xd

# Alt+F7 move mode
MoveMode: None  Left  :MoveLeft  20
MoveMode: None  Right :MoveRight 20
MoveMode: None  Up    :MoveUp    20
MoveMode: None  Down  :MoveDown  20
MoveMode: Shift Left  :MoveLeft   1
MoveMode: Shift Right :MoveRight  1
MoveMode: Shift Up    :MoveUp     1
MoveMode: Shift Down  :MoveDown   1
MoveMode: Return      :KeyMode default
MoveMode: KP_Enter    :KeyMode default

# Alt+F8 resize mode
ResizeMode: None  Left  :ResizeHorizontal -20
ResizeMode: None  Right :ResizeHorizontal  20
ResizeMode: None  Up    :ResizeVertical   -20
ResizeMode: None  Down  :ResizeVertical    20
ResizeMode: Shift Left  :ResizeHorizontal  -1
ResizeMode: Shift Right :ResizeHorizontal   1
ResizeMode: Shift Up    :ResizeVertical    -1
ResizeMode: Shift Down  :ResizeVertical     1
ResizeMode: Return      :KeyMode default
ResizeMode: KP_Enter    :KeyMode default

# Alt+Shift+F10 directional maximizations
Mod1 Shift F10 Left  :MaximizeHorizontal
Mod1 Shift F10 Right :MaximizeHorizontal
Mod1 Shift F10 Up    :MaximizeVertical
Mod1 Shift F10 Down  :MaximizeVertical

# Title bar right click to open window menu
OnTitlebar Mouse3 :WindowMenu

# (Un)shade window when scrolling on titlebar
OnTitlebar Mouse4 :ShadeOn
OnTitlebar Mouse5 :ShadeOff

# Title bar drag, border drag, and Alt+drag
OnTitlebar Move1     :StartMoving
OnWindowBorder Move1 :StartMoving
OnWindow Mod1 Move1  :StartMoving
#OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}

# Resize on corner dragging and Alt+right-click on window
OnLeftGrip Move1     :StartResizing BottomLeft
OnRightGrip Move1    :StartResizing BottomRight
OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing NearestCorner}

# Maximize on title bar double click
OnTitlebar Double Mouse1 :Maximize

# Tiling
Mod4 Left  :MacroCmd {ResizeTo 50% 100%} {MoveTo 0 0 TopLeft}
Mod4 Right :MacroCmd {ResizeTo 50% 100%} {MoveTo 0 0 TopRight}
Mod4 Up    :MacroCmd {ResizeTo 100% 50%} {MoveTo 0 0 TopLeft}
Mod4 Down  :MacroCmd {ResizeTo 100% 50%} {MoveTo 0 0 BottomLeft}

#OnTitlebar Mouse1 :MacroCmd {Raise} {Focus} {ActivateTab}

#
# Tab Management
#

# Super(+Shift)+Tab
Mod4 Tab       :NextTab
Mod4 Shift Tab :PrevTab

# Switch to specific tab
Mod4 1 :Tab 1
Mod4 2 :Tab 2
Mod4 3 :Tab 3
Mod4 4 :Tab 4
Mod4 5 :Tab 5
Mod4 6 :Tab 6
Mod4 7 :Tab 7
Mod4 8 :Tab 8
Mod4 9 :Tab 9

# Ctrl+drag tabs
OnTitlebar Control Mouse1 :StartTabbing

#
# Workspace Management
#

# Switch to next/previous workspace
Control Mod1 Right :NextWorkspace 1
Control Mod1 Left  :PrevWorkspace 1

# Switch to specific workspace
Control F1  :Workspace 1
Control F2  :Workspace 2
Control F3  :Workspace 3
Control F4  :Workspace 4
Control F5  :Workspace 5
Control F6  :Workspace 6
Control F7  :Workspace 7
Control F8  :Workspace 8
Control F9  :Workspace 9
Control F10 :Workspace 10
Control F11 :Workspace 11
Control F12 :Workspace 12

# Move window to next/previous workspace
Control Mod1 Shift Right :TakeToNextWorkspace 1
Control Mod1 Shift Left  :TakeToPrevWorkspace 1

# Move window to next/previous workspace
Control Shift F1  :TakeToWorkspace 1
Control Shift F2  :TakeToWorkspace 2
Control Shift F3  :TakeToWorkspace 3
Control Shift F4  :TakeToWorkspace 4
Control Shift F5  :TakeToWorkspace 5
Control Shift F6  :TakeToWorkspace 6
Control Shift F7  :TakeToWorkspace 7
Control Shift F8  :TakeToWorkspace 8
Control Shift F9  :TakeToWorkspace 9
Control Shift F10 :TakeToWorkspace 10
Control Shift F11 :TakeToWorkspace 11
Control Shift F12 :TakeToWorkspace 12

#
# Session and Applications
#

# Session/screen management
Pause                 :Delay {Exec xset dpms force off} 100000
Control Mod1 Delete l :Exec xscreensaver-command -lock
Control Mod1 Delete q :Exec ~/bin/xsession logout
Control Mod1 Delete s :Exec ~/bin/xsession shutdown
Control Mod1 Delete r :Exec ~/bin/xsession reboot
Control Mod1 Delete d :Exec ~/bin/xsession s2disk
Control Mod1 Delete c :Reconfigure

# Brightness
XF86MonBrightnessUp   :Exec ~/bin/bright +
XF86MonBrightnessDown :Exec ~/bin/bright -

# Audio
XF86AudioRaiseVolume :Exec amixer set Master,0 5dB+
XF86AudioLowerVolume :Exec amixer set Master,0 5dB-
XF86AudioMute        :Exec amixer set Master,0 toggle

# Music
XF86AudioPlay       :Exec mpc -h music toggle
XF86AudioStop       :Exec mpc -h music stop
Shift XF86AudioPlay :Exec mpc -h music repeat
Shift XF86AudioStop :Exec mpc -h music single
XF86AudioNext       :Exec mpc -h music next
XF86AudioPrev       :Exec mpc -h music prev
Shift XF86AudioNext :Exec mpc -h music seek +00:00:05
Shift XF86AudioPrev :Exec mpc -h music seek -00:00:05

# PrtSc
Print       :Exec mkdir -p ~/shots/ && scrot ~/shots/%Y-%m-%d_%H:%M:%S.png
Shift Print :Exec mkdir -p ~/shots/ && scrot -u -b ~/shots/%Y-%m-%d_%H:%M:%S.png
Mod1 Print  :Exec mkdir -p ~/shots/ && scrot -s ~/shots/%Y-%m-%d_%H:%M:%S.png

# Launch applications
#Mod4 :CustomMenu ~/.fluxbox/menus/applications
Mod4       t :Exec x-terminal-emulator
Mod4       m :Exec claws-mail
Mod4       w :Exec x-www-browser
Mod4 Shift w :Exec x-www-browser -p
Mod4       i :Exec apulse icecat -P -no-remote
Mod4       c :Exec gnome-calculator
Mod4       o :Exec libreoffice

#
# Menus
#

OnDesktop Mouse1 :HideMenus
OnDesktop Mouse2 :WorkspaceMenu
OnDesktop Mouse3 :RootMenu