JustToThePoint English Website Version
JustToThePoint en español

Maximize your online presence with our exclusive offer: Get a stunning hero banner, the hero you need and deserve, at an unbeatable price! Bew, 689282782, bupparchard@gmail.com

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 

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 # sudo pacman -S ttf-ubuntu-font-family
    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 @DEFAULT_SINK@ +6% 
    bindsym $mod+Shift+F2 exec pactl set-sink-volume @DEFAULT_SINK@ -5%
    bindsym $mod+Shift+F4 exec pactl set-sink-mute @DEFAULT_SINK@ 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).

      # Copy Conky's configuration file cp /etc/conky/conky.conf .config/conky/conky.conf
      # dracula-01.conkyrc (i3)     
    
      conky.config = {
    
        --Various settings
        background = true, 							-- forked to background
        cpu_avg_samples = 2,						-- The number of samples to average for CPU monitoring.
        diskio_avg_samples = 10,				-- The number of samples to average for disk I/O monitoring.
        double_buffer = true,						-- Use the Xdbe extension? (eliminates flicker)
        if_up_strictness = 'address',		-- how strict if testing interface is up - up, link or address
        net_avg_samples = 2,						-- The number of samples to average for net data
        no_buffers = true,							-- Subtract (file system) buffers from used memory?
        temperature_unit = 'fahrenheit',-- fahrenheit or celsius
        text_buffer_size = 2048,				-- size of buffer for display of content of large variables - default 256
        update_interval = 1,						-- update interval
        imlib_cache_size = 0,           -- disable image cache to get a new spotify cover per song
    
          -- Placement (For SINGLE monitor users!)
        alignment = 'top_right',	-- top_left,top_middle,top_right,bottom_left,bottom_middle,bottom_right,
        gap_x = 50,								-- pixels between right or left border
        gap_y = 70,								-- pixels between bottom or left border
    
          -- Size
        minimum_height = 200,						-- minimum height of window
        minimum_width = 260,						-- minimum width of window
        maximum_width = 260,						-- maximum width of window
    
        --Graphical
        border_inner_margin = 5, 				-- margin between border and text
        border_outer_margin = 5, 				-- margin between border and edge of window
        border_width = 0, 							-- border width in pixels
        default_bar_width = 260,				-- default is 0 - full width
        default_bar_height = 10,				-- default is 6
        default_gauge_height = 25,			-- default is 25
        default_gauge_width =40,				-- default is 40
        default_graph_height = 40,			-- default is 25
        default_graph_width = 153,			-- default is 0 - full width
        default_shade_color = '#000000',-- default shading colour
        default_outline_color = '#000000',-- default outline colour
        draw_borders = false,						-- draw borders around text
        draw_graph_borders = true,			-- draw borders around graphs
        draw_shades = false,						-- draw shades
        draw_outline = false,						-- draw outline
        stippled_borders = 0,						-- dashing the border
    
        --Textual
        format_human_readable = true,				-- KiB, MiB rather then number of bytes
        font  = 'Source Code Pro:bold:size=15',-- the default font used
        font2 = 'Raleway:bold:size=30',     -- font for the time
        font3 = 'Ubuntu:size=14',           -- font for the date
        font4 = 'Raleway:bold:size=9',      -- font for the keybindings heading
        max_text_width = 0,							-- 0 will make sure line does not get broken if width too smal
        max_user_text = 16384,					-- max text in conky default 16384
        override_utf8_locale = true,		-- force UTF8 requires xft
        short_units = true,							-- shorten units from KiB to k
        top_name_width = 21,						-- width for $top name value default 15
        top_name_verbose = false,					-- If true, top name shows the full command line of  each  process - Default value is false.
        uppercase = false,							-- uppercase or not
        use_spacer = 'none',						-- adds spaces around certain objects to align - default none
        use_xft = true,								  -- xft font - anti-aliased font
        xftalpha = 1,								    -- alpha of the xft font - between 0-1
    
        --Windows
        own_window = true,							-- create your own window to draw
        own_window_argb_value = 255,		-- real transparency - composite manager required 0-255
        own_window_argb_visual = true,	-- use ARGB - composite manager required
        own_window_class = 'Conky',			-- manually set the WM_CLASS name for use with xprop
        own_window_colour = '#282a36',	-- set colour if own_window_transparent no
        own_window_transparent = false,	-- if own_window_argb_visual is true sets background opacity 0%
        own_window_title = 'xmonad_conky',			-- set the name manually
        own_window_type = 'desktop',		-- if own_window true options are: normal/override/dock/desktop/panel
        own_window_hints = 'undecorated,below,above,sticky,skip_taskbar,skip_pager',  -- if own_window true - just hints - own_window_type sets it
    
        --Colors (Dracula)
        color0 = '#bd93f9',
        color1 = '#f8f8f2',
        color2 = '#8be9fd',
        color2 = '#8be9fd',
        color3 = '#50fa7b',
      };
    
      conky.text = [[
        ${alignc}${color0}${font2}${time %H:%M}${font}
        ${voffset 6}${alignc}${color0}${font3}${time %b %d, %Y}${font}${color}
        ${voffset 18}${goto 12}${color3}CPU${goto 50}$cpu%
        ${color2}${goto 12}${cpubar 8,254}
        ${voffset 5}${goto 12}$font${color1}${top name 1}$alignr$color${top cpu 1}%
        ${goto 12}${color1}${top name 2}$alignr$color${top cpu 2}%
        ${goto 12}${color1}${top name 3}$alignr$color${top cpu 3}%
        ${voffset 14}${goto 12}${color3}RAM${goto 50}$mem/$memmax
        ${color2}${goto 12}${membar 8,254}${color}
        ${goto 12}${voffset 5}${color1}${top_mem name 1}$alignr$color${top_mem mem_res 1}
        ${goto 12}${color1}${top_mem name 2}$alignr$color${top_mem mem_res 2}
        ${goto 12}${color1}${top_mem name 3}$alignr$color${top_mem mem_res 3}
        ${color5}${font Roboto:size=10}${voffset 2}S Y S T E M   ${hr 2}${font}${color}
        ${color2}${voffset 8}Hostname:${color}${alignr}${nodename}
        ${color2}Distro:${color}${alignr}$sysname ${alignr}${execi 6000 lsb_release -a | grep 'Description'|awk {'print $2 $3'}}
        ${color2}Kernel:${color}${alignr}${exec uname} ${exec uname -r}
        ${color2}Nvidia:${color}${alignr}${execp  nvidia-smi --query-supported-clocks=gpu_name --format=csv,noheader}
        ${color2}IP Address:${color}${alignr}${addrs enp5s0}/${execi 1000 wget -q -O- http://ipecho.net/plain; echo}
        ${color2}Eth Up:${color} ${alignr}${offset -10$}${upspeed enp5s0}${alignr}${upspeedgraph enp5s0 8,100}
        ${color2}Eth Down:${color} ${alignr}${offset -10$}${downspeed enp5s0}${alignr}${downspeedgraph enp5s0 8,100}
        ${color2}File system:${color} ${alignr}${fs_used /} / ${fs_size /} $alignr${fs_used_perc /}%
        ${voffset 18}${color1}${alignc}${font4}i3 KEYBINDINGS${font}${color}
        ${color1}${hr}${color}
        ${color1}[S]+[RET]${alignr}${color2}open terminal${color}
        ${color1}[S]+[d]${alignr}${color2}launch rofi${color}
        ${color1}[S]+[b]${alignr}${color2}launch pavucontrol${color}
        ${color1}[S]+[SHIFT]+d${alignr}${color2}rofi power menu${color}
        ${color1}[S]+hjkl${alignr}${color2}move win focus${color}
        ${color1}[S]+[SHIFT]+jklñ${alignr}${color2}move focused  window${color}
        ${color1}[S]+[1-9]${alignr}${color2}switch workspace${color}
        ${color1}[S]+[SHIFT]+[1-9]${alignr}${color2}send window${color}
        ${color1}[S]+[SHIFT]+q${alignr}${color2}kill focused windows${color}
        ${color1}${hr}${color}
        ${color1}[S]+[SHIFT]+c${alignr}${color2}reload config file${color}
        ${color1}[S]+[SHIFT]+r${alignr}${color2}restart i3${color}
        ${color1}[S]+[SHIFT]+h${alignr}${color2}my Knowledge system${color}
        ${color1}[S]+[SHIFT]+t${alignr}${color2}toggle Conky${color}
        ${color1}[S]+F1, F2, F3${alignr}${color2}Brave, code, Nautilus${color}
        ${color1}[S]+F4, F5${alignr}${color2}KeePassXC, edit i3 config${color}
        ${color1}[S]+F7${alignr}${color2}Naughty List${color}
        ${color1}[S]+z${alignr}${color2}take a screenshot${color}
        ${color1}[S]+[SHIFT]+F1-F5v${alignr}${color2}Play,Up,Down,Mute,Pause${color}
        ${color1}${hr}${color}
        ${color1}[S]+h${alignr}${color2}split in horizontal orientation${color}
        ${color1}[S]+v${alignr}${color2}split in vertical orientation${color}
        ${color1}[S]+f${alignr}${color2}enter fullscreen mode${color}
        ${color1}[S]+s,w,e${alignr}${color2}change container layout${color}
        ${color1}[S]+[SHIFT]+space${alignr}${color2}togle tiling/floating${color}
        ${color1}${hr}${color}
        ${color1}Vim: v/V${alignr}${color2}select characters/lines
        ${color1}d/y "+y${alignr}${color2}cut/copy
        ${color1}P/p "+p${alignr}${color2}paste before/after cursor
        # Weather    
        ${color orange}${voffset 2}${hr 1}
        ${font Dejavu Sans Mono:size=12}${alignc War}${color green}${execpi 300 curl wttr.in/Málaga?T0 --silent --max-time 3}${font ubuntu:size=10.5}
      ]];
    

    gedit/nvim ~/.config/i3/config

      # 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
    
      # Start i3status (statusbar). mkdir cd .config/i3status/, sudo cp /etc/i3status.conf ~/.config/i3status/i3status.conf    
      bar {
          status_command i3status --config ~/.config/i3status/i3status.conf
      }
    
      # 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
      exec --no-startup-id greenclip daemon # Greenclip is a clipboard manager, copy some text and paste with Ctrl + Shift + V
    
  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) 

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 - 2024 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. Social Issues, Join us.

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.