## Base16 Eighties
# Author: Chris Kempson (http://chriskempson.com)
#
# You can use these variables anywhere in the sway configuration file.

set $base00 #2d2d2d
set $base01 #393939
set $base02 #515151
set $base03 #747369
set $base04 #a09f93
set $base05 #d3d0c8
set $base06 #e8e6df
set $base07 #f2f0ec
set $base08 #f2777a
set $base09 #f99157
set $base0A #ffcc66
set $base0B #99cc99
set $base0C #66cccc
set $base0D #6699cc
set $base0E #cc99cc
set $base0F #d27b53

# Basic color configuration using the Base16 variables for windows and borders.
# Property Name		Border		BG		Text		Indicator	Child Border
client.focused		$base05		$base0D		$base00		$base05		$base0D
client.focused_inactive	$base01		$base01		$base05		$base03		$base01
client.unfocused	$base01		$base00		$base05		$base01		$base01
client.urgent		$base08		$base08		$base00		$base08		$base08
client.placeholder	$base00		$base00		$base05		$base00		$base00
client.background	$base00

# Inputs configuration

input "type:keyboard" {
	xkb_layout fr
	xkb_variant bepo_afnor
#	xkb_variant oss
	xkb_numlock enable
}

# Outputs configuration

output 'Samsung Electric Company C24FG7x HTHK500785' {
	subpixel rgb
	adaptive_sync off
}

# start terminal daemon
exec foot --server

# Export some variables
exec systemctl --user import-environment DISPLAY

# GTK Configuration

set $gs org.gnome.desktop.interface

exec_always {
	gsettings set $gs gtk-theme "Vertex-Dark"
	gsettings set $gs icon-theme "Vertex-Icons"
	gsettings set $gs cursor-theme "Adwaita"
	gsettings set $gs font-name "IBM Plex Sans 10"
}

# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4

# set default desktop layout (default is tiling)
# workspace_layout tabbed <stacking|tabbed>

# Configure border style <normal|1pixel|pixel xx|none|pixel>
default_border normal 1
default_floating_border normal 1

# Hide borders
# hide_edge_borders smart

# change borders
bindsym $mod+u border none
bindsym $mod+y border pixel 1
bindsym $mod+n border normal 1

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font IBM Plex Sans, DejaVu Sans 10

# Use Mouse+$mod to drag floating windows
floating_modifier $mod

# start a footclient
bindsym $mod+Return exec footclient fish
bindsym $mod+Ctrl+Return exec footclient 


# kill focused window
bindsym $mod+Shift+q kill

# start program launcher
# bindsym $mod+d exec dmenu_recent -f -nb '#2d2d2d' -nf '#747369' -sb '#6699cc' -sf '#2d2d2d' -p 'execute' -fn 'xos4 Terminus'
bindcode $mod+40 exec dmenu_recent

# launch desktop menu
bindsym $mod+z exec i3-dmenu-desktop --dmenu='dmenu -p "Launch:"'

# launch without history
bindcode $mod+Ctrl+40 exec dmenu_run -p "Execute:" 


################################################################################################

# Screen
bindsym $mod+Home exec pkill -x -USR1 gammastep
bindsym $mod+End output * adaptive_sync on, exec dunstify -r 53364 -u low "Sway" "FreeSync activé"
bindsym $mod+Shift+End output * adaptive_sync off, exec dunstify -r 53364 -u low "Sway" "FreeSync désactivé"

# Volume controls
bindsym XF86AudioRaiseVolume exec button=4 ${HOME}/.i3blocks/volume && pkill -RTMIN+10 i3blocks
bindsym XF86AudioLowerVolume exec button=5 ${HOME}/.i3blocks/volume && pkill -RTMIN+10 i3blocks
bindsym Shift+XF86AudioRaiseVolume exec mpc volume +2
bindsym Shift+XF86AudioLowerVolume exec mpc volume -2
bindsym XF86AudioMute exec button=2 ${HOME}/.i3blocks/volume && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMicMute exec button=2 instance=mic ${HOME}/.i3blocks/volume && pkill -RTMIN+10 i3blocks
bindsym XF86HomePage exec button=2 instance=mic ${HOME}/.i3blocks/volume && pkill -RTMIN+10 i3blocks

