Browse Source

Pass integration

main
Yigit Colakoglu 4 years ago
parent
commit
25cabfa21b
16 changed files with 176 additions and 39 deletions
  1. +3
    -0
      arch-setup/packages.rice
  2. +0
    -4
      bash_logout
  3. +2
    -0
      config/X11/xinitrc
  4. +0
    -0
      config/mutt/.mailsynclastrun
  5. +0
    -1
      config/zsh/.zshrc
  6. +15
    -5
      install.sh
  7. +2
    -0
      local/bin/.gitignore
  8. +81
    -0
      local/bin/bwsync
  9. +4
    -2
      local/bin/check-updates
  10. +15
    -17
      local/bin/dmenu-mconnect
  11. +0
    -1
      local/bin/firefox-sync
  12. +1
    -1
      local/bin/mailsync
  13. +42
    -2
      local/bin/password_manager
  14. +1
    -1
      local/bin/zaread
  15. +8
    -5
      profile
  16. +2
    -0
      root/pam_env.conf

+ 3
- 0
arch-setup/packages.rice View File

@ -17,6 +17,9 @@ notmuch
msmtp msmtp
isync isync
pass pass
pass-otp
newsboat
pam-gnupg
libgee libgee
calcurse calcurse
neomutt neomutt


+ 0
- 4
bash_logout View File

@ -1,4 +0,0 @@
#!/bin/bash
date > $HOME/last
~/.local/bin/firefox-sync

+ 2
- 0
config/X11/xinitrc View File

@ -74,3 +74,5 @@ do
exec dwm > $XDG_RUNTIME_DIR/dwm.log 2> $XDG_RUNTIME_DIR/dwm.err exec dwm > $XDG_RUNTIME_DIR/dwm.log 2> $XDG_RUNTIME_DIR/dwm.err
sleep 0.2 sleep 0.2
done done
firefox-sync

+ 0
- 0
config/mutt/.mailsynclastrun View File


+ 0
- 1
config/zsh/.zshrc View File

@ -16,7 +16,6 @@ compinit
compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
[[ ! -d "$XDG_DATA_HOME"/zsh/history ]] || source "$XDG_DATA_HOME"/zsh/history [[ ! -d "$XDG_DATA_HOME"/zsh/history ]] || source "$XDG_DATA_HOME"/zsh/history
HISTFILE="$XDG_DATA_HOME"/zsh/history
HISTSIZE=100000 HISTSIZE=100000
SAVEHIST=100000 SAVEHIST=100000
setopt appendhistory setopt appendhistory


+ 15
- 5
install.sh View File

