From fbec75168c4e055c8b3ec0217937f5d936d5c0b6 Mon Sep 17 00:00:00 2001 From: danix Date: Wed, 6 Nov 2024 12:55:24 +0100 Subject: [PATCH] forgot a few files --- Xresources | 86 +- bash_profile | 2 - bashrc | 50 +- bin/betterlockscreen | 942 -------- bin/blackpearl-appsmenu.sh | 5 - bin/blackpearl-emoji.sh | 4 - bin/blackpearl-notes.sh | 28 - bin/blackpearl-powermenu.sh | 39 - bin/blackpearl-runner.sh | 4 - bin/blackpearl-scrotmenu.sh | 19 - bin/blackpearl-sshmenu.sh | 4 - bin/blackpearl-symbols.sh | 1 - bin/blackpearl-utilsmenu.sh | 20 - bin/blackpearl-window.sh | 12 - bin/change_wallpaper.sh | 127 - bin/dunst-snooze.sh | 14 - bin/dunst_vol_brig.sh | 87 - bin/feh-blur | 412 ---- bin/gify.sh | 170 -- bin/hideIt.sh | 686 ------ bin/hidebars.sh | 10 - bin/i3-exit | 24 - bin/i3-scrot | 73 - bin/i3lock-blur | 8 - bin/i3lock-fancy | 141 -- bin/i3suspend | 7 - bin/info-airqualityindex.sh | 41 - bin/is_installed | 123 - bin/lightsOn.sh | 240 -- bin/maiumin | 18 - bin/mkpass | 54 - bin/mvb | 164 -- bin/my_netstat | 8 - bin/nopy.sh | 77 - bin/nospaces | 14 - bin/notes | 726 ------ bin/polybar-kdeconnect.sh | 123 - bin/qwalwal.sh | 131 - bin/run-polybar.sh | 37 - bin/send-to-device.sh | 54 - bin/slack-updates | 36 - bin/speedtest | Bin 2613400 -> 0 bytes bin/superenalotto.sh | 37 - bin/symbols.sh | 80 - bin/vt-color-scheme.py | 59 - bin/wacom | 22 - bin/wal.sh | 30 - bin/wallpaper.sh | 127 - bin/walogram | 173 -- bin/walwal.sh | 131 - i3/config | 344 --- picom.conf | 429 ---- picom/picom.conf | 431 ---- polybar/config | 118 - polybar/config.ini-original | 423 ---- polybar/config.ini-vecchio | 383 --- polybar/config.ini.boh | 333 --- polybar/modules/airquality.ini | 5 - polybar/modules/battery.ini | 39 - polybar/modules/cpu.ini | 15 - polybar/modules/date.ini | 8 - polybar/modules/duckstation.ini | 10 - polybar/modules/dunst-snooze.ini | 6 - polybar/modules/filesys.ini | 18 - polybar/modules/gmail-0.ini | 10 - polybar/modules/gmail-1.ini | 10 - polybar/modules/gmail-2.ini | 10 - polybar/modules/gmail/.gitignore | 1 - polybar/modules/gmail/LICENSE | 21 - polybar/modules/gmail/README.md | 67 - polybar/modules/gmail/auth.py | 27 - polybar/modules/gmail/client_secrets.json | 1 - polybar/modules/gmail/credentials_65d85.json | 1 - .../modules/gmail/credentials_danixland.json | 1 - polybar/modules/gmail/credentials_itdm.json | 1 - polybar/modules/gmail/launch.py | 67 - polybar/modules/gmail/list_labels.py | 18 - polybar/modules/gmail/poetry.lock | 412 ---- polybar/modules/gmail/preview.png | Bin 497 -> 0 bytes polybar/modules/gmail/pyproject.toml | 22 - polybar/modules/i3.ini | 34 - polybar/modules/kdeconnect.ini | 5 - polybar/modules/keyboard.ini | 20 - polybar/modules/memory.ini | 6 - polybar/modules/network.ini | 16 - polybar/modules/pulseaudio.ini | 13 - polybar/modules/slackware.ini | 10 - polybar/modules/temperature.ini | 54 - polybar/modules/tray.ini | 6 - polybar/modules/weather.ini | 10 - .../modules/weather/openweathermap-simple.sh | 329 --- .../weather/openweathermap-simple.sh.old | 59 - polybar/modules/windowlist.ini | 5 - polybar/modules/windows.ini | 11 - polybar/modules/workspaces.ini | 37 - polybar/scripts/windowlist/LICENSE | 22 - polybar/scripts/windowlist/Makefile | 26 - polybar/scripts/windowlist/README.md | 229 -- .../scripts/windowlist/click-actions/close | Bin 32392 -> 0 bytes .../scripts/windowlist/click-actions/close.c | 46 - .../scripts/windowlist/click-actions/minimize | Bin 25160 -> 0 bytes .../windowlist/click-actions/minimize.c | 22 - .../scripts/windowlist/click-actions/raise | Bin 32512 -> 0 bytes .../scripts/windowlist/click-actions/raise.c | 47 - polybar/scripts/windowlist/config.toml | 52 - polybar/scripts/windowlist/main | Bin 178608 -> 0 bytes polybar/scripts/windowlist/main.c | 450 ---- polybar/scripts/windowlist/screenshot.png | Bin 2759 -> 0 bytes polybar/scripts/windowlist/toml-c.h | 2132 ----------------- polybar/scripts/windowlist/windowlist.c | 284 --- polybar/scripts/windowlist/windowlist.h | 12 - polybar/scripts/windowlist/windowlist.o | Bin 31096 -> 0 bytes tmux/tmux.conf.danix | 7 +- xinitrc | 4 + xprofile | 18 +- 115 files changed, 53 insertions(+), 12624 deletions(-) delete mode 100644 bin/betterlockscreen delete mode 100644 bin/blackpearl-appsmenu.sh delete mode 100644 bin/blackpearl-emoji.sh delete mode 100644 bin/blackpearl-notes.sh delete mode 100644 bin/blackpearl-powermenu.sh delete mode 100644 bin/blackpearl-runner.sh delete mode 100644 bin/blackpearl-scrotmenu.sh delete mode 100644 bin/blackpearl-sshmenu.sh delete mode 100644 bin/blackpearl-symbols.sh delete mode 100644 bin/blackpearl-utilsmenu.sh delete mode 100644 bin/blackpearl-window.sh delete mode 100644 bin/change_wallpaper.sh delete mode 100644 bin/dunst-snooze.sh delete mode 100644 bin/dunst_vol_brig.sh delete mode 100644 bin/feh-blur delete mode 100644 bin/gify.sh delete mode 100644 bin/hideIt.sh delete mode 100644 bin/hidebars.sh delete mode 100644 bin/i3-exit delete mode 100644 bin/i3-scrot delete mode 100644 bin/i3lock-blur delete mode 100644 bin/i3lock-fancy delete mode 100644 bin/i3suspend delete mode 100644 bin/info-airqualityindex.sh delete mode 100644 bin/is_installed delete mode 100644 bin/lightsOn.sh delete mode 100644 bin/maiumin delete mode 100644 bin/mkpass delete mode 100644 bin/mvb delete mode 100644 bin/my_netstat delete mode 100644 bin/nopy.sh delete mode 100644 bin/nospaces delete mode 100644 bin/notes delete mode 100644 bin/polybar-kdeconnect.sh delete mode 100644 bin/qwalwal.sh delete mode 100644 bin/run-polybar.sh delete mode 100644 bin/send-to-device.sh delete mode 100644 bin/slack-updates delete mode 100644 bin/speedtest delete mode 100644 bin/superenalotto.sh delete mode 100644 bin/symbols.sh delete mode 100644 bin/vt-color-scheme.py delete mode 100644 bin/wacom delete mode 100644 bin/wal.sh delete mode 100644 bin/wallpaper.sh delete mode 100644 bin/walogram delete mode 100644 bin/walwal.sh delete mode 100644 i3/config delete mode 100644 picom.conf delete mode 100644 picom/picom.conf delete mode 100644 polybar/config delete mode 100644 polybar/config.ini-original delete mode 100644 polybar/config.ini-vecchio delete mode 100644 polybar/config.ini.boh delete mode 100644 polybar/modules/airquality.ini delete mode 100644 polybar/modules/battery.ini delete mode 100644 polybar/modules/cpu.ini delete mode 100644 polybar/modules/date.ini delete mode 100644 polybar/modules/duckstation.ini delete mode 100644 polybar/modules/dunst-snooze.ini delete mode 100644 polybar/modules/filesys.ini delete mode 100644 polybar/modules/gmail-0.ini delete mode 100644 polybar/modules/gmail-1.ini delete mode 100644 polybar/modules/gmail-2.ini delete mode 100644 polybar/modules/gmail/.gitignore delete mode 100644 polybar/modules/gmail/LICENSE delete mode 100644 polybar/modules/gmail/README.md delete mode 100755 polybar/modules/gmail/auth.py delete mode 100644 polybar/modules/gmail/client_secrets.json delete mode 100644 polybar/modules/gmail/credentials_65d85.json delete mode 100644 polybar/modules/gmail/credentials_danixland.json delete mode 100644 polybar/modules/gmail/credentials_itdm.json delete mode 100755 polybar/modules/gmail/launch.py delete mode 100755 polybar/modules/gmail/list_labels.py delete mode 100644 polybar/modules/gmail/poetry.lock delete mode 100644 polybar/modules/gmail/preview.png delete mode 100644 polybar/modules/gmail/pyproject.toml delete mode 100644 polybar/modules/i3.ini delete mode 100644 polybar/modules/kdeconnect.ini delete mode 100644 polybar/modules/keyboard.ini delete mode 100644 polybar/modules/memory.ini delete mode 100644 polybar/modules/network.ini delete mode 100644 polybar/modules/pulseaudio.ini delete mode 100644 polybar/modules/slackware.ini delete mode 100644 polybar/modules/temperature.ini delete mode 100644 polybar/modules/tray.ini delete mode 100644 polybar/modules/weather.ini delete mode 100755 polybar/modules/weather/openweathermap-simple.sh delete mode 100755 polybar/modules/weather/openweathermap-simple.sh.old delete mode 100644 polybar/modules/windowlist.ini delete mode 100644 polybar/modules/windows.ini delete mode 100644 polybar/modules/workspaces.ini delete mode 100644 polybar/scripts/windowlist/LICENSE delete mode 100644 polybar/scripts/windowlist/Makefile delete mode 100644 polybar/scripts/windowlist/README.md delete mode 100755 polybar/scripts/windowlist/click-actions/close delete mode 100644 polybar/scripts/windowlist/click-actions/close.c delete mode 100755 polybar/scripts/windowlist/click-actions/minimize delete mode 100644 polybar/scripts/windowlist/click-actions/minimize.c delete mode 100755 polybar/scripts/windowlist/click-actions/raise delete mode 100644 polybar/scripts/windowlist/click-actions/raise.c delete mode 100644 polybar/scripts/windowlist/config.toml delete mode 100755 polybar/scripts/windowlist/main delete mode 100644 polybar/scripts/windowlist/main.c delete mode 100644 polybar/scripts/windowlist/screenshot.png delete mode 100644 polybar/scripts/windowlist/toml-c.h delete mode 100644 polybar/scripts/windowlist/windowlist.c delete mode 100644 polybar/scripts/windowlist/windowlist.h delete mode 100644 polybar/scripts/windowlist/windowlist.o diff --git a/Xresources b/Xresources index d3610cf..2337db3 100644 --- a/Xresources +++ b/Xresources @@ -1,83 +1,11 @@ -Xft.dpi: 96 -Xft.antialias: true -Xft.hinting: true -Xft.rgba: rgb -Xft.autohint: false -Xft.hintstyle: hintslight -Xft.lcdfilter: lcddefault +Xcursor.theme: Oxygen_Zion -XTerm*pointerColor: #64b5f6 -XTerm*faceName: Fixed -XTerm*faceSize: 11 +!URxvt*inheritPixmap: true +!URxvt*transparent: true +! URxvt*shading: 0 to 99 darkens, 101 to 200 lightens +URxvt*shading: 70 - -! special -*.foreground: #f5f5f5 -*.background: #303030 -*.fading: 15 -*.fadeColor: #303030 -*.cursorColor: #64b5f6 -*.pointerColorBackground:#303030 -*.pointerColorForeground:#64b5f6 - -! black -*.color0: #303030 -*.color8: #424242 - -! red -*.color1: #d32f2f -*.color9: #e57373 - -! green -*.color2: #388e3c -*.color10: #81c784 - -! yellow -*.color3: #f57c00 -*.color11: #ffb74d - -! blue -*.color4: #303f9f -*.color12: #7986cb - -! magenta -*.color5: #c51162 -*.color13: #ff4081 - -! cyan -*.color6: #1976d2 -*.color14: #64b5f6 - -! white -*.color7: #bdbdbd -*.color15: #f5f5f5 - - -XTerm*background: #303030 -XTerm*foreground: #f5f5f5 -XTerm*reverseVideo: on -XTerm*selectToClipboard: true - -URxvt*termName: rxvt-unicode-256color -!URxvt.font: xft:Inconsolata:Regular:pixelsize=14 -!URxvt.boldFont:Inconsolata:Regular:pixelsize=14 -URxvt.font: xft:Space Mono:Regular:pixelsize=14 -URxvt.boldFont: xft:Space Mono:Bold:pixelsize=14 -!URxvt.font: xft:Source Code Pro:Regular:pixelsize=14 -!URxvt.boldFont: xft:Source Code Pro:Bold:pixelsize=14 -URxvt.geometry: 120x30 URxvt.depth: 32 -URxvt.letterSpace: 1 -URxvt.background: [90]#303030 -URxvt*scrollBar: false -URxvt*mouseWheelScrollPage: false -URxvt*cursorBlink: true -URxvt*cursorUnderline: true -URxvt*.foreground: #f5f5f5 -URxvt*cursorColor: #f5f5f5 -URxvt*saveLines: 5000 -URxvt.internalBorder: 1 +URxvt.background: [75]#000000 +URxvt.scrollbar: false -URxvt.colorIT: #64b5f6 -URxvt.colorBD: #f5f5f5 -URxvt.colorUL: #1976d2 diff --git a/bash_profile b/bash_profile index ea3b693..d05411c 100644 --- a/bash_profile +++ b/bash_profile @@ -4,5 +4,3 @@ if [ -f ~/.bashrc ]; then source ~/.bashrc fi -# opam configuration -test -r /home/danix/.opam/opam-init/init.sh && . /home/danix/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true diff --git a/bashrc b/bashrc index 6eade8a..11e5aa9 100644 --- a/bashrc +++ b/bashrc @@ -3,6 +3,20 @@ if [ -f /etc/profile.d/bash_completion.sh ]; then . /etc/profile.d/bash_completion.sh fi +# uses pywal for all new terminals +(cat ~/.cache/wal/sequences &) + +# turns on git prompt +if [ -f ~/.git-prompt.sh ]; then + GIT_PS1_SHOWDIRTYSTATE=true + GIT_PS1_SHOWSTASHSTATE=true + GIT_PS1_SHOWUNTRACKEDFILES=true + GIT_PS1_SHOWUPSTREAM="auto" + GIT_PS1_HIDE_IF_PWD_IGNORED=true + GIT_PS1_SHOWCOLORHINTS=true + . ~/.git-prompt.sh +fi + user_color=32m if [ ${UID} -eq 0 ] then @@ -50,17 +64,6 @@ bash_prompt() { export PROMPT_COMMAND=bash_prompt printf "\033]0;%s@%s\007" "${LOGNAME}" "${HOSTNAME%%.*}" -# turns on git prompt -if [ -f /home/danix/.git-prompt.sh ]; then - GIT_PS1_SHOWDIRTYSTATE=true - GIT_PS1_SHOWSTASHSTATE=true - GIT_PS1_SHOWUNTRACKEDFILES=true - GIT_PS1_SHOWUPSTREAM="auto" - GIT_PS1_HIDE_IF_PWD_IGNORED=true - GIT_PS1_SHOWCOLORHINTS=true - . /home/danix/.git-prompt.sh -fi - alias su="su -" alias ls="ls --color -lh" alias cp="cp -v" @@ -75,23 +78,21 @@ alias du="du -sh" alias diff='diff --color=auto' alias grep='grep --color=auto' alias path='(IFS=:;ls -1d $PATH | nl)' +alias feh='feh -T darknix' # history as big as possible!! HISTSIZE=1000000 HISTFILESIZE=2000000 -# HISTIGNORE='hf *' +#HISTIGNORE='hf *' # unix.stackexchange.com/a/18443 # history: erase duplicates... HISTCONTROL=ignoreboth:erasedups shopt -s histappend - - -#export PATH=~/.platformio/penv/bin:~/.config/composer/vendor/bin:~/.local/bin:~/bin:$PATH -#export PATH=~/.config/composer/vendor/bin:~/.local/bin:~/bin:$PATH +export PATH=~/.local/bin:~/bin:$PATH export INTEL_BATCH=1 -export QT_QPA_PLATFORMTHEME="lxqt" -export QT_STYLE_OVERRIDE="kvantum-dark" +export QT_QPA_PLATFORMTHEME="qt5ct" +#export QT_STYLE_OVERRIDE="kvantum" export XDG_DATA_DIRS="/usr/local/share/:/usr/share/" export CM_LAUNCHER=rofi @@ -107,7 +108,7 @@ alias more='less' export LESS=' -R' export LESSOPEN='|~/.lessfilter %s' export PAGER=less -export SVN_EDITOR=vim +export SVN_EDITOR=nvim export LESSCHARSET='utf-8' man() { @@ -124,16 +125,15 @@ man() { export SUDO_ASKPASS=/usr/bin/lxsudo # password store directory -export PASSWORD_STORE_DIR=/home/danix/Programming/GIT/password_store/ +export PASSWORD_STORE_DIR=/home/danix/.password-store/ # logdate appends a date to a script output logdate() { - while IFS= read -r line; do - echo "$(date +"%F_%R.%S") $line" - done + while IFS= read -r line; do + echo "$(date +"%F_%R.%S") $line" + done } -# start gpg-agent for ssh authentication as well as key management unset GPG_AGENT_INFO unset SSH_AGENT_PID if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then @@ -141,7 +141,7 @@ if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then fi export GPG_TTY=$(tty) if [ -x "$(which gpg-connect-agent)" ]; then - gpg-connect-agent updatestartuptty /bye > /dev/null + gpg-connect-agent updatestartuptty /bye > /dev/null fi mount-fs () { diff --git a/bin/betterlockscreen b/bin/betterlockscreen deleted file mode 100644 index 0b92ad9..0000000 --- a/bin/betterlockscreen +++ /dev/null @@ -1,942 +0,0 @@ -#!/usr/bin/env bash - -# Author : Copyright (c) 2017-2023 Pavan Jadhaw, and others (https://github.com/betterlockscreen/betterlockscreen/graphs/contributors) -# Project Repository : https://github.com/betterlockscreen/betterlockscreen - -cmd_exists () { - command -v "$1" >/dev/null -} - -init_config () { - # default options - display_on=0 - span_image=false - lock_timeout=300 - fx_list=(dim blur dimblur pixel dimpixel color) - dim_level=40 - blur_level=1 - pixel_scale=10,1000 - solid_color=333333 - description="" - quiet=false - i3lockcolor_bin="i3lock-color" - suspend_command="systemctl suspend" - convert_command="magick" - composite_command="magick composite" - - if ! cmd_exists "$i3lockcolor_bin" && cmd_exists "i3lock"; then - i3lockcolor_bin="i3lock" - fi - - if ! cmd_exists "magick"; then - convert_command="convert" - composite_command="composite" - fi - - # default theme - loginbox=00000066 - loginshadow=00000000 - locktext="Type password to unlock..." - font="sans-serif" - ringcolor=ffffffff - insidecolor=00000000 - separatorcolor=00000000 - ringvercolor=ffffffff - insidevercolor=00000000 - ringwrongcolor=ffffffff - insidewrongcolor=d23c3dff - timecolor=ffffffff - time_format="%H:%M:%S" - greetercolor=ffffffff - layoutcolor=ffffffff - keyhlcolor=d23c3dff - bshlcolor=d23c3dff - veriftext="Verifying..." - verifcolor=ffffffff - wrongtext="Failure!" - wrongcolor=d23c3dff - modifcolor=d23c3dff - bgcolor=000000ff - wallpaper_cmd="feh --bg-fill" - - # read user config - USER_CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}" - USER_CONF="$USER_CONF_DIR/betterlockscreenrc" - SYS_CONF="/etc/betterlockscreenrc" - XDG_USER_CONF_DIR="$USER_CONF_DIR/betterlockscreen" - XDG_USER_CONF="$XDG_USER_CONF_DIR/betterlockscreenrc" - - if [ -e "$SYS_CONF" ]; then - # shellcheck source=/dev/null - source "$SYS_CONF" - fi - - if [ -e "$USER_CONF" ]; then - echof error "Please, migrate your config $USER_CONF to $XDG_USER_CONF. Old location will soon be deprecated." - echof info "mkdir -p ~/.config/betterlockscreen/ && mv $USER_CONF $XDG_USER_CONF" - - # shellcheck source=/dev/null - source "$USER_CONF" - fi - - if [ -e "$XDG_USER_CONF" ]; then - # shellcheck source=/dev/null - source "$XDG_USER_CONF" - fi - - if ! cmd_exists "$i3lockcolor_bin"; then - echof error "Unable to find i3lock-color binary under detected/configured name: '$i3lockcolor_bin'!" - exit - fi - - # Please make sure to adjust this before release! - VERSION="4.3.0" - - # paths - CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/betterlockscreen" - CUR_DIR="$CACHE_DIR/current" - - # wallpaper - CUR_W_RESIZE="$CUR_DIR/wall_resize.png" - CUR_W_DIM="$CUR_DIR/wall_dim.png" - CUR_W_BLUR="$CUR_DIR/wall_blur.png" - CUR_W_DIMBLUR="$CUR_DIR/wall_dimblur.png" - CUR_W_PIXEL="$CUR_DIR/wall_pixel.png" - CUR_W_DIMPIXEL="$CUR_DIR/wall_dimpixel.png" - CUR_W_COLOR="$CUR_DIR/wall_color.png" - - # lockscreen - CUR_L_RESIZE="$CUR_DIR/lock_resize.png" - CUR_L_DIM="$CUR_DIR/lock_dim.png" - CUR_L_BLUR="$CUR_DIR/lock_blur.png" - CUR_L_DIMBLUR="$CUR_DIR/lock_dimblur.png" - CUR_L_PIXEL="$CUR_DIR/lock_pixel.png" - CUR_L_DIMPIXEL="$CUR_DIR/lock_dimpixel.png" - CUR_L_COLOR="$CUR_DIR/lock_color.png" - - # Original DPMS timeout - DEFAULT_TIMEOUT=$(cut -d ' ' -f4 <<< "$(xset q | sed -n '25p')") - # Original DPMS status - DEFAULT_DPMS=$(xset q | awk '/^[[:blank:]]*DPMS is/ {print $(NF)}') - - # Dunst - DUNST_INSTALLED=false && [[ -e "$(command -v dunstctl)" ]] && DUNST_INSTALLED=true - DUNST_IS_RUNNING=false && [[ "$DUNST_INSTALLED" == "true" ]] && [[ "$(pgrep -c dunst)" -gt 0 ]] && DUNST_IS_RUNNING=true - DUNST_IS_PAUSED=false && [[ "$DUNST_IS_RUNNING" == "true" ]] && DUNST_IS_PAUSED=$(dunstctl is-paused) - - # Feh - FEH_INSTALLED=false && [[ -e "$(command -v feh)" ]] && FEH_INSTALLED=true -} - -# called before screen is locked -prelock() { - # set dpms timeout - if [ "$DEFAULT_DPMS" == "Enabled" ]; then - xset dpms "$lock_timeout" - fi - - # If dusnt is already paused don't pause it again - if [[ "$DUNST_IS_RUNNING" == "true" && "$DUNST_IS_PAUSED" == "false" ]]; then - dunstctl set-paused true - fi - - if [ -e "$XDG_USER_CONF_DIR/custom-pre.sh" ]; then - # shellcheck source=/dev/null - source "$XDG_USER_CONF_DIR/custom-pre.sh" - fi -} - -# lock screen with specified image -lock() { - local image="$1" - local fontlg=32 - local fontmd=16 - local fontsm=12 - - if [ -f "$image" ]; then - echof act "Locking screen..." - else - echof act "Locking screen... (FAILSAFE MODE)" - fi - - $i3lockcolor_bin \ - ${image:+-i "$image"} \ - --color "$bgcolor" \ - ${display_on:+-S "$display_on"} \ - --ind-pos="x+310:y+h-80" \ - --radius=25 \ - --ring-width=5 \ - --inside-color="$insidecolor" \ - --ring-color="$ringcolor" \ - --separator-color=$separatorcolor \ - --insidever-color="$insidevercolor" \ - --insidewrong-color="$insidewrongcolor" \ - --ringver-color="$ringvercolor" \ - --ringwrong-color="$ringwrongcolor" \ - --line-uses-inside \ - --keyhl-color="$keyhlcolor" \ - --bshl-color="$bshlcolor" \ - --clock --force-clock \ - --time-pos="ix-265:iy-10" \ - --time-align 1 \ - --time-str "$time_format" \ - --time-color="$timecolor" \ - --time-font="$font" \ - --time-size="$fontlg" \ - --date-str "" \ - --greeter-pos="ix-265:iy+12" \ - --greeter-align 1 \ - --greeter-text "$locktext" \ - --greeter-color="$greetercolor" \ - --greeter-font="$font" \ - --greeter-size="$fontmd" \ - --layout-pos="ix-265:iy+32" \ - --layout-align 1 \ - --layout-color="$layoutcolor" \ - --layout-font="$font" \ - --layout-size="$fontsm" \ - --verif-pos="ix+35:iy-34" \ - --verif-align 2 \ - --verif-text="$veriftext" \ - --verif-color="$verifcolor" \ - --verif-font="$font" \ - --verif-size="$fontsm" \ - --wrong-pos="ix+24:iy-34" \ - --wrong-align 2 \ - --wrong-text="$wrongtext" \ - --wrong-color="$wrongcolor" \ - --wrong-font="$font" \ - --wrong-size="$fontsm" \ - --modif-pos="ix+45:iy+43" \ - --modif-align 2 \ - --modif-size="$fontsm" \ - --modif-color="$modifcolor" \ - --noinput-text="" \ - --pass-media-keys \ - --pass-screen-keys \ - --pass-volume-keys \ - --pass-power-keys \ - "${lockargs[@]}" -} - -# called after screen is unlocked -postlock() { - # restore default dpms timeout - if [ "$DEFAULT_DPMS" == "Enabled" ]; then - xset dpms "$DEFAULT_TIMEOUT" - fi - - # If dunst already paused before locking don't unpause dunst - if [[ "$DUNST_IS_RUNNING" == "true" && "$DUNST_IS_PAUSED" == "false" ]]; then - dunstctl set-paused false - fi - - if [ -e "$XDG_USER_CONF_DIR/custom-post.sh" ]; then - # shellcheck source=/dev/null - source "$XDG_USER_CONF_DIR/custom-post.sh" - fi -} - -# select effect and lock screen -lockinit() { - if pgrep -u "$USER" "$i3lockcolor_bin"; then - echof error "i3lock already running" - exit 1 - fi - - echof act "Running prelock..." - prelock - - if [[ $runsuspend ]]; then - lockselect "$@" & - $suspend_command - wait $! - else - lockselect "$@" - fi - - echof act "Running postlock..." - postlock -} - -lockselect() { - case "$1" in - dim) lock "$CUR_L_DIM" ;; - blur) lock "$CUR_L_BLUR" ;; - dimblur) lock "$CUR_L_DIMBLUR" ;; - pixel) lock "$CUR_L_PIXEL" ;; - dimpixel) lock "$CUR_L_DIMPIXEL" ;; - color) lock "$CUR_L_COLOR" ;; - *) lock "$CUR_L_RESIZE" ;; - esac -} - -# calculate adjustments for hidpi displays -logical_px() { - # $1: number of pixels to convert - # $2: 1 for width. 2 for height - local pixels="$1" - local direction="$2" - local dpi - - # use DPI set by user in .Xresources - dpi=$(xrdb -q | grep -oP '^\s*Xft.dpi:\s*\K\d+' | bc) - - # or get dpi value from xdpyinfo - if [ -z "$dpi" ]; then - dpi=$(xdpyinfo | sed -En "s/\s*resolution:\s*([0-9]*)x([0-9]*)\s.*/\\$direction/p" | head -n1) - fi - - # adjust scaling - if [ -n "$dpi" ]; then - local scale - scale=$(echo "scale=3; $dpi / 96.0" | bc) - echo "$scale * $pixels / 1" | bc - else - # return the default value if no DPI is set - echo "$pixels" - fi -} - -# get total resolution, sets $TOTAL_SIZE -get_total_size () { - TOTAL_SIZE=$(xdpyinfo | grep -w "dimensions" | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/') -} - -# get list of displays, sets $DISPLAY_LIST -get_display_list () { - local count=0 - mapfile -t displays < <(xrandr --listactivemonitors) - for display in "${displays[@]:1}"; do - ((count++)) - display="$(echo "$display" | sed -r 's/\/[0-9]*//g')" - IFS=' ' read -r -a info <<< "$display" - DISPLAY_LIST+=("$count ${info[3]} ${info[2]}") - done -} - -# populate $WALL_LIST depending on number of displays and images passed -get_wall_list() { - local paths=("$@") - declare -ga WALL_LIST - - # multiple images and spanning conflict, bail out - if [ "${#paths[@]}" -gt 1 ] && [ "$span_image" = true ]; then - echof err "Can't use --span with multiple images!" - exit 1 - fi - - # if spanning return 1 image - if [ "$span_image" = true ]; then - get_image "${paths[0]}" - - # if # paths is 1 - elif [ "${#paths[@]}" -eq 1 ]; then - for ((i=0; i<${#DISPLAY_LIST[@]}; i++)); do - # add same image to $WALL_LIST for each display - get_image "${paths[0]}" - done - - # if # of paths equals # of displays - elif [ ${#paths[@]} -eq "${#DISPLAY_LIST[@]}" ]; then - for ((i=0; i<${#DISPLAY_LIST[@]}; i++)); do - # add each image to $WALL_LIST - get_image "${paths[$i]}" - done - - # if # of paths differ from # of display, bail out - else - echof err "${#paths[@]} images provided for ${#DISPLAY_LIST[@]} displays!" - exit 1 - fi -} - -# get image path, append to $WALL_LIST -get_image() { - local path="$1" - - # we have a file - if [ -f "$path" ]; then - WALL_LIST+=("$path") - return - # we have a directory - elif [ -d "$path" ]; then - dir=("$path"/*) - rdir="${dir[RANDOM % ${#dir[@]}]}" - get_image "$rdir" # <-- calls itself - # not file or directory, bail out - else - echof err "invalid path: $path" - exit 1 - fi - -} - -# scale base image and generate effects -resize_and_render () { - local base="$1" - local path="$2" - local resolution="$3" - - # resource paths - RES_RESIZE="$path/resize.png" - RES_DIM="$path/dim.png" - RES_BLUR="$path/blur.png" - RES_DIMBLUR="$path/dimblur.png" - RES_PIXEL="$path/pixel.png" - RES_DIMPIXEL="$path/dimpixel.png" - RES_COLOR="$path/color.png" - - # resize - base_resize "$base" "$RES_RESIZE" "$resolution" - - # effects - for effect in "${fx_list[@]}"; do - case $effect in - dim) fx_dim "$RES_RESIZE" "$RES_DIM";; - blur) fx_blur "$RES_RESIZE" "$RES_BLUR" "$resolution";; - dimblur) fx_dimblur "$RES_RESIZE" "$RES_DIMBLUR" "$resolution";; - pixel) fx_pixel "$RES_RESIZE" "$RES_PIXEL";; - dimpixel) fx_dimpixel "$RES_RESIZE" "$RES_DIMPIXEL";; - color) fx_color "$RES_COLOR" "$resolution";; - esac - done - -} - -# apply resize -base_resize() { - local input="$1" - local output="$2" - local size="$3" - - echof act "Resizing base image..." - eval $convert_command "$input" \ - -resize "$size""^" \ - -gravity center \ - -extent "$size" \ - "$output" -} - -# apply dim -fx_dim() { - local input="$1" - local output="$2" - - echof act "Rendering 'dim' effect..." - eval $convert_command "$input" \ - -fill black -colorize "$dim_level"% \ - "$output" -} - -# apply blur -fx_blur() { - local input="$1" - local output="$2" - local size="$3" - - echof act "Rendering 'blur' effect..." - blur_shrink=$(echo "scale=2; 20 / $blur_level" | bc) - blur_sigma=$(echo "scale=2; 0.6 * $blur_level" | bc) - eval $convert_command "$input" \ - -filter Gaussian \ - -resize "$blur_shrink%" \ - -define "filter:sigma=$blur_sigma" \ - -resize "$size^" -gravity center -extent "$size" \ - "$output" -} - -# apply dimblur -fx_dimblur() { - local input="$1" - local output="$2" - local size="$3" - - echof act "Rendering 'dimblur' effect..." - blur_shrink=$(echo "scale=2; 20 / $blur_level" | bc) - blur_sigma=$(echo "scale=2; 0.6 * $blur_level" | bc) - eval $convert_command "$input" \ - -fill black -colorize "$dim_level"% \ - -filter Gaussian \ - -resize "$blur_shrink%" \ - -define "filter:sigma=$blur_sigma" \ - -resize "$size^" -gravity center -extent "$size" \ - "$output" -} - -# pixelate -fx_pixel() { - local input="$1" - local output="$2" - - echof act "Rendering 'pixel' effect..." - IFS=',' read -ra range <<< "$pixel_scale" - eval $convert_command "$input" \ - -scale "${range[0]}"% -scale "${range[1]}"% \ - "$output" -} - -# apply dimpixel -fx_dimpixel() { - local input="$1" - local output="$2" - - echof act "Rendering 'dimpixel' effect..." - IFS=',' read -ra range <<< "$pixel_scale" - eval $convert_command "$input" \ - -fill black -colorize "$dim_level"% \ - -scale "${range[0]}"% -scale "${range[1]}"% \ - "$output" -} - -# create solid color -fx_color() { - local output="$1" - local size="$2" - - echof act "Rendering 'color' effect..." - eval $convert_command -size "$size" canvas:\#"$solid_color" "$RES_COLOR" -} - -# create loginbox rectangle, set "$RECTANGLE" -create_loginbox () { - RECTANGLE="$CUR_DIR/rectangle.png" - local shadow="$CUR_DIR/shadow.png" - local width height - width=$(logical_px 340 1) - height=$(logical_px 100 2) - $convert_command -size "$width"x"$height" xc:\#"$loginbox" -fill none "$RECTANGLE" - $convert_command "$RECTANGLE" \ - \( -clone 0 -background \#"$loginshadow" -shadow 100x5+0+0 \) +swap \ - -background none -layers merge +repage "$shadow" - $composite_command -compose Dst_Out -gravity center \ - "$RECTANGLE" "$shadow" -alpha Set "$shadow" - $convert_command "$shadow" "$RECTANGLE" -geometry +10+10 -composite "$RECTANGLE" - [[ "$shadow" ]] && rm "$shadow" -} - -# create rectangle with description, set "$DESCRECT" -create_description () { - DESCRECT="$CUR_DIR/description.png" - local shadow="$CUR_DIR/shadow.png" - $convert_command -background none -family "$(fc-match "$font" family)" -style Normal -pointsize 14 -fill \#"$greetercolor" label:"\ $description\ " -bordercolor \#"$loginbox" -border 10 "$DESCRECT" - $convert_command "$DESCRECT" \ - \( -clone 0 -background \#"$loginshadow" -shadow 100x5+0+0 \) +swap \ - -background none -layers merge +repage "$shadow" - $composite_command -compose Dst_Out -gravity center \ - "$DESCRECT" "$shadow" -alpha Set "$shadow" - $convert_command "$shadow" "$DESCRECT" -geometry +10+10 -composite "$DESCRECT" - [[ "$shadow" ]] && rm "$shadow" -} - -# delete and recreate directory -purge_cache () { - if [[ -d "$1" ]]; then - rm -r "$1" - fi - mkdir -p "$1" -} - -# update lockscreen and wallpaper images -update () { - local images=("$@") - - echof act "Updating image cache..." - mkdir -p "$CACHE_DIR" &>/dev/null - - get_display_list # DISPLAY_LIST - get_total_size # TOTAL_SIZE - echof info "Detected ${#DISPLAY_LIST[@]} display(s) @ $TOTAL_SIZE total resolution" - - get_wall_list "${images[@]}" # WALL_LIST - echof info "Original image(s): ${WALL_LIST[*]##*/}" - - # Prepare description box to obtain width for positioning - local descwidth - local descheight - if [ -z "$description" ]; then - descwidth=0 - descheight=0 - else - create_description - descwidth=$(identify -format "%[fx:w]" "$DESCRECT") - descheight=$(identify -format "%[fx:h]" "$DESCRECT") - fi - - for ((i=0; i<${#DISPLAY_LIST[@]}; i++)); do - display="${DISPLAY_LIST[$i]}" - USER_WALL="${WALL_LIST[$i]}" - - # escape spaces for IM - if echo "$USER_WALL" | grep -E -q "[[:space:]]"; then - USER_WALL="${USER_WALL// /\\ }" - fi - - IFS=' ' read -r -a dinfo <<< "$display" - local id="${dinfo[0]}" - local device="${dinfo[1]}" - local geometry="${dinfo[2]}" - - read -r -a cols <<< "${geometry//[x+-]/ }" - local position="${geometry#*"${cols[1]}"}" - local resolution="${geometry%"${position}"*}" - - if [[ $id -eq "$display_on" ]] || [[ "$display_on" -eq 0 ]]; then - - IFS='x' read -r -a dimension <<< "$resolution" - res_x="${dimension[0]}" - res_y="${dimension[1]}" - read -r -a val <<< "${position//[+-]/ }" - read -r -a sym <<< "${position//[0-9]/ }" - pos_x="${sym[0]}${val[0]}" - pos_y="${sym[1]}${val[1]}" - - rect_x=$((pos_x + $(logical_px 15 1))) - rect_y=$((pos_y + res_y - $(logical_px 140 2))) - positions+=("+$((rect_x))+$((rect_y))") - - descrect_x=$((pos_x + res_x - descwidth - $(logical_px 15 1))) - descrect_y=$((pos_y + res_y - descheight - $(logical_px 20 2))) - positions_desc+=("+$((descrect_x))+$((descrect_y))") - fi - - local path="$CACHE_DIR/$id-$device" - purge_cache "$path" - - if [ "$span_image" = true ]; then - if [ "$id" -gt 1 ]; then - continue - else - device="[span]" - id="*" - resolution="$TOTAL_SIZE" - fi - fi - - echof info "Processing display: $device ($id)" - echof info "Resolution: $resolution" - - if [ "$span_image" = true ]; then - resize_and_render "$USER_WALL" "$path" "$resolution" - else - resize_and_render "$USER_WALL" "$path" "$resolution" - - PARAM_RESIZE="$PARAM_RESIZE $RES_RESIZE -geometry $position -composite " - PARAM_DIM="$PARAM_DIM $RES_DIM -geometry $position -composite " - PARAM_BLUR="$PARAM_BLUR $RES_BLUR -geometry $position -composite " - PARAM_DIMBLUR="$PARAM_DIMBLUR $RES_DIMBLUR -geometry $position -composite " - PARAM_PIXEL="$PARAM_PIXEL $RES_PIXEL -geometry $position -composite " - PARAM_DIMPIXEL="$PARAM_DIMPIXEL $RES_DIMPIXEL -geometry $position -composite " - PARAM_COLOR="$PARAM_COLOR $RES_COLOR -geometry $position -composite " - fi - - done - - purge_cache "$CUR_DIR" - - if [ "$span_image" = true ] || [ ${#DISPLAY_LIST[@]} -lt 2 ]; then - echof act "Rendering final wallpaper images..." - [[ -f "$RES_RESIZE" ]] && eval "cp $RES_RESIZE $CUR_W_RESIZE" - [[ -f "$RES_DIM" ]] && eval "cp $RES_DIM $CUR_W_DIM" - [[ -f "$RES_BLUR" ]] && eval "cp $RES_BLUR $CUR_W_BLUR" - [[ -f "$RES_DIMBLUR" ]] && eval "cp $RES_DIMBLUR $CUR_W_DIMBLUR" - [[ -f "$RES_PIXEL" ]] && eval "cp $RES_PIXEL $CUR_W_PIXEL" - [[ -f "$RES_DIMPIXEL" ]] && eval "cp $RES_DIMPIXEL $CUR_W_DIMPIXEL" - [[ -f "$RES_COLOR" ]] && eval "cp $RES_COLOR $CUR_W_COLOR" - else - echof act "Creating canvas: $TOTAL_SIZE" - [[ -f "$RES_RESIZE" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_RESIZE" - [[ -f "$RES_DIM" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_DIM" - [[ -f "$RES_BLUR" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_BLUR" - [[ -f "$RES_DIMBLUR" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_DIMBLUR" - [[ -f "$RES_PIXEL" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_PIXEL" - [[ -f "$RES_DIMPIXEL" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_DIMPIXEL" - [[ -f "$RES_COLOR" ]] && eval "$convert_command -size $TOTAL_SIZE 'xc:blue' $CUR_W_COLOR" - - echof act "Rendering final wallpaper images..." - [[ -f "$CUR_W_RESIZE" ]] && eval "$convert_command $CUR_W_RESIZE $PARAM_RESIZE $CUR_W_RESIZE" - [[ -f "$CUR_W_DIM" ]] && eval "$convert_command $CUR_W_DIM $PARAM_DIM $CUR_W_DIM" - [[ -f "$CUR_W_BLUR" ]] && eval "$convert_command $CUR_W_BLUR $PARAM_BLUR $CUR_W_BLUR" - [[ -f "$CUR_W_DIMBLUR" ]] && eval "$convert_command $CUR_W_DIMBLUR $PARAM_DIMBLUR $CUR_W_DIMBLUR" - [[ -f "$CUR_W_PIXEL" ]] && eval "$convert_command $CUR_W_PIXEL $PARAM_PIXEL $CUR_W_PIXEL" - [[ -f "$CUR_W_DIMPIXEL" ]] && eval "$convert_command $CUR_W_DIMPIXEL $PARAM_DIMPIXEL $CUR_W_DIMPIXEL" - [[ -f "$CUR_W_COLOR" ]] && eval "$convert_command $CUR_W_COLOR $PARAM_COLOR $CUR_W_COLOR" - fi - - echof act "Rendering final lockscreen images..." - - create_loginbox - for pos in "${positions[@]}"; do - PARAM_RECT="$PARAM_RECT $RECTANGLE -geometry $pos -composite " - done - - if [ -n "$description" ]; then - create_description - for descpos in "${positions_desc[@]}"; do - PARAM_RECT="$PARAM_RECT $DESCRECT -geometry $descpos -composite " - done - fi - - [[ -f "$CUR_W_RESIZE" ]] && eval "$convert_command $CUR_W_RESIZE $PARAM_RECT $CUR_L_RESIZE" - [[ -f "$CUR_W_DIM" ]] && eval "$convert_command $CUR_W_DIM $PARAM_RECT $CUR_L_DIM" - [[ -f "$CUR_W_BLUR" ]] && eval "$convert_command $CUR_W_BLUR $PARAM_RECT $CUR_L_BLUR" - [[ -f "$CUR_W_DIMBLUR" ]] && eval "$convert_command $CUR_W_DIMBLUR $PARAM_RECT $CUR_L_DIMBLUR" - [[ -f "$CUR_W_PIXEL" ]] && eval "$convert_command $CUR_W_PIXEL $PARAM_RECT $CUR_L_PIXEL" - [[ -f "$CUR_W_DIMPIXEL" ]] && eval "$convert_command $CUR_W_DIMPIXEL $PARAM_RECT $CUR_L_DIMPIXEL" - [[ -f "$CUR_W_COLOR" ]] && eval "$convert_command $CUR_W_COLOR $PARAM_RECT $CUR_L_COLOR" - - [[ "$RECTANGLE" ]] && rm "$RECTANGLE" - [[ "$DESCRECT" ]] && rm "$DESCRECT" - - echof ok "Done" - -} - -# set wallpaper with effect -wallpaper() { - local effect="$1" - - # make wallpaper span displays - get_display_list - if [ "$span_image" = true ] || [[ "${#DISPLAY_LIST[@]}" -gt 1 ]]; then - wallpaper_cmd="$wallpaper_cmd --no-xinerama" - fi - - # set wallpaper - case "$effect" in - dim) wallpaper="$CUR_W_DIM";; - blur) wallpaper="$CUR_W_BLUR";; - dimblur) wallpaper="$CUR_W_DIMBLUR";; - pixel) wallpaper="$CUR_W_PIXEL";; - dimpixel) wallpaper="$CUR_W_DIMPIXEL";; - color) wallpaper="$CUR_W_COLOR";; - *) wallpaper="$CUR_W_RESIZE";; - esac - eval "$wallpaper_cmd $wallpaper" -} - -# wrap echo with fancy prefix -echof() { - local prefix="$1" - local message="$2" - - case "$prefix" in - header) msgpfx="[\e[1;95mB\e[m]";; - info) msgpfx="[\e[1;97m=\e[m]";; - act) msgpfx="[\e[1;92m*\e[m]";; - ok) msgpfx="[\e[1;93m+\e[m]";; - error) msgpfx="[\e[1;91m!\e[m]";; - *) msgpfx="";; - esac - [ "$quiet" != true ] && echo -e "$msgpfx $message" -} - -# help message -usage() { - echo - echo "Usage: betterlockscreen [-u ] [-l ] [-w ]" - echo - echo " -q --quiet" - echo " Do not produce any text output on locking" - echo - echo " -u --update " - echo " Update lock screen image" - echo - echo " -l --lock " - echo " Lock screen with cached image" - echo - echo " -w --wall " - echo " Set wallpaper with cached image" - echo - echo "Additional arguments:" - echo - echo " --display " - echo " Set display to draw loginbox" - echo - echo " --span" - echo " Scale image to span multiple displays" - echo - echo " --off " - echo " Turn display off after N seconds" - echo - echo " --fx " - echo " List of effects to generate" - echo - echo " --desc " - echo " Set a description for the new lock screen image" - echo " (Only has an effect in combination with --update)" - echo - echo " --show-layout" - echo " Show current keyboard layout" - echo - echo " --wallpaper-cmd " - echo " to set your custom wallpaper setter" - echo - echo " --time-format " - echo " to set the time format used by i3lock-color" - echo - echo " -- " - echo " Pass additional arguments to i3lock" - echo - echo "Effects arguments:" - echo - echo " --dim " - echo " Dim image N percent (0-100)" - echo - echo " --blur " - echo " Blur image N amount (0.0-1.0)" - echo - echo " --pixel " - echo " Pixelate image with N shrink and N grow (unsupported)" - echo - echo " --color " - echo " Solid color background with HEX" - echo - exit 1 -} - -lockargs=(-n) - -init_config - -# show usage when no arguments passed -[[ "$1" = "" ]] && usage - -# process arguments -for arg in "$@"; do - [[ "${arg:0:1}" = '-' ]] || continue - - case "$1" in - - -q | --quiet) - quiet=true - shift - ;; - - -u | --update) - runupdate=true - imagepaths+=("$2") - shift 2 - ;; - - -s | --suspend) - runsuspend=true - ;& - - -l | --lock) - runlock=true - if [[ ${2:0:1} = '-' ]]; then - shift 1 - else - lockstyle="$2"; shift 2 - fi - ;; - - -w | --wall) - wallpaper "$2" - shift 2 - ;; - - --wallpaper-cmd) - wallpaper_cmd="$2" - shift 2 - ;; - - --time-format) - time_format="$2" - shift 2 - ;; - - --display) - display_on="$2" - shift 2 - ;; - - --span) - span_image=true - shift 1 - ;; - - --off) - lock_timeout="$2" - shift 2 - ;; - - --text) - locktext="$2" - shift 2 - ;; - - --show-layout) - keylayout="$2"; - lockargs+=(--keylayout "${keylayout:-0}") - shift 2 - ;; - - --fx) - IFS=',' read -ra fx_list <<< "$2" - shift 2 - ;; - - --dim) - dim_level="$2" - shift 2 - ;; - - --blur) - blur_level="$2" - shift 2 - ;; - - --pixel) - pixel_scale="$2" - shift 2 - ;; - - --color) - solid_color="${2//\#/}" - shift 2 - ;; - - --desc) - description="$2" - shift 2 - ;; - - -v | --version) - echo - echo "Betterlockscreen: version: v$VERSION (dunst: $DUNST_INSTALLED, feh: $FEH_INSTALLED)" - $i3lockcolor_bin --version - $convert_command --version - - if [[ "$DUNST_INSTALLED" == "true" ]]; then - dunstctl debug - fi - - if [[ "$FEH_INSTALLED" == "true" ]]; then - feh --version - fi - - break - ;; - - --) - lockargs+=("${@:2}") - break - ;; - - -h | --help | *) - usage - ;; - esac -done - -echof header "Betterlockscreen" - -# Run image generation -[[ $runupdate ]] && update "${imagepaths[@]}" - -# Activate lockscreen -[[ $runlock ]] && lockinit "$lockstyle" - -exit 0 diff --git a/bin/blackpearl-appsmenu.sh b/bin/blackpearl-appsmenu.sh deleted file mode 100644 index 6c499c4..0000000 --- a/bin/blackpearl-appsmenu.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# rofi -no-lazy-grab -show drun -theme blackpearl/appmenu -rofi -no-lazy-grab -show drun -theme darknix/appmenu.rasi - diff --git a/bin/blackpearl-emoji.sh b/bin/blackpearl-emoji.sh deleted file mode 100644 index a240225..0000000 --- a/bin/blackpearl-emoji.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -rofi -no-lazy-grab -modi emoji -show emoji -theme darknix/runner.rasi - diff --git a/bin/blackpearl-notes.sh b/bin/blackpearl-notes.sh deleted file mode 100644 index a11244a..0000000 --- a/bin/blackpearl-notes.sh +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/bash - -rofi_command="rofi -theme darknix/notes.rasi" - -# list of existing notes passed to rofi -options=$(notes -pl) - -# how to run the script -PARAM="$1" -case $PARAM in - -a ) - alacritty --hold --class notes --title notes -e notes -a - ;; - -e ) - # note_ID - selected=$(echo -e "$options" | $rofi_command -p "edit note" -dmenu -selected-row 0 | cut -d " " -f1) - alacritty --hold --class notes --title notes -e notes -e ${selected} - ;; - -d ) - # note_ID - selected=$(echo -e "$options" | $rofi_command -p "delete note" -dmenu -selected-row 0 | cut -d " " -f1) - alacritty --hold --class notes --title notes -e notes -d ${selected} - ;; - * ) - selected=$(echo -e "$options" | $rofi_command -p "notes" -dmenu -selected-row 0 | cut -d " " -f1) - alacritty --hold --class notes --title notes -e notes -s $selected - ;; -esac diff --git a/bin/blackpearl-powermenu.sh b/bin/blackpearl-powermenu.sh deleted file mode 100644 index fad6b19..0000000 --- a/bin/blackpearl-powermenu.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# rofi_command="rofi -theme blackpearl/powermenu.rasi" -rofi_command="rofi -theme darknix/powermenu.rasi" - -### Options ### -power_off="" -reboot="" -lock="" -#suspend="⏾" -log_out="󰿅" -# Variable passed to rofi -options="$power_off\n$reboot\n$lock\n$log_out" - -chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 0)" -case $chosen in - $power_off) - notify-send 'shutting down' 'the system is going to shutdown now' - sleep 1 - /usr/bin/loginctl poweroff - ;; - $reboot) - notify-send 'rebooting the system' 'the system is going to reboot now' - sleep 1 - /usr/bin/loginctl reboot - ;; - $lock) - sleep 1 - i3lock-fancy - ;; -# $suspend) -# sleep 1 -# i3suspend -# ;; - $log_out) - i3-exit - ;; -esac - diff --git a/bin/blackpearl-runner.sh b/bin/blackpearl-runner.sh deleted file mode 100644 index 36517d1..0000000 --- a/bin/blackpearl-runner.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -rofi -no-lazy-grab -show run -theme darknix/runner.rasi - diff --git a/bin/blackpearl-scrotmenu.sh b/bin/blackpearl-scrotmenu.sh deleted file mode 100644 index dbafcb7..0000000 --- a/bin/blackpearl-scrotmenu.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -rofi_command="rofi -theme darknix/scrotmenu.rasi" - -### Options ### -screen="" -area="" -# Variable passed to rofi -options="$screen\n$area" - -chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 1)" -case $chosen in - $screen) - i3-scrot -d 3 - ;; - $area) - i3-scrot -s - ;; -esac diff --git a/bin/blackpearl-sshmenu.sh b/bin/blackpearl-sshmenu.sh deleted file mode 100644 index b70d4b9..0000000 --- a/bin/blackpearl-sshmenu.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -rofi -no-lazy-grab -show ssh -no-parse-known-hosts -theme darknix/sshmenu.rasi - diff --git a/bin/blackpearl-symbols.sh b/bin/blackpearl-symbols.sh deleted file mode 100644 index 5723bd1..0000000 --- a/bin/blackpearl-symbols.sh +++ /dev/null @@ -1 +0,0 @@ -rofi -no-lazy-grab -show sym -modes "sym:symbols.sh" -theme darknix/runner.rasi diff --git a/bin/blackpearl-utilsmenu.sh b/bin/blackpearl-utilsmenu.sh deleted file mode 100644 index 8c2beaa..0000000 --- a/bin/blackpearl-utilsmenu.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -rofi_command="rofi -theme darknix/utilsmenu.rasi" - -### Options ### -wpaper="" -webdevel="" -# Variable passed to rofi -options="$wpaper\n$webdevel" - -chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 1)" -case $chosen in - $wpaper) - qwalwal.sh - ;; - $webdevel) - webdevel - ;; -esac - diff --git a/bin/blackpearl-window.sh b/bin/blackpearl-window.sh deleted file mode 100644 index 68d4d4f..0000000 --- a/bin/blackpearl-window.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -case $1 in - all ) - rofi -no-lazy-grab -show window -theme darknix/appslist.rasi -window-format " [{w}] {c} {t:20}" -window-thumbnail - ;; - desktop ) - rofi -no-lazy-grab -show windowcd -theme darknix/appslist.rasi - ;; -esac - - diff --git a/bin/change_wallpaper.sh b/bin/change_wallpaper.sh deleted file mode 100644 index e3d293a..0000000 --- a/bin/change_wallpaper.sh +++ /dev/null @@ -1,127 +0,0 @@ -#! /bin/bash - -# uncomment for debug -# set -x - -PID=$$ -PIDFILE=${PIDFILE:-/tmp/wallpaper.pid} -WAIT_CYCLE="5m" -INPUT=$1 - -trap "rm -f $PIDFILE" SIGTERM - -WP_SETTER="/usr/bin/feh" -QARMA="/usr/bin/qarma" - -function set_wp() { - NEW_WP=$1 - $WP_SETTER --bg-fill $NEW_WP -} - -# set background function (requires input) -function wpapers() { - if [[ -f $1 ]]; then - # We have a single file as input - set_wp $1 - exit 0 - elif [[ -d $1 ]]; then - # directory as input - while true; do - BGIMG=$(find $1 -type f -print | shuf -n1) - set_wp ${BGIMG} - sleep $WAIT_CYCLE - done - fi -} - -function file_or_dir() { - if [[ -f /tmp/choice ]]; then - rm /tmp/choice - fi - - FOD=$($QARMA --list --text="single image or directory?" --hide-header "file" "directory" > /tmp/choice) - case $? in - 0 ) - file_chooser $(cat /tmp/choice) - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - ;; - esac -} - -function file_chooser() { - case $1 in - "file" ) - FILE="$($QARMA --file-selection --title='Choose your Wallpaper')" - case $? in - 0 ) - wpapers $FILE - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - esac - ;; - "directory" ) - FILE="$($QARMA --file-selection --directory --title='Choose your Wallpaper directory')" - case $? in - 0 ) - wpapers $FILE - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - esac - ;; - * ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - ;; - esac -} - -function run() { - if [[ $(basename $0) == "wallpaper.sh" ]]; then - # we were called as wallpaper.sh, so simple wallpaper setter without qarma interaction - wpapers "$1" - elif [[ $(basename $0) == "change_wallpaper.sh" ]]; then - # we use qarma to set the wallpaper - $QARMA --question --title="Change Wallpaper" --text="Do you want to change the wallpaper?" - case $? in - 0 ) - file_or_dir - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - esac - fi -} - -if [[ -r $PIDFILE ]]; then - # PIDFILE exists, so I guess there's already an instance running - # let's kill it and run again - kill -s 15 $(cat $PIDFILE) > /dev/null 2>&1 - # should already be deleted by trap, but just to be sure - rm /tmp/choice || true - rm $PIDFILE -fi - -# create PIDFILE -echo $PID > $PIDFILE - -if [[ ! -z $1 ]]; then - run $1 -else - run -fi - diff --git a/bin/dunst-snooze.sh b/bin/dunst-snooze.sh deleted file mode 100644 index 59bf6b0..0000000 --- a/bin/dunst-snooze.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -case "$1" in - --toggle) - dunstctl set-paused toggle - ;; - *) - if [ "$(dunstctl is-paused)" = "true" ]; then - echo "  " - else - echo "  " - fi - ;; -esac diff --git a/bin/dunst_vol_brig.sh b/bin/dunst_vol_brig.sh deleted file mode 100644 index a255d34..0000000 --- a/bin/dunst_vol_brig.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/bash -# See README.md for usage instructions -bar_color="#ffbf00" -volume_step=5 -brightness_step=10 - -# Uses regex to get volume from pactl -function get_volume { - pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1 -} - -# Uses regex to get mute status from pactl -function get_mute { - pactl get-sink-mute @DEFAULT_SINK@ | grep -Po '(?<=Mute: )(yes|no)' -} - -# Uses regex to get brightness from xbacklight -function get_brightness { - xbacklight | grep -Po '[0-9]{1,3}(?=\.)' -} - -# Returns a mute icon, a volume-low icon, or a volume-high icon, depending on the volume -function get_volume_icon { - volume=$(get_volume) - mute=$(get_mute) - if [ $volume -eq 0 ] || [ $mute == "yes" ] ; then - volume_icon="" - elif [ $volume -lt 50 ]; then - volume_icon="" - else - volume_icon="" - fi -} - -# Always returns the same icon - I couldn't get the brightness-low icon to work with fontawesome -function get_brightness_icon { - brightness_icon="󰃠" -} - -# Displays a volume notification using dunstify -function show_volume_notif { - volume=$(get_volume) - get_volume_icon - if [ $volume -eq 0 ] || [ $mute == "yes" ] ; then - volstr="SHHH!!" - else - volstr=${volume}% - fi - dunstify -i audio-volume-muted -t 1000 -r 2593 -u normal "$volume_icon $volstr" -h int:value:$volume -h string:hlcolor:$bar_color -} - -# Displays a brightness notification using dunstify -function show_brightness_notif { - brightness=$(get_brightness) - get_brightness_icon - dunstify -t 1000 -r 2593 -u normal "$brightness_icon $brightness%" -h int:value:$brightness -h string:hlcolor:$bar_color -} - -# Main function - Takes user input, "volume_up", "volume_down", "brightness_up", or "brightness_down" -case $1 in - vol_u) - # Unmutes and increases volume, then displays the notification - pactl set-sink-mute @DEFAULT_SINK@ 0 - pactl set-sink-volume @DEFAULT_SINK@ +$volume_step% - show_volume_notif - ;; - vol_d) - # Raises volume and displays the notification - pactl set-sink-volume @DEFAULT_SINK@ -$volume_step% - show_volume_notif - ;; - mute) - # Toggles mute and displays the notification - pactl set-sink-mute @DEFAULT_SINK@ toggle - show_volume_notif - ;; - brig_u) - # Increases brightness and displays the notification - xbacklight -inc $brightness_step -time 0 - show_brightness_notif - ;; - brig_d) - # Decreases brightness and displays the notification - xbacklight -dec $brightness_step -time 0 - show_brightness_notif - ;; -esac diff --git a/bin/feh-blur b/bin/feh-blur deleted file mode 100644 index da1f499..0000000 --- a/bin/feh-blur +++ /dev/null @@ -1,412 +0,0 @@ -#!/usr/bin/env bash -# https://github.com/rstacruz/feh-blur - -if [[ "$1" != "--worker" ]]; then - # Where to write stuff - export CACHE_DIR="/tmp/feh-blur.$$" - - # How much to blur (--blur N) - export BLUR_STRENGTH="32" - - # Contrast (--uncontrast) - export REDUCE_CONTRAST="0" - - # How much to dim (--dim N) - export DIM_STRENGTH="32" - - # Dimmer - export DIM_COLOR="#000" - - # Where to write the final blurred image (--save-image PATH) - export BLUR_IMAGE_SAVE_LOCATION="" - - # Interval between frames in an animation - export ANIMATION_INTERVAL=0.005 - - # Fade in and out? - export ANIMATE_FADE=1 - - # Interval to check with wmctrl - export POLL_INTERVAL=0.3 - - # The verbosity. --verbose sets this to 2, and --quiet sets it to 0. - export VERBOSE=1 -fi - -# The name of this program -export BIN="$(basename "$0")" - -# Expression for proc grepping -PROC_EXPR="bash.*$(basename "$0")" - -# Run mode. -d sets this to background (daemon) mode. -# Values: background | foreground | noop -MODE=foreground - -# Guard so that do_cleanup will only be invoked once. -CLEANING_UP=0 - -# Image extension to use. 'ppm' is used because it's faster to read/write to, I -# think. -EXT="ppm" - -# The original source. -wall_original="$CACHE_DIR/original.$EXT" - -# Echo some info. Only if verbose=1 -info () { - if [[ "$VERBOSE" -gt 0 ]]; then - echo " $1" - fi -} - -head () { - if [[ "$VERBOSE" -gt 0 ]]; then - echo "" - echo -e " \033[31m>>\033[32m $1\033[0m" - fi -} - -# Log some debug info -debug () { - if [[ "$VERBOSE" -gt 1 ]]; then - echo " - $1" - fi -} - -# Generate a bunch of images -generate_blurred_images () { - mkdir -p "$CACHE_DIR" - local source="$1" - local original="$CACHE_DIR/original.$EXT" - - gm convert "$source" -resize 1920x "$original" - - head "Found wallpaper" - info "$source" - info "Generating blurred images..." - - local fx1="" - local fx2="" - local fx3="" - - if [[ "$BLUR_STRENGTH" != "0" ]]; then - fx1="$fx1 -scale 25% -blur 0x$(( "$BLUR_STRENGTH" / 4 )) -scale 400%" - fx2="$fx2 -scale 25% -blur 0x$(( "$BLUR_STRENGTH" / 2 )) -scale 400%" - fx3="$fx3 -scale 25% -blur 0x$(( "$BLUR_STRENGTH" / 1 )) -scale 400%" - fi - - if [[ "$REDUCE_CONTRAST" = "1" ]]; then - fx1="+contrast $fx1" - fx2="+contrast +contrast $fx2" - fx3="+contrast +contrast +contrast $fx3" - fi - - if [[ "$DIM_STRENGTH" != "0" ]]; then - fx1="$fx1 -fill $DIM_COLOR -colorize $(( "$DIM_STRENGTH" / 4 ))%" - fx2="$fx2 -fill $DIM_COLOR -colorize $(( "$DIM_STRENGTH" / 2 ))%" - fx3="$fx3 -fill $DIM_COLOR -colorize $(( "$DIM_STRENGTH" / 1 ))%" - fi - - gm convert "$original" \ - $fx1 \ - "$CACHE_DIR/blur-0.$EXT" - gm convert "$CACHE_DIR/blur-0.$EXT" \ - $fx2 \ - "$CACHE_DIR/blur-1.$EXT" - gm convert "$CACHE_DIR/blur-0.$EXT" \ - $fx3 \ - "$CACHE_DIR/blur-final.$EXT" - - if [[ -n "$BLUR_IMAGE_SAVE_LOCATION" ]]; then - gm convert \ - "$CACHE_DIR/blur-final.$EXT" \ - "$BLUR_IMAGE_SAVE_LOCATION" - fi - - info "Done." -} - -# Get current feh wallpaper -get_feh_wallpaper() { - tail -n1 "$HOME/.fehbg" | sed 's/--no-fehbg //g' | cut -d"'" -f2 -} - -# Get wallpaper mode like --bg-tile -get_feh_wallpaper_mode() { - tail -n1 "$HOME/.fehbg" | sed 's/--no-fehbg //g' | cut -d' ' -f2 -} - -# get_current_workspace => "2" -get_current_workspace() { - # 2 * DG: N/A VP: 0,0 WA: N/A Name - wmctrl -d | grep '\*' | cut -d' ' -f1 -} - -# get_open_windows_count() => "2" -get_open_windows_count() { - workspace="$(get_current_workspace)" - wmctrl -l | cut -d' ' -f3 | grep -c "$workspace" -} - -is_blank() { - count=$(get_open_windows_count) - [[ "$count" -eq 0 ]] -} - -set_blurred_wallpaper() { - debug "Setting blurred wallpaper" - local mode="$1" # --bg-tile - - if [[ "$ANIMATE_FADE" == 1 ]]; then - # We're going to redirect output to /dev/null to supress feh warnings - feh --no-fehbg "$mode" "$CACHE_DIR/blur-0.$EXT" &> /dev/null - sleep $ANIMATION_INTERVAL - feh --no-fehbg "$mode" "$CACHE_DIR/blur-1.$EXT" &> /dev/null - sleep $ANIMATION_INTERVAL - fi - - feh --no-fehbg "$mode" "$CACHE_DIR/blur-final.$EXT" &> /dev/null -} - -set_original_wallpaper() { - debug "Setting original wallpaper" - local mode="$1" # --bg-tile - - if [[ "$ANIMATE_FADE" == 1 ]]; then - feh --no-fehbg "$mode" "$CACHE_DIR/blur-1.$EXT" &> /dev/null - sleep $ANIMATION_INTERVAL - feh --no-fehbg "$mode" "$CACHE_DIR/blur-0.$EXT" &> /dev/null - sleep $ANIMATION_INTERVAL - fi - - feh --no-fehbg "$mode" "$wall_original" &> /dev/null -} - -kill_other_instances() { - if [[ "$(pgrep -fcl "$PROC_EXPR")" -gt 1 ]]; then - head "Stopping other instances of $BIN..." - - local count=1 - while [[ "$(pgrep -fcl "$PROC_EXPR")" -gt 1 ]]; do - count=$(( count + 1 )) - old_pid="$(pgrep -fo "$PROC_EXPR")" - - # Kill it; if it refuses after some time, force-stop it - if [[ "$count" -gt 10 ]]; then - kill -9 "$old_pid" - else - kill "$old_pid" - fi - sleep 0.1 - done - fi -} - -run_loop () { - prev_blank="-" - prev_wallpaper="-" - first_run="1" - - while true; do - wallpaper="$(get_feh_wallpaper)" - - # Check if wallpaper has changed. - if [[ "$prev_wallpaper" != "$wallpaper" ]]; then - wallpaper_mode="$(get_feh_wallpaper_mode)" - - # If there's no wallpaper, try again later. - if [[ -z "$wallpaper" ]]; then - sleep "$POLL_INTERVAL" - continue - else - generate_blurred_images "$wallpaper" - prev_wallpaper="$wallpaper" - prev_blank="" - fi - fi - - blank="$(is_blank && echo 1 || echo 0)" - if [[ "$prev_blank" != "$blank" ]]; then - if [[ "$blank" == 0 ]]; then - set_blurred_wallpaper "$wallpaper_mode" - elif [[ "$first_run" == "0" ]]; then - # Skip set_original_wallpaper if we were started without - # an active window so that the animation is skipped - set_original_wallpaper "$wallpaper_mode" - fi - prev_blank="$blank" - fi - - first_run=0 - sleep "$POLL_INTERVAL" - done -} - -show_help() { - echo "Usage: $BIN [-v|--verbose]" - echo '' - echo 'Options:' - echo ' -b, --blur N set blur strength to N (4...128, default 32)' - echo ' --darken N darken image by N (4...100, default 32)' - echo ' --lighten N lengthen image by N (4...100, default 0)' - echo ' -c, --uncontrast reduce contrast' - echo ' --save-image PATH save blurred image to PATH' - echo ' --no-animate skip fading animation' - echo '' - echo 'Daemon options:' - echo ' -d, --daemon run in background' - echo ' -s, --stop stop previously-ran daemon' - echo '' - echo 'Other options:' - echo ' -v, --verbose show more messages' - echo ' -q, --quiet supress messages' - echo '' -} - -parse_opts() { - while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in - -h | --help) - MODE=noop - show_help - ;; - -V | --version ) - MODE=noop - echo version - ;; - -b | --blur ) - shift - BLUR_STRENGTH="$1" - ;; - -c | --uncontrast ) - REDUCE_CONTRAST=1 - ;; - --save-image ) - shift - BLUR_IMAGE_SAVE_LOCATION="$1" - ;; - --no-animate ) - ANIMATE_FADE=0 - ;; - -D | --dim | --darken ) - shift - DIM_COLOR="#000" - DIM_STRENGTH="$1" - ;; - --lighten ) - shift - DIM_COLOR="#fff" - DIM_STRENGTH="$1" - ;; - --tint-color ) - shift - DIM_COLOR="$1" - ;; - --tint-strength ) - shift - DIM_STRENGTH="$1" - ;; - -d | --daemon ) - MODE=background - ;; - -s | --stop ) - MODE=stop - ;; - -q | --quiet ) - VERBOSE=0 - ;; - -v | --verbose ) - VERBOSE=2 - ;; - esac; shift; done - if [[ "$1" == '--' ]]; then shift; fi -} - -ensure_feh() { - if ! command -v feh >/dev/null; then - echo "$BIN requires Feh to set wallpapers." - exit - fi -} - -# Ensure that 'graphicsmagick' is available. -ensure_gm() { - if ! command -v gm >/dev/null; then - echo "$BIN requires GraphicsMagick to set wallpapers." - exit - fi -} - -ensure_wmctrl() { - if ! command -v wmctrl >/dev/null; then - echo "$BIN requires wmctrl to detect events." - exit - fi -} - -print_usage() { - head "Monitoring changes" - info "$BIN will now blur any wallpapers set using 'feh'." - info "To change your wallpaper, try:" - info "" - info " feh --bg-tile your-image.jpg" -} - -main() { - ensure_feh - ensure_gm - ensure_wmctrl - parse_opts "$@" - - case "$MODE" in - background) - kill_other_instances - print_usage - "$0" --worker --quiet & disown - - head "Background mode" - info "$BIN started in background mode!" - info "To stop, use '$BIN --stop'." - ;; - - stop) - kill_other_instances - ;; - - noop) - exit - ;; - - *) - kill_other_instances - print_usage - run_loop - ;; - esac -} - -# Perform cleanup operations before stopping. -do_cleanup () { - # Guard clause so that it's only ran once - if [[ "$CLEANING_UP" == "1" ]]; then return; fi - CLEANING_UP=1 - - rm -rf "$CACHE_DIR" - - # Restore original wallpaper before exiting - if [[ "$MODE" == "foreground" ]] && [[ -e "$HOME/.fehbg" ]]; then - head "Restoring original wallpaper" - source "$HOME/.fehbg" - fi -} - -finish () { - do_cleanup - exit 1 -} - -trap finish EXIT -trap finish SIGHUP -trap finish SIGINT -trap finish SIGTERM -main "$@" diff --git a/bin/gify.sh b/bin/gify.sh deleted file mode 100644 index ee38bc0..0000000 --- a/bin/gify.sh +++ /dev/null @@ -1,170 +0,0 @@ -#! /bin/bash - - -# ERROR & EXIT STATUSES -SHOWHELP=61 -USERABORTED=62 - -E_INTERROR=71 -E_NOOPTS=72 -E_NOARGS=73 -E_FILEXISTS=74 -E_NOIMAGES=75 -E_UNKNOWNOPT=76 - -# TOOLS -PWD=$(pwd) -MOGRIFY=$(which mogrify) -CONVERT=$(which convert) - -# we need mogrify and convert from the imagemagik toolset for this script to work -if [[ ! -x $MOGRIFY || ! -x $CONVERT ]]; then - showerror missingdeps - exit $E_MISSINGDEPS -fi - - -# showhelp -showhelp () -{ -case $1 in - resize ) - echo "USAGE: $(basename $0) -r | --resize [width] [extension]" - ;; - gif ) - echo "USAGE: $(basename $0) -g | --gif [delay] [extension] [output file name]" - ;; - * ) - #|----------------------- TEXT MAX WIDTH - 80 CHARS ----------------------------| - echo -e "$(basename $0) - create animated gifs from images inside current directory" - echo -e "USAGE: $(basename $0)