Banner of my i3 window manager config screenshot and some scripts

i3 Window Manager: Introduction and My Personal config


Category: Linux

Date: February 2023
Views: 742


i3 is a tiling window manager designed for Unix-like operating systems. It is lightweight, fast, and highly configurable, making it a popular choice among power users and developers.

Unlike traditional window managers that use a desktop metaphor, i3 divides your screen into a grid of tiles and arranges your windows in a non-overlapping way. This allows you to maximize your screen real estate and be more productive.

Some of the key features of i3 include:

  • Tiling layout
  • Keyboard-driven
  • Multiple workspaces
  • Customizable keybindings
  • Support for floating windows

If you're new to i3, here are some basic commands to get you started:

  • mod+enter: open a new terminal window
  • mod+d: open the dmenu (a launcher for applications)
  • mod+shift+q: close the current window
  • mod+1-9: switch to workspace 1-9
  • mod+shift+1-9: move the current window to workspace 1-9

To customize i3, you'll need to edit the configuration file located at ~/.config/i3/config. This file is written in a simple syntax and allows you to change keybindings, set up custom commands, and configure your i3 setup to your liking.

Overall, i3 is a powerful and highly customizable window manager that can help you be more productive and efficient in your daily work. If you're looking for a lightweight and fast alternative to traditional desktop environments, give i3 a try!

My i3 config file updated over the years

Ever since I installed Arch Linux with i3 window manager. I instantly fallen in love with it and I've never gone back to other systems. it is great. and once you get into the art of creating your own scripts for your needs you will never part ways with i3wm.

Dear visitor Please bear in mind that there are a lot of script files there that are for my personal system, once you copy the config file you have to change some things accordingly. feel free to ask about those files in the comments section bellow and I'll make sure to post them and notify you via Email

    

set $mod Mod4
set $altgr mod5

#i3-gaps
#gaps inner 12

font pango:monospace 12

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
#bindsym    $mod+Return 		exec --no-startup-id i3-sensible-terminal
bindsym     $mod+t			exec --no-startup-id lxterminal
bindsym     $mod+Return 		exec --no-startup-id lxterminal
bindsym     $mod+KP_Enter 		exec --no-startup-id terminator
bindsym     mod1+s		        exec --no-startup-id terminator




# kill focused window
 bindsym     mod1+x 		    kill
 bindsym     button3 	        floating toggle

# start program launchers
bindsym     $mod+shift+x    exec --no-startup-id "rofi -show combi "
bindsym     $mod+c 	    exec --no-startup-id ~/.i3/dm-mylocate.sh
bindsym     $mod+s 	    exec --no-startup-id ~/.i3/s-surf.sh
bindsym     $mod+g 	    exec --no-startup-id ~/.i3/dm-menu.sh '2 - search'
bindsym     mod1+a	    exec --no-startup-id ~/.i3/apropos-man.sh aaa
bindsym     $mod+x	    exec --no-startup-id ~/bin/mylauncher/launcher.sh
#bindsym     $mod+x	    exec --no-startup-id "i3-dmenu-desktop --dmenu='dmenu -i -fn monospace:20 -p run'"

# 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

 # split in horizontal orientation
 bindsym $mod+h split h

 # split in vertical orientation
 bindsym $mod+v split v

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

 # Make the currently focused window a scratchpad
 bindsym $mod+q move scratchpad
 # Show the first scratchpad window
 bindsym $mod+Shift+s scratchpad show
 # change container layout (stacked, tabbed, toggle split)
 bindsym $mod+a layout stacking
 bindsym $mod+z 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

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

 # focus the child container
 #bindsym $mod+d focus child

 # Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1	       "1: root"
set $ws2	       "2: net"
set $ws3	       "3: Media"
set $ws4	       "4: Files"
set $ws5	       "5: Work"
set $ws6	       "6: Docs"
set $ws7	       "7"
set $ws8	       "8"
set $ws9	       "9"
set $ws10 	       "10"
set $ws11 	       "11"
set $ws12 	       "12"
set $ws13 	       "13"

# switch to workspace
 bindsym $mod+ampersand       		 workspace $ws1
 bindsym $mod+eacute 		         workspace $ws2
 bindsym $mod+quotedbl 		         workspace $ws3
 bindsym $mod+apostrophe 	         workspace $ws4
 bindsym $mod+parenleft 		 workspace $ws5
 bindsym $mod+minus 		         workspace $ws6
 bindsym $mod+egrave 		         workspace $ws7
 bindsym $mod+underscore 	         workspace $ws8
 bindsym $mod+ccedilla 		         workspace $ws9
 bindsym $mod+agrave 		         workspace $ws10
 bindsym $mod+parenright	         workspace $ws11
 bindsym $mod+equal		         workspace $ws12
 bindsym $mod+control+twosuperior	 workspace $ws13

