#+TITLE: My custom Spectrwm configuration
#+PROPERTY: header-args :tangle spectrwm.conf
#+author: Joelchrono12
* My config
:PROPERTIES:
:DIR:      ~/.config/spectrwm/org-assets/
:END:
This is my personal config for the Spectrwm window manager. Spectrwm its a really minimal program to manage windows, not as simple as DWM, while still being fairly customizable.
You can see how it looks here!

[[./org-assets/spectrwm.png][My config]]

* Initial setup
These first lines are pretty easy to understand. The variables in spectrwm describe their functionality quite well. These first lines are just setting up the minimal, simple configuration.
#+begin_src conf
    # Initial setup config
workspace_limit = 9
focus_mode = manual
focus_close = previous
focus_close_wrap = 0
focus_default = last
spawn_position = next
workspace_clamp = 1
warp_focus = 0
warp_pointer = 0

#+end_src
* Window decoration & boundaries
This is a fairly customizable section of the config, we configure the borders of the windows, the colors when focused or not, as well as the gaps and padding.

I like to have quite a big amount of gaps. The focus color is the blue from the [[https://www.nordtheme.com/][Nord]] color scheme, and the unfocused is dark gray

#+begin_src conf
    # Window decorations & boundaries
border_width = 3
color_focus = rgb:b4/8e/ad
color_unfocus = rgb:2e/34/40
region_padding = 0
tile_gap = 0
boundary_width = 50

#+end_src

* The bar
My bar is the most important aspect of this config, since its the one that will appear in all of my workspaces. It is a top bar and it shows all of the
available workspaces, marking the current one with an asterisk The bar borders are useless to me since I only have one screen

#+begin_src conf
    # Bar configuration
bar_enabled = 1
bar_border_width = 1
bar_border[1] = rgb:18/18/18
bar_border_unfocus[1] = rgb:18/18/18
bar_color[1] = rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/ad,rgb:88/c0/d0,rgb:d0/87/70,rgb:3b/42/52,rgb:4c/56/6a
bar_color_selected[1] = rgb:88/c0/d0
bar_font_color[1] = rgb:ec/ef/f4,rgb:2e/34/40,rgb:2e/34/40,rgb:eb/cb/8b,rgb:a3/be/8c,rgb:bf/61/6a,rgb:b4/8e/ad,rgb:88/c0/d0,rgb:d0/87/70,rgb:3b/42/52,rgb:4c/56/6a
bar_font = Blex Mono Nerd Font:pixelsize=15:antialias=true
bar_action = ~/.config/spectrwm/baraction.sh
bar_action_expand = 1
bar_justify = right
bar_format = +|L +@bg=0;+S +L +@bg=0; +@bg=8; +C +@fg=0; +|2R +A +@bg=0;+@fg=0; %a, %b %d %R +<
bar_at_bottom = 0
workspace_indicator = listall,markcurrent
stack_enabled = 1
clock_enabled = 1
clock_format = %a, %b %d %R
iconic_enabled = 1
maximize_hide_bar = 0
window_class_enabled = 1
window_instance_enabled = 1
window_name_enabled = 0
verbose_layout = 0
urgent_enabled = 1
urgent_collapse = 0

#+end_src

* Starting up and applications
No need to talk about these, I use these programs to set up stuff as soon as my session starts, maybe I should put some in another file, like ~.initrc~, but I've not done it yet.

#+begin_src conf
    # Autorunning applications
autorun = ws[1]:nitrogen --set-auto ~/Pictures/walls/paranoid.jpg &
autorun = ws[1]:setxkbmap -layout latam &
autorun = ws[1]:alacritty
autorun = ws[1]:volumeicon
autorun = ws[1]:xfce4-power-manager
autorun = ws[1]:syncthing
autorun = ws[1]:nm-applet &
autorun = ws[1]:lxpolkit &
autorun = ws[1]:picom --experimental-backends --backend glx --blur-method 'dual_kawase' --blur-strength 6

#+end_src

Other important details are setup here, like workspace names and defining a Modifier key, I could use glyphs as workspace names, but honestly, they don't really describe that well what I want to do in them.

#+begin_src conf
    # Workspace names and modkey
layout = ws[1]:4:0:0:0:vertical
name = ws[1]:WEB
name = ws[2]:DEV
name = ws[3]:MAIL
name = ws[4]:FILE
name = ws[5]:CHAT
name = ws[6]:SSH
name = ws[7]:EMACS
name = ws[8]:TERM
name = ws[9]:ETC
# ", " ", " ", " ", " ", " ", " ", " ", " ", " "
modkey = Mod4

#+end_src
* Quirks
These are different ways to treat the windows of specific programs, making them float, or appear in a certain workspace all the time. These are really powerful settings, but are still being set up, since some apps don't behave as I expect them to do so.

#+begin_src conf
    # Quirks and custom per program behavior
quirk[firefox:Dialog] = FLOAT + MINIMALBORDER + TRANSSZ
quirk[Image Lounge] = FLOAT
quirk[firefox] =  IGNOREPID + TRANSSZ + ANYWHERE
quirk[Thunderbird] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
quirk[Claws-mail] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
quirk[Xarchiver] = ANYWHERE + IGNORESPAWNWS + IGNOREPID + TRANSSZ
quirk[Lxappearance] = FLOAT
quirk[Pavucontrol] = FLOAT
quirk[Volumeicon] = FLOAT + ANYWHERE + IGNORESPAWNWS + IGNOREPID
quirk[discord:Discord Updater] = FLOAT + IGNOREPID
quirk[stalonetray] = FLOAT + ANYWHERE
quirk[trayer] = FLOAT + ANYWHERE + NOFOCUSCYCLE + MINIMALBORDER + NOFOCUSONMAP
quirk[Lxpolkit] = FLOAT + IGNOREPID +FOCUSPREV + IGNORESPAWNWS
quirk[Xfce4-power-manager-settings] = FLOAT + ANYWHERE
quirk[Nm-connection-editor] = ANYWHERE + IGNORESPAWNWS + FLOAT
quirk[Pcmanfm] = ANYWHERE + IGNORESPAWNWS
quirk[Thunar] = ANYWHERE + IGNORESPAWNWS

#+end_src

* General Keybindings
This is the defining factor of any window manager, how good and optimized are your keybindings. As you can assume, these are made to fit my needs, so your mileage may vary, but a lot of them are just the default one, in case you are wondering.

It is important to remember that default kebindings are not unbinded unless you add ~bind[] = <keybinding>~, so that's why you'll seee a few of them here and there.
#+begin_src conf
    # General keybindings
bind[] = MOD+x
bind[] = MOD+v
bind[bar_toggle]	= MOD+b
bind[bar_toggle_ws] = MOD+Shift+b
bind[cycle_layout] = MOD+space
bind[flip_layout] = MOD+Shift+backslash
bind[float_toggle] = MOD+t
bind[focus_main] = MOD+m
bind[focus_next] = MOD+j
bind[focus_next] = MOD+Tab
bind[focus_prev] = MOD+k
bind[focus_prev] = MOD+Shift+Tab
bind[focus_urgent] = MOD+u
bind[height_grow] = MOD+Shift+equal
bind[height_shrink] = MOD+Shift+minus
bind[iconify] = MOD+w
bind[initscr] = MOD+Shift+i
bind[lock] = MOD+Shift+Delete
bind[master_add] = MOD+Shift+comma
bind[master_del] = MOD+Shift+period
bind[master_grow] = MOD+l
bind[master_shrink] = MOD+h
bind[maximize_toggle] = MOD+e
bind[move_down] = MOD+Shift+bracketright
bind[move_left] = MOD+bracketleft
bind[move_right] = MOD+bracketright
bind[move_up] = MOD+Shift+bracketleft
bind[mvrg_1] = MOD+Shift+KP_End
bind[mvrg_2] = MOD+Shift+KP_Down
bind[mvrg_3] = MOD+Shift+KP_Next
bind[mvrg_4] = MOD+Shift+KP_Left
bind[mvrg_5] = MOD+Shift+KP_Begin
bind[mvrg_6] = MOD+Shift+KP_Right
bind[mvrg_7] = MOD+Shift+KP_Home
bind[mvrg_8] = MOD+Shift+KP_Up
bind[mvrg_9] = MOD+Shift+KP_Prior
bind[mvws_1] = MOD+Shift+1
bind[mvws_2] = MOD+Shift+2
bind[mvws_3] = MOD+Shift+3
bind[mvws_4] = MOD+Shift+4
bind[mvws_5] = MOD+Shift+5
bind[mvws_6] = MOD+Shift+6
bind[mvws_7] = MOD+Shift+7
bind[mvws_8] = MOD+Shift+8
bind[mvws_9] = MOD+Shift+9
bind[mvws_10] = MOD+Shift+0
bind[mvws_11] = MOD+Shift+F1
bind[mvws_12] = MOD+Shift+F2
bind[mvws_13] = MOD+Shift+F3
bind[mvws_14] = MOD+Shift+F4
bind[mvws_15] = MOD+Shift+F5
bind[mvws_16] = MOD+Shift+F6
bind[mvws_17] = MOD+Shift+F7
bind[mvws_18] = MOD+Shift+F8
bind[mvws_19] = MOD+Shift+F9
bind[mvws_20] = MOD+Shift+F10
bind[mvws_21] = MOD+Shift+F11
bind[mvws_22] = MOD+Shift+F12
bind[name_workspace] = MOD+Shift+slash
bind[quit] = MOD+Control+q
bind[raise_toggle] = MOD+Control+r
bind[restart] = MOD+Shift+r
bind[rg_1] = MOD+KP_End
bind[rg_2] = MOD+KP_Down
bind[rg_3] = MOD+KP_Next
bind[rg_4] = MOD+KP_Left
bind[rg_5] = MOD+KP_Begin
bind[rg_6] = MOD+KP_Right
bind[rg_7] = MOD+KP_Home
bind[rg_8] = MOD+KP_Up
bind[rg_9] = MOD+KP_Prior
bind[rg_next] = MOD+period
bind[rg_prev] = MOD+comma
bind[screenshot_all] = MOD+s
bind[screenshot_wind] = MOD+Shift+s
bind[search_win] = MOD+f
bind[search_workspace] = MOD+slash
bind[stack_dec] = MOD+Shift+period
bind[stack_inc] = MOD+Shift+comma
bind[stack_reset] = MOD+Shift+space
bind[swap_next] = MOD+Shift+j
bind[swap_prev] = MOD+Shift+k
bind[uniconify] = MOD+Shift+w
bind[version] = MOD+Shift+v
bind[width_grow] = MOD+equal
bind[width_shrink] = MOD+minus
bind[wind_del] = MOD+q
bind[ws_1] = MOD+1
bind[ws_2] = MOD+2
bind[ws_3] = MOD+3
bind[ws_4] = MOD+4
bind[ws_5] = MOD+5
bind[ws_6] = MOD+6
bind[ws_7] = MOD+7
bind[ws_8] = MOD+8
bind[ws_9] = MOD+9
bind[ws_10] = MOD+0
bind[ws_11] = MOD+F1
bind[ws_12] = MOD+F2
bind[ws_13] = MOD+F3
bind[ws_14] = MOD+F4
bind[ws_15] = MOD+F5
bind[ws_16] = MOD+F6
bind[ws_17] = MOD+F7
bind[ws_18] = MOD+F8
bind[ws_19] = MOD+F9
bind[ws_20] = MOD+F10
bind[ws_21] = MOD+F11
bind[ws_22] = MOD+F12
bind[ws_next_all] = MOD+Right
bind[ws_next] = MOD+Up
bind[ws_next_move] = MOD+Shift+Right
bind[ws_prev_all] = MOD+Left
bind[ws_prev] = MOD+Down
bind[ws_prev_move] = MOD+Shift+Left
bind[ws_prior] = MOD+a

#+end_src

* Program Keybindings
These are the keybindings I setup myself, in order to open programs and execute any command I configure, they don't change much, but I add some new one from time to time.
#+begin_src conf
    # Custom program keybindings
program[Discord] = discord
bind[Discord] = MOD+mod1+d
program[term] = alacritty
bind[term] = MOD+Return
program[rofi_run] = rofi -show run
bind[rofi_run] = MOD+r
program[post] = ~/.config/rofi/scripts/qpost.sh
bind[post] = MOD+mod1+p
program[rofi_pass] = rofi-pass
bind[rofi_pass] = MOD+mod1+k
program[tab_switch] = rofi -show window
bind[tab_switch] = Mod1+Tab
program[rofi] = rofi -show drun
bind[rofi] = MOD+p
program[power_menu] = ~/.config/rofi/scripts/power-menu.sh
bind[power_menu] = MOD+Shift+q
program[screenshot] = flameshot gui
bind[screenshot] = MOD+Shift+s
program[firefox] = firefox
bind[firefox] = MOD+Mod1+b
program[pcmanfm] = pcmanfm
bind[pcmanfm] = MOD+Mod1+f
program[pulsemixer] = alacritty -e pulsemixer
bind[pulsemixer] = MOD+mod1+v
#+end_src
