# Required dependencies
feh
flameshot


# Font for window titles.
font pango:Courier Prime 12


# STARTUP APPLICATIONS
# Start XDG autostart .desktop files using dex.
exec --no-startup-id dex --autostart --environment i3

# Lock screen
# exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork

# Autostarts
exec --no-startup-id nm-applet
exec_always --no-startup-id picom
exec --no-startup-id vivaldi
exec --no-startup-id code
exec --no-startup-id discord
exec --no-startup-id slack
exec --no-startup-id spotify
exec --no-startup-id flameshot
# exec --no-startup-id /home/theuser/.config/polybar/launch_polybar.sh

#/STARTUP APPLICATIONS------->

# These applications are assigned to workspaces
assign [class="Code"] → number "1: "
assign [class="Vivaldi-stable"] → number "2 "
assign [class="discord"] → number "3 "
assign [class="Slack"] → number "3 "
assign [class="steam"] → number "4 "

# These applications are assigned to floating mode (xprop to get class)
for_window [class="kruler"] floating enable
for_window [class="gnome-calculator"] floating enable
for_window [class="pavucontrol-qt"] floating enable

# These applications are assigned to scratchpad (xprop to get class)
for_window [class="Spotify"] move scratchpad

# TODO: Media hotkeys
set $refresh_i3status killall -SIGUSR1 i3status

# use these keys for focus, movement, and resize directions when reaching for
# the arrows is not convenient
set $up l
set $down k
set $left j
set $right semicolon

# use Mouse+Mod4 to drag floating windows to their wanted position
floating_modifier Mod4

# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar


# APPLICATION HOTKEYS
bindsym Mod4+Return exec gnome-terminal
bindsym Mod4+Shift+Return exec vivaldi
bindsym Mod4+space exec --no-startup-id dmenu_run
# APPLICATION HOTKEYS-------->

# OTHER HOTKEYS
bindsym Mod4+Shift+q kill
bindsym Mod4+r mode "resize"


# change focus
bindsym Mod4+$left focus left
bindsym Mod4+$down focus down
bindsym Mod4+$up focus up
bindsym Mod4+$right focus right

# alternatively, you can use the cursor keys:
bindsym Mod4+Left focus left
bindsym Mod4+Down focus down
bindsym Mod4+Up focus up
bindsym Mod4+Right focus right

# move focused window
bindsym Mod4+Shift+$left move left
bindsym Mod4+Shift+$down move down
bindsym Mod4+Shift+$up move up
bindsym Mod4+Shift+$right move right

# alternatively, you can use the cursor keys:
bindsym Mod4+Shift+Left move left
bindsym Mod4+Shift+Down move down
bindsym Mod4+Shift+Up move up
bindsym Mod4+Shift+Right move right

# split in horizontal orientation
bindsym Mod4+h split h

# split in vertical orientation
bindsym Mod4+v split v

# enter fullscreen mode for the focused container
bindsym Mod4+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym Mod4+s layout stacking
bindsym Mod4+w layout tabbed
bindsym Mod4+e layout toggle split

# toggle tiling / floating
bindsym Mod4+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym Mod4+d focus mode_toggle

# focus the parent container
bindsym Mod4+a focus parent

# focus the child container
#bindsym Mod4+d focus child

# Scratchpad
bindsym Mod4+Shift+minus move scratchpad
bindsym Mod4+minus scratchpad show

bindsym Mod4+Shift+i exec --no-startup-id i3lock --tiling -i /home/theuser/Pictures/Wallpapers/charon.png

bindsym Mod4+Shift+u exec --no-startup-id flameshot gui

#-------OTHER HOTKEYS>



# switch to workspace
bindsym Mod4+1 workspace number $ws1
bindsym Mod4+2 workspace number $ws2
bindsym Mod4+3 workspace number $ws3
bindsym Mod4+4 workspace number $ws4
bindsym Mod4+5 workspace number $ws5
bindsym Mod4+6 workspace number $ws6
bindsym Mod4+7 workspace number $ws7
bindsym Mod4+8 workspace number $ws8
bindsym Mod4+9 workspace number $ws9
bindsym Mod4+0 workspace number $ws10