# switch to workspace
 bindsym $mod+control+ampersand       		 workspace "14"
 bindsym $mod+control+eacute 		         workspace "15"
 bindsym $mod+control+quotedbl 		         workspace "16"
 bindsym $mod+control+apostrophe 	         workspace "17"
 bindsym $mod+control+parenleft 		 workspace "18"
 bindsym $mod+control+minus 		         workspace "19"
 bindsym $mod+control+egrave 		         workspace "20"
 bindsym $mod+control+underscore 	         workspace "21"
 bindsym $mod+control+ccedilla 		         workspace "22"
 bindsym $mod+control+agrave 		         workspace "23"
 bindsym $mod+control+parenright 	         workspace "24"
 bindsym $mod+control+equal       	         workspace "25"

 # move focused container to workspace
 bindsym $mod+Shift+ampersand	    move container to workspace $ws1
 bindsym $mod+Shift+eacute  	    move container to workspace $ws2
 bindsym $mod+Shift+quotedbl  	    move container to workspace $ws3
 bindsym $mod+Shift+apostrophe      move container to workspace $ws4
 bindsym $mod+Shift+parenleft  	    move container to workspace $ws5
 bindsym $mod+Shift+minus  	    move container to workspace $ws6
 bindsym $mod+Shift+egrave  	    move container to workspace $ws7
 bindsym $mod+Shift+underscore      move container to workspace $ws8
 bindsym $mod+Shift+ccedilla  	    move container to workspace $ws9
 bindsym $mod+Shift+agrave  	    move container to workspace $ws10
 bindsym $mod+Shift+parenright      move container to workspace $ws11
 bindsym $mod+Shift+equal      	    move container to workspace $ws12
 bindsym $mod+Shift+twosuperior     move container to workspace $ws13

 # move focused container to workspace
 bindsym $mod+control+Shift+ampersand       move container to workspace  "14"
 bindsym $mod+control+Shift+eacute  	    move container to workspace  "15"
 bindsym $mod+control+Shift+quotedbl  	    move container to workspace  "16"
 bindsym $mod+control+Shift+apostrophe      move container to workspace  "17"
 bindsym $mod+control+Shift+parenleft  	    move container to workspace  "18"
 bindsym $mod+control+Shift+minus  	    move container to workspace  "19"
 bindsym $mod+control+Shift+egrave  	    move container to workspace  "20"
 bindsym $mod+control+Shift+underscore      move container to workspace  "21"
 bindsym $mod+control+Shift+ccedilla  	    move container to workspace  "22"
 bindsym $mod+control+Shift+agrave  	    move container to workspace  "23"
 bindsym $mod+control+Shift+parenright      move container to workspace  "24"
 bindsym $mod+control+Shift+equal      	    move container to workspace  "25"

bindsym $mod+w		exec --no-startup-id   ~/.i3/move_to_ws.sh
bindsym $mod+shift+w	exec --no-startup-id   ~/.i3/move_to_ws.sh move

 # dual monitor settings
 #exec_always --no-startup-id xrandr --output HDMI-1 --right-of eDP-1
 set $firstmonitor eDP1
 set $secondmonitor HDMI1

 workspace $ws1 output  $firstmonitor
 workspace $ws2 output  $firstmonitor
 workspace $ws4 output  $firstmonitor
 workspace $ws8 output  $firstmonitor
 workspace $ws9 output  $secondmonitor
 workspace $ws3 output  $secondmonitor
 workspace $ws5 output  $secondmonitor
 workspace $ws7 output  $secondmonitor

assign [class="Transmission-gtk"] $ws3
assign [class="Navigator|firefox"] $ws2
assign [class="libreoffice-calc|libreoffice-writer"] $ws5
assign [class="Chromium|Google-chrome"] $ws11
assign [class="Tor Browser"] $ws7
assign [class="VirtualBox Manager"] $ws7
assign [class="sqlitebrowser|DB Browser for SQLite"] $ws6
assign [class="Evince|Org.gnome.gedit|MuPDF"] $ws6
assign [class="VirtualBox Machine"] $ws6
assign [class="obs|explorer.exe|Wine|huniepop.exe|joey_pc.exe"] $ws12
assign [class="openshot|QtCreator|TeXstudio|code-oss|Atom"] $ws11
#
#
#some window parameters
for_window [class="mpv|Tor Browser|Transmission-gtk|vlc|Pavucontrol"] floating enable border normal
for_window [class="Gnome-system-monitor|smplayer|Gnome-calculator"] floating enable border normal
for_window [class="Pidgin|Woeusbgui|Wicd-client.py"] floating enable border normal
for_window [class="VirtualBox Manager|florence|Florence"] floating enable border normal
for_window [class="TelegramDesktop|Qalculate-gtk"] floating enable border normal
for_window [class="feh|fim"] floating enable move absolute position 0px 0px
#for_window [class="Lxterminal|lxterminal"] resize set 1200 700
for_window [class="Xfce4-terminal|Surf"] floating enable border normal
for_window [class="Xfce4-terminal"] resize set 1600 700
for_window [class="Surf"] resize set 1200 650
for_window [class="Xfce4-terminal|Surf"] move absolute position 70 70
for_window [class="Google-chrome|firefox|Chromium"] resize set width 33 ppt
#for_window [class="VirtualBox Machine"] floating enable, resize set 1601 900, move position 0 0
#

