Skip to content

Instantly share code, notes, and snippets.

@mtekman
Last active November 22, 2020 23:58
Show Gist options
  • Save mtekman/5f885e99ebabc6c68f85790581eceb02 to your computer and use it in GitHub Desktop.
Save mtekman/5f885e99ebabc6c68f85790581eceb02 to your computer and use it in GitHub Desktop.
Configs (single-file dotfiles using org-mode)
  • Global public configs for multiple utils. Makes use of tangled files.
  • C-c C-v t to export all.

First Run

Nix System

It’s slightly paradoxical to have the system config here, especially when it requires this dotfile to be downloaded first, but the other option is to have a seperate repo for system configs which seems pointless when this repo will still need to be cloned.

Steps to Run

  1. Add the following channels:

    These will enable the latest release and the home-manager. If you are having problems updating to 20.03, then incrementally upgrade in 6 month intervals.

    nix-channel --add https://nixos.org/channels/nixos-20.03 nixos
    nix-channel --add https://github.com/rycee/home-manager/archive/release-20.03.tar.gz home-manager
    nix-channel --update
        
  2. Export the below script only (C-u C-c C-v t). (If you are root, then maybe remove the /sudo:: from the header.)
    # Edit this configuration file to define what should be installed on
    # your system.  Help is available in the configuration.nix(5) man page
    # and in the NixOS manual (accessible by running ‘nixos-help’).
    
    { config, pkgs, lib, ... }:
    
    let
      hosts = pkgs.fetchurl {
        url = "https://raw.githubusercontent.com/StevenBlack/hosts/2c1f72fd4765fcf31cd70134677ecc38ed860589/hosts";
        sha256 = "0v4gzxcvmmcywlrmvlc0222p4js9acg7sfm21902kp8xir70rac2";
      };
    
      gitzsh = pkgs.fetchurl {
        url = "https://raw.githubusercontent.com/sgoranson/zsh/1c5e3ff626bcd11b123be67587368bc9e437cde1/git.zsh";
        sha256 = "14mb0cxb9x5jdrmvjsgvyyyqhq0rnjj86m6y2gj8prhsgq2k3wvv";
      };
    
      R-with-my-packages = with pkgs; rWrapper.override { packages = with rPackages; [ ggplot2 ggdendro reshape2 cowplot tidyr dplyr plotly ]; };
    in
    {
      imports =
        [ # Include the results of the hardware scan.
        ./hardware-configuration.nix
        <home-manager/nixos>
        ];
    
        # Use the systemd-boot EFI boot loader.
        boot.loader.systemd-boot.enable = true;
        boot.loader.efi.canTouchEfiVariables = true;
    
        networking.hostName = "nickel"; # Define your hostname.
        networking.extraHosts = builtins.readFile hosts; # stevenblack
        # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
    
        # Select internationalisation properties.
        console.font = "Lat2-Terminus16";
        console.keyMap = "de";
    
        i18n.defaultLocale = "en_GB.UTF-8";
    
        # Set your time zone.
        time.timeZone = "Europe/Zurich";
    
    
        environment = {
          # List packages installed in system profile. To search by name, run:
          # $ nix-env -qaP | grep wget
          systemPackages = with pkgs; [
    
            ### FHS user environment ###################################################
            # A very glorious sandbox that uses the Linux FHS-compatible sandbox. As   #
            # described by the Nixpkgs manual:                                         #
            #   This allows one to run software which is hard or unfeasible to patch   #
            #   for NixOS -- 3rd-party source trees with FHS assumptions, games        #
            #   distributed as tarballs, software with integrity checking and/or       #
            #   external self-updated binaries. It uses Linux namespaces feature to    #
            #   create temporary lightweight environments which are destroyed after    #
            #   all child processes exit, without root user rights requirement.        #
            ############################################################################
    
            # WM
            acpi arandr dunst sudo
            lispPackages.stumpwm
            lispPackages.swank
            i3-gaps
            libnotify pavucontrol
            xdotool xorg.xbacklight xorg.xev xorg.xkill xorg.xwininfo xorg.xhost xorg.xmodmap
            hsetroot compton
            lf
    
            # XFCE4
            xfce.xfce4-session xfce.thunar xfce.xfce4-power-manager xfce.xfce4-volumed-pulse
    
            #autorandr srandrd  # automate display management
            #xnee # automate desktop macros
            feh
            xautolock i3lock
            w3m # better than lynx or links2
            veracrypt
            pass #gnupg
            zoom-us
            ly
            pdftk
    
            p7zip unrar
    
            # Apps
            chromium firefox xclip xsel ipfs gparted
            weechat blender
    
            # Dev
            git R unzip gcc gfortran libxml2 xml2 gnumake cmake libtool libusb
            conda
    
            # do not install conda, it is simply not compatible with Nix.
            # use an ubuntu VM instead
    
            # CLI
            ascii zsh zsh-git-prompt lambda-mod-zsh-theme
            ncdu nload hexedit htop gawk gnused
            nmap openssl pv rsync tree wget
            parallel fortune screen gnuplot
    
            manix ## nixos options
    
            R-with-my-packages
    
            (python38.withPackages(ps: with ps; [ pip setuptools jupyterlab pandas scipy]))
            # scanpy?
            # It is recommended to *always* use a virtual environment when
            # installing via pip.
    
            # Home packages
            kitty redshift mpv ffmpeg-full
            imagemagick graphviz ripgrep fasd broot lsd## emacs
            ##okular asciiquarium gimp libreoffice inkscape
    
          ];
    
          variables = {
            TERMINAL = "kitty";
            EDITOR = "emacsclient -c";
            TERM = "xterm-256color";
            # needed so that qutebrowser can cache passwords somewhere writable
            TLDEXTRACT_CACHE = "/var/tmp/.tldcache";
          };
    
        };
    
        hardware = {
          bluetooth = {
            enable = true;            # Enable bluetooth
            powerOnBoot = true;       # Let bluetooth enable on startup
          };
          pulseaudio = {
            enable = true;                    # Enable pulseaudio sound manager
            package = pkgs.pulseaudioFull;    # Use full version (bluetooth support)
            #support32Bit = true;              # Sound support for Steam
          };
        };
    
        programs = {
          adb.enable = true;                  # Enables the Android Debug Bridge
          light.enable = true;                # make sure user is part of video grouup
          gnupg.agent.enable = true;          # For accessing passwords
          bash.enableCompletion = true;       # Enable completion in bash shell
    
          # texlive = {
            #   enable = lib.mkDefault false;
            #   extraPackages = texlive: {
              #     inherit (texlive)
              #     algorithms
              #     collection-fontsrecommended
              #     collection-genericrecommended
              #     collection-latexrecommended
              #     collection-xetex
              #     hyphen-swedish
              #     mathdesign
              #     moderncv
              #     qrcode
              #     relsize
              #     ticket
              #     wrapfig
              #     ;
              #   };
              # };
              zsh = {
                enable = true;
                promptInit =  (builtins.readFile gitzsh) + ''
                  ## load
                  autoload -U colors && colors
                  setopt promptsubst
                  source ${pkgs.lambda-mod-zsh-theme}/share/zsh/themes/lambda-mod.zsh-theme
                  function get_right_prompt() {
                  if type git &>/dev/null && git rev-parse --git-dir > /dev/null 2>&1; then
                  echo -n "$(git_prompt_info 2> /dev/null)%{$reset_color%}"
                  else
                  echo -n "%{$reset_color%}"
                  fi
                  }
                  ##PROMPT=$'\n'$LAMBDA' %{$fg_bold[$USERCOLOR]%}%n %{$fg_no_bold[magenta]%} %'$\{LAMBDA_MOD_N_DIR_LEVELS:-3\}'~» %{$reset_color%}'
                  PROMPT=$LAMBDA'%{$fg_no_bold[magenta]%} %'$\{LAMBDA_MOD_N_DIR_LEVELS:-3\}'~» %{$reset_color%}'
                  TERM=xterm-256color
                  eval "$(fasd --init auto)"
                '';
                autosuggestions.enable = true;
                enableCompletion = true;
                syntaxHighlighting = {
                  enable = true;
                  highlighters = [ "main" "pattern" ];
                  patterns = {
                    "rm -rf *" = "fg=red,bold,bg=white";
                  };
                };
                shellAliases = {
                  mc="mc -S gotar -C menunormal=red";
                  ls="lsd";
                  br="broot";
                  batf = "bat (fzf)";
                  cp = "rsync -ahv --progress";
                  dirsize = "du -sh";
                  em = "emacsclient -c";
                  emf = "emacsclient -c (fzf)";
                  config = "emacsclient -c /sudo::/etc/nixos/configuration.nix";
                  evalnix = "nix-instantiate --eval";
                  fonts = "fc-list : family | cut -f1 -d\",\" | sort";
                  gparted = "sudo fish -c gparted";
                  hash = "nix-hash --type sha256 --flat --base32";
                  history = "history | bat";
                  nix-repl = "nix repl";
                  prettify = "python -m json.tool"; # Prettify json!
                  rebuild = "sudo nixos-rebuild switch";
                  rebuilt = "sudo nixos-rebuild switch";
                  upgrade = "sudo nixos-rebuild switch --upgrade";
                  nix-options = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix";
                  pid = "ps aux | grep";
                };
                ## Look at the other definitions in ~/nixos.options.json
                loginShellInit = ''
                  bindkey "^[[1;5C" forward-word
                  bindkey "^[[1;5D" backward-word
                '';
              };
        };
    
        # # Configure fonts
        fonts = {
          fonts = with pkgs; [
            corefonts
            font-awesome-ttf
            #input-fonts
            noto-fonts-cjk
            noto-fonts-emoji
            powerline-fonts
            helvetica-neue-lt-std
          ];
        };
    
        # # used by redshift
        location.latitude = 40.0;
        location.longitude = 7.0;
    
        services.clamav = {
          daemon.enable = true;
          updater.enable = true;
        };
    
        services.compton = {
          enable = true;                    # Application transparency
          vSync = true;                     # Remove screen tearing
          backend = "glx";                  # hardware accelerated. "xrender" is partial.
        };
    
        services.emacs = {
          enable = true;
          ##install = true;
        };
        ## Now need to enable it as user systemctl --user enable emacs
    
        services.redshift.enable = true;
        #rogue.enable = true; # Enable the rogue game in tty 9
    
        services.openssh = {
          enable = true;
          forwardX11 = true;
        };
    
    
        services.xserver = {
          enable = true;
          layout = "de";
    
          xkbOptions = "caps:hyper_l"; ## maybe?
    
          #displayManager.lightdm.background = ""
    
          desktopManager.xterm.enable = false;
          windowManager.stumpwm.enable = true;
          desktopManager.xfce.enable = true;
          #desktopManager.surf-display.enable = true;
          #displayManager.ly.enable = true;
          # Give EXWM permission to control the session.
          displayManager.sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
    
          #videoDrivers = [ "nvidia" ];
    
          # Still needs to be started with `systemctl --user start xautolock.service`
          xautolock = {
            enable = true;
            time = 10; # Lock after 10 mins
            enableNotifier = true;
            notifier = "${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\"";
            notify = 10; # notifier 10 seconds before
            # After 30 minutes of lock, suspend.
            killtime = 30;
            killer = "\"${pkgs.systemd}/bin/systemctl suspend\"";
            # i3lock uses png
            locker = "${pkgs.imagemagick}/bin/convert x:root -interpolate nearest -virtual-pixel mirror -spread 5 +dither -posterize 5 /tmp/screenshot.png && ${pkgs.i3lock}/bin/i3lock -i /tmp/screenshot.png";
          };
        };
    
        ## Require for dunst to actually start
        # systemd.user.services.dunst = {
          #   enable = true;
          #   description = "dunst daemon";
          #   wantedBy = [ "default.target" ];
          #   serviceConfig = {
            #     ExecStart = "${pkgs.dunst}/bin/dunst -conf /home/tetris/.config/dunst/config";
            #     Restart = "always";
            #   };
            # };
    
            # # dwarf or f-fortress
            nixpkgs.config.allowUnfree = true;
    
            # # emacs latest git overlay, exposes emacsGit
            nixpkgs.overlays = [
              (self: super:
              let unstable = builtins.fetchTarball https://github.com/nixos/nixpkgs-channels/archive/nixos-unstable.tar.gz; in {
                emacs = (import unstable { }).emacs;
                ##(import (builtins.fetchTarball {
                  ##url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
                  ##}))
              })
            ];
    
            # Define a user account. Don't forget to set a password with ‘passwd’.
            users.extraUsers.tetris = {
              isNormalUser = true;
              extraGroups = [
                "audio"                           # Access sound hardware
                "disk"                            # Access /dev/sda /dev/sdb etc.
                "kvm"                             # Access virtual machines
                "networkmanager"                  # Access network manager
                "storage"                         # Access storage devices
                "video"                           # 2D/3D hardware acceleration & camera
                "wheel"                           # Access sudo command
              ];
              uid = 1000;
              ##shell = pkgs.bash;
              ##shell = pkgs.fish;
              shell = "${pkgs.zsh}/bin/zsh";
            };
            # #users.extraGroups.vboxusers.members = ["tetris"];
            # #virtualisation.virtualbox.host.enable = true;
            # #virtualisation.virtualbox.host.enableExtensionPack = true;
    
            home-manager.useGlobalPkgs = true; # create consistency with system
            # home-manager.users.tetris = { pkgs, ... }: {
              #   ## home.file.".emacs.d/init.el".source = ./init.el;
              #   #home.packages = [
                #     # pkgs.dwarf-fortress-packages.dwarf-fortress-full  ## contains dfhack
                #     # pkgs.zeroad ## causes spidermonkey issues
                #     # pkgs.qutebrowser ## not used
                #     # (pkgs.pass.withExtensions (ext: with ext; [pass-import]))
                #     # pkgs.rofi-pass # for qute-pass in qutebrowser
                #     # pkgs.rofi
                #     #];
    
                #     ## TODO: XDG settings, e.g. point most things to emacs
    
                #     programs.git = {
                  #       enable = true;
                  #       userName = "Mehmet Tekman";
                  #       userEmail = "[email protected]";
                  #     };
    
                  #     programs.emacs = {
                    #       enable = true;
                    #       ##package = pkgs.emacsGit;
                    #       ##package = pkgs.emacs27ish;
                    #     };
                    # };
    
                    nix.allowedUsers = [ "@wheel" ];
    
                    # The NixOS release to be compatible with for stateful data such as databases.
                    system.stateVersion = "20.03";
    }
        
  3. Run nixos-generate-config to generate the /etc/nixos/hardware-configuration.nix file
  4. Run nixos-rebuild switch. At this point, the user should be set up and you can now login and install the repos.

