diff --git a/config/dunst/dunstrc b/config/dunst/dunstrc new file mode 100644 index 0000000..4d9c16e --- /dev/null +++ b/config/dunst/dunstrc @@ -0,0 +1,57 @@ +[global] + monitor = 0 + follow = mouse + geometry = "320x5-15+15" + indicate_hidden = yes + shrink = no + transparency = 0 + notification_height = 0 + separator_height = 2 + padding = 10 + horizontal_padding = 10 + frame_width = 1 + frame_color = "#232323" + separator_color = frame + sort = yes + idle_threshold = 120 + font = Source Sans Pro 10 + line_height = 0 + markup = full + format = "%s %p\n%b" + alignment = left + show_age_threshold = 60 + word_wrap = yes + ellipsize = middle + ignore_newline = no + stack_duplicates = true + hide_duplicate_count = false + show_indicators = yes + icon_position = left + max_icon_size = 32 + icon_path = /usr/share/icons/Paper/16x16/status/:/usr/share/icons/Paper/16x16/devices/:/usr/share/icons/Paper/16x16/apps/ + sticky_history = yes + history_length = 20 + always_run_script = true + startup_notification = false + force_xinerama = false + +[urgency_low] + background = "#232323" + foreground = "#a8a8a8" + timeout = 10 + +[urgency_normal] + background = "#232323" + foreground = "#a8a8a8" + timeout = 10 + +[urgency_critical] + background = "#d64e4e" + foreground = "#f0e0e0" + frame_color = "#d64e4e" + timeout = 0 + icon = /usr/share/icons/Paper/16x16/status/dialog-warning.png + +[brave] + appname="Brave" + format="" diff --git a/config/i3/config b/config/i3/config new file mode 100644 index 0000000..d538e6c --- /dev/null +++ b/config/i3/config @@ -0,0 +1,350 @@ +# vim: ft=i3config + +# Modifier key is set as windows key +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango: mono, FontAwesome 11 + +title_align center + +# show the window icon for the focused window to make it stand out +# bindsym $mod+p title_window_icon on + + +# enable window icons for all windows with extra horizontal padding +for_window [all] title_window_icon padding 10px + + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +## Run a terminal +set $term st +bindsym $mod+Return exec $term + + +# Kill focused container +bindsym $mod+Shift+q kill + +# Use rofi launcher +bindsym $mod+d exec rofi -i -sync -show drun + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + + +# split in horizontal orientation +# its ">" +bindsym $mod+greater split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + + + +# client.focused #3B4252 #2f343f #d8dee8 #3B4252 #424a59 +# client.focused_inactive #2E3440 #2f343f #d8dee8 #2E3440 #2f345f +# client.unfocused #2E3440 #2f343f #d8dee8 #2f343f #2f343f +# client.urgent #3B4252 #2f343f #d8dee8 #3B4252 #2f343f +# client.placeholder #3B4252 #2f343f #d8dee8 #3B4252 #2f343f +# client.background #2f343f + + + +############################################################################### +# _ ______ ____ __ _______ ____ ___ _________________ # +# | | / / __ \/ __ \/ //_/ ___// __ \/ | / ____/ ____/ ___/ # +# | | /| / / / / / /_/ / ,< \__ \/ /_/ / /| |/ / / __/ \__ \ # +# | |/ |/ / /_/ / _, _/ /| |___/ / ____/ ___ / /___/ /___ ___/ / # +# |__/|__/\____/_/ |_/_/ |_/____/_/ /_/ |_\____/_____//____/ # +# # +############################################################################### + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws0 "10" + + +# Switch to workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws0 + +# Move focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws0 + + +# Move workspace to another display +bindsym $mod+Shift+U move workspace to output up +bindsym $mod+Shift+D move workspace to output down + +# reload the configuration file +bindsym $mod+Shift+c reload + +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart + +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Koniec?' -b 'Ta' 'i3-msg exit'" + +# +bindsym $mod+b exec pgrep picom && killall picom || picom -b + +# Lock screen +bindsym $mod+Escape exec lockScreen + +## Take screenshot of entire screen +bindsym Print exec scrot -e 'xclip -selection clipboard -target image/png -i $f' +## Take screenshot of focused container +bindsym --release Shift+Print exec scrot -u -e 'xclip -selection clipboard -target image/png -i $f' +## Take screenshot of selected area +bindsym --release Control+Print exec scrot -s -e 'xclip -selection clipboard -target image/png -i $f' + + +## Pulse Audio controls +bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer --sink 0 -i 5 +bindsym XF86AudioLowerVolume exec --no-startup-id pamixer --sink 0 -d 5 +bindsym XF86AudioMute exec --no-startup-id pamixer --sink 0 -t +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute 1 toggle + +######## +# Floating windows resize + +bindsym $mod+r mode "resize" + +mode "resize" { + bindsym h resize shrink width 5 px or 1 ppt + bindsym j resize grow height 5 px or 1 ppt + bindsym k resize shrink height 5 px or 1 ppt + bindsym l resize grow width 5 px or 1 ppt + + bindsym Shift+h resize shrink width 25 px or 5 ppt + bindsym Shift+j resize grow height 25 px or 5 ppt + bindsym Shift+k resize shrink height 25 px or 5 ppt + bindsym Shift+l resize grow width 25 px or 5 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +######## +# Floating windows move + +bindsym Mod4+m focus floating; mode "move" + +mode "move" { + bindsym h move left 20px + bindsym j move down 20px + bindsym k move up 20px + bindsym l move right 20px + + bindsym Shift+h move left 50px + bindsym Shift+j move down 50px + bindsym Shift+k move up 50px + bindsym Shift+l move right 50px + + bindsym Up move up 20px + bindsym Left move left 20px + bindsym Down move down 20px + bindsym Right move right 20px + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +######## +# bar + +bar { + i3bar_command i3bar -t + position top + tray_output primary + separator_symbol "|" + status_command i3blocks +} +bindsym $mod+o bar mode toggle + + + +############################################################################### +# gaps control + +set $mode_gaps gaps +set $mode_gaps_outer outer gaps +set $mode_gaps_inner inner gaps + +set $default_gaps_inner 10 +set $default_gaps_outer 0 + +set $gaps_outer_step 2 +set $gaps_inner_step 2 + +gaps inner $default_gaps_inner +gaps outer $default_gaps_outer + +#smart_gaps active + +bindsym $mod+Shift+g mode "$mode_gaps" + +mode "$mode_gaps" { + bindsym o mode "$mode_gaps_outer" + bindsym i mode "$mode_gaps_inner" + + bindsym 0 mode "default", exec --no-startup-id i3-msg "gaps inner current set 0" && i3-msg "gaps outer current set 0" + bindsym d mode "default", exec --no-startup-id i3-msg "gaps inner current set $default_gaps_inner" && i3-msg "gaps outer current set $default_gaps_outer" + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +mode "$mode_gaps_inner" { + bindsym plus gaps inner current plus $gaps_inner_step + bindsym minus gaps inner current minus $gaps_inner_step + bindsym 0 mode "default", gaps inner current set 0 + bindsym d mode "default", gaps inner current set $default_gaps_inner + + bindsym Shift+plus gaps inner all plus $gaps_inner_step + bindsym Shift+minus gaps inner all minus $gaps_inner_step + bindsym Shift+0 mode "default", gaps inner all set 0 + bindsym Shift+d mode "default", gaps inner all set $default_gaps_inner + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +mode "$mode_gaps_outer" { + bindsym plus gaps outer current plus $gaps_outer_step + bindsym minus gaps outer current minus $gaps_outer_step + bindsym 0 mode "default", gaps outer current set 0 + bindsym d mode "default", gaps outer current set $default_gaps_outer + + bindsym Shift+plus gaps outer all plus $gaps_outer_step + bindsym Shift+minus gaps outer all minus $gaps_outer_step + bindsym Shift+0 mode "default", gaps outer all set 0 + bindsym Shift+d mode "default", gaps outer all set $default_gaps_outer + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +############################################################################### +# Brightness + +# Screen brightness controls +bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 1 +bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 1 + +set $mode_brightness brightness + +bindsym $mod+Shift+b mode "$mode_brightness" + +mode "$mode_brightness" { + bindsym plus exec --no-startup-id xbacklight -inc 1 + bindsym minus exec --no-startup-id xbacklight -dec 1 + bindsym Shift+plus exec --no-startup-id xbacklight -inc 10 + bindsym Shift+minus exec --no-startup-id xbacklight -dec 10 + + bindsym 1 mode "default", exec --no-startup-id xbacklight -set 10 + bindsym 2 mode "default", exec --no-startup-id xbacklight -set 20 + bindsym 3 mode "default", exec --no-startup-id xbacklight -set 30 + bindsym 4 mode "default", exec --no-startup-id xbacklight -set 40 + bindsym 5 mode "default", exec --no-startup-id xbacklight -set 50 + bindsym 6 mode "default", exec --no-startup-id xbacklight -set 60 + bindsym 7 mode "default", exec --no-startup-id xbacklight -set 70 + bindsym 8 mode "default", exec --no-startup-id xbacklight -set 80 + bindsym 9 mode "default", exec --no-startup-id xbacklight -set 90 + bindsym 0 mode "default", exec --no-startup-id xbacklight -set 100 + + bindsym Return mode "default" + bindsym Escape mode "default" +} + +############################################################################### +# ______ _ _ _ # +# | ____| (_) | | | | # +# | |__ __ ___ __ ___ _ __ _ _ __ ___ ___ _ __ | |_ __ _| | # +# | __| \ \/ / '_ \ / _ \ '__| | '_ ` _ \ / _ \ '_ \| __/ _` | | # +# | |____ > <| |_) | __/ | | | | | | | | __/ | | | || (_| | | # +# |______/_/\_\ .__/ \___|_| |_|_| |_| |_|\___|_| |_|\__\__,_|_| # +# | | # +# |_| # +############################################################################### + +for_window [instance="dropdown-lf"] floating enable +for_window [instance="dropdown-lf"] resize set 1000 700 +for_window [instance="dropdown-lf"] move scratchpad +for_window [instance="dropdown-lf"] border pixel 5 +exec_always --no-startup-id $term -n dropdown-lf -e lfrun + +bindsym $mod+u [instance="dropdown-lf"] scratchpad show; [instance="dropdown-lf"] move position center + +for_window [class="GLWindow"] floating enable +no_focus [class="GLWindow"] + +new_window pixel 3 diff --git a/config/i3blocks/blocklets/backlight b/config/i3blocks/blocklets/backlight new file mode 100755 index 0000000..be6301c --- /dev/null +++ b/config/i3blocks/blocklets/backlight @@ -0,0 +1,8 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 4) xbacklight -inc 20 ;; + 5) xbacklight -dec 20 ;; +esac + +echo  $(xbacklight -get | cut -d'.' -f1)% diff --git a/config/i3blocks/blocklets/battery b/config/i3blocks/blocklets/battery new file mode 100755 index 0000000..a178ffa --- /dev/null +++ b/config/i3blocks/blocklets/battery @@ -0,0 +1,110 @@ +#!/usr/bin/env python + +# Works with upower 0.99.7 + +import time +import subprocess + +glyphs = { + 'supply' : { + 'on' : '', + 'off' : ''#'' + }, + 'status' : ["", "", "", "", ""], + 'time' : "" +} + +flags = { + 'supply' : False, + 'charge' : False, + 'full' : False, + 'discharging' : False, + 'charging' : False +} + +def getIco(percent): + if percent > 90: + color = '#FFFFFF' + ico = glyphs['status'][4] + elif percent > 70: + color = '#FFFFFF' + ico = glyphs['status'][3] + elif percent > 40: + color = '#FFFFFF' + ico = glyphs['status'][2] + elif percent > 15: + color = '#FFAAAA' + ico = glyphs['status'][1] + else: + color = '#A00000' + ico = glyphs['status'][0] + s = ''+ico+'' + return s +# Get information about power devices with following command: +# upower -e + +# Get information from upower about power supply +ac_device = '/org/freedesktop/UPower/devices/line_power_AC' +info_ac = subprocess.run(['upower', '-i', ac_device], stdout=subprocess.PIPE) +info_ac = info_ac.stdout.decode('UTF-8') +info_ac = info_ac.split('\n') + +## Process AC information +for l in info_ac: + foo = l.split() + if not foo: + continue + + if foo[0] == 'online:': + if foo[1] == 'yes': + flags['supply'] = True + + +# Get information from upower about BAT1 +ac_device = '/org/freedesktop/UPower/devices/battery_BAT1' +info_BAT1 = subprocess.run(['upower', '-i', ac_device], stdout=subprocess.PIPE) +info_BAT1 = info_BAT1.stdout.decode('UTF-8') +info_BAT1 = info_BAT1.split('\n') + +## Process BAT1 information +for l in info_BAT1: + foo = l.split() + if not foo: + continue + + if foo[0] == 'state:': + if foo[1] == 'fully-charged': + flags['full'] = True + elif foo[1] == 'discharging': + flags['discharging'] = True + + elif foo[0] == 'percentage:': + percentage = foo[1] + + elif foo[0] == 'time': + remaining = foo[3] + if foo[4] == 'minutes': + remaining += 'm' + elif foo[4] == 'hours': + remaining += 'h' + + + +if flags['supply']: + currentTime = int(time.time()) + supply_ico = glyphs['supply']['on'] + battery_ico = glyphs['status'][currentTime % 5] +else: + supply_ico = glyphs['supply']['off'] + p = int(percentage[:-1]) + battery_ico = getIco(p) + + +if flags['full']: + b = '' + glyphs['status'][4] + '' + print(b +' '+supply_ico) + #print(b +' '+percentage+' '+supply_ico) +else: + print(battery_ico) + #print(battery_ico+' '+percentage+'('+glyphs['time']+remaining+')'+supply_ico) + diff --git a/config/i3blocks/blocklets/microphone b/config/i3blocks/blocklets/microphone new file mode 100644 index 0000000..0d5a637 --- /dev/null +++ b/config/i3blocks/blocklets/microphone @@ -0,0 +1,16 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) pamixer -t ;; + 3) pavucontrol ;; + 4) pamixer -i 5 ;; + 5) pamixer -d 5 ;; +esac + +vol=$(pamixer --get-volume)% +if [[ $(pamixer --get-mute) = "true" ]] +then + echo ' '$vol'' +else + echo "" $vol +fi diff --git a/config/i3blocks/blocklets/pasink b/config/i3blocks/blocklets/pasink new file mode 100755 index 0000000..1f31be4 --- /dev/null +++ b/config/i3blocks/blocklets/pasink @@ -0,0 +1,18 @@ +#!/bin/sh + +SINK=$(pamixer --get-default-sink | tail -n 1 | cut -d" " -f1) + +case $BLOCK_BUTTON in + 1) pamixer --sink $SINK -t ;; + 3) pavucontrol ;; + 4) pamixer --sink $SINK -i 5 ;; + 5) pamixer --sink $SINK -d 5 ;; +esac + +vol=$(pamixer --sink $SINK --get-volume)% +if [[ $(pamixer --sink $SINK --get-mute) = "true" ]] +then + echo ' '$vol'' +else + echo "" $vol +fi diff --git a/config/i3blocks/config b/config/i3blocks/config new file mode 100644 index 0000000..3f062fb --- /dev/null +++ b/config/i3blocks/config @@ -0,0 +1,22 @@ +[volume] +command=~/.config/i3blocks/blocklets/pasink +interval=1 +markup=pango + +[backlight] +command=~/.config/i3blocks/blocklets/backlight +interval=1 + +[memory] +command=df -h / | tail -n 1 | awk '{print $4}' +label= /  +interval=30 + +[daycount] +command=echo "" "$(python -c 'from datetime import date as d;print((d.today()-d(1991,11,5)).days)')" +interval=30 + +[time] +command=echo "" "$(date '+%j-%U') $(date '+%Y-%m-%d %H:%M:%S')" +interval=1 + diff --git a/config/lf/cleaner b/config/lf/cleaner new file mode 100755 index 0000000..a184d84 --- /dev/null +++ b/config/lf/cleaner @@ -0,0 +1,4 @@ +#!/bin/sh +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" +fi diff --git a/config/lf/lfrc b/config/lf/lfrc new file mode 100644 index 0000000..0b01ad6 --- /dev/null +++ b/config/lf/lfrc @@ -0,0 +1,90 @@ +set drawbox true +set icons true +set period 1 +set previewer ~/.config/lf/preview +set cleaner ~/.config/lf/cleaner +set info size + + +cmd open_new_lf_here ${{ + setsid -f st lfrun $(pwd) +}} + +cmd open ${{ + case $(file --mime-type -b "$(readlink -f "$f")") in + application/pdf) setsid -f okular "$fx" >/dev/null 2>&1 ;; + image/vnd.djvu) setsid -f okular "$fx" >/dev/null 2>&1 ;; + image/*) setsid -f nsxiv -a "$fx" . ;; + audio/*) setsid -f mpv "$f" >/dev/null 2>&1 ;; + video/*) setsid -f mpv -quiet "$f" >/dev/null 2>&1 ;; + *) for f in "$fx"; do setsid -f $OPENER "$f" >/dev/null 2>&1; done ;; + esac +}} + +cmd trash ${{ + while IFS= read -r file + do + trash-put "$file" + done <<<"$fx" +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + + printf "%s\n" "$fx" + printf "\n\t" + printf "delete all/partial/none? [a/p/n]" + read ans + + # all + if [ $ans = "a" ] + then + while IFS= read -r file + do + printf "deleting $file" + rm -rf "$file" + done <<<"$fx" + fi + + # partial + if [ $ans = "p" ] + then + while IFS= read -r file + do + printf "delete $file? [y/n]" + read -u 1 ans + [ $ans = "y" ] && rm -rf "$file" + done <<<"$fx" + fi +}} + +cmd bulkrename ${{ + /bin/sh -c "vimv $(echo -e "$fx" | xargs -i echo "\\'{}\\'" | xargs echo)" +}} + + + +cmd real_symlink ${{ + ln -sr "$fs" "$(basename "$fs")" +}} + +cmd copy_path ${{ + echo "$f" | xclip -sel clip +}} + +cmd copy_filename ${{ + basename "$f" | xclip -sel clip +}} + + +map Dd trash +map Dp delete + +map A rename # at the very end +map I push A # at the very beginning +map o open + + +map .r real_symlink +map .p copy_path +map .f copy_filename diff --git a/config/lf/preview b/config/lf/preview new file mode 100755 index 0000000..73f7bc5 --- /dev/null +++ b/config/lf/preview @@ -0,0 +1,86 @@ +#!/bin/sh +CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' \ + -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" + +image() { + if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y":"%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' \ + "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + exit 1 + else + chafa "$1" -s "$4x" + fi +} + +batorcat() { + file="$1" + shift + if command -v bat > /dev/null 2>&1; then + bat --color=always --style=plain --pager=never "$file" "$@" + else + cat "$file" + fi +} + +glowormdcat() { + file="$1" + shift + if command -v glow > /dev/null 2>&1; then + glow "$file" + else + mdcat "$file" + fi +} + +case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in + *.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" ;; + # *.gz) gzip -l "$1" ;; + # *.rar) unrar l "$1" ;; + *.md) glowormdcat "$1";; + # *.7z) 7z l "$1" ;; + *.[1-8]) man "$1" | col -b ;; + *.o) nm "$1";; + *.torrent) transmission-show "$1" ;; + *.iso) iso-info --no-header -l "$1" ;; + *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; + *.doc) catdoc "$1" ;; + *.docx) docx2txt "$1" ;; + *.xml|*.html) w3m -dump "$1";; + *.xls|*.xlsx) + ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv + ;; + *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) + exiftool "$1" + ;; + *.pdf) + [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; + *.epub) + [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; + *.cbz|*.cbr|*.cbt) + [ ! -f "$CACHE" ] && comicthumb "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; + *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) + [ ! -f "${CACHE}.jpg" ] && \ + ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5 + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; + *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.tiff|*.gif|*.jfif|*.ico) + image "$1" "$2" "$3" "$4" "$5" + ;; + *.svg) + [ ! -f "${CACHE}.jpg" ] && convert "$1" "${CACHE}.jpg" + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; + *.ino) batorcat --language=cpp "$1" ;; + *) file -ibL "$1" | grep -q text && batorcat "$1" || file -Lb "$1" ;; +esac +exit 0 diff --git a/config/mpd/mpd.conf b/config/mpd/mpd.conf new file mode 100644 index 0000000..bdf2f47 --- /dev/null +++ b/config/mpd/mpd.conf @@ -0,0 +1,21 @@ +# /usr/share/doc/mpd/mpdconf.example + +music_directory "~/m" +playlist_directory "~/.config/mpd/playlists" + +auto_update "yes" +bind_to_address "127.0.0.1" +restore_paused "yes" +max_output_buffer_size "16384" + +audio_output { + type "pulse" + name "pulse" +} + +audio_output { + type "fifo" + name "Visualizer feed" + path "/tmp/mpd.fifo" + format "44100:16:2" +} diff --git a/config/ncmpcpp/config b/config/ncmpcpp/config new file mode 100644 index 0000000..547264c --- /dev/null +++ b/config/ncmpcpp/config @@ -0,0 +1,32 @@ +# vim: filetype=conf + +ncmpcpp_directory = "~/.config/ncmpcpp" +# lyrics_directory = "~/.local/share/lyrics" +mpd_music_dir = "~/m" +message_delay_time = "1" +visualizer_type = "spectrum" +song_list_format = {$4%a - }{%t}|{$8%f$9}$R{$3(%l)$9} +song_status_format = $b{{$8"%t"}} $3by {$4%a{ $3in $7%b{ (%y)}} $3}|{$8%f} +song_library_format = {%n - }{%t}|{%f} +alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b +alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D} +current_item_prefix = $(cyan)$r$b +current_item_suffix = $/r$(end)$/b +current_item_inactive_column_prefix = $(magenta)$r +current_item_inactive_column_suffix = $/r$(end) +playlist_display_mode = columns +browser_display_mode = columns +progressbar_look = -> +media_library_primary_tag = album_artist +media_library_albums_split_by_date = no +startup_screen = "media_library" +display_volume_level = no +ignore_leading_the = yes +external_editor = nvim +use_console_editor = yes +empty_tag_color = magenta +main_window_color = white +progressbar_color = black:b +progressbar_elapsed_color = blue:b +statusbar_color = red +statusbar_time_color = cyan:b diff --git a/config/picom/picom.conf b/config/picom/picom.conf new file mode 100644 index 0000000..fc11385 --- /dev/null +++ b/config/picom/picom.conf @@ -0,0 +1,20 @@ +shadow = false; +fading = true; +fade-in-step = 0.03; +fade-out-step = 0.03; +fade-delta = 5 + +backend = "glx" +opacity-rule = [ "100:class_g = 'St' && focused", "75:class_g = 'St' && !focused" ]; +blur: { + method = "dual_kawase"; + strength = 2; +} +blur-background-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'", + "_GTK_FRAME_EXTENTS@:c" +]; +detect-transient = true; + +no-ewmh-fullscreen = true; diff --git a/config/redshift/redshift.conf b/config/redshift/redshift.conf new file mode 100644 index 0000000..b15870b --- /dev/null +++ b/config/redshift/redshift.conf @@ -0,0 +1,16 @@ +[redshift] + +temp-day=5700 +temp-night=2000 + +fade=1 + +dawn-time=6:00-7:45 +dusk-time=18:35-20:15 + +;brightness-day=0.7 +;brightness-night=0.4 +;gamma-day=0.8:0.7:0.8 +;gamma-night=0.6 + +adjustment-method=randr diff --git a/config/rofi/config.rasi b/config/rofi/config.rasi new file mode 100644 index 0000000..6078dba --- /dev/null +++ b/config/rofi/config.rasi @@ -0,0 +1,8 @@ +configuration { + modi: "drun,window,run,ssh"; + font: "mono 12"; + fixed-num-lines: true; + show-icons: true; + terminal: "st"; +} +@theme "nord" diff --git a/config/rofi/nord.rasi b/config/rofi/nord.rasi new file mode 100644 index 0000000..423e2ed --- /dev/null +++ b/config/rofi/nord.rasi @@ -0,0 +1,109 @@ +* { + backgroundcolor: #2e3440; + bg1: #3b4252; + backgroundcoloralternate: #2e3440; + separatorcolor: #3b4252; + scrollbarcolor: #3b4252; + foregroundcolor: #839496; + foregroundcolorinverse: #839496; + selectioncolor: #3b4252; + + font-size: 1px; + border-color: @separatorcolor; + background-color: @backgroundcolor; + text-color: @foregroundcolor; + margin: 0; + margin-bottom: 0; + margin-top: 0; + spacing: 0; +} + +#listview { + spacing: 0; + scrollbar: true; + margin: 0; + dynamic: true; + lines: 5; + +} + +#window { + background-color: @backgroundcolor; + border-color: @separatorcolor; + border: 2px; + border-radius: 4px; + width: 40%; +} + +#mainbox { + border: 0; + padding: 0; + background-color: @backgroundcoloralternate; +} + +#element { + padding: 16; + border: 0 0 1 0; + border-color: @separatorcolor; + background-color: @backgroundcoloralternate; +} + +#element.selected.normal { + background-color: @selectioncolor; + text-color: @foregroundcolorinverse; + border-radius: 0px; + + border: 0 0 1 0; + border-color: @separatorcolor; +} + +#element.alternate.normal { + background-color: @backgroundcoloralternate; +} + +#element.normal.active { + background-color: #434c5e; +} + +#element.alternate.active { + background-color: #434c5e; +} + +#element.selected.active { + background-color: @selectioncolor; + text-color: @foregroundcolorinverse; + border-radius: 0px; + + border: 0 0 1 0; + border-color: @separatorcolor; +} + +#inputbar { + border: 0 solid 0 solid 1 solid 0 solid; + margin: 0; + spacing: 0; + border-color: @separatorcolor; +} + +#prompt { + padding: 16; + background-color: @backgroundcoloralternate; + border: 0 1 0 0; +} + +#entry { + padding: 16; +} + +#scrollbar { + border: 0px; + width: 1px; + handle-color: @scrollbarcolor; + handle-width: 5px; + background-color: @backgroundcoloralternate; +} + +#scrollbar handle { + border: 1px; + border-color: #ff0000; +} diff --git a/config/systemd/user/ssh-agent.service b/config/systemd/user/ssh-agent.service new file mode 100644 index 0000000..9428410 --- /dev/null +++ b/config/systemd/user/ssh-agent.service @@ -0,0 +1,10 @@ +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf new file mode 100644 index 0000000..f096b92 --- /dev/null +++ b/config/tmux/tmux.conf @@ -0,0 +1 @@ +setw -g mouse on diff --git a/config/user-dirs.dirs b/config/user-dirs.dirs new file mode 100644 index 0000000..adabb85 --- /dev/null +++ b/config/user-dirs.dirs @@ -0,0 +1,8 @@ +XDG_DESKTOP_DIR="$HOME/" +XDG_DOWNLOAD_DIR="$HOME/t" +XDG_DOCUMENTS_DIR="$HOME/d" +XDG_MUSIC_DIR="$HOME/m" +XDG_PICTURES_DIR="$HOME/i" +XDG_VIDEOS_DIR="$HOME/v" +#XDG_TEMPLATES_DIR="" +#XDG_PUBLICSAHRE_DIR="" diff --git a/config/x11/Xresources b/config/x11/Xresources new file mode 100644 index 0000000..a788915 --- /dev/null +++ b/config/x11/Xresources @@ -0,0 +1,36 @@ +!! Transparency (0-1): +st.alpha: 0.4 +!st.alphaOffset: 0.3 + +!! Set a default font and font size as below: + +*.font: DejaVuSansMono Nerd Font Mono-11; +!*.font: FiraCode Nerd Font Mono-11; +!*.font: Iosevka Nerd Font Mono-11; +!*.font: TerminessTTF Nerd Font Mono-11; + +! st.termname: st-256color +! st.borderpx: 2 + +!! Set the background, foreground and cursor colors as below: + +!! gruvbox: +!*.color0: #1d2021 +!*.color1: #cc241d +!*.color2: #98971a +!*.color3: #d79921 +!*.color4: #458588 +!*.color5: #b16286 +!*.color6: #689d6a +!*.color7: #a89984 +!*.color8: #928374 +!*.color9: #fb4934 +!*.color10: #b8bb26 +!*.color11: #fabd2f +!*.color12: #83a598 +!*.color13: #d3869b +!*.color14: #8ec07c +!*.color15: #ebdbb2 +!*.background: #282828 +!*.foreground: white +!*.cursorColor: white diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc index 8985573..7dd652c 100644 --- a/config/zsh/.zshrc +++ b/config/zsh/.zshrc @@ -23,6 +23,7 @@ bindkey '^[[B' history-substring-search-down # or '\eOB' HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 +alias lf='lfrun' alias l='ls -lah' alias la='ls -lAh' diff --git a/install.sh b/install.sh index c4b46ce..8956ee5 100755 --- a/install.sh +++ b/install.sh @@ -9,8 +9,15 @@ ln --force --symbolic $BASEDIR/.zshenv $HOME/.zshenv mkdir -p "${XDG_CONFIG_HOME}" mkdir -p "${XDG_DATA_HOME}" -ln --force --symbolic --no-dereference $BASEDIR/config/x11/ "${XDG_CONFIG_HOME}/x11" -ln --force --symbolic --no-dereference $BASEDIR/config/zsh/ "${XDG_CONFIG_HOME}/zsh" +INSTALL_CONFIGS=(dunst i3 i3blocks lf mpd picom redshift rofi tmux x11 zsh) +for f in $INSTALL_CONFIGS ; do + echo "Installing config for ${f}..." + rm -rf ${XDG_CONFIG_HOME}/${f} > /dev/null 2>&1 + ln --force --symbolic --no-dereference ${BASEDIR}/config/${f}/ "${XDG_CONFIG_HOME}/${f}" +done -ln --force --symbolic --no-dereference $BASEDIR/local/bin/fssh "${XDG_BIN_HOME}/fssh" -ln --force --symbolic --no-dereference $BASEDIR/local/bin/setbg "${XDG_BIN_HOME}/setbg" +INSTALL_BINS=(fssh lfrun lockScreen scroll_high_res_off setbg sl tmux_chooser) +for p in $INSTALL_BINS ; do + echo "Installing script ${p}..." + ln --force --symbolic --no-dereference ${BASEDIR}/local/bin/${f} "${XDG_BIN_HOME}/${f}" +done diff --git a/local/bin/lfrun b/local/bin/lfrun new file mode 100755 index 0000000..1591251 --- /dev/null +++ b/local/bin/lfrun @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup EXIT + lf "$@" 3>&- +fi diff --git a/local/bin/lockScreen b/local/bin/lockScreen new file mode 100755 index 0000000..aa96db7 --- /dev/null +++ b/local/bin/lockScreen @@ -0,0 +1,58 @@ +#!/bin/zsh + +IMG_PATH=$HOME/i/zamkopapiery +FILENAME=$(ls $IMG_PATH | sort -R | head -n 1) +IMG=$IMG_PATH/$FILENAME + +tmp=/tmp/lockscreen.jpg +scrot --format jpg $tmp + +magick $tmp -scale 5% -scale 2000% $tmp +magick $tmp "$IMG" -gravity South -composite $tmp + +BLANK='#00000000' +CLEAR='#ffffff22' +DEFAULT='#ff00ffcc' +TEXT='#ee00eeee' +WRONG='#880000bb' +VERIFYING='#bb00bbbb' + +i3lock \ +--insidever-color=$CLEAR \ +--ringver-color=$VERIFYING \ +\ +--insidewrong-color=$CLEAR \ +--ringwrong-color=$WRONG \ +\ +--inside-color=$BLANK \ +--ring-color=$DEFAULT \ +--line-color=$BLANK \ +--separator-color=$DEFAULT \ +\ +--verif-color=$TEXT \ +--wrong-color=$TEXT \ +--time-color=$TEXT \ +--date-color=$TEXT \ +--layout-color=$TEXT \ +--keyhl-color=$WRONG \ +--bshl-color=$WRONG \ +--ind-pos="x+310:y+h-80" \ +--radius=25 \ +--ring-width=5 \ +--clock --force-clock \ +--time-pos="ix-265:iy-10" \ +--time-align 1 \ +--date-str "" \ +--greeter-pos="ix-265:iy+12" \ +--pass-media-keys \ +--pass-screen-keys \ +--pass-volume-keys \ +--pass-power-keys \ +--screen 1 \ +--blur 5 \ +--time-str="%H:%M:%S" \ +--date-str="%A, %Y-%m-%d" \ +--ignore-empty-password \ +--image="${tmp}" + +rm $tmp diff --git a/local/bin/scroll_high_res_off b/local/bin/scroll_high_res_off new file mode 100755 index 0000000..e348d36 --- /dev/null +++ b/local/bin/scroll_high_res_off @@ -0,0 +1,14 @@ +#!/bin/sh + +# +# Turn off High Resolution Wheel Scroll +# + + +IDX=$(xinput list | grep "Performance MX" | awk '{print $6}' | cut -d "=" -f 2) + + +for id in $IDX +do + xinput set-prop $id 'libinput High Resolution Wheel Scroll Enabled' 0 +done diff --git a/local/bin/sl b/local/bin/sl new file mode 100755 index 0000000..229a75a --- /dev/null +++ b/local/bin/sl @@ -0,0 +1,20 @@ +#!/bin/sh + + +function dom_itek () { + xrandr --output eDP1 --primary --mode 1920x1080 --pos 320x1440 --rotate normal --output DP1 --off --output DP2 --mode 2560x1440 --pos 0x0 --rotate normal --output HDMI1 --off --output HDMI2 --off --output VIRTUAL1 --off +} + +function lab_420_itek () { + xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x1200 --rotate normal --output DP1 --off --output DP2 --mode 1920x1200 --pos 0x0 --rotate normal --output HDMI1 --off --output HDMI2 --off --output VIRTUAL1 --off +} + +LAYOUTS="$(cat <<-EOF +dom_itek +lab_420_itek +EOF +)" + +L=$(echo "$LAYOUTS" | fzf) + +eval "$L" diff --git a/local/bin/tmux_chooser b/local/bin/tmux_chooser new file mode 100755 index 0000000..7468ee7 --- /dev/null +++ b/local/bin/tmux_chooser @@ -0,0 +1,34 @@ +#!/usr/bin/zsh +# shellcheck disable=SC2207 + +# Doesn't let you press Ctrl-C +function ctrl_c() { + echo -e "\renter nil to drop to normal prompt" +} + +trap ctrl_c SIGINT + +no_of_terminals=$(tmux list-sessions | wc -l) +IFS=$'\n' +output=($(tmux list-sessions)) +output_names=($(tmux list-sessions -F\#S)) +k=1 +echo "Choose the terminal to attach: " +for i in "${output[@]}"; do + echo "$k - $i" + ((k++)) +done +echo +echo "Create a new session by entering a name for it" +read -r input +if [[ $input == "" ]]; then + tmux new-session +elif [[ $input == 'nil' ]]; then + exit 1 +elif [[ $input =~ ^[0-9]+$ ]] && [[ $input -le $no_of_terminals ]]; then + terminal_name="${output_names[input - 1]}" + tmux attach -t "$terminal_name" +else + tmux new-session -s "$input" +fi +exit 0