#new_window normal
#set $background  #e0eaf9
#
## class                 border  backgr. text    indicator child_border
#client.focused          #271f17 #271f17 #AAAAAA #AAAAAA   #C93F2C
#client.focused_inactive #21211d #1d2121 #a1a1a1 #484e50   #1d2121
#client.unfocused        #333333 #222222 #888888 #292d2e   #222222
#client.urgent           #4a4b4c #4a4b4c #AAAAAA #AAAAAA   #4a4c4b
#client.placeholder      #000000 #0c0c0c #AAAAAA #000000   #0c0c0c
#
#client.background       #111111

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

# 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 j resize shrink width 10 px or 10 ppt
		bindsym k resize grow height 10 px or 10 ppt
		bindsym l resize shrink height 10 px or 10 ppt
		bindsym m 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 shrink height  10 px or 10 ppt
		bindsym Up    resize grow   height  10 px or 10 ppt
		bindsym Right resize grow   width   10 px or 10 ppt

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

 bindsym $mod+r mode "resize"


# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)

#Polybar to replace the default i3statusbar:
#exec_always --no-startup-id $HOME/.config/polybar/launch.sh boot

bar {
    colors {
        background #000000
        # statusline #00A5FF #that neon blue
        separator #000000
        focused_workspace  #4c7899 #285577 #ffffff
        active_workspace   #333333 #5f676a #ffffff
        inactive_workspace #333333 #222222 #888888
        urgent_workspace   #2f343a #900000 #ffffff
    }
    font pango:FontAwesome Bold 9
#tray_output none
    status_command i3blocks -c ~/.i3/top-bar/i3blocks.conf
    position 	top
#bindsym --release button3 	exec --no-startup-id scrot '%Y-%m-%d-%s_$wx$h.png' -e 'mv $f ~/Pictures/' && mplayer ~/.i3/Nikon.ogg
}

#bar {
#    font pango:FontAwesome Bold 20
#    status_command i3blocks -c ~/.i3/bottom-bar/i3blocks.conf
#    position 	bottom
#    modifier    Mod4
#    mode        hide
#    hidden_state hide
#    workspace_buttons no
#}

# Pulse Audio controls
 bindsym XF86AudioRaiseVolume	    exec --no-startup-id /home/mosaid/bin/vv + 2
 bindsym XF86AudioLowerVolume	    exec --no-startup-id /home/mosaid/bin/vv - 2
 bindsym XF86AudioMute 		    exec --no-startup-id /home/mosaid/bin/vv mute

 # Screen brightness controls
 #bindsym XF86MonBrightnessUp 	    exec --no-startup-id xbacklight -inc 20 # increase screen brightness
 #bindsym XF86MonBrightnessDown     exec --no-startup-id xbacklight -dec 20 # decrease screen brightness
 bindsym XF86MonBrightnessUp 	    exec --no-startup-id light -A 10 # increase screen brightness
 bindsym XF86MonBrightnessDown 	    exec --no-startup-id light -U 10 # decrease screen brightness

# Touchpad controls
#bindsym XF86TouchpadToggle 	exec --no-startup-id /some/path/toggletouchpad.sh # toggle touchpad
#bindsym XF86TouchpadToggle 	exec --no-startup-id vlc

# Media player controls
 bindsym XF86AudioPlay	 	        exec --no-startup-id /home/mosaid/bin/mympc.sh pp
 bindsym XF86AudioPause 	 	exec --no-startup-id /home/mosaid/bin/mympc.sh pp
 bindsym XF86AudioNext 	 	        exec --no-startup-id /home/mosaid/bin/mympc.sh
 bindsym XF86AudioPrev 	 	        exec --no-startup-id /home/mosaid/bin/mympc.sh p

 #screenshots
bindsym Print				    exec --no-startup-id  ~/.i3/screenshot.sh 1
bindsym mod1+control+p			    exec --no-startup-id  ~/.i3/screenshot.sh 1
bindsym mod1+control+o			    exec --no-startup-id  ~/.i3/screenshot.sh 2

