# Cheat Sheet

## Audio

### Keyboard keys

Install `pactl`and `playerctl`.

{% code title="\~/.config/i3/config" %}

```bash
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness

# Touchpad controls
bindsym XF86TouchpadToggle exec /some/path/toggletouchpad.sh # toggle touchpad

# Media player controls
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
```

{% endcode %}

{% code title="toggletouchpad.sh" %}

```bash
#!/bin/bash
if synclient -l | grep "TouchpadOff .*=.*0" ; then
    synclient TouchpadOff=1 ;
else
    synclient TouchpadOff=0 ;
fi
```

{% endcode %}

#### References

<https://faq.i3wm.org/question/3747/enabling-multimedia-keys/?answer=3759#post-id-3759>

### Tray

Install `pasystray`.

```bash
sudo apt install pasystray
```

Then edit your config file.

{% code title="\~/.config/i3/config" %}

```bash
exec_always /usr/bin/pasystray
```

{% endcode %}

## Autoload application&#x20;

### On login

{% code title="\~/.config/i3/config" %}

```bash
exec firefox
```

{% endcode %}

### On i3 reload

{% code title="\~/.config/i3/config" %}

```bash
exec_always firefox
```

{% endcode %}

## bindsym

```bash
bindsym $mod+g exec "rofi -show run"
bindsym $mod+x exec "xdg-open ."
```

## Multiple monitors

Install arandr.

```bash
sudo apt install arandr
```

Then, press `$mod+d` and run `arandr`.

Make your changes, click on "Save as" then save your config file at \`\~/.screenlayout/dual.sh\` and change permissions.

```
chmod +rx ~/.screenlayout/dual.sh
```

Open the file saved, copy its content and paste it in your `~/.config/i3/config` with `exec_always` option.

{% code title="\~/.config/i3/config" %}

```bash
exec --no-startup-id ~/.screenlayout/dual.sh
```

{% endcode %}

Restart i3 pressing `$mod+Shift+r`.

## Theme

<https://youtu.be/ARKIwOlazKI>

## Wallpaper

Install `feh`.

```bash
sudo apt install feh
```

Test it.

```bash
feh --bg-scale $HOME/Pictures/wallpaper.jpg
```

Always use it.

{% code title="\~/.config/i3/config" %}

```bash
exec_always feh --bg-scale $HOME/Pictures/wallpaper.jpg
```

{% endcode %}

## Workspaces

### Workspace icons

Downlado the latest Font-Awesome release: <https://github.com/FortAwesome/Font-Awesome/releases>

Extract the file downloaded.

Create a font directory and copy the font file.

```bash
mkdir ~/.fonts
cp webfonts/*.ttf ~/.fonts
```

Go to: <https://fontawesome.com/cheatsheet>

Find your icon and copy th icon itself.

Paste the icon in the workspace string

{% code title="\~/.config/i3/config" %}

```bash
set $workspace1 "1: Terminals "
```

{% endcode %}

Logout: `$mod+shift+e`.

### Open application in a specific workspace

First, you need to find the window class.

To do so, open the application you want, open a termianal and run `xprop`.

The cursos will become a cross , click on your application window.

Get the second value of " `WM_CLASS(STRING)`.&#x20;

For example: `WM_CLASS(STRING) = "x-terminal-emulator", "X-terminal-emulator"`

Edit your config file as follows.

{% code title="\~/.config/i3/config" %}

```bash
assign [class="X-terminal-emulator"] 1
# Or, if you have a workspace variable...
# assign [class="PUT-YOUR-CLASS-HERE"] $workspace1
```

{% endcode %}

### Rename workspace

Rename workspace `1` to `Terminals`.

{% code title="\~/.config/i3/config" %}

```bash
set $workspace1 "1: Terminals"
bindsym $mod+1 workspace $workspace1
bindsym $mod+Shift+1 move container to workspace $workspace1
```

{% endcode %}

Logout: `$cmd+shift+e`.
