init: new dotfile configuration
Remove all org files using a new script to more config over, The old org file configuaration were great but required org. This new version only requires the scripts that is included in the repo. The configuration are all done but have not ported the theming system yet. Signed-off-by: Steve Beaulac <steve@sagacity.ca> Change-Id: I14cd7fe058a71c8ba9d6d35397dc8d7e6a6a6964
This commit is contained in:
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
hyprctl activeworkspace -j | jq -r '@text "Workspace \(.id)"'
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
while : ; do
|
||||
/usr/bin/avrdude -p atmega32u4 -c avr109 -U flash:w:$1 -P $2
|
||||
[[ $? == 0 ]] && break
|
||||
done
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
# macOS
|
||||
BATTERY=$(pmset -g batt | grep -Eo '[0-9]+%' | head -1 | tr -d '%')
|
||||
CHARGING=$(pmset -g batt | grep -c 'AC Power')
|
||||
else
|
||||
BATTERY=$(cat /sys/class/power_supply/BAT0/capacity 2>/dev/null || upower -i $(upower -e | grep BAT) | grep percentage | awk '{print $2}' | tr -d '%')
|
||||
CHARGING=$(cat /sys/class/power_supply/BAT0/status 2>/dev/null | grep -c 'Charging')
|
||||
fi
|
||||
|
||||
if [[ -z "$BATTERY" ]]; then
|
||||
echo "🔋 N/A"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Choose icon based on level
|
||||
if [[ "$CHARGING" -gt 0 ]]; then
|
||||
ICON="⚡"
|
||||
elif [[ "$BATTERY" -ge 80 ]]; then
|
||||
ICON="🔋"
|
||||
elif [[ "$BATTERY" -ge 40 ]]; then
|
||||
ICON="🔋"
|
||||
elif [[ "$BATTERY" -ge 20 ]]; then
|
||||
ICON="🪫"
|
||||
else
|
||||
ICON="🪫"
|
||||
fi
|
||||
|
||||
echo "$ICON ${BATTERY}%"
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh -e
|
||||
if [[ ! -x /usr/bin/swww ]]; then
|
||||
echo "required swww please install with yay -S swww" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# setting paths
|
||||
offset=0
|
||||
[[ "$1" =~ [1-9][0-9]*$ ]] && offset=$1
|
||||
|
||||
BACKGROUNDS_DIR="$HOME/Sync/Shared/wallpapers"
|
||||
CURRENT_BACKGROUND_LINK="$HOME/.local/share/themes/current/background"
|
||||
|
||||
url_preffix="http://www.bing.com"
|
||||
xml_url="https://cn.bing.com/HPImageArchive.aspx?format=xml&idx=$offset&n=10&nc=1612409408851&pid=hp&FORM=BEHPTB&uhd=1&uhdwidth=3840&uhdheight=2160"
|
||||
[ -d $BACKGROUNDS_DIR ] || mkdir -p $BACKGROUNDS_DIR
|
||||
|
||||
# actual script
|
||||
url_suffix=$(curl --no-progress-meter $xml_url | xmllint --xpath "string(//url)" -) && \
|
||||
url="$url_preffix$url_suffix"
|
||||
|
||||
if [[ ! -z "$url_suffix" ]]; then
|
||||
name=$(echo $url_suffix | awk -F'&' '{print $1}' | awk -F'=' '{print $2}')
|
||||
if [ ! -z "$name" ]; then
|
||||
file_path="$BACKGROUNDS_DIR/$name"
|
||||
echo "Wallpaper name: $name"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$file_path" || -z "$url" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$file_path" ]]; then
|
||||
if curl "$url" -o "$file_path" 2>/dev/null; then
|
||||
echo "Downloaded"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ln -nsf $file_path $CURRENT_BACKGROUND_LINK && \
|
||||
setsid uwsm app -- swww img $CURRENT_BACKGROUND_LINK && \
|
||||
exit 0
|
||||
|
||||
# return exitcode if above crashed
|
||||
exit 1
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
while : ; do
|
||||
/usr/bin/dfu-programmer atmega32u4 erase
|
||||
[[ $? == 0 ]] && break
|
||||
done
|
||||
/usr/bin/dfu-programmer atmega32u4 flash $1
|
||||
/usr/bin/dfu-programmer atmega32u4 reset
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
emacsclient -c -F "((name . \"capture\") (height . 20) (width . 80))" -e "(activate-capture-frame)"
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
rm -rf /run/user/$UID/emacs
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
WS_DIR=${!#}
|
||||
if [ -z "$WS_DIR" ]; then
|
||||
WS_DIR="."
|
||||
fi
|
||||
|
||||
git clone --bare ${*: -$#:$#-1} $WS_DIR/.bare && echo "gitdir: ./.bare" > $WS_DIR/.git && git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Written by Corey Haines
|
||||
# Scriptified by Gary Bernhardt
|
||||
#
|
||||
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
|
||||
# and you'll be able to do `git churn`.
|
||||
#
|
||||
# Show churn for whole repo:
|
||||
# $ git churn
|
||||
#
|
||||
# Show churn for specific directories:
|
||||
# $ git churn app lib
|
||||
#
|
||||
# Show churn for a time range:
|
||||
# $ git churn --since='1 month ago'
|
||||
#
|
||||
# (These are all standard arguments to `git log`.)
|
||||
|
||||
set -e
|
||||
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | sort -g
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
hyprctl activeworkspace -j | jq -r '@text "Workspace \(.id)"'
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
#chooser="walker -d"
|
||||
chooser="rofi -i -dmenu -display-columns 1"
|
||||
workspace=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.value.title)\\\t\(.value.class)::\(.value.address)"' | $chooser -p 'Client to Fetch')
|
||||
#address=$(hyprctl clients -j | jq -r "to_entries | .[] | select(.value.title == \"$selected\") | \"\(.value.address)\"")
|
||||
address=$(echo "$selected" | awk -F '::' '{print $NF}')
|
||||
hyprctl dispatch movetoworkspace "$workspace,address:$address"
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
#chooser="walker -d"
|
||||
chooser="rofi -i -dmenu -display-columns 1"
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.value.title)\\\t\(.value.class)::\(.value.address)"' | $chooser -p 'Client to Focus')
|
||||
address=$(echo $selected | awk -F'::' '{print $NF}')
|
||||
#address=$(hyprctl clients -j | jq -r "to_entries | .[] | select(.value.title == '$selected') | \"\(.value.address)\"")
|
||||
json=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$address\")")
|
||||
workspace=$(echo $json | jq -r '.workspace.id')
|
||||
hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace"
|
||||
hyprctl dispatch focuswindow "address:$address"
|
||||
Executable
+90
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
# A script to display Hyprland keybindings defined in your configuration
|
||||
#
|
||||
# original script from omarchy
|
||||
|
||||
# Fetch dynamic keybindings from Hyprland
|
||||
#
|
||||
# Also do some pre-processing:
|
||||
# - Remove standard Omarchy bin path prefix
|
||||
# - Remove uwsm prefix
|
||||
# - Map numeric modifier key mask to a textual rendition
|
||||
# - Output comma-separated values that the parser can understand
|
||||
dynamic_bindings() {
|
||||
hyprctl -j binds | \
|
||||
jq -r '.[] | {modmask, key, keycode, description, dispatcher, arg, submap} | "\(.modmask),\(.key)@\(.keycode),\(.description),\(.dispatcher),\(.arg),\(.submap)"' | \
|
||||
sed -E \
|
||||
-e 's/null//' \
|
||||
-e 's,uwsm app -- ,,' \
|
||||
-e 's|exec,.*/([^/]*)|exec,\1|' \
|
||||
-e 's/@0//' \
|
||||
-e 's/,@/,code:/' \
|
||||
-e 's/^0,/,/' \
|
||||
-e 's/^1,/SHIFT,/' \
|
||||
-e 's/^4,/CTRL,/' \
|
||||
-e 's/^5,/SHIFT CTRL,/' \
|
||||
-e 's/^8,/ALT,/' \
|
||||
-e 's/^9,/SHIFT ALT,/' \
|
||||
-e 's/^12,/CTRL ALT,/' \
|
||||
-e 's/^13,/SHIFT CTRL ALT,/' \
|
||||
-e 's/^64,/SUPER,/' \
|
||||
-e 's/^65,/SUPER SHIFT,/' \
|
||||
-e 's/^68,/SUPER CTRL,/' \
|
||||
-e 's/^69,/SUPER SHIFT CTRL,/' \
|
||||
-e 's/^72,/SUPER ALT,/' \
|
||||
-e 's/^77,/HYPR,/'
|
||||
}
|
||||
|
||||
# Parse and format keybindings
|
||||
#
|
||||
# `awk` does the heavy lifting:
|
||||
# - Set the field separator to a comma ','.
|
||||
# - Joins the key combination (e.g., "SUPER + Q").
|
||||
# - Joins the command that the key executes.
|
||||
# - Prints everything in a nicely aligned format.
|
||||
parse_bindings() {
|
||||
awk -F, '
|
||||
{
|
||||
# Combine the modifier and key (first two fields)
|
||||
key_combo = $1 " + " $2;
|
||||
|
||||
# Clean up: strip leading "+" if present, trim spaces
|
||||
gsub(/^[ \t]*\+?[ \t]*/, "", key_combo);
|
||||
gsub(/[ \t]+$/, "", key_combo);
|
||||
|
||||
# Use description, if set
|
||||
action = $3;
|
||||
submenu = $NF;
|
||||
|
||||
if (action == "") {
|
||||
# Reconstruct the command from the remaining fields
|
||||
for (i = 4; i <= NF - 1; i++) {
|
||||
action = action $i (i < NF ? "," : "");
|
||||
}
|
||||
|
||||
# Clean up trailing commas, remove leading "exec, ", and trim
|
||||
sub(/,$/, "", action);
|
||||
gsub(/(^|,)[[:space:]]*exec[[:space:]]*,?/, "", action);
|
||||
gsub(/^[ \t]+|[ \t]+$/, "", action);
|
||||
gsub(/[ \t]+/, " ", key_combo); # Collapse multiple spaces to one
|
||||
|
||||
# Escape XML entities
|
||||
gsub(/&/, "\\&", action);
|
||||
gsub(/</, "\\<", action);
|
||||
gsub(/>/, "\\>", action);
|
||||
gsub(/"/, "\\"", action);
|
||||
gsub(/'"'"'/, "\\'", action);
|
||||
}
|
||||
|
||||
if (action != "") {
|
||||
if (submenu != "") {
|
||||
printf "%-10s | %-22s → %s\n", submenu, key_combo, action;
|
||||
} else {
|
||||
printf "%-35s → %s\n", key_combo, action;
|
||||
}
|
||||
}
|
||||
}'
|
||||
}
|
||||
|
||||
dynamic_bindings | parse_bindings | sort -u
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
workspace=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t: |\(.value.address)"' | rofi -i -dmenu -tokenize -matching prefix -p 'Client to Fetch')
|
||||
address=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
hyprctl dispatch movetoworkspace "$workspace,address:$address"
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t |\(.value.address)"' | rofi -i -dmenu -tokenize -matching prefix -p 'Client to Fetch')
|
||||
addr=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
json=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$addr\")")
|
||||
client=$(echo $json | jq -r '.address')
|
||||
workspace=$(echo $json | jq -r '.workspace.id')
|
||||
hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace"
|
||||
hyprctl dispatch focuswindow "address:$client"
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
sessions="$(tmux list-sessions -F '#S' 2>/dev/null || true)"
|
||||
[ -n "${sessions}" ] || exit 0
|
||||
|
||||
walker_pick_session() {
|
||||
if command -v walker >/dev/null 2>&1; then
|
||||
walker -d -p 'tmux sessions:'
|
||||
fi
|
||||
}
|
||||
|
||||
rofi_pick_session() {
|
||||
if command -v rofi >/dev/null 2>&1; then
|
||||
rofi -dmenu -p 'tmux sessions:'
|
||||
fi
|
||||
}
|
||||
|
||||
chosen="$(printf '%s\n' "$sessions" | rofi_pick_session)"
|
||||
|
||||
[ -n "$chosen" ] || exit 0
|
||||
|
||||
if [ "${TMUX-}" ]; then
|
||||
exec tmux switch-client -t "${chosen}"
|
||||
fi
|
||||
|
||||
client_tty="$(
|
||||
tmux list-clients -F '#{client_tty} #{client_termname}' 2>/dev/null \
|
||||
| awk '$2 ~ /ghostty/ { print $1; exit }' || true
|
||||
)"
|
||||
|
||||
if [ -n "${client_tty}" ]; then
|
||||
# switch that client to the chosen session
|
||||
tmux switch-client -c "${client_tty}" -t "${chosen}"
|
||||
address=$(hyprctl clients -j | jq -r "to_entries | .[] | select(.value.class == \"com.mitchellh.ghostty\") | \"\(.value.address)\"")
|
||||
workspace=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$address\") | \"(.workspace.id)\"")
|
||||
hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace"
|
||||
hyprctl dispatch focuswindow "address:$address"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
monitor=$1
|
||||
state=$(hyprctl monitors all -j | jq -r ".[] | select(.name == \"$monitor\") | .disabled")
|
||||
if [ $state == "true" ]; then
|
||||
hyprctl keyword monitor $monitor,preferred
|
||||
else
|
||||
hyprctl keyword monitor $monitor,disable
|
||||
fi
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
chooser="walker -d -V 2 -t '|'"
|
||||
workspace=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t: |\(.value.address)"' | $chooser -p 'Client to Fetch')
|
||||
address=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
hyprctl dispatch movetoworkspace "$workspace,address:$address"
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
chooser="walker -d -V 2 -t '|'"
|
||||
selected=$(hyprctl clients -j | jq -r 'to_entries | .[] | select(.value.hidden == false) | "\(.key). w\(.value.workspace.name): m\(.value.monitor): \(.value.class)\t \(.value.title)\t |\(.value.address)"' | $chooser -p 'Client to Focus')
|
||||
addr=$(echo $selected | awk -F'|' '{ print $NF }')
|
||||
json=$(hyprctl clients -j | jq -r ".[] | select(.address == \"$addr\")")
|
||||
client=$(echo $json | jq -r '.address')
|
||||
workspace=$(echo $json | jq -r '.workspace.id')
|
||||
hyprctl dispatch focusworkspaceoncurrentmonitor "$workspace"
|
||||
hyprctl dispatch focuswindow "address:$client"
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
# macgen.py script to generate a MAC address for Red Hat Virtualization guests
|
||||
#
|
||||
import random
|
||||
|
||||
def randomMAC():
|
||||
mac = [ 0x00, 0x16, 0x3e,
|
||||
random.randint(0x00, 0x7f),
|
||||
random.randint(0x00, 0xff),
|
||||
random.randint(0x00, 0xff) ]
|
||||
return ':'.join(map(lambda x: "%02x" % x, mac))
|
||||
|
||||
print randomMAC()
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
export LD_PRELOAD="/usr/lib/libfreetype.so.6"
|
||||
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/
|
||||
/opt/MATLAB/R2022b/bin/matlab $*
|
||||
|
||||
#!/bin/bash
|
||||
export LD_PRELOAD="/usr/lib/libfreetype.so.6"
|
||||
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/
|
||||
/opt/MATLAB/R2022b/bin/matlab $*
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Cycles through the background images available
|
||||
|
||||
THEMES_DIR="$HOME/.local/share/themes"
|
||||
BACKGROUNDS_DIR="${THEMES_DIR}/current/theme/backgrounds/"
|
||||
CURRENT_BACKGROUND_LINK="${THEMES_DIR}/current/background"
|
||||
|
||||
mapfile -d '' -t BACKGROUNDS < <(find "$BACKGROUNDS_DIR" -type f -print0 | sort -z)
|
||||
TOTAL=${#BACKGROUNDS[@]}
|
||||
|
||||
if [[ $TOTAL -eq 0 ]]; then
|
||||
notify-send "No background was found for theme" -t 2000
|
||||
setsid uwsm app -- swww clear >/dev/null 2>&1 &
|
||||
else
|
||||
# Get current background from symlink
|
||||
if [[ -L "$CURRENT_BACKGROUND_LINK" ]]; then
|
||||
CURRENT_BACKGROUND=$(readlink "$CURRENT_BACKGROUND_LINK")
|
||||
else
|
||||
# Default to first background if no symlink exists
|
||||
CURRENT_BACKGROUND=""
|
||||
fi
|
||||
|
||||
# Find current background index
|
||||
INDEX=-1
|
||||
for i in "${!BACKGROUNDS[@]}"; do
|
||||
if [[ "${BACKGROUNDS[$i]}" == "$CURRENT_BACKGROUND" ]]; then
|
||||
INDEX=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Get next background (wrap around)
|
||||
if [[ $INDEX -eq -1 ]]; then
|
||||
# Use the first background when no match was found
|
||||
NEW_BACKGROUND="${BACKGROUNDS[0]}"
|
||||
else
|
||||
NEXT_INDEX=$(((INDEX + 1) % TOTAL))
|
||||
NEW_BACKGROUND="${BACKGROUNDS[$NEXT_INDEX]}"
|
||||
fi
|
||||
|
||||
# Set new background symlink
|
||||
ln -nsf "$NEW_BACKGROUND" "$CURRENT_BACKGROUND_LINK"
|
||||
|
||||
# Relaunch swaybg
|
||||
setsid uwsm app -- swww img "$CURRENT_BACKGROUND_LINK" >/dev/null 2>&1 &
|
||||
fi
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
THEMES_DIR="$HOME/.local/share/themes"
|
||||
find ${THEMES_DIR}/available -mindepth 1 -maxdepth 1 \( -type d -o -type l \) | sort | while read -r path; do
|
||||
echo "$(basename "$path" | sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g')"
|
||||
done
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# omarchy-theme-set: Set a theme, specified by its name.
|
||||
# Usage: omarchy-theme-set <theme-name>
|
||||
|
||||
if [[ -z "$1" && "$1" != "CNCLD" ]]; then
|
||||
echo "Usage: omarchy-theme-set <theme-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
THEMES_DIR="$HOME/.local/share/themes"
|
||||
CURRENT_THEME_DIR="${THEMES_DIR}/current/theme"
|
||||
|
||||
THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
THEME_PATH="$THEMES_DIR/available/$THEME_NAME"
|
||||
|
||||
base_theme_dir=$(dirname "$CURRENT_THEME_DIR")
|
||||
if [[ ! -d "$base_theme_dir" ]]; then
|
||||
mkdir -p $base_theme_dir
|
||||
fi
|
||||
|
||||
# Check if the theme entered exists
|
||||
if [[ ! -d "$THEME_PATH" ]]; then
|
||||
echo "Theme '$THEME_NAME' does not exist in $THEMES_DIR" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Update theme symlinks
|
||||
ln -nsf "$THEME_PATH" "$CURRENT_THEME_DIR"
|
||||
|
||||
# Change gnome modes
|
||||
if [[ -f ~/.config/omarchy/current/theme/light.mode ]]; then
|
||||
gsettings set org.gnome.desktop.interface color-scheme "prefer-light"
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita"
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
|
||||
fi
|
||||
|
||||
# Change gnome icon theme color
|
||||
if [[ -f ~/.config/omarchy/current/theme/icons.theme ]]; then
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$(<~/.config/omarchy/current/theme/icons.theme)"
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface icon-theme "Yaru-blue"
|
||||
fi
|
||||
|
||||
# Change Chromium colors
|
||||
if command -v chromium &>/dev/null; then
|
||||
if [[ -f ~/.config/omarchy/current/theme/light.mode ]]; then
|
||||
chromium --no-startup-window --set-color-scheme="light"
|
||||
else
|
||||
chromium --no-startup-window --set-color-scheme="dark"
|
||||
fi
|
||||
|
||||
if [[ -f ~/.config/omarchy/current/theme/chromium.theme ]]; then
|
||||
chromium --no-startup-window --set-theme-color="$(<~/.config/omarchy/current/theme/chromium.theme)"
|
||||
else
|
||||
# Use a default, neutral grey if theme doesn't have a color
|
||||
chromium --no-startup-window --set-theme-color="28,32,39"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "${CURRENT_THEME_DIR}/ghostty" ]]; then
|
||||
touch ${CURRENT_THEME_DIR}/ghostty
|
||||
fi
|
||||
|
||||
if [[ ! -f "${CURRENT_THEME_DIR}/tmux" ]]; then
|
||||
touch ${CURRENT_THEME_DIR}/tmux
|
||||
fi
|
||||
|
||||
omarchy-theme-bg-next
|
||||
|
||||
# Restart components to apply new theme
|
||||
pkill -SIGUSR2 btop
|
||||
makoctl reload
|
||||
hyprctl reload
|
||||
|
||||
Executable
+993
@@ -0,0 +1,993 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# rofi-pass
|
||||
# (c) 2015 Rasmus Steinke <rasi@xssn.at>
|
||||
basecommand="$0"
|
||||
|
||||
# set default settings
|
||||
_rofi () {
|
||||
rofi -no-auto-select -i "$@"
|
||||
}
|
||||
|
||||
_pwgen () {
|
||||
pwgen -y "$@"
|
||||
}
|
||||
|
||||
_image_viewer () {
|
||||
feh -
|
||||
}
|
||||
|
||||
config_dir=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||
cache_dir=${XDG_CACHE_HOME:-$HOME/.cache}
|
||||
|
||||
# We expect to find these fields in pass(1)'s output
|
||||
URL_field='url'
|
||||
USERNAME_field='user'
|
||||
AUTOTYPE_field='autotype'
|
||||
OTPmethod_field='otp_method'
|
||||
|
||||
default_autotype="user :tab pass"
|
||||
delay=2
|
||||
wait=0.2
|
||||
type_delay=12
|
||||
default_do='menu' # menu, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
|
||||
auto_enter='false'
|
||||
notify='false'
|
||||
help_color=""
|
||||
clip=primary
|
||||
clip_clear=45
|
||||
default_user="${ROFI_PASS_DEFAULT_USER-$(whoami)}"
|
||||
default_user2=john_doe
|
||||
password_length=12
|
||||
fix_layout=false
|
||||
|
||||
# default shortcuts
|
||||
autotype="Alt+1"
|
||||
type_user="Alt+2"
|
||||
type_pass="Alt+3"
|
||||
open_url="Alt+4"
|
||||
copy_name="Alt+u"
|
||||
copy_url="Alt+l"
|
||||
copy_pass="Alt+p"
|
||||
show="Alt+o"
|
||||
copy_menu="Alt+c"
|
||||
action_menu="Alt+a"
|
||||
type_menu="Alt+t"
|
||||
help="Alt+h"
|
||||
switch="Alt+x"
|
||||
insert_pass="Alt+n"
|
||||
qrcode="Alt+q"
|
||||
previous_root="Shift+Left"
|
||||
next_root="Shift+Right"
|
||||
clipboard_backend=${ROFI_PASS_CLIPBOARD_BACKEND:-xclip}
|
||||
backend=${ROFI_PASS_BACKEND:-xdotool}
|
||||
|
||||
case "$clipboard_backend" in
|
||||
"xclip");;
|
||||
"wl-clipboard");;
|
||||
*)
|
||||
>&2 echo "Invalid clipboard backend '$clipboard_backend', falling back to xclip"
|
||||
clipboard_backend=xclip
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$backend" in
|
||||
"xdotool");;
|
||||
"wtype");;
|
||||
*)
|
||||
>&2 echo "Invalid backend '$backend', falling back to xdotool"
|
||||
backend=xdotool
|
||||
;;
|
||||
esac
|
||||
|
||||
# Safe permissions
|
||||
umask 077
|
||||
|
||||
# Backends for clipboard manipulation
|
||||
_clip_in_primary_wl-clipboard() {
|
||||
wl-copy -p
|
||||
}
|
||||
|
||||
_clip_in_clipboard_wl-clipboard() {
|
||||
wl-copy
|
||||
}
|
||||
|
||||
_clip_out_primary_wl-clipboard() {
|
||||
wl-paste -p
|
||||
}
|
||||
|
||||
_clip_out_clipboard_wl-clipboard() {
|
||||
wl-paste
|
||||
}
|
||||
|
||||
_clip_in_primary_xclip() {
|
||||
xclip
|
||||
}
|
||||
|
||||
_clip_in_clipboard_xclip() {
|
||||
xclip -selection clipboard
|
||||
}
|
||||
|
||||
_clip_out_primary_xclip() {
|
||||
xclip -o
|
||||
}
|
||||
|
||||
_clip_out_clipboard_xclip() {
|
||||
xclip --selection clipboard -o
|
||||
}
|
||||
|
||||
# Backends for typing what's in stdin
|
||||
_do_type_xdotool() {
|
||||
xdotool type --delay ${type_delay} --clearmodifiers --file -
|
||||
}
|
||||
|
||||
_do_type_wtype() {
|
||||
wtype -d ${type_delay} -
|
||||
}
|
||||
|
||||
# Backends for pressing the key specified by the first argument ($1)
|
||||
_do_press_key_xdotool() {
|
||||
xdotool key "$1"
|
||||
}
|
||||
|
||||
_do_press_key_wtype() {
|
||||
wtype -P "$1" -p "$1"
|
||||
}
|
||||
|
||||
has_qrencode() {
|
||||
command -v qrencode >/dev/null 2>&1
|
||||
}
|
||||
|
||||
listgpg () {
|
||||
mapfile -d '' pw_list < <(find -L . -name '*.gpg' -print0)
|
||||
pw_list=("${pw_list[@]#./}")
|
||||
printf '%s\n' "${pw_list[@]}" | sort -n
|
||||
}
|
||||
|
||||
# get all password files and output as newline-delimited text
|
||||
list_passwords() {
|
||||
cd "${root}" || exit
|
||||
mapfile -t pw_list < <(listgpg)
|
||||
printf '%s\n' "${pw_list[@]%.gpg}" | sort -n
|
||||
}
|
||||
|
||||
doClip () {
|
||||
case "$clip" in
|
||||
"primary") ${clip_in_primary} ;;
|
||||
"clipboard") ${clip_in_clipboard} ;;
|
||||
"both") ${clip_in_primary}; ${clip_out_primary} | ${clip_in_clipboard};;
|
||||
esac
|
||||
}
|
||||
|
||||
checkIfPass () {
|
||||
printf '%s\n' "${root}: $selected_password" >| "$cache_dir/rofi-pass/last_used"
|
||||
}
|
||||
|
||||
|
||||
autopass () {
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
x_repeat_enabled=$(xset q | awk '/auto repeat:/ {print $3}')
|
||||
xset r off
|
||||
fi
|
||||
|
||||
rm -f "$cache_dir/rofi-pass/last_used"
|
||||
printf '%s\n' "${root}: $selected_password" > "$cache_dir/rofi-pass/last_used"
|
||||
for word in ${stuff["$AUTOTYPE_field"]}; do
|
||||
case "$word" in
|
||||
":tab") ${do_press_key} Tab;;
|
||||
":space") ${do_press_key} space;;
|
||||
":delay") sleep "${delay}";;
|
||||
":enter") ${do_press_key} Return;;
|
||||
":otp") printf '%s' "$(generateOTP)" | ${do_type};;
|
||||
"pass") printf '%s' "${password}" | ${do_type};;
|
||||
"path") printf '%s' "${selected_password}" | rev | cut -d'/' -f1 | rev | ${do_type};;
|
||||
*) printf '%s' "${stuff[${word}]}" | ${do_type};;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ${auto_enter} == "true" ]]; then
|
||||
${do_press_key} Return
|
||||
fi
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
xset r "$x_repeat_enabled"
|
||||
unset x_repeat_enabled
|
||||
fi
|
||||
|
||||
clearUp
|
||||
}
|
||||
|
||||
generateQrCode() {
|
||||
has_qrencode
|
||||
|
||||
if [[ $? -eq "1" ]]; then
|
||||
printf '%s\n' "qrencode not found" | _rofi -dmenu
|
||||
exit_code=$?
|
||||
if [[ $exit_code -eq "1" ]]; then
|
||||
exit
|
||||
else
|
||||
"${basecommand}"
|
||||
fi
|
||||
fi
|
||||
|
||||
checkIfPass
|
||||
pass "$selected_password" | head -n 1 | qrencode -d 300 -v 8 -l H -o - | _image_viewer
|
||||
if [[ $? -eq "1" ]]; then
|
||||
printf '%s\n' "" | _rofi -dmenu -mesg "Image viewer not defined or cannot read from pipe"
|
||||
exit_value=$?
|
||||
if [[ $exit_value -eq "1" ]]; then
|
||||
exit
|
||||
else
|
||||
"${basecommand}"
|
||||
fi
|
||||
fi
|
||||
clearUp
|
||||
}
|
||||
|
||||
openURL () {
|
||||
checkIfPass
|
||||
$BROWSER "$(PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep "${URL_field}: " | gawk '{sub(/:/,"")}{print $2}1' | head -1)"; exit;
|
||||
clearUp
|
||||
}
|
||||
|
||||
typeUser () {
|
||||
checkIfPass
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
x_repeat_enabled=$(xset q | awk '/auto repeat:/ {print $3}')
|
||||
xset r off
|
||||
fi
|
||||
|
||||
printf '%s' "${stuff[${USERNAME_field}]}" | ${do_type}
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
xset r "$x_repeat_enabled"
|
||||
unset x_repeat_enabled
|
||||
fi
|
||||
|
||||
clearUp
|
||||
}
|
||||
|
||||
typePass () {
|
||||
checkIfPass
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
x_repeat_enabled=$(xset q | awk '/auto repeat:/ {print $3}')
|
||||
xset r off
|
||||
fi
|
||||
|
||||
printf '%s' "${password}" | ${do_type}
|
||||
|
||||
if [[ $notify == "true" ]]; then
|
||||
if [[ "${stuff[notify]}" == "false" ]]; then
|
||||
:
|
||||
else
|
||||
notify-send "rofi-pass" "finished typing password";
|
||||
fi
|
||||
elif [[ $notify == "false" ]]; then
|
||||
if [[ "${stuff[notify]}" == "true" ]]; then
|
||||
notify-send "rofi-pass" "finished typing password";
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
xset r "$x_repeat_enabled"
|
||||
unset x_repeat_enabled
|
||||
fi
|
||||
|
||||
clearUp
|
||||
}
|
||||
|
||||
typeField () {
|
||||
checkIfPass
|
||||
local to_type
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
x_repeat_enabled=$(xset q | awk '/auto repeat:/ {print $3}')
|
||||
xset r off
|
||||
fi
|
||||
|
||||
case $typefield in
|
||||
"OTP") to_type="$(generateOTP)" ;;
|
||||
*) to_type="${stuff[${typefield}]}" ;;
|
||||
esac
|
||||
|
||||
printf '%s' "$to_type" | ${do_type}
|
||||
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
xset r "$x_repeat_enabled"
|
||||
unset x_repeat_enabled
|
||||
fi
|
||||
|
||||
unset to_type
|
||||
|
||||
clearUp
|
||||
}
|
||||
|
||||
generateOTP () {
|
||||
checkIfPass
|
||||
|
||||
# First, we check if there is a non-conventional OTP command in the pass file
|
||||
if PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep -q "${OTPmethod_field}: "; then
|
||||
# We execute the commands after otp_method: AS-IS
|
||||
bash -c "$(PASSWORD_STORE_DIR="${root}" pass "$selected_password" | grep "${OTPmethod_field}: " | cut -d' ' -f2-)"
|
||||
else
|
||||
# If there is no method defined, fallback to pass-otp
|
||||
PASSWORD_STORE_DIR="${root}" pass otp "$selected_password"
|
||||
fi
|
||||
|
||||
clearUp
|
||||
}
|
||||
|
||||
copyUser () {
|
||||
checkIfPass
|
||||
printf '%s' "${stuff[${USERNAME_field}]}" | doClip
|
||||
clearUp
|
||||
}
|
||||
|
||||
copyField () {
|
||||
checkIfPass
|
||||
printf '%s' "${stuff[${copyfield}]}" | doClip
|
||||
clearUp
|
||||
}
|
||||
|
||||
copyURL () {
|
||||
checkIfPass
|
||||
printf '%s' "${stuff[${URL_field}]}" | doClip
|
||||
clearUp
|
||||
}
|
||||
|
||||
copyPass () {
|
||||
checkIfPass
|
||||
printf '%s' "$password" | doClip
|
||||
if [[ $notify == "true" ]]; then
|
||||
notify-send "rofi-pass" "Copied Password\\nClearing in $clip_clear seconds"
|
||||
fi
|
||||
|
||||
if [[ $notify == "true" ]]; then
|
||||
(sleep $clip_clear; printf '%s' "" | ${clip_in_primary}; printf '%s' "" | ${clip_in_clipboard} | notify-send "rofi-pass" "Clipboard cleared") &
|
||||
elif [[ $notify == "false" ]]; then
|
||||
(sleep $clip_clear; printf '%s' "" | ${clip_in_primary}; printf '%s' "" | ${clip_in_clipboard}) &
|
||||
fi
|
||||
}
|
||||
|
||||
viewEntry () {
|
||||
checkIfPass
|
||||
showEntry "${selected_password}"
|
||||
}
|
||||
|
||||
generatePass () {
|
||||
askmenu_content=(
|
||||
"Yes"
|
||||
"No"
|
||||
)
|
||||
|
||||
askGenMenu=$(printf '%s\n' "${askmenu_content[@]}" | _rofi -dmenu -p "Generate new Password for ${selected_password}? > ")
|
||||
askgen_exit=$?
|
||||
|
||||
if [[ $askgen_exit -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
if [[ $askGenMenu == "Yes" ]]; then
|
||||
true
|
||||
elif [[ $askGenMenu == "No" ]]; then
|
||||
actionMenu
|
||||
fi
|
||||
|
||||
checkIfPass
|
||||
|
||||
symbols_content=(
|
||||
"0 Cancel"
|
||||
"1 Yes"
|
||||
"2 No"
|
||||
)
|
||||
|
||||
symbols=$(printf '%s\n' "${symbols_content[@]}" | _rofi -dmenu -p "Use Symbols? > ")
|
||||
symbols_val=$?
|
||||
|
||||
if [[ $symbols_val -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
if [[ $symbols == "0 Cancel" ]]; then
|
||||
mainMenu;
|
||||
elif [[ $symbols == "1 Yes" ]]; then
|
||||
symbols="";
|
||||
elif [[ $symbols == "2 No" ]]; then
|
||||
symbols="-n";
|
||||
fi
|
||||
|
||||
HELP="<span$help_color_attribute>Enter Number or hit Enter to use default length</span>"
|
||||
length=$(printf '%s' "" | _rofi -dmenu -mesg "${HELP}" -p "Password length? (Default: ${password_length}) > ")
|
||||
length_exit=$?
|
||||
|
||||
if [[ $length_exit -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
if [[ $length == "" ]]; then
|
||||
PASSWORD_STORE_DIR="${root}" pass generate ${symbols} -i "$selected_password" "${password_length}" > /dev/null;
|
||||
else
|
||||
PASSWORD_STORE_DIR="${root}" pass generate ${symbols} -i "$selected_password" "${length}" > /dev/null;
|
||||
fi
|
||||
}
|
||||
|
||||
# main Menu
|
||||
mainMenu () {
|
||||
if [[ $1 == "--bmarks" ]]; then
|
||||
selected_password="$(list_passwords 2>/dev/null \
|
||||
| _rofi -mesg "Bookmarks Mode. ${switch} to switch" \
|
||||
-dmenu \
|
||||
-kb-custom-10 "${switch}" \
|
||||
-select "$entry" \
|
||||
-p "rofi-pass > ")"
|
||||
|
||||
rofi_exit=$?
|
||||
|
||||
if [[ $rofi_exit -eq 1 ]]; then
|
||||
exit
|
||||
elif [[ $rofi_exit -eq 19 ]]; then
|
||||
${basecommand}
|
||||
elif [[ $rofi_exit -eq 0 ]]; then
|
||||
openURL
|
||||
fi
|
||||
else
|
||||
unset selected_password
|
||||
|
||||
args=( -dmenu
|
||||
-kb-custom-1 "${autotype}"
|
||||
-kb-custom-2 "${type_user}"
|
||||
-kb-custom-3 "${type_pass}"
|
||||
-kb-custom-4 "${open_url}"
|
||||
-kb-custom-5 "${copy_name}"
|
||||
-kb-custom-6 "${copy_pass}"
|
||||
-kb-custom-7 "${show}"
|
||||
-kb-custom-8 "${copy_url}"
|
||||
-kb-custom-9 "${type_menu}"
|
||||
-kb-custom-10 "${previous_root}"
|
||||
-kb-custom-11 "${next_root}"
|
||||
-kb-custom-14 "${action_menu}"
|
||||
-kb-custom-15 "${copy_menu}"
|
||||
-kb-custom-16 "${help}"
|
||||
-kb-custom-17 "${switch}"
|
||||
-kb-custom-18 "${insert_pass}"
|
||||
-kb-custom-19 "${qrcode}"
|
||||
)
|
||||
args+=( -kb-mode-previous "" # These keyboard shortcut options are needed, because
|
||||
-kb-mode-next "" # Shift+<Left|Right> are otherwise taken by rofi.
|
||||
-select "$entry"
|
||||
-p "> " )
|
||||
|
||||
if [[ ${#roots[@]} -gt "1" || $custom_root == "true" ]]; then
|
||||
args+=(-mesg "PW Store: ${root}")
|
||||
fi
|
||||
|
||||
selected_password="$(list_passwords 2>/dev/null | _rofi "${args[@]}")"
|
||||
|
||||
rofi_exit=$?
|
||||
if [[ $rofi_exit -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Actions based on exit code, which do not need the entry.
|
||||
# The exit code for -kb-custom-X is X+9.
|
||||
case "${rofi_exit}" in
|
||||
19) roots_index=$(( (roots_index-1+roots_length) % roots_length)); root=${roots[$roots_index]}; mainMenu; return;;
|
||||
20) roots_index=$(( (roots_index+1) % roots_length)); root=${roots[$roots_index]}; mainMenu; return;;
|
||||
25) helpMenu; return;;
|
||||
26) ${basecommand} --bmarks; return;;
|
||||
esac
|
||||
|
||||
mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass show "$selected_password")
|
||||
password=${password_temp[0]}
|
||||
|
||||
if [[ ${password} == "#FILE="* ]]; then
|
||||
pass_file="${password#*=}"
|
||||
mapfile -t password_temp2 < <(PASSWORD_STORE_DIR="${root}" pass show "${pass_file}")
|
||||
password=${password_temp2[0]}
|
||||
fi
|
||||
|
||||
fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/ || /otpauth:\/\// {$1=$1;print}')
|
||||
declare -A stuff
|
||||
stuff["pass"]=${password}
|
||||
|
||||
if [[ -n $fields ]]; then
|
||||
while read -r LINE; do
|
||||
unset _id _val
|
||||
case "$LINE" in
|
||||
"otpauth://"*|"${OTPmethod_field}"*)
|
||||
_id="OTP"
|
||||
_val=""
|
||||
;;
|
||||
*)
|
||||
_id="${LINE%%: *}"
|
||||
_val="${LINE#* }"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -n "$_id" ]]; then
|
||||
stuff["${_id}"]=${_val}
|
||||
fi
|
||||
done < <(printf '%s\n' "${fields}")
|
||||
|
||||
if test "${stuff['autotype']+autotype}"; then
|
||||
:
|
||||
else
|
||||
stuff["autotype"]="${USERNAME_field} :tab pass"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${stuff["${AUTOTYPE_field}"]}" ]]; then
|
||||
if [[ -n $default_autotype ]]; then
|
||||
stuff["${AUTOTYPE_field}"]="${default_autotype}"
|
||||
fi
|
||||
fi
|
||||
if [[ -z "${stuff["${USERNAME_field}"]}" ]]; then
|
||||
if [[ -n $default_user ]]; then
|
||||
if [[ "$default_user" == ":filename" ]]; then
|
||||
stuff["${USERNAME_field}"]="$(basename "$selected_password")"
|
||||
else
|
||||
stuff["${USERNAME_field}"]="${default_user}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
pass_content="$(for key in "${!stuff[@]}"; do printf '%s\n' "${key}: ${stuff[$key]}"; done)"
|
||||
|
||||
# actions based on keypresses
|
||||
# The exit code for -kb-custom-X is X+9.
|
||||
case "${rofi_exit}" in
|
||||
0) typeMenu;;
|
||||
10) sleep $wait; autopass;;
|
||||
11) sleep $wait; typeUser;;
|
||||
12) sleep $wait; typePass;;
|
||||
13) openURL;;
|
||||
14) copyUser;;
|
||||
15) copyPass;;
|
||||
16) viewEntry;;
|
||||
17) copyURL;;
|
||||
18) default_do="menu" typeMenu;;
|
||||
23) actionMenu;;
|
||||
24) copyMenu;;
|
||||
27) insertPass;;
|
||||
28) generateQrCode;;
|
||||
esac
|
||||
clearUp
|
||||
}
|
||||
|
||||
|
||||
clearUp () {
|
||||
password=''
|
||||
selected_password=''
|
||||
unset stuff
|
||||
unset password
|
||||
unset selected_password
|
||||
unset password_temp
|
||||
unset stuff
|
||||
}
|
||||
|
||||
helpMenu () {
|
||||
_rofi -dmenu -mesg "Hint: All hotkeys are configurable in config file" -p "Help > " <<- EOM
|
||||
${autotype}: Autotype
|
||||
${type_user}: Type Username
|
||||
${type_pass}: Type Password
|
||||
${qrcode}: Generate and display qrcode
|
||||
---
|
||||
${copy_name}: Copy Username
|
||||
${copy_pass}: Copy Password
|
||||
${copy_url}: Copy URL
|
||||
${open_url}: Open URL
|
||||
${copy_menu}: Copy Custom Field
|
||||
---
|
||||
${action_menu}: Edit, Move, Delete, Re-generate Submenu
|
||||
${show}: Show Password File
|
||||
${insert_pass}: Insert new Pass Entry
|
||||
${switch}: Switch Pass/Bookmark Mode
|
||||
---
|
||||
${previous_root}: Switch to previous password store (--root)
|
||||
${next_root}: Switch to next password store (--root)
|
||||
EOM
|
||||
help_val=$?
|
||||
|
||||
if [[ $help_val -eq 1 ]]; then
|
||||
exit;
|
||||
else
|
||||
unset helptext; mainMenu;
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
typeMenu () {
|
||||
if [[ -n $default_do ]]; then
|
||||
if [[ $default_do == "menu" ]]; then
|
||||
checkIfPass
|
||||
local -a keys=("${!stuff[@]}")
|
||||
keys=("${keys[@]/$AUTOTYPE_field}")
|
||||
typefield=$({ printf '%s' "${AUTOTYPE_field}" ; printf '%s\n' "${keys[@]}" | sort; } | _rofi -dmenu -p "Choose Field to type > ")
|
||||
typefield_exit=$?
|
||||
if [[ $typefield_exit -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
case "$typefield" in
|
||||
'') exit;;
|
||||
'pass') sleep $wait; typePass;;
|
||||
"${AUTOTYPE_field}") sleep $wait; autopass;;
|
||||
*) sleep $wait; typeField
|
||||
esac
|
||||
clearUp
|
||||
elif [[ $default_do == "${AUTOTYPE_field}" ]]; then
|
||||
sleep $wait; autopass
|
||||
else
|
||||
${default_do}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
copyMenu () {
|
||||
checkIfPass
|
||||
copyfield=$(printf '%s\n' "${!stuff[@]}" | sort | _rofi -dmenu -p "Choose Field to copy > ")
|
||||
val=$?
|
||||
if [[ $val -eq 1 ]]; then
|
||||
exit;
|
||||
fi
|
||||
if [[ $copyfield == "pass" ]]; then
|
||||
copyPass;
|
||||
else
|
||||
copyField
|
||||
fi
|
||||
clearUp
|
||||
}
|
||||
|
||||
actionMenu () {
|
||||
checkIfPass
|
||||
action_content=("< Return"
|
||||
"---"
|
||||
"1 Move Password File"
|
||||
"2 Copy Password File"
|
||||
"3 Delete Password File"
|
||||
"4 Edit Password File"
|
||||
"5 Generate New Password"
|
||||
)
|
||||
|
||||
action=$(printf '%s\n' "${action_content[@]}" | _rofi -dmenu -p "Choose Action > ")
|
||||
if [[ ${action} == "1 Move Password File" ]]; then
|
||||
manageEntry move;
|
||||
elif [[ ${action} == "3 Delete Password File" ]]; then
|
||||
manageEntry delete;
|
||||
elif [[ ${action} == "2 Copy Password File" ]]; then
|
||||
manageEntry copy;
|
||||
elif [[ ${action} == "4 Edit Password File" ]]; then
|
||||
manageEntry edit;
|
||||
elif [[ ${action} == "5 Generate New Password" ]]; then
|
||||
generatePass;
|
||||
elif [[ ${action} == "< Return" ]]; then
|
||||
mainMenu;
|
||||
elif [[ ${action} == "" ]]; then
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
showEntry () {
|
||||
if [[ -z $pass_content ]]; then
|
||||
pass_temp=$(PASSWORD_STORE_DIR="${root}" pass show "$selected_password")
|
||||
password="${pass_temp%%$'\n'*}"
|
||||
pass_key_value=$(printf '%s\n' "${pass_temp}" | tail -n+2 | grep ': ')
|
||||
declare -A stuff
|
||||
|
||||
while read -r LINE; do
|
||||
_id="${LINE%%: *}"
|
||||
_val="${LINE#* }"
|
||||
stuff["${_id}"]=${_val}
|
||||
done < <(printf '%s\n' "${pass_key_value}")
|
||||
|
||||
stuff["pass"]=${password}
|
||||
|
||||
if test "${stuff['autotype']+autotype}"; then
|
||||
:
|
||||
else
|
||||
stuff["autotype"]="${USERNAME_field} :tab pass"
|
||||
fi
|
||||
|
||||
pass_content="$(for key in "${!stuff[@]}"; do printf '%s\n' "${key}: ${stuff[$key]}"; done)"
|
||||
fi
|
||||
|
||||
bla_content=("< Return"
|
||||
"${pass_content}"
|
||||
)
|
||||
|
||||
bla=$(printf '%s\n' "${bla_content[@]}" | _rofi -dmenu -mesg "Enter: Copy entry to clipboard" -p "> ")
|
||||
rofi_exit=$?
|
||||
|
||||
word=$(printf '%s' "$bla" | gawk -F': ' '{print $1}')
|
||||
|
||||
if [[ ${rofi_exit} -eq 1 ]]; then
|
||||
exit
|
||||
elif [[ ${rofi_exit} -eq 0 ]]; then
|
||||
if [[ ${bla} == "< Return" ]]; then
|
||||
mainMenu
|
||||
else
|
||||
if [[ -z $(printf '%s' "${stuff[${word}]}") ]]; then
|
||||
printf '%s' "$word" | doClip
|
||||
else
|
||||
printf '%s' "${stuff[${word}]}" | doClip
|
||||
fi
|
||||
if [[ $notify == "true" ]]; then
|
||||
notify-send "rofi-pass" "Copied Password\\nClearing in $clip_clear seconds"
|
||||
fi
|
||||
if [[ $notify == "true" ]]; then
|
||||
(sleep $clip_clear; printf '%s' "" | ${clip_in_primary}; printf '%s' "" | ${clip_in_clipboard} | notify-send "rofi-pass" "Clipboard cleared") &
|
||||
elif [[ $notify == "false" ]]; then
|
||||
(sleep $clip_clear; printf '%s' "" | ${clip_in_primary}; printf '%s' "" | ${clip_in_clipboard}) &
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
exit
|
||||
unset stuff
|
||||
unset password
|
||||
unset selected_password
|
||||
unset password_temp
|
||||
unset stuff
|
||||
exit
|
||||
}
|
||||
|
||||
manageEntry () {
|
||||
if [[ "$1" == "edit" ]]; then
|
||||
EDITOR=$EDITOR PASSWORD_STORE_DIR="${root}" pass edit "${selected_password}"
|
||||
mainMenu
|
||||
elif [[ $1 == "move" ]]; then
|
||||
cd "${root}" || exit
|
||||
group_array=(*/)
|
||||
group=$(printf '%s\n' "${group_array[@]%/}" | _rofi -dmenu -p "Choose Group > ")
|
||||
if [[ $group == "" ]]; then
|
||||
exit
|
||||
fi
|
||||
PASSWORD_STORE_DIR="${root}" pass mv "$selected_password" "${group}"
|
||||
mainMenu
|
||||
elif [[ $1 == "copy" ]]; then
|
||||
cd "${root}" || exit
|
||||
group_array=(*/)
|
||||
group=$(printf '%s\n' "${group_array[@]%/}" | _rofi -dmenu -p "Choose Group > ")
|
||||
if [[ $group == "" ]]; then
|
||||
exit
|
||||
else
|
||||
new_name="$(listgpg | _rofi -dmenu -format 'f' -mesg "Copying to same Group. Please enter a name for the new entry" -p "> ")"
|
||||
fi
|
||||
PASSWORD_STORE_DIR="${root}" pass cp "$selected_password" "${group}/${new_name}"
|
||||
mainMenu
|
||||
elif [[ "$1" == "delete" ]]; then
|
||||
HELP="<span$help_color_attribute>Selected entry: ${selected_password}</span>"
|
||||
ask_content=("Yes"
|
||||
"No"
|
||||
)
|
||||
ask=$(printf '%s\n' "${ask_content[@]}" | _rofi -mesg "${HELP}" -dmenu -p "Are You Sure? > ")
|
||||
if [[ "$ask" == "Yes" ]]; then
|
||||
PASSWORD_STORE_DIR="${root}" pass rm --force "${selected_password}"
|
||||
elif [[ "$ask" == "No" ]]; then
|
||||
mainMenu
|
||||
elif [[ -z "$ask" ]]; then
|
||||
exit
|
||||
fi
|
||||
else
|
||||
mainMenu
|
||||
fi
|
||||
}
|
||||
|
||||
edit_pass() {
|
||||
if [[ $edit_new_pass == "true" ]]; then
|
||||
PASSWORD_STORE_DIR="${root}" pass edit "${1}"
|
||||
fi
|
||||
}
|
||||
|
||||
insertPass () {
|
||||
url=$(${clip_out_clipboard})
|
||||
|
||||
if [[ "${url:0:4}" == "http" ]]; then
|
||||
domain_name="$(printf '%s\n' "${url}" | awk -F / '{l=split($3,a,"."); print (a[l-1]=="com"?a[l-2] OFS:X) a[l-1] OFS a[l]}' OFS=".")"
|
||||
help_content="Domain: ${domain_name}
|
||||
Type name, make sure it is unique"
|
||||
else
|
||||
help_content="Hint: Copy URL to clipboard before calling this menu.
|
||||
Type name, make sure it is unique"
|
||||
fi
|
||||
|
||||
cd "${root}" || exit
|
||||
group_array=(*/)
|
||||
grouplist=$(printf '%s\n' "${group_array[@]%/}")
|
||||
name="$(listgpg | _rofi -dmenu -format 'f' -filter "${domain_name}" -mesg "${help_content}" -p "> ")"
|
||||
val=$?
|
||||
|
||||
if [[ $val -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
user_content=("${default_user2}"
|
||||
"${USER}"
|
||||
"${default_user}"
|
||||
)
|
||||
|
||||
user=$(printf '%s\n' "${user_content[@]}" | _rofi -dmenu -mesg "Chose Username or type" -p "> ")
|
||||
val=$?
|
||||
|
||||
if [[ $val -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
group_content=("No Group"
|
||||
"---"
|
||||
"${grouplist}"
|
||||
)
|
||||
|
||||
group=$(printf '%s\n' "${group_content[@]}" | _rofi -dmenu -p "Choose Group > ")
|
||||
val=$?
|
||||
|
||||
if [[ $val -eq 1 ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
pw=$(printf '%s' "Generate" | _rofi -dmenu -password -p "Password > " -mesg "Type Password or hit Enter to generate one")
|
||||
|
||||
if [[ $pw == "Generate" ]]; then
|
||||
pw=$(_pwgen "${password_length}")
|
||||
fi
|
||||
|
||||
clear
|
||||
|
||||
if [[ "$group" == "No Group" ]]; then
|
||||
if [[ $url == http* ]]; then
|
||||
pass_content=("${pw}"
|
||||
"---"
|
||||
"${USERNAME_field}: ${user}"
|
||||
"${URL_field}: ${url}"
|
||||
)
|
||||
printf '%s\n' "${pass_content[@]}" | PASSWORD_STORE_DIR="${root}" pass insert -m "${name}" > /dev/null && edit_pass "${name}"
|
||||
else
|
||||
pass_content=("${pw}"
|
||||
"---"
|
||||
"${USERNAME_field}: ${user}"
|
||||
)
|
||||
printf '%s\n' "${pass_content[@]}" | PASSWORD_STORE_DIR="${root}" pass insert -m "${name}" > /dev/null && edit_pass "${name}"
|
||||
fi
|
||||
else
|
||||
if [[ $url == http* ]]; then
|
||||
pass_content=("${pw}"
|
||||
"---"
|
||||
"${USERNAME_field}: ${user}"
|
||||
"${URL_field}: ${url}"
|
||||
)
|
||||
printf '%s\n' "${pass_content[@]}" | PASSWORD_STORE_DIR="${root}" pass insert -m "${group}/${name}" > /dev/null && edit_pass "${group}/${name}"
|
||||
else
|
||||
pass_content=("${pw}"
|
||||
"---"
|
||||
"${USERNAME_field}: ${user}"
|
||||
)
|
||||
printf '%s\n' "${pass_content[@]}" | PASSWORD_STORE_DIR="${root}" pass insert -m "${group}/${name}" > /dev/null && edit_pass "${group}/${name}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
help_msg () {
|
||||
cat <<'EOF'
|
||||
Usage:
|
||||
rofi-pass [command]
|
||||
|
||||
Commands:
|
||||
--insert insert new entry to password store
|
||||
--root set custom root directories (colon separated)
|
||||
--last-used highlight last used item
|
||||
--show-last show details of last used Entry
|
||||
--bmarks start in bookmarks mode
|
||||
|
||||
rofi-pass version 1.5.3
|
||||
EOF
|
||||
}
|
||||
|
||||
get_config_file () {
|
||||
configs=("$ROFI_PASS_CONFIG"
|
||||
"$config_dir/rofi-pass/config"
|
||||
"/etc/rofi-pass.conf")
|
||||
|
||||
# return the first config file with a valid path
|
||||
for config in "${configs[@]}"; do
|
||||
# '-n' is needed in case ROFI_PASS_CONFIG is not set
|
||||
if [[ -n "${config}" && -f "${config}" ]]; then
|
||||
printf "%s" "$config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main () {
|
||||
# load config file
|
||||
config_file="$(get_config_file)"
|
||||
[[ -n "$config_file" ]] && source "$config_file"
|
||||
|
||||
# create tmp dir
|
||||
if [[ ! -d "$cache_dir/rofi-pass" ]]; then
|
||||
mkdir -p "$cache_dir/rofi-pass"
|
||||
fi
|
||||
|
||||
# set backends
|
||||
clip_in_primary=_clip_in_primary_${clipboard_backend}
|
||||
clip_in_clipboard=_clip_in_clipboard_${clipboard_backend}
|
||||
clip_out_primary=_clip_out_primary_${clipboard_backend}
|
||||
clip_out_clipboard=_clip_out_clipboard_${clipboard_backend}
|
||||
|
||||
do_type=_do_type_${backend}
|
||||
do_press_key=_do_press_key_${backend}
|
||||
|
||||
# backwards compat
|
||||
if [[ -n "$xdotool_delay" ]]; then
|
||||
>&2 echo "Setting 'xdotool_delay' is deprecated. Please update your configuration to use 'type_delay' instead"
|
||||
type_delay=${xdotool_delay}
|
||||
fi
|
||||
|
||||
# Only valid for the xdotool backend
|
||||
if [[ $backend == "xdotool" ]]; then
|
||||
# fix keyboard layout if enabled in config
|
||||
if [[ $fix_layout == "true" ]]; then
|
||||
layout_cmd
|
||||
fi
|
||||
fi
|
||||
|
||||
# set help color
|
||||
if [[ $help_color == "" ]]; then
|
||||
help_color_attribute=""
|
||||
else
|
||||
help_color_attribute=" color='$help_color'"
|
||||
fi
|
||||
|
||||
# check for BROWSER variable, use xdg-open as fallback
|
||||
if [[ -z $BROWSER ]]; then
|
||||
export BROWSER=xdg-open
|
||||
fi
|
||||
|
||||
# check if alternative root directory was given on commandline
|
||||
if [[ -r "$cache_dir/rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then
|
||||
roots=("$(awk -F ': ' '{ print $1 }' "$cache_dir/rofi-pass/last_used")")
|
||||
elif [[ -n "$2" && "$1" == "--root" ]]; then
|
||||
custom_root=true; IFS=: read -r -a roots <<< "$2"
|
||||
elif [[ -n $root ]]; then
|
||||
custom_root=true; IFS=: read -r -a roots <<< "${root}"
|
||||
elif [[ -n ${PASSWORD_STORE_DIR} ]]; then
|
||||
roots=("${PASSWORD_STORE_DIR}")
|
||||
else
|
||||
roots=("$HOME/.password-store")
|
||||
fi
|
||||
roots_index=0
|
||||
roots_length=${#roots[@]}
|
||||
export root=${roots[$roots_index]}
|
||||
export PASSWORD_STORE_DIR="${root}"
|
||||
case $1 in
|
||||
--insert)
|
||||
insertPass
|
||||
;;
|
||||
--root)
|
||||
mainMenu
|
||||
;;
|
||||
--help)
|
||||
help_msg
|
||||
;;
|
||||
--last-used)
|
||||
if [[ -r "$cache_dir/rofi-pass/last_used" ]]; then
|
||||
entry="$(awk -F ': ' '{ print $2 }' "$cache_dir/rofi-pass/last_used")"
|
||||
fi
|
||||
mainMenu
|
||||
;;
|
||||
--show-last)
|
||||
if [[ -r "$cache_dir/rofi-pass/last_used" ]]; then
|
||||
selected_password="$(awk -F ': ' '{ print $2 }' "$cache_dir/rofi-pass/last_used")" viewEntry
|
||||
else
|
||||
mainMenu
|
||||
fi
|
||||
;;
|
||||
--bmarks)
|
||||
mainMenu --bmarks;
|
||||
;;
|
||||
*)
|
||||
mainMenu
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
if [ "$TMUX" ]; then
|
||||
FZF="fzf-tmux"
|
||||
else
|
||||
FZF="fzf"
|
||||
fi
|
||||
|
||||
SESSION=$(tmux list-sessions | awk -F: '{ print $1 }' | $FZF --reverse)
|
||||
if [ -z "$SESSION" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$TMUX" ]; then
|
||||
tmux attach -t $SESSION
|
||||
else
|
||||
tmux switch-client -t $SESSION
|
||||
fi
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/usr/bin/rclone serve sftp $HOME --addr :2022
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/rclone serve sftp $HOME --addr :2022
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [[ ! -x "$(command -v emacs)" ]]; then
|
||||
yay -S --noconfirm emacs
|
||||
fi
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-d|--dry-run)
|
||||
dry=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
log() {
|
||||
if [[ $dry == "1" ]]; then
|
||||
echo "[DRY-RUN] $@"
|
||||
else
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
execute() {
|
||||
log "executing: $@"
|
||||
if [[ $dry == "1" ]]; then
|
||||
return
|
||||
fi
|
||||
"$@"
|
||||
}
|
||||
|
||||
tangle() {
|
||||
emacs -Q --batch --eval "
|
||||
(progn
|
||||
(require 'ob-tangle)
|
||||
(dolist (file command-line-args-left)
|
||||
(with-current-buffer (find-file-noselect file)
|
||||
(org-babel-tangle))))
|
||||
" "$@"
|
||||
}
|
||||
|
||||
execute tangle $@
|
||||
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "File $1 does not exist."
|
||||
fi
|
||||
|
||||
mkdir -p ~/.local/bin
|
||||
|
||||
script=$(basename "$1")
|
||||
echo "update script $script"
|
||||
cp "$1" ~/.local/bin/$script
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
config_file=$1
|
||||
|
||||
if [[ -z "$SJB_CONF_DIR" ]]; then
|
||||
echo "Error: SJB_CONF_DIR is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$config_file" ]]; then
|
||||
cat <<USAGE
|
||||
Usage: $0 [config_file]
|
||||
|
||||
Must provide a file path from the .config directory to be refreshed.
|
||||
To copy ~/.local/share/omarchy/config/hypr/hyprlock.conf to ~/.config/hypr/hyprlock.conf
|
||||
|
||||
$0 hypr/hyprlock.conf
|
||||
USAGE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Backup the destination file (with timestamp) to avoid clobbering (Ex: hyprlock.conf.bak.1753817951)
|
||||
user_config_file="${HOME}/.config/$config_file"
|
||||
default_config_file="${SJB_CONF_DIR}/config/$config_file"
|
||||
backup_config_file="$user_config_file.bak.$(date +%s)"
|
||||
|
||||
if [[ -f "$user_config_file" ]]; then
|
||||
# Create preliminary backup
|
||||
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
|
||||
|
||||
# Replace config with new default
|
||||
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
|
||||
|
||||
# Compare and delete/inform accordingly
|
||||
if cmp -s "$user_config_file" "$backup_config_file"; then
|
||||
rm "$backup_config_file"
|
||||
else
|
||||
echo -e "\e[31mReplaced $user_config_file with new Omarchy default.\nSaved backup as ${backup_config_file}.\n\n\e[32mChanges:\e[0m"
|
||||
diff "$user_config_file" "$backup_config_file" || true
|
||||
fi
|
||||
else
|
||||
# Config file did not exist already
|
||||
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
|
||||
fi
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
get_file_extension() {
|
||||
local url="$1"
|
||||
|
||||
# Remove query parameters and fragments
|
||||
local clean_url="${url%%\?*}"
|
||||
clean_url="${clean_url%%\#*}"
|
||||
|
||||
# Get the filename part
|
||||
local filename="${clean_url##*/}"
|
||||
|
||||
# Check if there's a dot in the filename
|
||||
if [[ "$filename" == *.* ]]; then
|
||||
echo "${filename##*.}"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo -e "\e[32mLet's create a new web app you can start with the app launcher.\n\e[0m"
|
||||
APP_NAME=$(gum input --prompt "Name> " --placeholder "My favorite web app")
|
||||
APP_URL=$(gum input --prompt "URL> " --placeholder "https://example.com")
|
||||
ICON_URL=$(gum input --prompt "Icon URL> " --placeholder "See https://dashboardicons.com (must use PNG!)")
|
||||
else
|
||||
APP_NAME="$1"
|
||||
APP_URL="$2"
|
||||
ICON_URL="$3"
|
||||
fi
|
||||
|
||||
if [[ -z "$APP_NAME" || -z "$APP_URL" || -z "$ICON_URL" ]]; then
|
||||
echo "You must set app name, app URL, and icon URL!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ICON_EXT=$(get_file_extension "$ICON_URL")
|
||||
ICON_DIR="$HOME/.local/share/icons"
|
||||
DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop"
|
||||
ICON_PATH="$ICON_DIR/$APP_NAME.$ICON_EXT"
|
||||
|
||||
mkdir -p "$ICON_DIR"
|
||||
|
||||
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
|
||||
echo "Error: Failed to download icon."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat >"$DESKTOP_FILE" <<EOF
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=$APP_NAME
|
||||
Comment=$APP_NAME
|
||||
Exec=chromium --new-window --ozone-platform=wayland --app="$APP_URL" --name="$APP_NAME" --class="$APP_NAME"
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=$APP_NAME
|
||||
StartupNotify=true
|
||||
EOF
|
||||
|
||||
chmod +x "$DESKTOP_FILE"
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
|
||||
fi
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
echo "Date: $(TZ='America/Toronto' date)"
|
||||
echo "$(/sbin/acpi)"
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# determine if the tmux server is running
|
||||
if [ "$TMUX" ]; then
|
||||
FZF="fzf-tmux"
|
||||
else
|
||||
FZF="fzf"
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
ZOXIDE_RESULT=$(zoxide query -l | $FZF --reverse)
|
||||
elif [ x"." == x"$1" ]; then
|
||||
ZOXIDE_RESULT=$PWD
|
||||
else
|
||||
ZOXIDE_RESULT=$(zoxide query $1)
|
||||
fi
|
||||
|
||||
if [ -z "$ZOXIDE_RESULT" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FOLDER=$(echo $ZOXIDE_RESULT | awk 'BEGIN{FS="/"} { print $(NF-1)"_"$NF }' | tr '. ' '_')
|
||||
SESSION=$(tmux list-sessions | grep $FOLDER | awk -F: '{print $1}')
|
||||
|
||||
if [ -z "$TMUX" ]; then
|
||||
if [ -z "$SESSION" ]; then
|
||||
cd $ZOXIDE_RESULT
|
||||
tmux new-session -s $FOLDER
|
||||
else
|
||||
tmux attach -t $SESSION
|
||||
fi
|
||||
else
|
||||
if [ -z "$SESSION" ]; then
|
||||
cd $ZOXIDE_RESULT
|
||||
tmux new-session -d -s $FOLDER
|
||||
tmux switch-client -t $FOLDER
|
||||
else
|
||||
tmux switch-client -t $SESSION
|
||||
fi
|
||||
fi
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
gpg-connect-agent "scd serialno" "learn --force" /bye
|
||||
|
||||
#!/bin/bash
|
||||
gpg-connect-agent -q "scd serialno" "learn --force" /bye
|
||||
Reference in New Issue
Block a user