# move focused container to workspace
bindsym Mod4+Shift+1 move container to workspace number $ws1
bindsym Mod4+Shift+2 move container to workspace number $ws2
bindsym Mod4+Shift+3 move container to workspace number $ws3
bindsym Mod4+Shift+4 move container to workspace number $ws4
bindsym Mod4+Shift+5 move container to workspace number $ws5
bindsym Mod4+Shift+6 move container to workspace number $ws6
bindsym Mod4+Shift+7 move container to workspace number $ws7
bindsym Mod4+Shift+8 move container to workspace number $ws8
bindsym Mod4+Shift+9 move container to workspace number $ws9
bindsym Mod4+Shift+0 move container to workspace number $ws10

# reload the configuration file
bindsym Mod4+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Mod4+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym Mod4+Shift+e 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'"

bindsym Mod4+Shift+O exec autorandr --load default
bindsym Mod4+Shift+P exec autorandr --load jobb

# xrandr --auto --output DP-2 --mode 5120x1440 --rate 60 --above eDP-1
# xrandr --output eDP-1 --off

#/OTHER HOTKEYS------->


# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.

#dev
set $ws1 "1 "
#browser
set $ws2 "2 "
#social
set $ws3 "3 "
#spel
set $ws4 "4 "

set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# resize window (you can also use the mouse for that)
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 $left       resize shrink width 10 px or 10 ppt
        bindsym $down       resize grow height 10 px or 10 ppt
        bindsym $up         resize shrink height 10 px or 10 ppt
        bindsym $right      resize grow width 10 px or 10 ppt

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

        # back to normal: Enter or Escape or Mod4+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym Mod4+r mode "default"
}


# Wallpaper shuffle

# Live shuffle wallpaper 
# exec_always watch -n 1200 feh --randomize --bg-fill ~/Pictures/Wallpapers/*

# Pick random wallpaper on startup
exec_always feh --randomize --bg-fill ~/Pictures/Wallpapers/*

## Volume control

# Path to volume control, without trailing slash
set $volumepath ~/i3-volume

# Command for the status line
#   ie: i3blocks, i3status
set $statuscmd i3status

# Signal used to update the status line
#   i3blocks uses SIGRTMIN+10 by default
#   i3status uses SIGUSR1 by default
set $statussig SIGUSR1

# Amount to increase/decrease volume as a percentage
set $volumestep 5

# pulseaudio-utils settings
#
# Symbolic name for sink (numeric index not supported)
#   Recommended: comment out this setting and omit the -s option to use default sink
#   List sink names: pacmd list-sinks | awk -F "[<>]" '/^\s+name: <.*>/{print $2}'
#set $sinkname alsa_output.pci-0000_00_1b.0.analog-stereo

# Using pulseaudio-utils (append "-s $sinkname" without quotes to override default sink)
bindsym XF86AudioRaiseVolume exec --no-startup-id $volumepath/volume -n -t $statuscmd -u $statussig up $volumestep
bindsym XF86AudioLowerVolume exec --no-startup-id $volumepath/volume -n -t $statuscmd -u $statussig down $volumestep
bindsym XF86AudioMute        exec --no-startup-id $volumepath/volume -n -t $statuscmd -u $statussig mute
bindsym XF86AudioPause exec --no-startup-id playerctl play-pause
bindsym Mod4+Mod1+Left exec --no-startup-id playerctl previous
bindsym Mod4+Mod1+Right exec --no-startup-id playerctl next

# Touchpad
# Enable touchpad tapping
exec_always --no-startup-id xinput set-prop "DELL097D:00 04F3:311C Touchpad" "libinput Tapping Enabled" 1

bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-


# Theming
for_window [class="^.*"] border pixel 1
default_border pixel 4
smart_borders on

client.focused          #333333 #a19081 #030306 #2e9ef4   #000000
client.focused_inactive #333333 #5f676a #ffffff #484e50   #5f676a
client.unfocused        #333333 #222222 #888888 #292d2e   #222222
client.urgent           #2f343a #900000 #ffffff #900000   #900000
client.placeholder      #000000 #0c0c0c #ffffff #000000   #0c0c0c

client.background       #ffffff
gaps inner 5px
gaps outer 5px

bar {
    status_command i3status --config /home/theuser/.config/i3/i3status.conf
    tray_padding 4
    font pango:DejaVu Courier Prime Bold 12
    # i3bar_command i3bar --transparency
    padding 2 2
    workspace_min_width 100
    separator_symbol " ł "

    colors {
        background         #292929EE

        #                   border      background   text
        focused_workspace   #45150a     #45150a      #ffffff
        active_workspace    #45150a     #45150a      #ffffff
        inactive_workspace  #45150a25   #45150a      #888888
        urgent_workspace    #45150a     #45150a      #ffffff
        binding_mode        #2f343a     #900000      #ffffff
    }
}