bindsym $mod+Ctrl+m exec pavucontrol

# Media controls
bindsym XF86AudioNext exec mpc next
bindsym XF86AudioPrev exec mpc prev
bindsym XF86AudioPlay exec mpc toggle
bindsym $mod+XF86AudioPlay exec mpc stop

# Mail
bindsym XF86Mail exec pkill -RTMIN+11 i3blocks, workspace 🖂

# Notifications
bindsym Ctrl+space exec dunstctl close
bindsym Ctrl+Shift+space exec dunstctl close-all
bindsym Ctrl+Shift+dollar exec dunstctl context
bindsym Ctrl+dollar exec dunstctl history-pop
bindsym $mod+Pause exec dunstctl set-paused toggle

# Beep toggle
bindsym $mod+Delete exec $HOME/.local/bin/toggle-beep && pkill -SIGRTMIN+14 i3blocks

# Start Applications
bindsym $mod+F2 exec $BROWSER
bindsym $mod+Shift+F2 exec $BROWSER -P tmp --no-remote
bindsym $mod+Ctrl+F2 exec epiphany
bindsym $mod+Ctrl+F3 exec pcmanfm
bindsym $mod+F3 exec footclient ranger
bindsym $mod+F4 exec footclient bashmount
bindsym $mod+F5 exec footclient ncmpcpp
bindsym Print exec grimshot --notify save screen
bindsym $mod+Print exec grimshot --notify save active
bindsym $mod+Shift+Print exec grimshot --notify save area
bindsym $mod+l exec passmenu --type -l 10 $DMENU_OPTIONS

# focus_follows_mouse no

# change focus
#bindsym $mod+j focus left
#bindsym $mod+k focus down
#bindsym $mod+l focus up
#bindsym $mod+m 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+m 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

# workspace back and forth (with/without active container)
workspace_auto_back_and_forth yes
bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth

# split orientation
bindsym $mod+h split h
bindsym $mod+v split v
bindsym $mod+q split toggle

# toggle fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
bindsym $mod+Shift+f fullscreen toggle global

# 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

# toggle sticky
bindsym $mod+Shift+s sticky toggle

# focus the parent container
bindsym $mod+a focus parent

# move the currently focused window to the scratchpad
bindsym $mod+Shift+dollar move scratchpad

# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+dollar scratchpad show

#navigate workspaces next / previous
bindsym $mod+Ctrl+Right workspace next
bindsym $mod+Ctrl+Left workspace prev

# Workspace names
# to display names or symbols instead of plain workspace numbers you can use
set $ws1 1
set $ws2 2
set $ws3 3
set $ws4 4
set $ws5 5
set $ws6 6
set $ws7 7
set $ws8 8

# switch to workspace
bindcode $mod+10 workspace $ws1
bindcode $mod+11 workspace $ws2
bindcode $mod+12 workspace $ws3
bindcode $mod+13 workspace $ws4
bindcode $mod+14 workspace $ws5
bindcode $mod+15 workspace $ws6
bindcode $mod+16 workspace $ws7
bindcode $mod+17 workspace $ws8

# Move focused container to workspace
bindcode $mod+Ctrl+10 move container to workspace $ws1
bindcode $mod+Ctrl+11 move container to workspace $ws2
bindcode $mod+Ctrl+12 move container to workspace $ws3
bindcode $mod+Ctrl+13 move container to workspace $ws4
bindcode $mod+Ctrl+14 move container to workspace $ws5
bindcode $mod+Ctrl+15 move container to workspace $ws6
bindcode $mod+Ctrl+16 move container to workspace $ws7
bindcode $mod+Ctrl+17 move container to workspace $ws8

