diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-12-21 14:17:42 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-12-21 14:17:42 +0530 |
| commit | ebab2f2586739a9e7d0df38f9a1b2eca18b7c719 (patch) | |
| tree | ca630f596ba2ce011021e5516f237f3527e5db96 | |
| parent | 810a3e60ca64e18a11b55ec7e1c2d85e56e51bd5 (diff) | |
| download | nixos-config-ebab2f2586739a9e7d0df38f9a1b2eca18b7c719.tar.gz nixos-config-ebab2f2586739a9e7d0df38f9a1b2eca18b7c719.zip | |
Moves ls and dunst configs and enables notifications
Diffstat (limited to '')
| -rw-r--r-- | config/dunst/dunstrc | 243 | ||||
| -rw-r--r-- | config/lf/lfrc | 117 | ||||
| -rwxr-xr-x | config/lf/lfrun.sh | 18 | ||||
| -rwxr-xr-x | config/lf/previewer.sh | 50 | ||||
| -rw-r--r-- | packages.nix | 6 |
5 files changed, 432 insertions, 2 deletions
diff --git a/config/dunst/dunstrc b/config/dunst/dunstrc new file mode 100644 index 0000000..0337ae9 --- /dev/null +++ b/config/dunst/dunstrc @@ -0,0 +1,243 @@ +[global] + font = JetBrains Mono, Font Awesome 5 Free Solid, Font Awesome 5 Free Regular, Font Awesome 5 Brands 11 + + # Allow a small subset of html markup: + # <b>bold</b> + # <i>italic</i> + # <s>strikethrough</s> + # <u>underline</u> + # + # For a complete reference see + # <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>. + # If markup is not allowed, those tags will be stripped out of the + # message. + markup = yes + + # The format of the message. Possible variables are: + # %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 + # Markup is allowed + format = "<b>%a: </b>\n<i>%s</i>\n%b\n" + + # Sort messages by urgency. + sort = yes + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # The frequency with wich text that is longer than the notification + # window allows bounces back and forth. + # This option conflicts with "word_wrap". + # Set to 0 to disable. + bounce_freq = 0 + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectevly. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + geometry = "500x5-30+20" + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = no + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing windowmanager is + # present (e.g. xcompmgr, compiz, etc.). + transparency = 0 + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + idle_threshold = 120 + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a windowmanager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern windowmanagers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = mouse + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + # This adds empty space above and under the text. + line_height = 0 + + # Draw a line of "separatpr_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 2 + + # Padding between text and separator. + padding = 12 + + # Horizontal padding. + horizontal_padding = 15 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + # dmenu path. + dmenu = dmenu + + # Browser for opening urls in context menu. + browser = xdg-open + + # Align icons left/right/off + icon_position = off + + # Paths to default icons. + icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + + # Frame config + frame_width = 1 + frame_color = "#6f8285" + +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = ctrl+space + + # Close all notifications. + close_all = ctrl+shift+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + history = ctrl+grave + + # Context menu. + context = ctrl+shift+period + +[urgency_low] + background = "#7e6aD3" + foreground = "#ffffff" + timeout = 3 + +[urgency_normal] + background = "#4e3aA3" + foreground = "#ffffff" + timeout = 5 + +[urgency_critical] + background = "#d63031" + foreground = "#ffffff" + timeout = 10 + + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +# vim: ft=cfg diff --git a/config/lf/lfrc b/config/lf/lfrc new file mode 100644 index 0000000..2114fd7 --- /dev/null +++ b/config/lf/lfrc @@ -0,0 +1,117 @@ +set hidden true +# set color256 true +set drawbox true +set icons true +set ignorecase true +set relativenumber true +set ratios 2:3 + +set preview false +set previewer ~/.config/lf/previewer.sh + +# Function definitions {{{ +cmd open_inplace ${{ + case $(file --mime-type "$f" -bL) in + text/*|application/json) $EDITOR "$fx" 2&> /dev/null ;; + video/*) setsid -f swallow mpv "$f" 2&> /dev/null ;; + image/gif) setsid -f swallow mpv "$f" 2&> /dev/null ;; + image/*) setsid -f swallow sxiv "$f" 2&> /dev/null ;; + application/pdf) setsid -f swallow zathura "$f" 2&> /dev/null ;; + *) + for f in "$fx"; do + open "$f" + done + ;; + esac; + disown; +}} + +cmd open ${{ + case $(file --mime-type "$f" -bL) in + text/*|application/json) $EDITOR "$fx" ;; + video/*|application/pdf) open "$f" & ;; + *) + for f in "$fx"; do + open "$f" + done + ;; + esac; + disown; +}} + +cmd mkdir ${{ + printf "Directory Name: " + read ans + mkdir $ans +}} + +cmd mkfile ${{ + printf "File Name: " + read ans + $EDITOR $ans +}} + +cmd move_to_trash ${{ + mkdir -p /tmp/.trash-cache/ + echo "$fx" | while read file; do + mv "$file" /tmp/.trash-cache/ + done; +}} + +cmd rename %{{ + printf " Rename to: " + read ans + mv "$f" "$ans" +}} + +cmd set_wallpaper $feh --bg-scale "$f" + +cmd show_images ${{ + if [ "$(echo "$fx" | wc -l)" = "1" ]; then + swallow sxiv $(dirname "$fx") & + else + swallow sxiv $fx & + fi; +}} + +# }}} + +# Unset old keys {{{ + map w + map m + map n + map "'" + map '"' + map d}} + map c + map e + map d +# }}} + +# Mutations +map dd move_to_trash +map p paste +map x cut +map y copy +map mf mkfile +map md mkdir +map wp set_wallpaper +map rr rename + + +# View changes +map <enter> open_inplace +map si show_images +map du $du -h -d1 | less +map sh :set hidden! +map st :set sortby time + + +# Traversal keys +map gde cd ~/Desktop +map gdl cd ~/Downloads/dl +map gdm cd ~/Downloads/music +map gdv cd ~/dev +map gs cd ~/scripts +map gp cd ~/Pictures + diff --git a/config/lf/lfrun.sh b/config/lf/lfrun.sh new file mode 100755 index 0000000..e350c3f --- /dev/null +++ b/config/lf/lfrun.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +export FIFO_UEBERZUG="/tmp/lf-ueberzug-${PPID}"; +export LAST_IMAGE_F="/tmp/lf-ueberzug-${PPID}-last-img"; + +function cleanup { + ~/scripts/image.sh clear; + rm "$FIFO_UEBERZUG" 2>/dev/null + pkill -P $$ +} + +mkfifo "$FIFO_UEBERZUG" 2&>/dev/null; +mkfifo "$LAST_IMAGE_F" 2&>/dev/null; + +trap cleanup EXIT +tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & + +lf "$@"; diff --git a/config/lf/previewer.sh b/config/lf/previewer.sh new file mode 100755 index 0000000..1b748e1 --- /dev/null +++ b/config/lf/previewer.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +width=`echo "$(tput cols) / 2" | bc`; +height=`echo "$(tput lines) - 3" | bc`; + +x=$((width - 3)); +y=3; + +~/scripts/image.sh clear; + +case "$1" in + # Archives + *.tgz|*.tar.gz) tar tzf "$1";; + *.tar.bz2|*.tbz2) tar tjf "$1";; + *.tar.txz|*.txz) xz --list "$1";; + *.tar) tar tf "$1";; + *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1";; + *.rar) unrar l "$1";; + *.7z) 7z l "$1";; + *.o) nm "$1" | less ;; + *.apk) mediainfo "$1" ;; + + # Docs + *.md|*.org) glow -s dark "$1" ;; + *.csv) cat "$1" | sed s/,/\\n/g ;; + *.pdf) pdftotext "$1" - ;; + *.docx) docx2txt "$1" - ;; + *.epub) mediainfo "$1" ;; + *.[1-8]) man "$1" | col -b ;; + + # Images + *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp) mediainfo "$1"; ;; + + #*.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp) + #~/scripts/image.sh draw "$1" "$x" "$y" "$width" "$height"; + #;; + + # Audio + *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.flac) + mediainfo "$1" + ;; + + # Video + *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) + mediainfo "$1"; + ;; + + # Syntax + *) highlight --out-format ansi "$1" || cat "$1" ;; +esac diff --git a/packages.nix b/packages.nix index ef7a723..2dbda50 100644 --- a/packages.nix +++ b/packages.nix @@ -38,7 +38,6 @@ let # qutebrowser firefox brave - w3m # Media mpv @@ -46,8 +45,11 @@ let ]; utils = with pkgs; [ - mtm + w3m lf + libnotify + dunst + mtm pass xcwd alsaUtils |