Repos

Here we initialise all repos for first time use if they are not already set up, otherwise just update. This script is also run on stumpwm desktop start.

#!/usr/bin/env bash
rfile=~/repos/update.log

declare -A REPOLOC;
# Format is [folder/default-reponame]=author:remote[+author2:remote2],override-reponame
# Configs
REPOLOC[~/repos/_mtekman/myorg]=mtekman:origin,org-projects
REPOLOC[~/repos/_mtekman/_configs/conf]=:origin,5f885e99ebabc6c68f85790581eceb02
REPOLOC[~/repos/_mtekman/_configs/emacs.d]=:origin,09ef535a0a44fa49ca482e84c5e9399d
#
# Work : Galaxy, Conda, Teaching
REPOLOC[~/repos/_work/_galaxy/eu-website]=usegalaxy-eu:origin,website
REPOLOC[~/repos/_work/_galaxy/galaxy]=mtekman:origin+galaxyproject:upstream
REPOLOC[~/repos/_work/_galaxy/tools-iuc]=mtekman:origin+galaxyproject:upstream
REPOLOC[~/repos/_work/_galaxy/training-material]=mtekman:origin+galaxyproject:upstream
#
REPOLOC[~/repos/_work/_conda/bioconda-recipes]=bioconda:origin
REPOLOC[~/repos/_work/_conda/bioconda-utils]=bioconda:origin
REPOLOC[~/repos/_work/_conda/conda-recipes]=mtekman:origin+conda-forge:upstream,staged-recipes
#
# Not mine
REPOLOC[~/repos/_other/hosts]=StevenBlack:origin
REPOLOC[~/repos/_other/melpa]=melpa:origin
REPOLOC[~/repos/_other/stumpwm-contrib]=stumpwm:origin,stumpwm
#
# Emacs packages
REPOLOC[~/repos/_mtekman/_elisp/elisp-depmap.el]=mtekman:origin
REPOLOC[~/repos/_mtekman/_elisp/planemo-mode.el]=mtekman:origin
REPOLOC[~/repos/_mtekman/_elisp/org-treescope.el]=mtekman:origin
REPOLOC[~/repos/_mtekman/_elisp/org-treeusage.el]=mtekman:origin
REPOLOC[~/repos/_mtekman/_elisp/org-tanglesync.el]=mtekman:origin
REPOLOC[~/repos/_mtekman/_elisp/remind-bindings.el]=mtekman:origin
#
# Ongoing other projects
REPOLOC[~/repos/_mtekman/_projects/cv]=mtekman:origin,CurriculaVitae
REPOLOC[~/repos/_mtekman/_projects/jokedict]=mtekman:origin,JokeDictionary
REPOLOC[~/repos/_mtekman/_projects/ghubpages]=mtekman:origin,mtekman.github.io
#

echo -e "\n$(date)" >> $rfile

updateOrInstallRepo() {
    local folder=$1;
    local base=$(basename $folder)
    local value=${REPOLOC[$folder]}

    local remotes=$(echo $value | cut -d, -f 1)
    local repo=$(echo $value | cut -d, -f 2)

    if [ "$repo" = "" ] || [ "$repo" = "$value" ]; then
        repo=$base
    fi

    outstr=""
    if [ -d $folder ]; then
        outstr=":::Updating $base - ["
        cd $folder;
        for rem in $(git remote); do
            outstr=$outstr" $rem"
            git fetch $rem >> $rfile
        done;
        outstr=$outstr" ]"
        cd - >> $rfile;
    else
        first=Yes
        outstr=":::Initialising $folder - "
        mkdir -p $(dirname $folder);
        for rem in $(echo $remotes | sed 's|+| |g'); do
            author=$(echo $rem | cut -d':' -f 1)
            remnam=$(echo $rem | cut -d':' -f 2)
            outstr=$outstr" ($author $remnam)"
            if [ "$author" = "" ]; then
                if [ "$first" = "Yes" ]; then
                    git clone -o $remnam [email protected]:$repo $folder >> $rfile
                else
                    cd $folder;
                    git remote add $remnam [email protected]:$repo >> $rfile;
                    cd -;
                fi
            else
                if [ "$first" = "Yes" ]; then
                    git clone -o $remnam [email protected]:$author/$repo $folder >> $rfile
                else
                    cd $folder;
                    git remote add $remnam [email protected]:$author/$repo  >> $rfile;
                    cd -;
                fi
            fi
            first=No
        done
    fi
    echo $outstr
}

