From ea5cd9509971f43dcc19185f8ce00daad61e0085 Mon Sep 17 00:00:00 2001 From: agryphus Date: Mon, 18 Sep 2023 20:00:25 -0400 Subject: [PATCH] Added rofi / sourced aliases / dlkiller --- .config/zsh/.zshrc | 31 +++++++++++++++++++++++++++++-- .local/bin/blueman | 5 ----- .local/bin/dlkiller | 13 +++++++++++++ .local/bin/rofi-alias | 5 +++++ 4 files changed, 47 insertions(+), 7 deletions(-) delete mode 100755 .local/bin/blueman create mode 100755 .local/bin/dlkiller create mode 100755 .local/bin/rofi-alias diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index e2c469d..c6b5272 100755 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -13,6 +13,10 @@ alias xournal='xournalpp' alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' alias javafx='java --module-path /usr/lib/jvm/default/lib/ --add-modules javafx.base,javafx.controls,javafx.graphics,javafx.media,javafx.swing,javafx.web' alias sxiv='nsxiv' +alias blueman='blueman-manager' +alias spotify='spotify-launcher' +alias spotify-launcher='dlkiller spotify-launcher' +alias zoom='dlkiller zoom' # Some wsl stuff alias clip=/mnt/c/Windows/System32/clip.exe @@ -33,7 +37,7 @@ alias egrep='egrep --color=auto' alias diff='diff --color=auto' alias ip='ip --color=auto' -## KEYBINDS ## +## FUNCTIONS ## # Use lf to switch directories and bind it to ctrl-o lfcd () { @@ -50,7 +54,30 @@ lfcd () { fi fi } -bindkey -s '^o' 'lfcd\n' + +# This script was automatically generated by the broot program +# More information can be found in https://github.com/Canop/broot +# This function starts broot and executes the command +# it produces, if any. +# It's needed because some shell commands, like `cd`, +# have no useful effect if executed in a subshell. +function br { + local cmd cmd_file code + cmd_file=$(mktemp) + if broot --outcmd "$cmd_file" "$@"; then + cmd=$(<"$cmd_file") + command rm -f "$cmd_file" + eval "$cmd" + else + code=$? + command rm -f "$cmd_file" + return "$code" + fi +} + +## KEYBINDS ## + +bindkey -s '^e' 'lfcd\n' # Enable completion features autoload -Uz compinit diff --git a/.local/bin/blueman b/.local/bin/blueman deleted file mode 100755 index b4c04ee..0000000 --- a/.local/bin/blueman +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Alias for dmenu_run - -blueman-manager - diff --git a/.local/bin/dlkiller b/.local/bin/dlkiller new file mode 100755 index 0000000..bc5147a --- /dev/null +++ b/.local/bin/dlkiller @@ -0,0 +1,13 @@ +#!/usr/bin/sh +# For the programs that create a ~/Downloads folder on startup (ie: spotify, zoom) +# Look in the program settings to redirect the Downloads folder before trying this solution +# Usage: 'dlkiller $my-program' +# Must have $SHELL variable set to your preferred shell + +$1 & + +sleep 4 +if [ -d ~/Downloads ] && [ -z "$(ls -A ~/Downloads)" ]; then + rm -r ~/Downloads +fi + diff --git a/.local/bin/rofi-alias b/.local/bin/rofi-alias new file mode 100755 index 0000000..c44cb05 --- /dev/null +++ b/.local/bin/rofi-alias @@ -0,0 +1,5 @@ +#!/usr/bin/sh +# Script to have rofi show and run aliases + +rofi -run-list-command "alias | awk -F= \"{print \\\$1}\"" -run-command "/usr/bin/zsh -i -c '{cmd}'" -rnow -show run +