@ -82,9 +82,6 @@ chmod +x $HOME/.zshenv
mvie ~/.profile ~/.dotfiles_backup/profile mvie ~/.profile ~/.dotfiles_backup/profile
ln -sf ~/.dotfiles/profile ~/.profile ln -sf ~/.dotfiles/profile ~/.profile
mvie ~/.bash_logout ~/.dotfiles_backup/bash_logout
ln -sf ~/.dotfiles/bash_logout ~/.bash_logout
cp ~/.dotfiles/config.env.def ~/.config.env cp ~/.dotfiles/config.env.def ~/.config.env
# Downloading assets # Downloading assets
@ -152,21 +149,24 @@ touch "$_Z_DATA"
# Root Files and Directories # Root Files and Directories
sudo mkdir -p /usr/share/xsessions sudo mkdir -p /usr/share/xsessions
sudo mkdir -p /etc/security
sudo cp ~/.dotfiles/root/dwm.desktop /usr/share/xsessions sudo cp ~/.dotfiles/root/dwm.desktop /usr/share/xsessions
sudo cp ~/.dotfiles/root/pam_env.conf /etc/security/pam_env.conf
sudo cp ~/.dotfiles/root/issue /etc/issue sudo cp ~/.dotfiles/root/issue /etc/issue
sudo cp ~/.dotfiles/root/motd /etc/motd sudo cp ~/.dotfiles/root/motd /etc/motd
sudo cp ~/.dotfiles/root/nancyj.flf /usr/share/figlet/fonts sudo cp ~/.dotfiles/root/nancyj.flf /usr/share/figlet/fonts
if [ "$(grep artix < $(uname -a))" = "" ]; then if [ "$(grep artix < $(uname -a))" = "" ]; then
sudo cp ~/.dotfiles/root/quark /etc/init.d sudo cp ~/.dotfiles/root/quark /etc/init.d
sudo rc-update add quark
else else
sudo cp ~/.dotfiles/root/quark.service /usr/lib/systemd/system sudo cp ~/.dotfiles/root/quark.service /usr/lib/systemd/system
sudo systemctl enable quark
fi fi
sudo cp ~/.dotfiles/root/kdialog /usr/local/bin/kdialog sudo cp ~/.dotfiles/root/kdialog /usr/local/bin/kdialog
sudo cp ~/.dotfiles/root/udevil.conf /etc/udevil/udevil.conf sudo cp ~/.dotfiles/root/udevil.conf /etc/udevil/udevil.conf
sudo chmod +x /usr/local/bin/kdialog sudo chmod +x /usr/local/bin/kdialog
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo groupadd nogroup sudo groupadd nogroup
sudo systemctl enable quark
if [ "$username" = "yigit" ]; then if [ "$username" = "yigit" ]; then
~/.dotfiles/arch-setup/fetch_keys.sh # Fetch keys (For personal use, this is not for you) ~/.dotfiles/arch-setup/fetch_keys.sh # Fetch keys (For personal use, this is not for you)
@ -175,6 +175,17 @@ if [ "$username" = "yigit" ]; then
git config --global user.name "Yigit Colakoglu" git config --global user.name "Yigit Colakoglu"
fi fi
# Setup for pam-gnupg
sudo cat << EOF >> /etc/pam.d/system-local-login
session optional pam_env.so user_readenv=1
auth optional pam_gnupg.so store-only
session optional pam_gnupg.so
EOF
echo "allow-preset-passphrase" >> $GNUPGHOME/gpg-agent.conf
echo "max-cache-ttl 172800" >> $GNUPGHOME/gpg-agent.conf
# Build and Install Everything # Build and Install Everything
## Suckless utilities ## Suckless utilities
echo "Installing suckless utilities" echo "Installing suckless utilities"
@ -193,7 +204,6 @@ npm install > /dev/null 2> /dev/null
npm run build > /dev/null 2> /dev/null npm run build > /dev/null 2> /dev/null
cd $prev cd $prev
# Vim and tmux plugins # Vim and tmux plugins
mkdir -p ~/.tmux/plugins mkdir -p ~/.tmux/plugins
vim +PlugInstall +qall vim +PlugInstall +qall


+ 2
- 0
local/bin/.gitignore View File

@ -60,3 +60,5 @@
!zaread !zaread
!texclear !texclear
!check-updates !check-updates
!password_manager
!bwsync

+ 81
- 0
local/bin/bwsync View File

@ -0,0 +1,81 @@
#!/bin/sh
skey="$(bw unlock --raw)"
export BW_SESSION="$skey"
data="$(bw list items | jq -r -M \
'.[]| select( .type | contains(1)) |.name,.folderId,(.login|.username,.password,.totp,(.uris|.[0]|.uri))')"
echo "Fetched passwords from bitwarden."
uri=""
password=""
name=""
username=""
totp=""
fid=""
echo "Cleaning previuos store"
prev=$(pwd)
cd $PASSWORD_STORE_DIR
for f in *; do
pass rm -rf "$f"
done
cd $prev
strip_domain(){
if [ "$1" = "null" ]; then
echo "null"
return 0
fi
echo "$1" | head -n 1 | sed 's~http[s]*://~~g' | cut -d"/" -f 1
}
get_folder(){
if [ "$1" = "null" ]; then
echo "No Folder"
return 0
fi
bw get folder "$1" | jq -r -M ".name"
}
IFS="
"
for l in $data; do
if [ "$name" = "" ]; then
name=$l
echo "$name"
elif [ "$fid" = "" ]; then
fid=$l
elif [ "$username" = "" ]; then
username=$l
elif [ "$password" = "" ]; then
password=$l
elif [ "$totp" = "" ]; then
totp=$l
elif [ "$uri" = "" ]; then
uri=$(strip_domain $l)
folder=$(get_folder $fid)
if [ "$uri" = "null" ]; then
echo "$password" | pass insert -f -e "$folder/$name/$username" 2> /dev/null > /dev/null
if [ ! "$totp" = "null" ]; then
echo "$totp" | pass otp append -f -e "$folder/$name/$username" > /dev/null 2> /dev/null
fi
else
echo "$password" | pass insert -f -e "$folder/$uri/$username" 2> /dev/null > /dev/null
if [ ! "$totp" = "null" ]; then
echo "$totp" | pass otp append -f -e "$folder/$uri/$username" > /dev/null 2> /dev/null
fi
fi
uri=""
fid=""
password=""
name=""
username=""
totp=""
fi
done