N=5
(
 for key in ${!REPOLOC[@]}; do
     ((i=i%N)); ((i++==0)) && wait
     updateOrInstallRepo $key &
 done
)

[ ! -e ~/.emacs.d/init.el ] && ln -s ~/repos/_mtekman/_configs/emacs.d/init.el ~/.emacs.d/init.el

tree --fromfile <(find $HOME/repos/ -type d -exec test -e '{}/.git' ';' -print -prune  | sed "s|^$HOME/repos/||g")

Audio

PulseAudio

  • Enable the pulseaudio user socket right after login
    systemctl --user enable pulseaudio
        
  • <2020-04-26 Sun> Archived, this is now easily handled by Nix

Bluetooth Connect

#!/usr/bin/env bash
device="38:18:4C:D3:21:DB"

int=2

bluetoothctl scan on & sleep 10 && kill $!
sleep $int
bluetoothctl disconnect $device
sleep $int
bluetoothctl remove $device
sleep $int
bluetoothctl untrust $device
sleep $int
bluetoothctl pairable on
sleep $int
bluetoothctl pair $device
sleep $int
bluetoothctl trust $device
sleep $int
bluetoothctl scan off
sleep $int
bluetoothctl pair $device
sleep $int
bluetoothctl connect $device
sleep $int
bluetoothctl pairable off

Desktop

X11

Xinitrc

Config
setxkbmap -layout de

synclient TapButton1=1
synclient TapButton2=3
synclient TapButton2=2

# Set fallback cursor.
# xsetroot -cursor_name left_ptr

# Set keyboard repeat rate.
# -- seems to cause problems
# xset r rate 200 30

case "$(tty)" in
    "/dev/tty1")
        ~/stumpwm.ros;;
    "/dev/tty2")
        exec i3;;
    "/dev/tty3")
        exec dbus-launch --exit-with-session emacs;;
esac

    

Xmodmap

  • Here we bind the caps or search key (on the chromium machine) to the Hyper key.
    #!/usr/bin/env bash
    
    setxkbmap -layout de
    
    xmodmap -e "clear Lock"
    
    if [ "`hostname`" = "tegrity" ]; then
       # Map the weird search key that
       # is in the Caps Lock position
       xmodmap -e "keycode 133 = Hyper_L"
    else
       xmodmap -e "keycode 66 = Hyper_L"
    fi
    
    # Leave windows key as only mod4 modifier
    xmodmap -e "remove mod4 = Hyper_L"
    
    # Set mod3 to Hyper_L
    xmodmap -e "add mod3 = Hyper_L"
        

Window Manager

i3

Repo
Install
pikaur -S i3-gaps i3wsr kitty rofi xtrlock
    
Config
# My screen setup
exec --no-startup-id "sh -c 'sleep 2; ~/.screenlayout/screen_switch.sh last'"
exec --no-startup-id i3-msg 'workspace 1; exec firefox'
exec --no-startup-id i3-msg 'workspace 1; exec emacs --daemon'

# CapsLock or Search key
exec --no-startup-id "sh -c '~/.config/xmodmap/setkeys.sh'"

# Headphones
exec --no-startup-id "sh -c 'pacmd load-module module-bluetooth-policy;pacmd load-module module-bluetooth-discover;'"

# Default assignments for these programs
set $mod Mod3

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8

# Notification Manager
exec --no-startup-id dunst -conf ~/.config/dunst/config

# Compositor
exec_always --no-startup-id "sh -c '~/.config/i3/run_picom.sh'"

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

bindsym $mod+Shift+q kill

# Floating terminal
exec --no-startup-id kitty
for_window [instance="kitty"] move scratchpad;
bindsym $mod+Return [instance="kitty"] scratchpad show;
bindsym $mod+Shift+Return exec kitty
#bindsym $mod+Return scratchpad show;

bindsym $mod+Shift+minus [title="YouTube.*"] move container to scratchpad
bindsym $mod+period floating toggle
bindsym $mod+minus [title="YouTube.*"] scratchpad show

# brightness + volume + screen
bindsym XF86MonBrightnessDown exec xbacklight - 5
bindsym XF86MonBrightnessUp exec xbacklight + 20
bindsym XF86AudioMute exec pulsemixer --toggle-mute
bindsym XF86AudioLowerVolume exec pulsemixer --change-volume -10
bindsym XF86AudioRaiseVolume exec pulsemixer --change-volume +10
bindsym $mod+Shift+p exec ~/.screenlayout/screen_switch.sh

# program bindings
bindsym $mod+j exec emacs -f org-journal-new-entry
bindsym $mod+Shift+X exec emacsclient -c -n
bindsym $mod+Escape exec xtrlock

# start application launcher
#bindsym $mod+d exec dmenu_run
bindsym $mod+d exec rofi -show drun -m -1 -theme arthur
bindsym $mod+Shift+d exec rofi -show run -m -1 -theme arthur
bindsym $mod+g exec rofi -mode combi -combi-modi "window#drun" -m -1 -theme arthur -show combi

set $e_filter "^((?!emacs).)*"
bindsym $mod+F1 [title=$e_filter] focus

# alternatively, you can use the cursor keys:
bindsym $mod+Left  [title=$e_filter] focus left
bindsym $mod+Down  [title=$e_filter] focus down
bindsym $mod+Up    [title=$e_filter] focus up
bindsym $mod+Right [title=$e_filter] focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left 100px
bindsym $mod+Shift+Down move down 100px
bindsym $mod+Shift+Up move up 100px
bindsym $mod+Shift+Right move right 100px

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

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
bindsym $mod+k layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+button2 floating toggle

focus_follows_mouse no

# Define names for other workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.

# Auto naming of workspaces
# requires: i3wsr from AUC
# conflicts with rofi matching
#exec_always --no-startup-id exec i3wsr

bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 0

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

mode "movement" {
     bindsym Up move workspace to output up
     bindsym Down move workspace to output down
     bindsym Left move workspace to output left
     bindsym Right move workspace to output right
     bindsym Return mode "default"
}

bindsym $mod+m mode "movement"

# resize window (you can also use the mouse for that)
mode "resize" {
     bindsym Ctrl+Left resize shrink width 50 px or 50 ppt
     bindsym Ctrl+Down resize grow height 50 px or 50 ppt
     bindsym Ctrl+Up resize shrink height 50 px or 50 ppt
     bindsym Ctrl+Right resize grow width 50 px or 50 ppt
     bindsym Left resize shrink width 10 px or 10 ppt
     bindsym Down resize grow height 10 px or 10 ppt
     bindsym Up resize shrink height 10 px or 10 ppt
     bindsym Right resize grow width 10 px or 10 ppt
     bindsym Shift+Left resize shrink width 1 px or 1 ppt
     bindsym Shift+Down resize grow height 1 px or 1 ppt
     bindsym Shift+Up resize shrink height 1 px or 1 ppt
     bindsym Shift+Right resize grow width 1 px or 1 ppt
     bindsym Return mode "default"
}

bindsym $mod+r mode "resize"

# reload the configuration file
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart


set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (p) shutdown
mode "$mode_system" {
    bindsym l exec --no-startup-id i3lock, mode "default"
    bindsym e exec --no-startup-id i3-msg exit, mode "default"
    bindsym s exec --no-startup-id systemctl suspend, mode "default"
    bindsym h exec --no-startup-id systemctl hibernate, mode "default"
    bindsym r exec --no-startup-id systemctl reboot, mode "default"
    bindsym p exec --no-startup-id systemctl poweroff, mode "default"

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

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
    font pango:Inconsolata 12, FontAwesome 15
    output EDP1
    output eDP-1
    output HDMI1
    status_command i3status-rs ~/.config/i3/config.i3status-rust
#   Abandoned status commands:
#    * i3status
#    * py3status
#    * bumblebee-status
}
    

StumpWM

Setup
  1. Install dependencies
    pikaur -S autoconf roswell
            
  2. Install libraries via roswell
    (ql:quickload "stumpwm")
    (ql:quickload "quicklisp-slime-helper")
    (quit)
            
  3. More
    ros install slime
    mkdir -p ~/repos/other/
    cd ~/repos/other
    git clone [email protected]:stumpwm/stumpwm-contrib
            
Archived
Config
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
  ;;(ros:ensure-asdf)
  #+quicklisp(ql:quickload '(stumpwm) :silent t)
  )

(defpackage :ros.script.stumpwm.3776840127
  (:use :cl))
(in-package :ros.script.stumpwm.3776840127)

(defun main (&rest argv)
  (declare (ignorable argv))
  (stumpwm:stumpwm))