# Move to workspace with focused container
bindcode $mod+Shift+10 move container to workspace $ws1; workspace $ws1
bindcode $mod+Shift+11 move container to workspace $ws2; workspace $ws2
bindcode $mod+Shift+12 move container to workspace $ws3; workspace $ws3
bindcode $mod+Shift+13 move container to workspace $ws4; workspace $ws4
bindcode $mod+Shift+14 move container to workspace $ws5; workspace $ws5
bindcode $mod+Shift+15 move container to workspace $ws6; workspace $ws6
bindcode $mod+Shift+16 move container to workspace $ws7; workspace $ws7
bindcode $mod+Shift+17 move container to workspace $ws8; workspace $ws8

#workspace $ws1 output DP-1
#workspace $ws2 output DP-1 
#workspace $ws3 output DP-1 
#workspace $ws4 output DP-1 
#workspace $ws5 output DP-1 
#workspace $ws6 output DP-1 
#workspace $ws7 output DP-1 
#workspace $ws8 output HDMI-A-1

# Open specific applications in floating mode
for_window [title="File Transfer*"] floating enable
for_window [class="Pavucontrol"] floating enable
for_window [class="qt5ct"] floating enable sticky enable border normal
for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal
for_window [class="(?i)TransportFever2"] border none fullscreen disable
for_window [class="(?i)System-config-printer.py"] floating enable border normal
for_window [class="(?i)variety"] floating enable
for_window [app_id="newsboat"] move scratchpad

# Games
for_window [class="(?i)factorio"] border none
for_window [class="(?i)Rail Route.x86"] border none

# Assign apps to workspace
assign [app_id="claws-mail"] 🖂
assign [instance="qbittorrent"] 8

# reload the configuration file
bindsym $mod+Shift+c reload

# Set shut down, restart and locking features
set $mode_system (l)ock, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown
bindcode $mod+19 mode "$mode_system"
mode "$mode_system" {
    bindsym l exec "systemctl --user stop graphical-session.target; swaylock", mode "default"
    bindsym s exec "systemctl suspend", mode "default"
    bindsym e exec "systemctl --user stop graphical-session.target; swaymsg exit", mode "default"
    bindsym h exec systemctl hibernate, mode "default"
    bindsym r exec "systemctl --user stop graphical-session.target; systemctl reboot", mode "default"
    bindsym Shift+s exec "systemctl --user stop graphical-session.target; systemctl poweroff", mode "default"

    # exit system mode: "Enter" or "Escape"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

# Resize window (you can also use the mouse for that)
bindsym $mod+r mode "resize"
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode
        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym j resize shrink width 5 px or 5 ppt
        bindsym k resize grow height 5 px or 5 ppt
        bindsym l resize shrink height 5 px or 5 ppt
        bindsym m resize grow width 5 px or 5 ppt

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 5 px or 5 ppt
        bindsym Down resize grow height 5 px or 5 ppt
        bindsym Up resize shrink height 5 px or 5 ppt
        bindsym Right resize grow width 5 px or 5 ppt

        # exit resize mode: Enter or Escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

# Lock screen
bindsym $mod+9 exec swaylock

# Autostart applications
#exec conky --config "$HOME/.config/conky/conkyrc1"
#exec conky --config "$HOME/.config/conky/conkyrc2"
exec sleep 5 && footclient -a newsboat -T newsboat -o colors.alpha=1.0 -o colors.background=2D2D2D newsboat
exec steam-native -silent -noverifyfiles -language french
exec play "$HOME/Musique/WELCOME BACK.wav"
exec gammastep
exec_always sleep 5 && variety -n
exec claws-mail --online

# Start swaybar to display a workspace bar (plus the system information swaystatus if available)
bar {
	status_command i3blocks

	height 24

	tray_output none

	font Terminus, DejaVu Sans Mono 12

	colors {
            background $base00
            separator  $base02
            statusline $base05

            # State             Border  BG      Text
            focused_workspace   $base05 $base0D $base00
            active_workspace    $base05 $base03 $base00
            inactive_workspace  $base03 $base01 $base05
            urgent_workspace    $base08 $base08 $base00
            binding_mode        $base00 $base0A $base00
        }
}

# hide/unhide swaybar
bindsym $mod+comma bar mode toggle

workspace 1