+ 4
- 2
local/bin/check-updates View File

@ -20,11 +20,13 @@ notify " Repository Sync" "Checking for package updates..."
sudo pacman -Syyuw --noconfirm || notify " An error occured" "Error downloading updates. sudo pacman -Syyuw --noconfirm || notify " An error occured" "Error downloading updates.
Check your internet connection, if pacman is already running, or run update manually to see errors." Check your internet connection, if pacman is already running, or run update manually to see errors."
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
if pacman -Qu | grep -v "\[ignored\]" if pacman -Qu | grep -v "\[ignored\]"
then then
notify " Repository Sync" "Updates available. Click statusbar icon () for update."
checkupdates 2> /dev/null > ~/.cache/pacman_updates
notify " Repository Sync" "$(pacman -Qu | grep -v "\[ignored\]" | wc -l) Updates available. Click statusbar icon () for update."
else else
notify " Repository Sync" "Sync complete. No new packages for update." notify " Repository Sync" "Sync complete. No new packages for update."
fi fi
kill -49 "$(pidof dwmblocks)"

+ 15
- 17
local/bin/dmenu-mconnect View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# dmenu_kdeconnect.sh is a script based off of these scripts # dmenu_kdeconnect.sh is a script based off of these scripts
# [polybar-kdeconnect] https://github.com/HackeSta/polybar-kdeconnect
# [polybar-kdeconnect] https://github.com/HackeSta/polybar-kdeconnect
# [polybar-kdeconnect-scripts] https://github.com/witty91/polybar-kdeconnect-scripts # [polybar-kdeconnect-scripts] https://github.com/witty91/polybar-kdeconnect-scripts
# Added features # Added features
# - Removed polybar as a Dependencies (since I use dwm) # - Removed polybar as a Dependencies (since I use dwm)
@ -25,9 +25,9 @@
# nnn # nnn
# zenity # zenity
# ranger # ranger
Picker='ranger'
Picker='lf'
# Color Settings of dmenu
# Color Settings of dmenu
COLOR_DISCONNECTED='#000' # Device Disconnected COLOR_DISCONNECTED='#000' # Device Disconnected
COLOR_NEWDEVICE='#ff0' # New Device COLOR_NEWDEVICE='#ff0' # New Device
COLOR_BATTERY_90='#fff' # Battery >= 90 COLOR_BATTERY_90='#fff' # Battery >= 90
@ -63,12 +63,12 @@ show_devices (){
icon=$(get_icon $battery $devicetype) icon=$(get_icon $battery $devicetype)
# colors="$(get_colors $battery)" # colors="$(get_colors $battery)"
# echo "$colors" # echo "$colors"
show_menu "$devicename | $battery $icon" $deviceobj $battery
show_menu "$devicename | $battery $icon" $deviceobj $battery
devices+="$devicename $battery $icon $SEPERATOR" devices+="$devicename $battery $icon $SEPERATOR"
elif [ "$isreach" = "false" ] && [ "$istrust" = "true" ];then elif [ "$isreach" = "false" ] && [ "$istrust" = "true" ];then
#nothing is found #nothing is found
devices+="$(get_icon -1 $devicetype)$SEPERATOR" devices+="$(get_icon -1 $devicetype)$SEPERATOR"
else
else
#found but not yet paired #found but not yet paired
icon=$(get_icon -2 $devicetype) icon=$(get_icon -2 $devicetype)
show_pmenu $devicename $deviceobj show_pmenu $devicename $deviceobj
@ -94,32 +94,30 @@ show_menu () {
options=$(printf "Send SMS\\nSend File\\nSend Text\\nSend URL\\nDisconnect\\n") options=$(printf "Send SMS\\nSend File\\nSend Text\\nSend URL\\nDisconnect\\n")
menu=$(echo $options | dmenu -i -p $1 -l $optionNum ) menu=$(echo $options | dmenu -i -p $1 -l $optionNum )
case "$menu" in case "$menu" in
*'Send File')
if [ $Picker == 'ranger' ]; then
mkdir -p $XDG_RUNTIME_DIR/ranger/
rm -rf $XDG_RUNTIME_DIR/ranger/sentfile
st -c ranger -e ranger --choosefile=$XDG_RUNTIME_DIR/ranger/sentfile
if [ -f $XDG_RUNTIME_DIR/ranger/sentfile ]; then
mconnectctl share-file "$2" "$(cat $XDG_RUNTIME_DIR/ranger/sentfile)"
fi
*'Send File')
mkdir -p $XDG_RUNTIME_DIR/lf/
rm -rf $XDG_RUNTIME_DIR/lf/sentfile
st -c ranger -e lf -selection-path "$XDG_RUNTIME_DIR/lf/sentfile"
if [ -f $XDG_RUNTIME_DIR/lf/sentfile ]; then
mconnectctl share-file "$2" "$(cat $XDG_RUNTIME_DIR/lf/sentfile)"
fi;; fi;;
*'Send SMS' )
*'Send SMS' )
message=$(echo 'OTW' | dmenu -i -p "Msg to send") message=$(echo 'OTW' | dmenu -i -p "Msg to send")
recipient=$(echo '14039199518' | dmenu -i -p "Recipient's phone #") recipient=$(echo '14039199518' | dmenu -i -p "Recipient's phone #")
mconnectctl send-sms "$2" "$message" "$recipient" ;; mconnectctl send-sms "$2" "$message" "$recipient" ;;
*'Send URL' )
*'Send URL' )
message=$(echo 'Clipboard' | dmenu -i -p "Enter Url:") message=$(echo 'Clipboard' | dmenu -i -p "Enter Url:")
if [ "$message" = "Clipboard" ]; then if [ "$message" = "Clipboard" ]; then
message=$(sselp) message=$(sselp)
fi fi
mconnectctl share-url "$2" "$message";; mconnectctl share-url "$2" "$message";;
*'Send Text' )
*'Send Text' )
message=$(echo 'Clipboard' | dmenu -i -p "Enter Text:") message=$(echo 'Clipboard' | dmenu -i -p "Enter Text:")
if [ "$message" = "Clipboard" ]; then if [ "$message" = "Clipboard" ]; then
message=$(sselp) message=$(sselp)
fi fi
mconnectctl share-text "$2" "$message";; mconnectctl share-text "$2" "$message";;
*'Disconnect' )
*'Disconnect' )
mconnectctl disallow-device "$2" mconnectctl disallow-device "$2"
esac esac
} }