;;; vim: set ft=lisp lisp:
    
;;!/usr/bin/env lisp
;;
;; Load swank.
;; *prefix-key* ; swank will kick this off
;(load "~/.roswell/lisp/slime/2019.12.27/swank-loader.lisp")
;; (swank-loader:init)
;; (defcommand swank () ()
;;     (swank:create-server :port 4005
;;                        :style swank:*communication-style*
;;                        :dont-close t)
;;   (echo-string (current-screen)
;;            "Starting swank. M-x slime-connect RET RET, then (in-package stumpwm)."))
;; (swank)

;; Namespace
(in-package :stumpwm)
(message "Loading rc!")

;; Make stumpm handle errors better
(setf stumpwm:*top-level-error-action* :break)
(set-module-dir (pathname-as-directory (concat (getenv "HOME") "/repos/_other/stumpwm-contrib")))


;; Themeing
(setf *window-border-style* :thin)
(setf *maxsize-border-width* 1)
(setf *transient-border-width* 1)
(setf *normal-border-width* 1)
(setf *message-window-gravity* :top)
(setf *input-window-gravity* :top)
(setf *message-window-padding* 4)
(setf *mouse-follows-focus* t)
(setf *mouse-focus-policy* :click)
(set-fg-color "#058dff")
(set-bg-color "#21252b")
(set-win-bg-color "#21252b")
(set-focus-color "#058dff")
(set-unfocus-color "#21252b")

;; Message box, width, text color, back
(set-msg-border-width 1)
(set-border-color "#222222")
(set-fg-color "#FFFFFF")
(set-bg-color "#222222")

;; ;; Gaps
;; (load-module "swm-gaps")
;; (setf swm-gaps:*inner-gaps-size* 8)
;; (setf swm-gaps:*outer-gaps-size* 8)
;; (swm-gaps:toggle-gaps)
;; (run-commands "toggle-gaps")

;; ("[^B%n^b] %W^>%d")