#other keyboard shortcuts
bindsym $mod+l				        exec --no-startup-id  betterlockscreen --lock
bindsym $mod+n				        exec --no-startup-id  ~/bin/playFromClipboard.sh npr
bindsym $mod+m					exec --no-startup-id  ~/.i3/top-bar/user.sh menu
bindsym mod1+space				exec --no-startup-id  ~/bin/mpd-controls.sh pp
bindsym control+mod1+space			exec --no-startup-id  ~/bin/mpd-controls.sh m
bindsym mod1+n				        exec --no-startup-id  ~/bin/mpd-controls.sh n
bindsym mod1+b				        exec --no-startup-id  ~/bin/mpd-controls.sh p
bindsym mod1+v				        exec --no-startup-id  ~/bin/mpd-controls.sh v
bindsym mod1+c				        exec --no-startup-id  ~/bin/mpd-controls.sh vv
bindsym mod1+r				        exec --no-startup-id  ~/bin/mpd-controls.sh r
bindsym mod1+w				        exec --no-startup-id  ~/.i3/pplay/play.sh
#bindsym mod1+f				        exec --no-startup-id  ~/bin/conkyfont.sh
bindsym $mod+mod1+g				exec --no-startup-id  ~/.i3/shortcuts-conky.sh
bindsym mod1+d				        exec --no-startup-id  ~/bin/myBash_functions.sh eglllr
bindsym mod1+t				        exec --no-startup-id  ~/bin/myBash_functions.sh ttor
bindsym control+less				exec --no-startup-id  ~/bin/ws.sh ++
bindsym control+shift+less			exec --no-startup-id  ~/bin/ws.sh --

#startup
#exec  		    --no-startup-id wicd-gtk -t
#exec		    --no-startup-id firefox
#exec		    --no-startup-id pidgin
#exec            --no-startup-id transmission-gtk -m
#exec		    --no-startup-id udiskie
#exec		    --no-startup-id ~/.i3/start-conky.sh
#exec		    --no-startup-id ~/.i3/prayerTime.sh
#exec		    --no-startup-id ~/.i3/pplay/pplayEngine.sh
exec		    --no-startup-id ~/.i3/onedriveMonitor.sh
#exec		    --no-startup-id ~/.i3/touchpadSettings.sh
exec  	        --no-startup-id redshift
exec_always	    --no-startup-id numlockx on
exec_always	    --no-startup-id picom --config ~/.i3/picom.conf
exec_always     --no-startup-id xkb-switch --i3

set $mode_display Mirrored (c) , Ext Screen (v) , HDMI ON (b) , HDMI OFF (n)
mode "$mode_display" {
    bindsym c 	exec  --no-startup-id ~/.i3/display.sh mirrored , mode "default"
    bindsym v 	exec  --no-startup-id ~/.i3/display.sh extended , mode "default"
    bindsym b 	exec  --no-startup-id ~/.i3/display.sh mirrored , mode "default"
    bindsym n 	exec  --no-startup-id ~/.i3/display.sh default  , mode "default"

    bindsym Return mode "default"
    bindsym Escape mode "default"
}
#
 bindsym $mod+d mode "$mode_display"
#bindsym $mod+d 		    exec --no-startup-id ~/.i3/display.sh
#bindsym XF86Display 	exec --no-startup-id ~/.i3/display.sh

# multitouch gestures
 bindsym --whole-window $mod+button10 workspace prev_on_output
 bindsym --whole-window $mod+button11 workspace next_on_output

#keyboard layout
exec_always --no-startup-id "setxkbmap -model pc104 -layout fr,ar -variant ,, -option grp:alt_shift_toggle"
#bindsym --release Caps_Lock exec --no-startup-id pkill -SIGRTMIN+11 i3blocks
#bindsym --release Num_Lock  exec --no-startup-id pkill -SIGRTMIN+11 i3blocks

#switch to greeter and login
#bindsym $mod+twosuperior exec dm-tool switch-to-greeter


set $playFromClipboard play From ClipBoard (c), play next youtube video (v)
mode "$playFromClipboard" {

    bindsym c  exec --no-startup-id ~/bin/playFromClipboard.sh
    bindsym v  exec --no-startup-id ~/bin/playFromClipboard.sh n

    bindsym Escape mode "default"
}

 bindsym mod1+p mode "$playFromClipboard"

set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
    bindsym l exec --no-startup-id i3exit.sh lock, mode "default"
    bindsym e exec --no-startup-id i3exit.sh logout, mode "default"
    bindsym s exec --no-startup-id i3exit.sh suspend, mode "default"
    bindsym h exec --no-startup-id i3exit.sh hibernate, mode "default"
    bindsym r exec --no-startup-id i3exit.sh reboot, mode "default"
    bindsym Shift+s exec --no-startup-id i3exit.sh shutdown, mode "default"

    # back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
 bindsym $mod+Shift+q mode "$mode_system"


    



742 views

Previous Article Next Article

0 Comments, latest

No comments.