+ 0
- 1
local/bin/firefox-sync View File

@ -3,7 +3,6 @@
source ~/.profile source ~/.profile
if [ ! "$BROWSER" = "firefox" ]; then if [ ! "$BROWSER" = "firefox" ]; then
echo "Default browser is not firefox, exiting..."
exit 0 exit 0
fi fi


+ 1
- 1
local/bin/mailsync View File

@ -47,7 +47,7 @@ case "$(uname)" in
displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do
export DISPLAY=$x export DISPLAY=$x
notify-send --app-name="mutt-wizard" "mutt-wizard" "ﯬ $2 new mail(s) in \`$1\` account."
notify-send --app-name="mutt-wizard" "ﯬ $2 new mail(s) in \`$1\` account."
done ;} done ;}
messageinfo() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do messageinfo() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do
export DISPLAY=$x export DISPLAY=$x


+ 42
- 2
local/bin/password_manager View File

@ -1,3 +1,43 @@
#!/bin/sh
#!/usr/bin/env bash
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
entry=$(printf '%s\n' "${password_files[@]}" | sort | dmenu -l 7 -p "Pass" -i "$@")
[[ -n $entry ]] || exit
action=$(echo -e "Username\nPassword\nTOTP" | dmenu -p "Entry" -i )
case "$action" in
Username)
username=$(echo "$entry" | rev | cut -d"/" -f 1 | rev)
echo "$username" | xclip -selection clipboard
notify-send -a " Password Manager" "Username copied to clipboard";;
Password)
if [[ $typeit -eq 0 ]]; then
pass show -c "$entry" 2>/dev/null
else
pass show "$entry" | { IFS= read -r pass; printf %s "$pass"; } |
xdotool type --clearmodifiers --file -
fi
notify-send -a " Password Manager" "Password copied to clipboard";;
TOTP)
if [[ $typeit -eq 0 ]]; then
pass otp -c "$entry" 2>/dev/null
else
pass otp "$entry" | { IFS= read -r pass; printf %s "$pass"; } |
xdotool type --clearmodifiers --file -
fi
notify-send -a " Password Manager" "TOTP copied to clipboard";;
esac
bitwarden-dmenu --dmenu-args='-i -l 10' --dmenu-pswd-args="-P -nf white" --clear-clipboard 30 --session-timeout 96600 --sync-vault-after 48300 --on-error 'xargs notify-send --urgency=low'

+ 1
- 1
local/bin/zaread View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
## zaread - a simple script created by paoloap. ## zaread - a simple script created by paoloap.
# default variables # default variables


+ 8
- 5
profile View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Fixes for some bugs
# Vars for some bugs and applications
export QT_QPA_PLATFORMTHEME="qt5ct" export QT_QPA_PLATFORMTHEME="qt5ct"
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
export AWT_TOOLKIT=MToolkit export AWT_TOOLKIT=MToolkit
@ -22,6 +22,7 @@ export XDG_CONFIG_DIRS="/etc/xdg"
export XDG_RUNTIME_DIR="/run/user/1000" export XDG_RUNTIME_DIR="/run/user/1000"
# Cleanup Home Directory # Cleanup Home Directory
export HISTFILE="$XDG_DATA_HOME"/history
export TMUX_PLUGIN_MANAGER_PATH="$XDG_DATA_HOME"/tmux/plugins export TMUX_PLUGIN_MANAGER_PATH="$XDG_DATA_HOME"/tmux/plugins
export BORG_KEYS_DIR="$XDG_DATA_HOME"/keys/borg export BORG_KEYS_DIR="$XDG_DATA_HOME"/keys/borg
export CARGO_HOME="$XDG_DATA_HOME"/cargo export CARGO_HOME="$XDG_DATA_HOME"/cargo
@ -92,10 +93,12 @@ fi
# Start xinit if logged in from tty1 # Start xinit if logged in from tty1
if [ "$DISPLAY" = "" ] && [ "$(tty)" = /dev/tty1 ]; then if [ "$DISPLAY" = "" ] && [ "$(tty)" = /dev/tty1 ]; then
if [ "$DBUS_SESSION_BUS_ADDRESS" = "" ] && [ ! $(command -v dbus-launch) = "" ]; then if [ "$DBUS_SESSION_BUS_ADDRESS" = "" ] && [ ! $(command -v dbus-launch) = "" ]; then
sleep 2
exec xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit || exit
sleep 1
exec xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit
else else
sleep 2
exec xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit || exit
sleep 1
exec xinit 2> $XDG_RUNTIME_DIR/xinit.err > $XDG_RUNTIME_DIR/xinit
fi fi
exit
fi fi

+ 2
- 0
root/pam_env.conf View File

@ -0,0 +1,2 @@
GNUPGHOME DEFAULT=@{HOME}/.local/share/gnupg
XDG_CONFIG_HOME DEFAULT=@{HOME}/.config

Loading…
Cancel
Save