;; Code by Male Display the keysequence in progress
;; (defun key-press-hook (key key-seq cmd)
;;   (declare (ignore key))
;;   (unless (eq *top-map* *resize-map*)
;;     (let ((*message-window-gravity* :bottom-right))
;;       (message-no-timeout "Key sequence: ~A"
;;                (print-key-seq (reverse key-seq))))
;;     (when (stringp cmd) ;; Give 'em time to read it.
;;         (sleep 0.5))))
;; (defmacro replace-hook (hook fn)
;;   `(remove-hook ,hook ,fn)
;;   `(add-hook ,hook ,fn))
;; (replace-hook *key-press-hook* 'key-press-hook)


;; Window and Background

(run-shell-command "
tdir=~/.config/dark_embroidery.png;
! [ -e $tdir ] && wget https://www.toptal.com/designers/subtlepatterns/patterns/dark_embroidery.png -O $tdir;
hsetroot -tile $tdir -gamma 1.7 -contrast 2.3;")
;;(progn
;; (run-shell-command "~/.screenlayout/screen_switch.sh last")
;; (run-shell-command "sleep 1 && sh -c '~/.config/picom/run_picom.sh'")
;; (run-shell-command "dunst -conf ~/.config/dunst/config"))

;; Caps as modifier
;;(run-shell-command "~/.config/xmodmap/setkeys.sh")
(set-prefix-key (kbd "H-x"))

;; Modeline
(setf *mode-line-position* :bottom)
(setf *colors* '("black" "red" "green" "yellow" "blue"
                 "magenta" "cyan" "white" "GreenYellow"))
(update-color-map (current-screen))
(setf *group-format* " %t ")
(setf *window-format* "%m%n%s%20t ")
(setf *mode-line-timeout* 2)
(setf *time-modeline-string* "^1%a ^7«%e %b» %k-%M")
(setf *mode-line-border-width* 0)
(setf *mode-line-background-color* "#112233")
(setf *mode-line-foreground-color* "#CCCCCC")
;; -- Disable mode line, it's just not that useful --
;;(if (not (head-mode-line (current-head)))
;;    (toggle-mode-line (current-screen) (current-head)))


;; Window Management
;; (load-module "winner-mode")
;; (defvar *winner-map* (make-sparse-keymap))
;; (define-key *top-map* (kbd "H-w") '*winner-map*)
;; (define-key *winner-map* (kbd "Left") "winner-undo")
;; (define-key *winner-map* (kbd "Right") "winner-redo")
;; (add-hook *post-command-hook*
;;  (lambda (command) (when (member command winner-mode:*default-commands*)
;;                 (winner-mode:dump-group-to-file))))


;; Full screen toggle
;; From: https://bbs.archlinux.org/viewtopic.php?id=104424
(defparameter *layouts* (make-hash-table :test #'eql))
(defcommand toggle-full-layout ()
  ()
  (let* ((gnum (group-number (current-group)))
         (currlay (gethash gnum *layouts*)))
    (if currlay
        (progn
          (restore-group (current-group) currlay)
          (setf (gethash gnum *layouts*) nil))
        (progn
          (setf (gethash gnum *layouts*) (dump-group (current-group)))
          (run-commands "only")))))

;; Functions
(defun rofi (mode) (run-shell-command (concat "rofi -show " mode " -m -1 -theme arthur")))
(defun volume (up step)
  (let ((sign (if up "+" "-"))
        (sink (run-shell-command
               "pactl list short | grep RUNNING | awk '{printf $1}'"
               t)))
    (run-shell-command
     (concat "pactl set-sink-volume " sink " " sign step "%"))
    (echo
     (concat "Vol: "
             (run-shell-command
              (concat
               "pactl list sinks | grep -A 10 'RUNNING' | grep '^[[:space:]]Volume:' |  head -n $(( " "0" " + 1 )) | awk '{printf $5}'")
              t)))))

(defun brightness (up step)
  (let ((direction (if up "-inc" "-dec")))
    (run-shell-command (format nil "xbacklight ~A ~D" direction step))
    (let ((bright
           (run-shell-command
            "xbacklight -get | awk -F'.' '{printf \"Brightness: \"$1\"%\"}'"
            t))
          (cbright-file "~/.config/current-user-brightness.txt"))
      (if (< 10 (length bright))
          (message bright)
          ;; Otherwise use xrandr -- slow though!
          (let ((outdevice
                 (string-trim
                  '(#\Space #\Tab #\Newline)
                  (run-shell-command
                   "xrandr | grep \" connected\" | cut -d' ' -f 1" t)))
                (next-brightN nil))
            (with-open-file (str cbright-file
                                 :direction :IO
                                 :if-exists :OVERWRITE
                                 :if-does-not-exist :CREATE)
              (let* ((file-bright (read-line str nil))
                     (file-brightN (if file-bright
                                       (parse-integer file-bright)
                                       50))
                     (increment (if up step (- step))))
                (setq next-brightN (+ file-brightN increment)))
              (file-position str 0)
              (write-line (format nil "~D" next-brightN) str))
            (run-shell-command
             (format nil
                     "xrandr --output ~A --brightness ~1,2F"
                     outdevice
                     (/ next-brightN 100))))))))





;; Commands
(defcommand rofi-run () () (rofi "run"))
(defcommand rofi-drun () () (rofi "drun"))
(defcommand emacs-pull () () (run-or-pull "emacsclient -c" '(:class "Emacs")))
(defcommand emacs () () (run-or-raise "emacsclient -c" '(:class "Emacs")))
(defcommand emacs-new () () (run-or-raise "emacsclient -c" '(:class "EmacsTwo")))
(defcommand terminal () () (run-or-raise "kitty --class Terminal" '(:class "Terminal")))
(defcommand firefox () () (run-or-raise "firefox" '(:role "browser")))
(defcommand thunderbird () () (run-or-raise "thunderbird" '(:class "Email")))
(defcommand xtrlock () () (run-shell-command "xautolock -locknow"))
(defcommand suspend () () (run-shell-command "systemctl suspend && echo done"))
(defcommand shutdown () () (run-shell-command "shutdown -P now"))
(defcommand volume-up () () (volume t "10"))
(defcommand volume-down () () (volume nil "10"))
(defcommand brightness-up () () (brightness t 5))
(defcommand brightness-down () () (brightness nil 5))
(defcommand screen-switch () () (message
   (concat "Screen Conf: "
           (run-shell-command "~/.screenlayout/screen_switch.sh" t))))
(defcommand get-status () ()
  (let ((battstring (split-string (string-trim '(#\Space #\Newline)
                                                (run-shell-command "echo /sys/class/power_supply/BAT? | sed 's|/[^ ]*BAT||g' | tr ' ' '\\n' | xargs -I'!!' -n1 cat /sys/class/power_supply/BAT'!!'/{energy_now,energy_full} | tr '\\n' ' '" t)) " "))
        (power-percs "Power Supply"))
    (when (> (length (car battstring)) 0)
      (let* ((power-vals (mapcar #'parse-integer battstring))
             (power-percs (if (eq (length power-vals) 4)
                   (format nil "~2,1F% and ~2,1F%"
                           (/ (* 100.0 (nth 0 power-vals)) (nth 1 power-vals))
                           (/ (* 100.0 (nth 2 power-vals)) (nth 3 power-vals)))
                   (format nil "~2,1F%"
                           (/ (* 100.0 (nth 0 power-vals)) (nth 1 power-vals))))))))
    (message (concat (string-trim '(#\Space #\Tab #\Newline)
             (run-shell-command "date +'%A--%H:%M--%d-%m-%Y'" t))
                     " | Battery: " power-percs))))


;; Keys
(define-key *top-map* (kbd "H-r") "iresize")
(define-key *top-map* (kbd "H-SPC") "pull-hidden-next")
;;(define-key *top-map* (kbd "H-M-g") "toggle-gaps")
(define-key *top-map* (kbd "H-ESC") "xtrlock")
(define-key *top-map* (kbd "H-F1") "suspend")
(define-key *top-map* (kbd "H-F8") "shutdown")
(define-key *top-map* (kbd "H-F5") "quit-confirm")
(define-key *top-map* (kbd "H-M-p") "screen-switch")
(define-key *top-map* (kbd "H-E") "emacs-pull")
(define-key *top-map* (kbd "H-e") "emacs")
(define-key *top-map* (kbd "H-M-e") "emacs-new")
(define-key *top-map* (kbd "H-t") "thunderbird")
(define-key *top-map* (kbd "H-d") "rofi-drun")
(define-key *top-map* (kbd "H-D") "rofi-run")
(define-key *top-map* (kbd "H-q") "terminal")
(define-key *top-map* (kbd "H-b") "firefox")
(define-key *top-map* (kbd "H-l") "reload")
(define-key *top-map* (kbd "H-L") "restart-soft")
(define-key *top-map* (kbd "H-a") "get-status")
;;
(define-key *top-map* (kbd "H-Up") "move-focus up")
(define-key *top-map* (kbd "H-Left") "move-focus left")
(define-key *top-map* (kbd "H-Down") "move-focus down")
(define-key *top-map* (kbd "H-Right") "move-focus right")
;;
(define-key *top-map* (kbd "H-S-Up") "move-window up")
(define-key *top-map* (kbd "H-S-Left") "move-window left")
(define-key *top-map* (kbd "H-S-Down") "move-window down")
(define-key *top-map* (kbd "H-S-Right") "move-window right")

;; Volume
(define-key *top-map* (kbd "H-,") "volume-down")
(define-key *top-map* (kbd "H-.") "volume-up")
(define-key *top-map* (kbd "H-M-,") "brightness-down")
(define-key *top-map* (kbd "H-M-.") "brightness-up")



;; Rule Based Window Placement
(define-key *top-map* (kbd "H-f") "toggle-full-layout")
(define-key *root-map* (kbd "f") "float-this")
(define-key *root-map* (kbd "M-f") "unfloat-this")


(define-frame-preference "Emacs" (0 t t :class "Emacs"))
(define-frame-preference "Web" (1 t t :class "Internet"))
(define-frame-preference "Float" (1 t t :class "Internet"))

;; Firefox, command to focus on centre portion
(defun get-media-window-number ()
  (let ((num-orig (window-number (current-window))))
    (act-on-matching-windows
     (window-number
      (title-re-p win ".*(Watch|YouTube).*")))))

(defun media-window-toggle ()
  (let ((num-orig (window-number (current-window))))
    (act-on-matching-windows
     (win) (title-re-p win ".*(Watch|YouTube|Episode).*")
     (progn (select-window-by-number (window-number win))
            (center-click))
     ;; Restore window and pointer
     (select-window-by-number num-orig)
     (banish)
     (echo "Toggled "))))

(defun center-click ()
  (let ((scre (window-screen (current-window)))
        (wwid2 (round (window-width (current-window)) 2))
        (whid2 (round (window-height (current-window)) 2))
        (geom (multiple-value-list (geometry-hints (current-window)))))
    (let* ((wx (nth 0 geom)) (wy (nth 1 geom))
           (sx (+ wx wwid2)) (sy (+ wy whid2)))
      (warp-pointer scre sx sy)
      (ratclick 1))))


;; (defun float-picture-in-picture ()
;;   (let ((num-orig (window-number (current-window))))
;;     (act-on-matching-windows
;;      (win) (title-re-p win "Picture-in-Picture")
;;      (progn (select-window-by-number (window-number win))
;;             (center-click)))))

(defcommand center-content-do () () (media-window-toggle))
(define-key *top-map* (kbd "H-M-x") "center-content-do")

;; Apps
;; (load-module "app-menu")
;; (setq app-menu:*app-menu*
;;       '(("INTERNET"
;;          ("Firefox" firefox))
;;         ("CODING"
;;          ("Emacs"  emacs)
;;          ("Terminal"  terminal))
;;         ("GRAPHICS"
;;          ("GIMP" "gimp")
;;          ("Inkscape" "inkscape"))))

;; (define-key *root-map* (kbd "M-c") "show-menu")


;; Startup
(run-commands "hsplit" "exec firefox" "exec emacsclient -c")

    

Compositor

Responsible for fixing vsync errors and making use of hardware acceleration.

Picom

Renamed from Compton after original developed up and left

Settings
# Shadow
shadow = true;				# Enable shadowing on windows
no-dnd-shadow = true;			# Don't draw shadows on DND windows
no-dock-shadow = false;			# Don't draw shadows on dock windows
clear-shadow = true;			# Zero the part of the shadow's mask behind the window
shadow-radius = 4;			# The radius of the shadow blur				(default 15)
shadow-offset-x = -5;			# The x offset of the shadow blur			(default -15)
shadow-offset-y = -5;			# The y offset of the shadow blur			(default -15)
shadow-opacity = 0.30;			# Opacity of the shadows     				(default .75)
shadow-red = 0.00;
shadow-green = 0.00;
shadow-blue = 0.00;
shadow-exclude = [ "name = 'Polybar tray window'" ]; # Exclude conditions for shadows
# shadow-ignore-shaped = true;

# Opacity
menu-opacity = 1.0;			# Opacity for menus					(default 1.0)
inactive-opacity = 1.0;			# Opacity for inactive windows				(0.1 - 1.0)
inactive-opacity-override = true;	# Overrides overall opacity rules
opacity-rule = [ "95:class_g *= 'kitty'", "100:class_g *= 'Emacs'"];

# Fading
fading = true;				# Fade windows during opacity changes
fade-delta = 10;			# The time between steps in milliseconds		(default 30)
fade-in-step = 0.1;			# Opacity delta when fading in				(default 0.028)
fade-out-step = 0.1;			# Opacity delta when fading out				(default 0.03)
no-fading-openclose = false;		# Fade windows in/out when opening/closing

# Other
mark-wmwin-focused = true;		# Tries to detect WM windows and mark as active
mark-ovredir-focused = true;		# Overrides focused windows as active
detect-rounded-corners = true;		# Tries to detect rounded cornered windows
detect-client-opacity = true;		# Detects if the window itself supports transparency
# inactive-dim = 0.5;  			# Dims inactive windows					(0.0 - 1.0, default 0.0)

blur-background = true;           # Blurs transparent background				(default false)
blur-background-frame = false;		# Blurs transparent frame				(default false)
blur-background-fixed = true;

# We use a compton fork here https://github.com/tryone144/compton
blur-method = "kawase";
blur-strength = 5;

detect-transient = true;
# detect-client-leader = true;

# GLX (backend)
backend = "glx";
vsync = "opengl";

# Window type settings
wintypes:
{
  tooltip = { fade = true; shadow = false; opacity = 0.90; };
};
    
Caller
#!/usr/bin/env bash

if [ "`hostname`" != "tegrity" ]; then
    # tegrity can't handle compositor
    picom --config ~/.config/picom/config
fi
    

Status Bar

conky

Install
pacman -S conky
    
Notes
This aims to be more configurable than i3status-rust, which has few options for blocks or customisability.
Config
conky.config = {
    out_to_x = false,
    own_window = false,
    out_to_console = true,
    background = false,
    max_text_width = 0,

    -- Update interval in seconds
    update_interval = 2.0,

    -- This is the number of times Conky will update before quitting.
    -- Set to zero to run forever.
    total_run_times = 0,

    -- Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
    short_units = true,

    -- How strict should if_up be when testing an interface for being up?
    -- The value is one of up, link or address, to check for the interface
    -- being solely up, being up and having link or being up, having link
    -- and an assigned IP address.
    if_up_strictness = 'address',

    -- Add spaces to keep things from moving about?  This only affects certain objects.
    -- use_spacer should have an argument of left, right, or none
    use_spacer = 'left',

    -- Force UTF8? note that UTF8 support required XFT
    override_utf8_locale = false,

    -- number of cpu samples to average
    -- set to 1 to disable averaging
    cpu_avg_samples = 2,
};

conky.text = [[
[
    { "full_text": "Home ${fs_free /home} Free" , "color": "\#ffffff" },
    { "full_text": "RAM ${memperc}%" , "color": ${if_match ${memperc}<90}"\#ffffff"${else}"\#ff0000"${endif} }
],
]];
    
Bar
This is to format conky output into i3status format. i3 calls this.
#!/bin/sh
# Send the header so that i3bar knows we want to use JSON:
echo '{"version":1}'
# Begin the endless array.
echo '['
# We send an empty first array of blocks to make the loop simpler:
echo '[],'
# Now send blocks with information forever:
exec conky -c ~/.config/i3/config.conkybar
    

bumblebee-status

Repo
Install
sudo pacman -Sy progress pulseaudio pavucontrol pacmd python-requests bluez bluez-utils python-netifaces
git clone https://github.com/tobi-wan-kenobi/bumblebee-status ~/repos/bumblebee-status
    
Notes
It was too slow, mouse rolling was too unresponsive for changing volume
Config
[modules]
pasink
brightness
progress
date
time
spacer
arch-update
cpu
memory
disk
nic
publicip
bluetooth
battery

[themes]
greyish-powerline

[module-parameters]
progress.placeholder=""
root.path=/
memory.format="{percent:2.1f}%"
disk.format="{percent:2.01f}%"
time.format="%H:%M" date.format="%a, %b %d %Y"
nic.format="{ip}"
    

i3status-rust

Repo
Install
pikaur -Sy i3status-rust
    
Notes
Built on rust, very fast!
Config
theme = "slick"
icons = "awesome"

#[[block]]
#block = "battery"
#upower = false

#[[block]]
#block = "pacman"
#interval = 60

#[[block]]
#block = "pacman"
#interval = 60

[[block]]
block = "custom"
# bind-tools provides dig
cycle = [
  "echo Battery: `acpi | grep -oP '..%'`",
  "df / -h | tail -1 | awk '{print \"Disk Usage: \"$5}'",
  "echo `ip route get 1 | awk '{print $5\" \"$7;exit}'` -:- `dig +short myip.opendns.com @resolver1.opendns.com`"
]
on_click = "<command>"
interval = 60

#[[block]]
#block = "disk_space"
#path = "/"
#alias = "/"
#info_type = "available"
#unit = "GB"
#interval = 20

[[block]]
block = "memory"
display_type = "memory"
format_mem = "{Mup}%"
format_swap = "{Mum} MB" # we don't care about swap
warning_mem = 60.0
critical_mem = 95.0
interval = 10

[[block]]
block = "cpu"
interval = 5
# format = "{barchart}"
#format = "{utilization}%s"
warning = 10
critical = 70

#[[block]]
#block = "load"
#interval = 1
#format = "{1m}"

# [[block]]
# block = "xrandr"
# icons = true
# #resolution = true
# interval = 2

#[[block]]
#block = "backlight"
#tdevice = "intel_backlight"

#[[block]]
#block = "speedtest"
#bytes = true
#interval = 1800

[[block]]
block = "sound"

[[block]]
block = "time"
interval = 60
format = "%a %d %b %R"
#on_click = "firefox calender.google.com"
    

Application Launcher

dmenu

rofi

Install
pikaur -S rofi
    
Config

Notification Manager

Dunst

Config
[frame]
    width = 0
    color = "#212121"

[urgency_low]
    background = "#000000"
    foreground = "#ffffff"
    timeout = 10

[urgency_normal]
    background = "#212121"
    foreground = "#ffffff"
    timeout = 10

[urgency_critical]
    background = "#fbc02d"
    foreground = "#000000"
    timeout = 0

[global]
    # The format of the message.  Possible variables:
    #   %a  appname
    #   %s  summary
    #   %b  body
    #   %i  iconname (including its path)
    #   %I  iconname (without its path)
    #   %p  progress value if set ([  0%] to [100%]) or nothing
    format = "%a\n<b>%s</b>\n%b\n%p"

    # The geometry of the window. Format: [{width}]x{height}[+/-{x}+/-{y}]
    # The height = number of notifications, all other variables are px
    # Omit width, provide height for full-screen width notifications
    # If width is 0, window will fit to longest message
    # Positive x value is measured from the left of the screen, negative x is measured from the right
    # Positive y value is measured from the top of the screen
    geometry = "300x5-50+75"

    font = Roboto 10
    allow_markup = yes
    plain_text = no             # Treat message as plain text
    sort = yes                  # Sort messages by urgency
    indicate_hidden = yes       # Show how many messages are currently hidden (see geometry)
    alignment = center          # Align text left/center/right
    bounce_freq = 0             # Frequency to bounce text back and forth if it is longer than the window width (conflicts with "word_wrap")
    show_age_threshold = 60     # Show if message is older than x seconds (-1 to disable)
    word_wrap = yes             # Split notifications into multiple lines if they don't fit into geometry
    ignore_newline = no         # Ignore "\n"
    transparency = 40           # The transparency of the window. 0 (opaque) to 100 (transparent) - requires compositing window manager (xcompmgr, compiz, compton, etc)
    shrink = no                 # Shrink window if it's smaller than the width (ignored if width is 0)
    monitor = 0                 # Display notifications on the monitor indicated (0 is default)
    follow = none               # Follow mouse/keyboard/none
    show_indicators = no        # Display indicators for URLs (U) and actions (A)
    line_height = 0             # The spacing between lines (forced to height of font at minimum)
    notification_height = 0     # The height of the entire notification (forced to height of font height and padding at minimum)
    separator_height = 2        # Space in pixels between two notifications
    padding = 8                 # Padding between text and separator
    horizontal_padding = 8      # Horizontal padding
    separator_color = frame     # Color for separator: auto/foreground/frame/X color
    icon_position = left        # Align icons left/right/off

    idle_threshold = 120        # Don't remove messages if the user is idle (no mouse or keyboard input) for longer than idle_threshold seconds
    sticky_history = yes        # Make notifications remain until clicked on (yes) or timeout as normal (no) when recalled from history
    history_length = 20         # Maximum amount of notifications kept in history

    icon_folders = /usr/share/icons/hicolor/16x16
    startup_notification = false
    dmenu = /usr/bin/dmenu -p dunst:
    browser = /usr/bin/firefox -new-tab

[shortcuts]
    # Available modifiers are "ctrl", "mod1", "mod2", "mod3", and "mod4"
    # Xev might be helpful to find names for keys

    # Close notification
    close = ctrl+space

    # Close all notifications
    close_all = ctrl+shift+space

    # Recall last message(s)
    history = mod1+grave

    # Context menu
    # context = ctrl+shift+period

Screens

Scripts

#!/usr/bin/env bash

state_file=~/.screen_state
touch $state_file

state=""
host="$(hostname)"

function getState {
    state="$(head -1 $state_file)"
    if [ "$state" = "" ]; then
        setNextState internal
        getState
    fi
}

function getLastState {
    state="$(tail -1 $state_file)"
    if [ "$state" = "" ]; then
        setNextState internal
        getState
    fi
}

function setNextState {
    echo "$1" > $state_file
}

function setLastState {
    echo "$1" >> $state_file
}




if [ "$1" = "" ]; then
    getState
elif [ "$1" = "last" ]; then
    getLastState
fi

case "$state" in
    extended)
        ~/.screenlayout/$host/extended.sh
        setNextState external
        ;;
    external)
        ~/.screenlayout/$host/external.sh
        setNextState internal
        ;;
    internal)
        ~/.screenlayout/$host/internal.sh
        setNextState extended
        ;;
esac

echo "$state"
setLastState "$state"

Hosts

mavilim

#!/bin/sh
xrandr --output eDP1 --primary --mode 1920x1080 --pos 1920x120 --rotate normal --output DP1 --off --output DP2 --off --output DP2-1 --mode 1920x1200 --pos 0x0 --rotate normal --output DP2-2 --off --output DP2-3 --off --output HDMI1 --off --output HDMI2 --off --output VIRTUAL1 --off
#!/bin/sh
xrandr --output DP1 --off --output DP2 --off --output DP3 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output DP2 --off --output DP1 --off
#!/bin/sh
xrandr --output eDP1 --off --output DP1 --off --output DP2 --off --output DP2-1 --off --output DP2-2 --mode 1920x1200 --pos 0x0 --rotate normal --output DP2-3 --off --output HDMI1 --off --output HDMI2 --off --output VIRTUAL1 --off

seurat

#!/bin/sh
xrandr --output HDMI1 --mode 2560x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x1080 --rotate normal
#!/bin/sh
xrandr --output HDMI1 --mode 2560x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off --output eDP1 --off
#!/bin/sh
xrandr --output HDMI1 --off --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal

Shells

Aliases

alias ls="lsd"

Profile

Config
export PATH=$PATH:~/miniconda3/bin:~/.cargo/bin
export VISUAL=emacsclient
export EDITOR="$VISUAL"
export ALTERNATE_EDITOR=""
alias em="emacs -nw"
    

Screen

Config
term screen-256color
    

Zsh

Zim

Repo
Install
#git clone --recursive https://github.com/zimfw/zimfw.git ${ZDOTDIR:-${HOME}}/.zim
curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh
    
Add theme
  • Add zmodule eriner to your .zimrc and run zimfw install
Config
# Start configuration added by Zim install {{{
# -------
# Modules
# -------

# Sets sane Zsh built-in environment options.
zmodule environment
# Provides handy git aliases and functions.
zmodule git
# Applies correct bindkeys for input events.
zmodule input
# Sets a custom terminal title.
zmodule termtitle
# Utility aliases and functions. Adds colour to ls, grep and less.
zmodule utility

#
# Prompt
#
# Exposes git repository status information to prompts.
zmodule git-info
# A customizable version of steeef's prompt theme.
zmodule eriner

# Additional completion definitions for Zsh.
zmodule zsh-users/zsh-completions
# Enables and configures smart and extensive tab completion.
# completion must be sourced after zsh-users/zsh-completions
zmodule completion
# Fish-like autosuggestions for Zsh.
zmodule zsh-users/zsh-autosuggestions
# Fish-like syntax highlighting for Zsh.
# zsh-users/zsh-syntax-highlighting must be sourced after completion
zmodule zsh-users/zsh-syntax-highlighting
# Fish-like history search (up arrow) for Zsh.
# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting
zmodule zsh-users/zsh-history-substring-search
# }}} End configuration added by Zim install

    

Login

#
# User configuration sourced by login shells
#
source ${HOME}/.profile
source ${HOME}/.aliases

# Initialize zim
[[ -s ${ZIM_HOME}/login_init.zsh ]] && source ${ZIM_HOME}/login_init.zsh

# Startx
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec startx
fi

RC

  • This conflicts with NixOS home-manager, which populates this manually.
    eval "$(fasd --init auto)"
    #
    # User configuration sourced by interactive shells
    #
    # Change default zim location
    export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
    # Start zim
    [[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh
    # Created by newuser for 5.5.1
    [ -f ${HOME}/miniconda3/etc/profile.d/conda.sh ] && source ${HOME}/miniconda3/etc/profile.d/conda.sh
    
    source ${HOME}/.aliases
    source ${HOME}/.config/broot/launcher/bash/br
        

Kitty

term xterm-256color

Programs

Emacs

Daemon Startup

According to the Arch Emacs wiki page we just need to do

systemctl --user enable --now emacs

Conda

channels:
  - bioconda
  - r
  - conda-forge
  - defaults
auto_update_conda: true
max_shlvl: 3

irssi

servers = (
  {
    address = "chat.freenode.net";
    chatnet = "Freenode";
    port = "6697";
    use_tls = "yes";
    tls_verify = "yes";
  },
  {
    address = "irc.rizon.net";
    chatnet = "Rizon";
    port = "6697";
    use_tls = "yes";
    tls_verify = "yes";
  }
);

chatnets = {
  Freenode = {
    type = "IRC";
    max_kicks = "1";
    max_msgs = "4";
    max_whois = "1";
  };
  Rizon = {
    type = "IRC";
    max_kicks = "1";
    max_msgs = "1";
    max_whois = "1";
  };
};

channels = (
  { name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; },
  { name = "#rizon"; chatnet = "Rizon"; autojoin = "No"; }
);

aliases = {
  ATAG = "WINDOW SERVER";
  ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
  B = "BAN";
  BACK = "AWAY";
  BANS = "BAN";
  BYE = "QUIT";
  C = "CLEAR";
  CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi";
  CHAT = "DCC CHAT";
  CUBES = "SCRIPT EXEC Irssi::active_win->print(\"%_bases\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x0\\${_}0\\$_\" } '0'..'9','A'..'F' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_cubes\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { my \\$y = \\$_*6 \\; join '', map { my \\$x = \\$_ \\; map { \"%x\\$x\\$_\\$x\\$_\" } @{['0'..'9','A'..'Z']}[\\$y .. \\$y+5] } 1..6 }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) for 0..5 \\; Irssi::active_win->print(\"%_grays\", MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print( do { join '', map { \"%x7\\${_}7\\$_\" } 'A'..'X' }, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; Irssi::active_win->print(\"%_mIRC extended colours\", MSGLEVEL_CLIENTCRAP) \\; my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 0..15 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) \\; for my \\$z (0..6) { my \\$x \\; \\$x .= sprintf \"\00399,%02d%02d\",\\$_,\\$_ for 16+(\\$z*12)..16+(\\$z*12)+11 \\; Irssi::active_win->print(\\$x, MSGLEVEL_NEVER | MSGLEVEL_CLIENTCRAP) }";
  DATE = "TIME";
  DEHIGHLIGHT = "DEHILIGHT";
  DESCRIBE = "ACTION";
  DHL = "DEHILIGHT";
  EXEMPTLIST = "MODE $C +e";
  EXIT = "QUIT";
  GOTO = "SCROLLBACK GOTO";
  HIGHLIGHT = "HILIGHT";
  HL = "HILIGHT";
  HOST = "USERHOST";
  INVITELIST = "MODE $C +I";
  J = "JOIN";
  K = "KICK";
  KB = "KICKBAN";
  KN = "KNOCKOUT";
  LAST = "LASTLOG";
  LEAVE = "PART";
  M = "MSG";
  MUB = "UNBAN *";
  N = "NAMES";
  NMSG = "^MSG";
  P = "PART";
  Q = "QUERY";
  RESET = "SET -default";
  RUN = "SCRIPT LOAD";
  SAY = "MSG *";
  SB = "SCROLLBACK";
  SBAR = "STATUSBAR";
  SIGNOFF = "QUIT";
  SV = "MSG * Irssi $J ($V) - http://www.irssi.org";
  T = "TOPIC";
  UB = "UNBAN";
  UMODE = "MODE $N";
  UNSET = "SET -clear";
  W = "WHO";
  WC = "WINDOW CLOSE";
  WG = "WINDOW GOTO";
  WJOIN = "JOIN -window";
  WI = "WHOIS";
  WII = "WHOIS $0 $0";
  WL = "WINDOW LIST";
  WN = "WINDOW NEW HIDDEN";
  WQUERY = "QUERY -window";
  WW = "WHOWAS";
  1 = "WINDOW GOTO 1";
  2 = "WINDOW GOTO 2";
  3 = "WINDOW GOTO 3";
  4 = "WINDOW GOTO 4";
  5 = "WINDOW GOTO 5";
  6 = "WINDOW GOTO 6";
  7 = "WINDOW GOTO 7";
  8 = "WINDOW GOTO 8";
  9 = "WINDOW GOTO 9";
  10 = "WINDOW GOTO 10";
  11 = "WINDOW GOTO 11";
  12 = "WINDOW GOTO 12";
  13 = "WINDOW GOTO 13";
  14 = "WINDOW GOTO 14";
  15 = "WINDOW GOTO 15";
  16 = "WINDOW GOTO 16";
  17 = "WINDOW GOTO 17";
  18 = "WINDOW GOTO 18";
  19 = "WINDOW GOTO 19";
  20 = "WINDOW GOTO 20";
  21 = "WINDOW GOTO 21";
  22 = "WINDOW GOTO 22";
  23 = "WINDOW GOTO 23";
  24 = "WINDOW GOTO 24";
  25 = "WINDOW GOTO 25";
  26 = "WINDOW GOTO 26";
  27 = "WINDOW GOTO 27";
  28 = "WINDOW GOTO 28";
  29 = "WINDOW GOTO 29";
  30 = "WINDOW GOTO 30";
  31 = "WINDOW GOTO 31";
  32 = "WINDOW GOTO 32";
  33 = "WINDOW GOTO 33";
  34 = "WINDOW GOTO 34";
  35 = "WINDOW GOTO 35";
  36 = "WINDOW GOTO 36";
  37 = "WINDOW GOTO 37";
  38 = "WINDOW GOTO 38";
  39 = "WINDOW GOTO 39";
  40 = "WINDOW GOTO 40";
  41 = "WINDOW GOTO 41";
  42 = "WINDOW GOTO 42";
  43 = "WINDOW GOTO 43";
  44 = "WINDOW GOTO 44";
  45 = "WINDOW GOTO 45";
  46 = "WINDOW GOTO 46";
  47 = "WINDOW GOTO 47";
  48 = "WINDOW GOTO 48";
  49 = "WINDOW GOTO 49";
  50 = "WINDOW GOTO 50";
  51 = "WINDOW GOTO 51";
  52 = "WINDOW GOTO 52";
  53 = "WINDOW GOTO 53";
  54 = "WINDOW GOTO 54";
  55 = "WINDOW GOTO 55";
  56 = "WINDOW GOTO 56";
  57 = "WINDOW GOTO 57";
  58 = "WINDOW GOTO 58";
  59 = "WINDOW GOTO 59";
  60 = "WINDOW GOTO 60";
  61 = "WINDOW GOTO 61";
  62 = "WINDOW GOTO 62";
  63 = "WINDOW GOTO 63";
  64 = "WINDOW GOTO 64";
  65 = "WINDOW GOTO 65";
  66 = "WINDOW GOTO 66";
  67 = "WINDOW GOTO 67";
  68 = "WINDOW GOTO 68";
  69 = "WINDOW GOTO 69";
  70 = "WINDOW GOTO 70";
  71 = "WINDOW GOTO 71";
  72 = "WINDOW GOTO 72";
  73 = "WINDOW GOTO 73";
  74 = "WINDOW GOTO 74";
  75 = "WINDOW GOTO 75";
  76 = "WINDOW GOTO 76";
  77 = "WINDOW GOTO 77";
  78 = "WINDOW GOTO 78";
  79 = "WINDOW GOTO 79";
  80 = "WINDOW GOTO 80";
  81 = "WINDOW GOTO 81";
  82 = "WINDOW GOTO 82";
  83 = "WINDOW GOTO 83";
  84 = "WINDOW GOTO 84";
  85 = "WINDOW GOTO 85";
  86 = "WINDOW GOTO 86";
  87 = "WINDOW GOTO 87";
  88 = "WINDOW GOTO 88";
  89 = "WINDOW GOTO 89";
  90 = "WINDOW GOTO 90";
  91 = "WINDOW GOTO 91";
  92 = "WINDOW GOTO 92";
  93 = "WINDOW GOTO 93";
  94 = "WINDOW GOTO 94";
  95 = "WINDOW GOTO 95";
  96 = "WINDOW GOTO 96";
  97 = "WINDOW GOTO 97";
  98 = "WINDOW GOTO 98";
  99 = "WINDOW GOTO 99";
};

statusbar = {

  items = {

    barstart = "{sbstart}";
    barend = "{sbend}";

    topicbarstart = "{topicsbstart}";
    topicbarend = "{topicsbend}";

    time = "{sb $Z}";
    user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}";

    window = "{sb $winref:$tag/$itemname{sbmode $M}}";
    window_empty = "{sb $winref{sbservertag $tag}}";

    prompt = "{prompt $[.15]itemname}";
    prompt_empty = "{prompt $winname}";

    topic = " $topic";
    topic_empty = " Irssi v$J - http://www.irssi.org";

    lag = "{sb Lag: $0-}";
    act = "{sb Act: $0-}";
    more = "-- more --";
  };

  default = {

    window = {

      disabled = "no";
      type = "window";
      placement = "bottom";
      position = "1";
      visible = "active";

      items = {
        barstart = { priority = "100"; };
        time = { };
        user = { };
        window = { };
        window_empty = { };
        lag = { priority = "-1"; };
        act = { priority = "10"; };
        more = { priority = "-1"; alignment = "right"; };
        barend = { priority = "100"; alignment = "right"; };
      };
    };

    window_inact = {

      type = "window";
      placement = "bottom";
      position = "1";
      visible = "inactive";

      items = {
        barstart = { priority = "100"; };
        window = { };
        window_empty = { };
        more = { priority = "-1"; alignment = "right"; };
        barend = { priority = "100"; alignment = "right"; };
      };
    };

    prompt = {

      type = "root";
      placement = "bottom";
      position = "100";
      visible = "always";

      items = {
        prompt = { priority = "-1"; };
        prompt_empty = { priority = "-1"; };
        input = { priority = "10"; };
      };
    };

    topic = {

      type = "root";
      placement = "top";
      position = "1";
      visible = "always";

      items = {
        topicbarstart = { priority = "100"; };
        topic = { };
        topic_empty = { };
        topicbarend = { priority = "100"; alignment = "right"; };
      };
    };
  };
};
settings = {
  core = { real_name = "Unknown";
  "fe-text" = { actlist_sort = "refnum"; };
  "irc/dcc" = { dcc_autoget = "yes"; dcc_autoaccept_lowports = "yes"; };
};

SSH

Host *
ServerAliveInterval 55

OpenPyn

#!/usr/bin/env bash

loc=${1:-be}

killall firefox brave

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sleep 1 && sudo openpyn $loc
#sleep 20 && firefox --private-window https://whatismyipaddress.com/

Good for spooking

Qutebrowser

## From: https://gitlab.com/Kaligule/qutebrowser-emacs-config/blob/master/config.py
## and: https://gitlab.com/jgkamat/qutemacs/blob/master/qutemacs.py
## and: https://gitlab.henriktjader.com/dotfiles/qutebrowser/blob/880c661227c50d16515f80d1a2bdc6238775946f/.config/qutebrowser/config.py

# qutemacs - a simple, preconfigured Emacs binding set for qutebrowser
#
# The aim of this binding set is not to provide bindings for absolutely
# everything, but to provide a stable launching point for people to make their
# own bindings.
#
# Installation:
#
# 1. Copy this file or add this repo as a submodule to your dotfiles.
# 2. Add this line to your config.py, and point the path to this file:
# config.source('qutemacs/qutemacs.py')


config = config  # type: ConfigAPI # noqa: F821 pylint: disable=E0602,C0103
c = c  # type: ConfigContainer # noqa: F821 pylint: disable=E0602,C0103

# disable insert mode completely
c.input.insert_mode.auto_enter = False
c.input.insert_mode.auto_leave = False
c.input.insert_mode.plugins = False

# Forward unbound keys
c.input.forward_unbound_keys = "all"
c.editor.command = ['emacsclient', '{}']

ESC_BIND = 'clear-keychain ;; search ;; fullscreen --leave'

c.bindings.default['normal'] = {}
# Bindings
c.bindings.commands['normal'] = {
    # Navigation
    '<ctrl-v>': 'scroll-page 0 0.5',
    '<alt-v>': 'scroll-page 0 -0.5',
    '<ctrl-shift-PgUp>': 'scroll-page 0 -0.1',
    '<ctrl-shift-PgDown>': 'scroll-page 0 0.1',
    '<ctrl-alt-shift-PgUp>': 'scroll-page -0.1 0',
    '<ctrl-alt-shift-PgDown>': 'scroll-page 0.1 0',

    # pass
    #'<ctrl-shift-p>':'spawn --userscript qute-pass --dmenu-invocation "rofi-pass"',
    #'<ctrl-alt-shift-p>':'spawn --userscript qute-pass --dmenu-invocation "rofi-pass" --password-only',
    '<ctrl-shift-p>':'spawn --userscript qute-pass',
    '<ctrl-alt-shift-p>':'spawn --userscript qute-pass --password-only',

    # Commands
    '<alt-x>': 'set-cmd-text :',
    '<ctrl-x>b': 'set-cmd-text -s :buffer',
    '<ctrl-x><ctrl-c>': 'quit',

    # Tabs
    '<ctrl-x>k': 'tab-close',
    '<ctrl-x>0': 'tab-close',
    '<ctrl-x>1': 'tab-only',
    '<ctrl-x>l': 'reload',
    '<ctrl-shift-right>': 'tab-next',
    '<ctrl-shift-left>': 'tab-prev',

    # zooming
    '<ctrl-+>': 'zoom-in',
    '<ctrl-->': 'zoom-out',

    # searching
    '<ctrl-s>': 'set-cmd-text /',
    '<ctrl-r>': 'set-cmd-text ?',

    # hinting
    '<alt-s>': 'hint all',

    # history
    # FIXME maybe this should be <C-b> <C-n>? Or would that be too confusing?
    '<alt-right>': 'forward',
    '<alt-left>': 'back',

    # tabs
    '<ctrl-tab>': 'tab-next',
    '<ctrl-shift-tab>': 'tab-prev',

    # file
    '<ctrl-x><ctrl-f>': 'set-cmd-text -s :open -t',
    '<ctrl-u><ctrl-x><ctrl-f>': 'set-cmd-text -s :open',

    # open links
    '<ctrl-l>': 'set-cmd-text -s :open',
    '<alt-l>': 'set-cmd-text -s :open -t',

    # editing
    '<ctrl-f>': 'fake-key <Right>',
    '<ctrl-b>': 'fake-key <Left>',
    '<ctrl-a>': 'fake-key <Home>',
    '<ctrl-e>': 'fake-key <End>',
    '<ctrl-n>': 'fake-key <Down>',
    '<ctrl-p>': 'fake-key <Up>',
    '<alt-f>': 'fake-key <Ctrl-Right>',
    '<alt-b>': 'fake-key <Ctrl-Left>',
    '<ctrl-d>': 'fake-key <Delete>',
    '<alt-d>': 'fake-key <Ctrl-Delete>',
    '<alt-backspace>': 'fake-key <Ctrl-Backspace>',
    '<ctrl-w>': 'fake-key <Ctrl-backspace>',
    '<ctrl-y>': 'insert-text {primary}',

    # Numbers
    # https://github.com/qutebrowser/qutebrowser/issues/4213
    '1': 'fake-key 1',
    '2': 'fake-key 2',
    '3': 'fake-key 3',
    '4': 'fake-key 4',
    '5': 'fake-key 5',
    '6': 'fake-key 6',
    '7': 'fake-key 7',
    '8': 'fake-key 8',
    '9': 'fake-key 9',
    '0': 'fake-key 0',

    # escape hatch
    '<ctrl-h>': 'set-cmd-text -s :help',
    '<ctrl-g>': ESC_BIND
}

c.bindings.commands['insert'] = {
    '<ctrl-e>': 'open-editor',
}

c.bindings.commands['command'] = {
    '<ctrl-s>': 'search-next',
    '<ctrl-r>': 'search-prev',

    '<ctrl-p>': 'completion-item-focus prev',
    '<ctrl-n>': 'completion-item-focus next',

    '<up>': 'command-history-prev',
    '<down>': 'command-history-next',

    # escape hatch
    '<ctrl-g>': 'leave-mode'
}

c.bindings.commands['hint'] = {
    # escape hatch
    '<ctrl-g>': 'leave-mode',
    '<return>': 'follow-hint',
    '<ctrl-m>': 'follow-hint'
}


c.bindings.commands['caret'] = {
    # escape hatch
    '<ctrl-g>': 'leave-mode'
}

c.url.searchengines = {
    'DEFAULT': 'https://duckduckgo.com/?q={}',
    'r': 'https://reddit.com/r/{}',
    'w': 'https://en.wikipidia.org/wiki/{}',
    "osm": "https://www.openstreetmap.org/search?query={}",
    'g': 'https://google.com/search?q={}'
}

c.content.geolocation = 'ask'

Git

Gitignore

Global git ignore file

*.elc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment