JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

How to use Window Managers to increase your productivity II (Linux)

Window managers are responsible for the placement, arrangement and appearance of all your windows. They can help you to make the most of your display's screen real estate and improve your multitasking experience. Some examples are: FancyZones (Windows), Amethyst (macOS), i3, Awesome WM, and XMonad. Window Managers

Window Managers

 

i3

i3 is a minimalist tiling manager that is primarily targeted at developers and advanced users.

  1. Install some packages: sudo apt install xorg i3 i3blocks fonts-font-awesome suckless-tools picom nitrogen

  2. Logout and select the i3 as the window manager.

  3. When you log in for the first time, you are then prompted on whether to: auto-generate an i3 configuration file (~/.config/i3/config) or use the default configuration file. Press Enter to generate an i3 configuration file. Next, you need to define the i3 modifier key ($mod). You can use the Windows (Super) key or the Alt key. Press Enter to use the Windows key.

  4. Open a terminal: $mod + ENTER. Open more than one terminal and you will notice that i3 automatically tiles them to occupy all available space. You may want to use Mod + v to split them vertically or Mod + h to split them horizontally. You can launch applications with dmenu: $mod + d. You could enter a fullscreen mode (on and off): $mod + f; close an application window with $mod + Shift + q; restart i3: $mod + Shift + r; exit i3: $mod + Shift + e; switch to workspace n: $mod + n; move focused windows to workspace n: $mod + Shift + n. Check i3 - Reference Card.

  5. Install Pop GTK and Material theme, Pop and Papirus icon themes, and lxappearance (a program to change GTK+ themes, icon themes, and fonts): sudo apt install pop-gtk-theme materia-gtk-theme pop-icon-theme papirus-icon-theme lxappearance. Launch it and select in Widget & Icon Theme (Pop) and Default font (Ubuntu, 12).

  6. gedit ~/.config/i3/config (you can always find any issues with your config with i3 -C -c ~/.config/i3/config)

    # Windows modkey
    set $mod Mod4
    # Font for window titles. Will also be used by the bar 
    font pango:Ubuntu Regular 14
    set $myTerm kitty 
    bindsym $mod+Return exec $myTerm # Launch terminal
    bindsym $mod+Shift+x exec i3lock -c 000000 # Lock the system
    bindsym $mod+b exec pavucontrol # Launch PulseAudio Volume Control
    
  7. playerctl is a programme that provides access to media players from the command line: play, pause, previous, etc.

    bindsym $mod+Shift+F1 exec playerctl play-pause # Media player controls.
    bindsym $mod+Shift+F5 exec playerctl pause
    bindsym $mod+Shift+F6 exec playerctl previous
    bindsym $mod+Shift+F7 exec playerctl next
    # We use pactl to adjust volume in PulseAudio. It controls the volume for the default sink -active audio stream-: increase volume, decrease volume, and mute. 
    bindsym $mod+Shift+F3 exec pactl set-sink-volume @[email protected] +6% 
    bindsym $mod+Shift+F2 exec pactl set-sink-volume @[email protected] -5%
    bindsym $mod+Shift+F4 exec pactl set-sink-mute @[email protected] toggle
    

    pactl is a command-line utility to issue control commands to the PulseAudio sound server.

    You may want to change the default sink: (switch between speakers and headphones)

    pacmd list-sinks | grep -e 'name:' -e 'index:'   
    It returns:
      index: 1
        name: <alsa_output.pci-0000_00_1f.3.iec958-stereo> # Headphones
    * index: 5
        name: <alsa_output.pci-0000_01_00.1.hdmi-stereo> # Speakers are the default sink 
    

    Edit sudo vim /etc/pulse/default.pa: and add the following line:

      set-defaults-sink alsa_output.pci-0000_01_00.1.hdmi-stereo
    

    Finally, we need to restart PulseAudio: systemctl –user restart pulseaudio.socket

  8. Let’s use Rofi, a program launcher, instead of dmenu.

      bindsym $mod+d exec rofi -show run
      bindsym $mod+Shift+d exec rofi -show p -modi p:$HOME/.local/bin/rofi-power-menu -theme Paper -font "JetBrains Mono NF 16" -width 20 -lines 6
      # Take screenshots and save them on Dropbox. It uses scrot, a minimalist command-line screen capturing application. 
      bindsym --release $mod+z exec scrot -s ~/Dropbox/%b%d::%H%M%S.png 
      # An alternative is to use flameshot, a powerful yet simple to use screenshot software
      bindsym --release Print exec flameshot full # Take a screenshot of a whole window. You can add -p pathToADirectory.
      bindsym --release Shift+Print exec flameshot gui # Take a screenshot of a screen region.
    
  9. Conky is a free system monitor for the X Window System. We want to turn Conky on/off with a keyboard shortcut (Win+Shift+t), we use the following script conkytoggle.sh: if pgrep conky; then pkill conky; else conky; fi (pgrep look up for processes based on name).

      # It turns your conky on/off with a keyboard shortcut
      bindsym $mod+Shift+t exec /home/nmaximo7/.local/bin/conkytoggle.sh
      # Define names for default workspaces for which we configure key bindings later on.
      set $ws1 "1: Terminal"
      set $ws2 "2: Brave"
      set $ws3 "3: Code"
      set $ws4 "4: Knowledge"
      set $ws5 "5: Nautilus"
      set $ws6 "6: Utils"
    
      bindsym $mod+F1 exec brave
      bindsym $mod+F2 exec code
      bindsym $mod+F3 exec nautilus
      bindsym $mod+F4 exec keepassxc
      bindsym $mod+F5 exec --no-startup-id gedit ~/.config/i3/config
    
      # Forcing apps on workspaces. xprop is a property displayer for X. Type xprop in a terminal, click on the window that you want to get some information (e.g. the popular Google browser), and it will return a lot of information among which: WM_CLASS(STRING) = "google-chrome", "Google-chrome"
      for_window [class="Brave-browser"] move to workspace $ws2
      for_window [class="Code"] move to workspace $ws3
      for_window [class="Gedit"] move to workspace $ws3
      for_window [class="Org.gnome.Nautilus"] move to workspace $ws5
      for_window [class="Alacritty"] move to workspace $ws4
      for_window [class="kitty"] move to workspace $ws1
      for_window [class="KeePassXC"] move to workspace $w6
      # Color config
      set $bgcolor 	 #3F8AC2
      set $ibgcolor    #424242
      set $textcolor   #ffffff
      set $ubgcolor    #ff0000
    
      # Window colors
      client.focused          $bgcolor    $bgcolor   $textcolor         $bgcolor
      client.unfocused        $ibgcolor   $ibgcolor  $textcolor         $ibgcolor
      client.focused_inactive $ibgcolor   $ibgcolor  $textcolor         $ibgcolor
      client.urgent           $ubgcolor   $ubgcolor  $textcolor         $ubgcolor
    
      # i3wm bar
      bar {
              status_command i3status -c ~/.config/i3status/i3status.conf
              colors {
                background $bgcolor
                separator #292929
                focused_workspace   $bgcolor    $bgcolor   $textcolor
                inactive_workspace  $ibgcolor   $ibgcolor  $textcolor
                urgent_workspace    $bgcolor    $bgcolor   $textcolor  
              }
      }
    
      # Apps on start
      exec --no-startup-id nm-applet # Network Manager provides a high-level interface for the configuration of the network interfaces and nm-applet is a desktop environment-independent system tray GUI for it.
      exec --no-startup-id start-pulseaudio-x11 # It starts PulseAudio server, a general purpose sound server intended to run as a middleware between your applications and your hardware devices.
      exec /usr/bin/barrierc -f --no-tray --debug INFO --name myarch [192.168.1.40]:24800 &
      exec_always dropbox start -i
    
  10. Picom is the most popular and widely used compositing window manager for GNU/Linux.

      exec_always picom --config ~/.config/picom/picom.conf
    
  11. Nitrogen is a fast and lightweight background browser and setter. Pick up wallpapers from Derek Taylor: git clone https://gitlab.com/dwt1/wallpapers.git ~/Pictures/wallpapers. The ‐‐random argument selects a file from the defined folder and applies this file as a wallpaper using the zoom fill size (‐‐set‐zoom-fill) setting. Nitrogen will choose random backgrounds from the ~/Pictures/wallpapers directory.

      exec_always nitrogen --set-zoom-fill --random ~/Pictures/wallpapers
      exec_always --no-startup-id copyq # CopyQ is a clipboard manager application
      exec --no-startup-id i3-msg 'workspace 1:Terminal; exec /usr/bin/kitty'
      exec --no-startup-id i3-msg 'workspace 3:Code; exec /usr/bin/code ~/justtothepoint/'
      exec --no-startup-id i3-msg 'workspace 5:Nautilus; exec /usr/bin/nautilus'
      exec --no-startup-id i3-msg 'workspace 2:Brave; exec /usr/bin/brave'
      exec --no-startup-id greenclip daemon>/dev/null # Greenclip is a simple clipboard manager designed to be integrated with Rofi.
      exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
    

    polkit is an authentication agent (sudo pacman -Syu polkit, sudo pacman -Syu polkit-gnome). It is used to make the user of a session prove that they really are the user (by authenticating as the user) or an administrative user (by authenticating as an administrator).

  12. Status bar: mkdir .config/i3status && sudo cp /etc/i3status.conf ~/.config/i3status/i3status.conf && sudo chown myUser:myUser i3status.conf

  13. i3-autolayout is a simple service which helps keep a reasonable windows layout for your i3 manager.

    First, you need to install Cargo: curl https://sh.rustup.rs -sSf | sh. To configure your current shell, run: source “$HOME/.cargo/env”. To install i3-autolayout: cargo install i3-autolayout (no repository clone is needed).

      exec_always --no-startup-id i3-autolayout autolayout
      gaps inner 5 # Gaps between windows
      gaps outer 5
    

Arch (i3)

Arch (i3)

 

Xmonad

Xmonad is a dynamically tiling window manager that is written and configured in Haskell.

  1. sudo apt install xmonad libghc-xmonad-contrib-dev xterm suckless-tools picom nitrogen xterm xmobar, and select lightdm as your display or login manager.
  2. Download a template xmonad config file from HaskellWiki, and place it in .xmonad.
  3. Open a Terminal with Alt (ModKey) + Shift + Enter.
  4. Let’s edit XMonad’s config file, gedit .xmonad/xmonad.hs:
    -- We need this library to startup programs.
    import XMonad.Util.SpawnOnce
    -- We need this libraries to run xmobar
    import XMonad.Util.Run
    import XMonad.Hooks.ManageDocks
    -- The preferred terminal program
    myTerminal = "kitty"
    -- Width of the window border in pixels.
    myBorderWidth = 2
    -- modMask lets you specify which modkey you want to use: mod4Mask is the "windows key". 
    myModMask = mod4Mask
    -- Key bindings
    myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
        -- launch a terminal: Super + Shift + Enter
        [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
        -- launch dmenu: Super + p
        , ((modm, xK_p), spawn "dmenu_run")
        -- Restart xmonad: Super + q.
        , ((modm, xK_q), spawn "xmonad --recompile; xmonad --restart")
    -- You can toggle the layout mode with mod-space, which will cycle through the available modes and switch to workspace N with mod-N (N=1, 2, etc.) The default tiling algorithm partitions the screen into two panes: on the left, a single window (master), on the right, tabbed windows occupying all the pane.
    -- We add avoidStruts layout modifier to our layout to prevent windows from overlapping our xmobar.
    myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
    -- Startup hook
    myStartupHook = do
      spawnOnce "nitrogen --set-zoom-fill --random ~/wallpapers"
      spawnOnce "picom -b"
      spawnOnce "barrier"
      spawnOnce "dropbox"
    -- Run xmonad with xmobar
    main = do
      xmproc <- spawnPipe "xmobar -x 0 /home/myUser/.config/xmobar/xmobar.config"
      -- We change "xmonad defaults" for this code so XMonad.Hooks.ManageDocks could automatically manage xmobar.
      xmonad $ docks defaults
    
  5. Restart xmonad with Alt + q because it is the old Xmonad config file. Next time, you will restart it with: Super + q.

Awesome Window Manager

Awesome Window Manager is a highly configurable window manager. It is free, fast, and extensible.

  1. Installation: sudo apt install awesome.
  2. Awesome provides a default config file. You will usually find it in /etc/xdg/awesome/. Copy it to ~/.config/awesome/: cp /etc/xdg/awesome/rc.lua /home/nmaximo7/.config/awesome
  3. sudo apt install compton nitrogen dmenu
  4. Key bindings. Show all key bindings: Super + s. Open a terminal: Mod4 + Enter, Mod4 is the “Windows key". Close a terminal: Mod4 + Shift + c; Launch programs: Mod4 + r. Mod4 + Left: go to the left desktop; Mod4 + Right: go to right desktop.
  5. Let’s edit Awesome’s config file, gedit /home/myUser/.config/awesome/rc.lua
-- personal variables
terminal = "kitty"
editor = os.getenv("EDITOR") or "nvim"
-- Default modkey. Mod4 is the "special" key (the Windows key)
modkey = "Mod4"
-- Windows are organized following a desired layout. The tiling layout consists of two columns: one for the master window and the other for the "non-master" windows. There is only one master window occupying half of the screen, while all other non-master windows are stacked vertically.
awful.layout.layouts = {
       awful.layout.suit.tile,
}
[...]-- Remove title bars.
{ rule_any = {type = { "normal", "dialog" }
  }, properties = { titlebars_enabled = false }
},[...]
 -- Personal keybindings
    -- Dmenu
    awful.key({ modkey },            "r",     function () awful.util.spawn("dmenu_run") end,
              {description = "Dmenu", group = "launcher"}),
    -- Google Chrome
    awful.key({ modkey },            "c",     function () awful.util.spawn("google-chrome") end,
              {description = "Open Google Chrome", group = "launcher"}),
    -- Station
    awful.key({ modkey },            "b",     function () awful.util.spawn( terminal.." -e /home/myUser/Applications/Station.AppImage") end,
              {description = "Open Station", group = "launcher"}),
beautiful.useless_gap = 5 --The gap or padding between clients.
-- Autostart
awful.spawn.with_shell("barrierc")
awful.spawn.with_shell("dropbox")
awful.spawn.with_shell("nitrogen --set-zoom-fill --random ~/wallpapers")
-- We use picom as compositor. You could edit ~/.config/kitty/kitty.conf, and add the line: _background_opacity 0.9_; so you can get transparency in the terminal.
awful.spawn.with_shell("picom -b")
-- Rofi
    awful.key({ modkey },            "r",     function () awful.util.spawn("rofi -show run") end,
              {description = "Dmenu", group = "launcher"}),
Bitcoin donation

JustToThePoint Copyright © 2011 - 2022 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.