From TonyWiki
Jump to navigation Jump to search

i3 is a tiling display manager for Linux based systems. Sometimes, there are handy options you can add to the config which I will list here.

i3 config

Trying to configure i3 but missing common functionality? Here are some helper commands I use!

Open certain programs in floating mode

This is useful for some programs like 'pavucontrol' or 'qt5ct'. Use this template for other programs as well

for_window [class="SMPlayer"] floating enable
for_window [class="qt5ct"] floating enable sticky enable border normal

Change system volume/mute from media controls

For muting, using ALSA to mute the Master output is a safe bet.

bindsym XF86AudioMute exec amixer -q set Master toggle

To adjust system volume, I have done this in 2 main ways:

Using Pulseaudio

Here, you can change how much you want to adjust the volume by (eg: 1%), and the sink number (eg: 2).

For example, I had the regular volume buttons change the 2nd sink volume, which is my USB DAC, and 'Mod1+XF86AudioRaiseVolume' to change the internal sound card volume by having it control sink 1.

bindsym XF86AudioRaiseVolume exec "pactl set-sink-volume 2 +1%"
bindsym XF86AudioLowerVolume exec "pactl set-sink-volume 2 -1%"

Using ALSA

This will change the volume of whatever output device is selected as default. I have found a slight glitch, if you adjust volume too fast, the left and right channels may imbalance. In this case, bring the volume down to 0, then back up.

bindsym XF86AudioRaiseVolume exec "amixer -q set Master 5%+ unmute"
bindsym XF86AudioLowerVolume exec "amixer -q set Master 5%- unmute"

Disable mouse acceleration

I don't like mouse acceleration usually, and prefer to use a linear model. On full DE's like KDE, there is always an option to set this.

In i3, we can set all mice to disable acceleration using libinput and xinput

exec_always for id in $(xinput list | grep "pointer" | cut -d '=' -f 2 | cut -f 1); do xinput --set-prop $id 'libinput Accel Profile Enabled' 0, 1; done

Emergency task end

Need to quickly shut off youtube videos?

bindsym Control+Mod1+q exec "killall mpv && killall vlc"

Audio player play/pause/skip/back controls

This is easy using playerctl

# media player
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

Lock computer

Using xscreensaver

bindsym Control+Mod1+l exec "xscreensaver-command -lock"

Using i3lock-fancy

bindsym Control+Mod1+l exec "i3lock-fancy -t 'Hello'"

Set desktop background color

Don't want to stare at your DM as your wallpaper?

exec --no-startup-id xsetroot -solid "#333333" &

Just pick the background color.

Notification support

Instead of each program using notifications, an easy solution is to use dunst. It supports notifications through notify-send as well as their own program. To launch on startup

exec dunst&

Pick which monitor gets the i3bar icons

Programs that stay in the tray on i3bar usually default to one of your monitors. To change this, just tell i3 which monitor to put the tray on.

bar {
        status_command i3status
        tray_output primary

Where primary defaults to your primary monitor. This can be a single monitor as well.

Use rofi instead of dmenu

Rofi is a program launcher with some more features.

Just bind the key used to launch dmenu to rofi instead.

bindsym Mod1+d exec exec rofi -combi-modi window#drun#ssh -theme gruvbox-dark -font "hack 10" -show combi