Remove scripts and bin folders.

Instead, everything is in the =~/.local/bin/= folder
Thus, the home folder is more clean
This commit is contained in:
Thomas Dehaeze 2020-04-06 23:56:37 +02:00
parent bfd810a097
commit 378a67efb3
14 changed files with 511 additions and 515 deletions

View File

@ -372,7 +372,7 @@ Force prompt to write history after every command. http://superuser.com/question
** Gui program to ask for sudo password ** Gui program to ask for sudo password
#+begin_src bash #+begin_src bash
export SUDO_ASKPASS=~/bin/askpass-rofi export SUDO_ASKPASS=~/.local/bin/askpass-rofi
#+END_SRC #+END_SRC
** Gnome Keyring Daemon ** Gnome Keyring Daemon
@ -423,7 +423,7 @@ Force prompt to write history after every command. http://superuser.com/question
PATH=$HOME/appimages:$PATH PATH=$HOME/appimages:$PATH
PATH=$HOME/.gem/ruby/2.5.0/bin:$PATH PATH=$HOME/.gem/ruby/2.5.0/bin:$PATH
PATH=$GOPATH:$GOPATH/bin:$PATH PATH=$GOPATH:$GOPATH/bin:$PATH
PATH=~/bin:$PATH PATH=~/.local/bin:$PATH
PATH=~/.emacs.d/bin:$PATH PATH=~/.emacs.d/bin:$PATH
export PATH export PATH
#+END_SRC #+END_SRC

View File

@ -23,7 +23,7 @@
* =displayselect= - Select Screen * =displayselect= - Select Screen
Script taken from Luke Smith. Script taken from Luke Smith.
#+begin_src bash :tangle ~/bin/displayselect #+begin_src bash :tangle ~/.local/bin/displayselect
twoscreen() { # If multi-monitor is selected and there are two screens. twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?") mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
@ -94,7 +94,7 @@ Script taken from Luke Smith.
* TODO =getbib= * TODO =getbib=
#+begin_src bash :tangle ~/bin/getbib #+begin_src bash :tangle ~/.local/bin/getbib
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit [ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
if [ -f "$1" ]; then if [ -f "$1" ]; then
@ -112,11 +112,11 @@ Script taken from Luke Smith.
* =vpntoggle= - Connect to VPN using NordVPN * =vpntoggle= - Connect to VPN using NordVPN
#+begin_src bash :tangle ~/bin/vpntoggle #+begin_src bash :tangle ~/.local/bin/vpntoggle
if [[ $(nordvpn status) == *"Connected"* ]]; then if [[ $(nordvpn status) == *"Connected"* ]]; then
nordvpn disconnect && dunstify --replace=23198 "VPN" "Disconnected"; nordvpn disconnect && dunstify --replace=23198 "VPN" "Disconnected";
else else
country=`cat ~/bin/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`; country=`cat ~/.local/data/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`;
dunstify --replace=23198 "VPN" "Connecting to $country..."; dunstify --replace=23198 "VPN" "Connecting to $country...";
nordvpn connect $country && dunstify --replace=23198 "VPN" "Connected to $country"; nordvpn connect $country && dunstify --replace=23198 "VPN" "Connected to $country";
fi fi
@ -124,7 +124,7 @@ Script taken from Luke Smith.
* =bukurun= - Open link from Buku * =bukurun= - Open link from Buku
#+begin_src bash :tangle ~/bin/bukurun #+begin_src bash :tangle ~/.local/bin/bukurun
_rofi () { _rofi () {
rofi -dmenu -i -no-levenshtein-sort -width 1000 "$@" rofi -dmenu -i -no-levenshtein-sort -width 1000 "$@"
} }
@ -459,11 +459,11 @@ mode=bookmarks main
* =i3exit= - Manage lock, suspend, reboot, ... * =i3exit= - Manage lock, suspend, reboot, ...
#+begin_src bash :tangle ~/bin/i3exit #+begin_src bash :tangle ~/.local/bin/i3exit
# with openrc use loginctl # with openrc use loginctl
case "$1" in case "$1" in
lock) lock)
~/scripts/lockscreen.sh ~/.local/bin/lockscreen
;; ;;
logout) logout)
loginctl terminate-session `loginctl session-status | head -n 1 | awk '{print $1}'` loginctl terminate-session `loginctl session-status | head -n 1 | awk '{print $1}'`
@ -472,10 +472,10 @@ mode=bookmarks main
dm-tool switch-to-greeter dm-tool switch-to-greeter
;; ;;
suspend) suspend)
systemctl suspend && ~/scripts/lockscreen.sh systemctl suspend && ~/.local/bin/lockscreen
;; ;;
hibernate) hibernate)
systemctl hibernate && ~/scripts/lockscreen.sh systemctl hibernate && ~/.local/bin/lockscreen
;; ;;
reboot) reboot)
systemctl reboot systemctl reboot
@ -494,22 +494,22 @@ mode=bookmarks main
* =readbib= - Open Bibliography File * =readbib= - Open Bibliography File
#+begin_src bash :tangle ~/bin/readbib #+begin_src bash :tangle ~/.local/bin/readbib
cd ~/Cloud/thesis/ressources/pdfs/ && ls | rofi -dmenu -lines 20 | xargs -I {} zathura {} cd ~/Cloud/thesis/ressources/pdfs/ && ls | rofi -dmenu -lines 20 | xargs -I {} zathura {}
#+end_src #+end_src
* =readnotes= - Open Note File * =readnotes= - Open Note File
#+begin_src bash :tangle ~/bin/readnotes #+begin_src bash :tangle ~/.local/bin/readnotes
cd ~/Cloud/thesis/ressources/notes/pdfs/ && ls *.pdf | rofi -dmenu -lines 20 | xargs -I {} zathura {} cd ~/Cloud/thesis/ressources/notes/pdfs/ && ls *.pdf | rofi -dmenu -lines 20 | xargs -I {} zathura {}
#+end_src #+end_src
* TODO askpass * TODO =askpass-rofi= - askpass
- [ ] Should be a script - [ ] Should be a script
Take password prompt from STDIN, print password to STDOUT. Take password prompt from STDIN, print password to STDOUT.
The sed piece just removes the colon from the provided prompt: =rofi -p= already gives us a colon The sed piece just removes the colon from the provided prompt: =rofi -p= already gives us a colon
#+BEGIN_SRC bash :tangle ~/bin/askpass-rofi #+BEGIN_SRC bash :tangle ~/.local/bin/askpass-rofi
rofi -dmenu \ rofi -dmenu \
-password \ -password \
-no-fixed-num-lines \ -no-fixed-num-lines \
@ -518,7 +518,7 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
* =screenshot= - Take Screenshot * =screenshot= - Take Screenshot
#+begin_src bash :tangle ~/bin/screenshot #+begin_src bash :tangle ~/.local/bin/screenshot
status=$(echo -e "All\nGUI\nSelection\nCropped\nCopy\nShadow\nActive" | rofi -i -dmenu -p "Type") status=$(echo -e "All\nGUI\nSelection\nCropped\nCopy\nShadow\nActive" | rofi -i -dmenu -p "Type")
if [ -z "$status" ]; then if [ -z "$status" ]; then
exit; exit;
@ -549,7 +549,7 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
* =remote-desktop= - Remote Desktop Connect * =remote-desktop= - Remote Desktop Connect
#+begin_src bash :tangle ~/bin/remote-desktop #+begin_src bash :tangle ~/.local/bin/remote-desktop
computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20); computer=$(echo -e 'RNICE\nPCMEL1\nPCNASS1\nPCMEG01' | dmenu -p 'Computer:' -l 20);
case $computer in case $computer in
@ -573,7 +573,7 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
* =network-toggle= - Toggle Network * =network-toggle= - Toggle Network
#+begin_src bash :tangle ~/bin/network-toggle #+begin_src bash :tangle ~/.local/bin/network-toggle
result=$(nmcli device | sed '1d' | dmenu -l 20); result=$(nmcli device | sed '1d' | dmenu -l 20);
interface=$(echo $result | awk -F ' ' '{print $1}'); interface=$(echo $result | awk -F ' ' '{print $1}');
@ -588,7 +588,7 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
* =print-rnice= - Print on Rnice * =print-rnice= - Print on Rnice
#+begin_src bash :tangle ~/bin/print-rnice #+begin_src bash :tangle ~/.local/bin/print-rnice
nbpage=$(echo -e '1\n2\n4' | dmenu -p 'Number of pages per sheet' -l 20); nbpage=$(echo -e '1\n2\n4' | dmenu -p 'Number of pages per sheet' -l 20);
sides=$(echo -e 'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge' | dmenu -p 'Two Sided:' -l 20); sides=$(echo -e 'one-sided\ntwo-sided-long-edge\ntwo-sided-short-edge' | dmenu -p 'Two Sided:' -l 20);
@ -602,10 +602,10 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
fi fi
#+end_src #+end_src
* TODO Mount TMP14DAYS * TODO =mnt_tmp_14_days= - Mount TMP14DAYS
- [ ] Put that as a script? - [ ] Put that as a script?
#+begin_src bash :tangle ~/bin/mnt_tmp_14_days #+begin_src bash :tangle ~/.local/bin/mnt_tmp_14_days
sudo -A mkdir ~/tmp_14_days; sudo -A mkdir ~/tmp_14_days;
sudo -A mount -o rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=160.103.232.103,mountvers=3,mountport=597,mountproto=tcp,local_lock=none,addr=160.103.232.103 rnice:/hz/tmp_14_days ~/tmp_14_days; sudo -A mount -o rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=160.103.232.103,mountvers=3,mountport=597,mountproto=tcp,local_lock=none,addr=160.103.232.103 rnice:/hz/tmp_14_days ~/tmp_14_days;
#+end_src #+end_src
@ -613,7 +613,7 @@ The sed piece just removes the colon from the provided prompt: =rofi -p= already
* =make-gif= - Make GIF * =make-gif= - Make GIF
http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
#+begin_src bash :tangle ~/bin/make-gif #+begin_src bash :tangle ~/.local/bin/make-gif
palette="/tmp/palette.png" palette="/tmp/palette.png"
filters="fps=15,scale=320:-1:flags=lanczos" filters="fps=15,scale=320:-1:flags=lanczos"
@ -623,7 +623,7 @@ http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
#+end_src #+end_src
* =yt-audio= - Download-Audio from youtube * =yt-audio= - Download-Audio from youtube
#+begin_src bash :tangle ~/bin/yt-audio #+begin_src bash :tangle ~/.local/bin/yt-audio
if [ $TMUX ]; then if [ $TMUX ]; then
tmux split -v -l 5 "cd ~/Downloads/ && youtube-dl --add-metadata -xic -f bestaudio/best $1" && tmux select-pane -U tmux split -v -l 5 "cd ~/Downloads/ && youtube-dl --add-metadata -xic -f bestaudio/best $1" && tmux select-pane -U
else else
@ -634,7 +634,7 @@ fi
* =yt-video= - Download-Video from youtube * =yt-video= - Download-Video from youtube
#+begin_src bash :tangle ~/bin/yt-video #+begin_src bash :tangle ~/.local/bin/yt-video
if [ $TMUX ]; then if [ $TMUX ]; then
tmux split -v -l 5 "cd ~/Downloads/ && youtube-dl --add-metadata -ic $1" && tmux select-pane -U tmux split -v -l 5 "cd ~/Downloads/ && youtube-dl --add-metadata -ic $1" && tmux select-pane -U
else else
@ -644,7 +644,7 @@ fi
#+end_src #+end_src
* =pdf-shrink= Pdf Shrink * =pdf-shrink= Pdf Shrink
#+begin_src bash :tangle ~/bin/pdf-shrink #+begin_src bash :tangle ~/.local/bin/pdf-shrink
shrink () shrink ()
{ {
gs \ gs \
@ -715,7 +715,7 @@ fi
#+end_src #+end_src
* =setbg= - Set Background * =setbg= - Set Background
#+begin_src bash :tangle ~/bin/setbg #+begin_src bash :tangle ~/.local/bin/setbg
bgloc="${XDG_CACHE_HOME:-$HOME/.cache/}/bg" bgloc="${XDG_CACHE_HOME:-$HOME/.cache/}/bg"
[ -f "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc" [ -f "$1" ] && ln -sf "$(readlink -f "$1")" "$bgloc"
@ -724,13 +724,13 @@ fi
xwallpaper --zoom "$bgloc" xwallpaper --zoom "$bgloc"
#+end_src #+end_src
* Insert Unicode Icon * =insert-unicode= - Insert Unicode Icon
#+begin_src bash :tangle ~/bin/insert-unicode #+begin_src bash :tangle ~/.local/bin/insert-unicode
# Must have xclip installed to even show menu. # Must have xclip installed to even show menu.
xclip -h 2>/dev/null || exit 1 xclip -h 2>/dev/null || exit 1
chosen=$(cut -d ';' -f1 ~/.local/share/emoji | rofi -dmenu -i -l 20 | sed "s/ .*//") chosen=$(cut -d ';' -f1 ~/.local/data/emoji | rofi -dmenu -i -l 20 | sed "s/ .*//")
[ "$chosen" != "" ] || exit [ "$chosen" != "" ] || exit
@ -743,13 +743,13 @@ fi
fi fi
#+end_src #+end_src
* Insert Nerd Font Icon * =insert-nerd-fonts= - Insert Nerd Font Icon
#+begin_src bash :tangle ~/bin/insert-nerd-fonts #+begin_src bash :tangle ~/.local/bin/insert-nerd-fonts
# Must have xsel installed to even show menu. # Must have xsel installed to even show menu.
xsel -h 2>/dev/null || exit 1 xsel -h 2>/dev/null || exit 1
chosen=$(cat ~/.local/share/nerd-fonts | rofi -dmenu -i -l 20 | sed "s/ .*//") chosen=$(cat ~/.local/data/nerd-fonts | rofi -dmenu -i -l 20 | sed "s/ .*//")
[ "$chosen" != "" ] || exit [ "$chosen" != "" ] || exit
@ -761,6 +761,7 @@ fi
dunstify "'$chosen' copied to clipboard." & dunstify "'$chosen' copied to clipboard." &
fi fi
#+end_src #+end_src
* =nas= - Interact with the NAS * =nas= - Interact with the NAS
As an alternative, =sshfs= can be used: As an alternative, =sshfs= can be used:
@ -768,7 +769,7 @@ As an alternative, =sshfs= can be used:
sshfs -o allow_other,default_permissions nas:/Data ~/mnt/NAS sshfs -o allow_other,default_permissions nas:/Data ~/mnt/NAS
#+end_src #+end_src
#+begin_src bash :tangle ~/bin/nas #+begin_src bash :tangle ~/.local/bin/nas
if [ $1 == "mount" ]; then if [ $1 == "mount" ]; then
if mount /home/thomas/mnt/NAS/; then if mount /home/thomas/mnt/NAS/; then
dunstify --replace=58249 'NAS ' 'Successfully mounted' dunstify --replace=58249 'NAS ' 'Successfully mounted'
@ -783,3 +784,139 @@ As an alternative, =sshfs= can be used:
fi fi
fi fi
#+end_src #+end_src
* =linkhandler= - Open with Default application
Inspired from =linkhandler= https://github.com/LukeSmithxyz/voidrice/
This is used in =newsboat= to handle links
#+begin_src bash :tangle ~/.local/bin/linkhandler
[ -z "$1" ] && { "$BROWSER"; exit; }
case "$1" in
,*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
,*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
,*mp3|*flac|*opus|*mp3?source*)
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
,*)
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
else setsid $BROWSER "$1" >/dev/null 2>&1 & fi ;;
esac
#+end_src
* =lockscreen= - LockScreen
:PROPERTIES:
:header-args: :tangle ~/.local/bin/lockscreen
:END:
First, turn off dunst
#+begin_src bash
killall -SIGUSR1 dunst && echo "off" > /tmp/dunststatus;
#+end_src
Turn off the music if it is playing.
#+begin_src bash
MPC_STATE=$(mpc | sed -n '2p' | cut -d "[" -f2 | cut -d "]" -f1)
if [[ $MPC_STATE == "playing" ]]; then
mpc pause
fi
#+end_src
Then take a screenshot and process it.
#+begin_src bash
temp_file="/tmp/screen.png"
rm -f $temp_file
maim $temp_file
convert $temp_file -scale 10% -scale 1000% $temp_file
#+end_src
Finally, lock the screen using =i3lock=.
#+begin_src bash
i3lock --no-unlock-indicator --ignore-empty-password --nofork --image=$temp_file && killall -SIGUSR2 dunst && echo "on" > /tmp/dunststatus
#+end_src
#+begin_src bash :tangle no
revert() {
xset dpms 0 0 0
}
trap revert HUP INT TERM
# turn off screen after 5 seconds
xset +dpms dpms 5 5 5
# Parameters
temp_file="/tmp/screen.png"
icon="$HOME/Pictures/Evil_Rick_Sprite.png"
width=1920
height=1080
blur_factor=6
lock_blur_factor=0
# Take the screen shot, blur the image and add the icon
ffmpeg -f x11grab -video_size "${width}x${height}" -y -i $DISPLAY -i $icon -filter_complex "boxblur=$blur_factor:$blur_factor,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2,boxblur=$lock_blur_factor:$lock_blur_factor" -vframes 1 $temp_file
# Alternative
# maim -d 1 $temp_file
# convert -blur 0x8 $temp_file $temp_file
# convert -composite $temp_file $icon -gravity South -geometry -20x1200 $temp_file
# Lock the screen with the image
i3lock --no-unlock-indicator --ignore-empty-password --show-failed-attempts --nofork --image=$temp_file
# Remove the screenshot
rm $temp_file
# Don't turn off screen when back from lock
revert
#+end_src
* TODO =quit= - Lock / Exit / Suspend / ...
- [ ] Seems duplicated with [[file:binaries.org::*=i3exit= - Manage lock, suspend, reboot, ...][=i3exit= - Manage lock, suspend, reboot, ...]]
- [ ] Also change the binary name
#+begin_src bash :tangle ~/.local/bin/quit
option=$(echo -e "Lock\nExit\nLogout\nSuspend\nHibernate\nReboot\nShutdown" | rofi -i -dmenu)
case "$option" in
"Lock")
i3exit lock ;;
"Exit")
i3exit switch_user ;;
"Logout")
i3exit logout ;;
"Suspend")
i3exit suspend ;;
"Hibernate")
i3exit hibernate ;;
"Reboot")
i3exit reboot ;;
"Shutdown")
i3exit shutdown ;;
esac
#+end_src
* =torrent-add= - Download Torrent
#+begin_src bash :tangle ~/.local/bin/torrent-add
transmission-remote 82.64.103.2:9091 --auth tdehaeze:$(pass nas/transmission | sed -n 1p) -a $1 && \
dunstify 'Torrent' 'Successfully added' || \
dunstify 'Torrent' 'Error'
#+end_src
* =mopidy-restart= - Restart Mopidy
#+begin_src bash :tangle ~/.local/bin/mopidy-restart
pids=( $(pgrep -f mopidy) )
for pid in "${pids[@]}"; do
if [[ $pid != $$ ]]; then
kill "$pid"
fi
done
echo "Killed mopidy."
echo "Restarting mopidy..."
mopidy --config ~/.config/mopidy/mopidy.conf >/dev/null 2>&1 &
echo "Done"
#+end_src

View File

@ -1,4 +1,4 @@
#+TITLE: Scripts #+TITLE: Data
:DRAWER: :DRAWER:
#+STARTUP: overview #+STARTUP: overview
@ -20,7 +20,7 @@
:END: :END:
* Nerd Fonts * Nerd Fonts
#+begin_src conf :tangle ~/.local/share/nerd-fonts #+begin_src conf :tangle ~/.local/data/nerd-fonts
 - i_dev_bing_small  - i_dev_bing_small
 - i_dev_css_tricks  - i_dev_css_tricks
 - i_dev_git  - i_dev_git
@ -1303,7 +1303,8 @@
 - i_custom_vim  - i_custom_vim
#+end_src #+end_src
* Emojis * Emojis
#+begin_src conf :tangle ~/.local/share/emojis😀 grinning face; U+1F600 #+begin_src conf :tangle ~/.local/data/emojis
😀 grinning face; U+1F600
😃 grinning face with big eyes; U+1F603 😃 grinning face with big eyes; U+1F603
😄 grinning face with smiling eyes; U+1F604 😄 grinning face with smiling eyes; U+1F604
😁 beaming face with smiling eyes; U+1F601 😁 beaming face with smiling eyes; U+1F601

View File

@ -2637,7 +2637,7 @@ Choose account label to feed msmtp -a option based on From header in Message buf
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! mu4e (use-package! mu4e
:config :config
(setq mu4e-get-mail-command "~/scripts/checkmail.sh" (setq mu4e-get-mail-command "checkmail"
mu4e-update-interval nil mu4e-update-interval nil
mu4e-change-filenames-when-moving t) ;; Fix for mbsync mu4e-change-filenames-when-moving t) ;; Fix for mbsync
) )

View File

@ -64,7 +64,6 @@ The general installation process is described [[file:install.org][here]].
- [[file:applications.org][Desktop Applications]] - [[file:applications.org][Desktop Applications]]
- [[file:matlab.org][Matlab]] - [[file:matlab.org][Matlab]]
- Some useful [[file:binaries.org][Binaries]] - Some useful [[file:binaries.org][Binaries]]
- Some useful [[file:scripts.org][Scripts]]
- [[file:git.org][Git]] Configuration - [[file:git.org][Git]] Configuration
- [[file:gtk.org][GTK]] - [[file:gtk.org][GTK]]
- [[file:config.org][Other Config]] - [[file:config.org][Other Config]]

View File

@ -251,7 +251,7 @@ Use ~sudo -A~, that will open a rofi prompt to ask for the password.
For that to work, we need to add the following code to =~/.profile=: For that to work, we need to add the following code to =~/.profile=:
#+begin_src bash #+begin_src bash
export SUDO_ASKPASS=~/bin/askpass-rofi export SUDO_ASKPASS=~/.local/bin/askpass-rofi
#+end_src #+end_src
The =askpass= script is: The =askpass= script is:
@ -357,8 +357,8 @@ https://github.com/carnager/buku_run
*** Installation *** Installation
#+begin_src bash #+begin_src bash
wget https://raw.githubusercontent.com/carnager/buku_run/master/buku_run -o ~/bin/buku_run wget https://raw.githubusercontent.com/carnager/buku_run/master/buku_run -o ~/.local/bin/buku_run
chmod +x ~/bin/buku_run chmod +x ~/.local/bin/buku_run
#+end_src #+end_src
*** Configuration *** Configuration
@ -376,7 +376,7 @@ cd ~/.local/share/buku/bookmarks.db
git init git init
#+end_src #+end_src
Then we create a script that will automatically add =bookmarks.db= and push to some repository: =~/scripts/buku_git_push.sh=. Then we create a script that will automatically add =bookmarks.db= and push to some repository: =buku_git_push=.
To automatically run the script every day, a systemd unit is used: =~/.config/systemd/user/bukugit.timer= and =~/.config/systemd/user/bukugit.service= To automatically run the script every day, a systemd unit is used: =~/.config/systemd/user/bukugit.timer= and =~/.config/systemd/user/bukugit.service=
@ -803,7 +803,7 @@ https://wiki.archlinux.org/index.php/Isync
*** Automation using systemd *** Automation using systemd
**** Retreive New mails **** Retreive New mails
- =~/scripts/checkmail.sh= - =checkmail=
- =~/.config/systemd/user/checkmail.service= - =~/.config/systemd/user/checkmail.service=
- =~/.config/systemd/user/checkmail.timer= - =~/.config/systemd/user/checkmail.timer=
@ -845,9 +845,6 @@ https://github.com/neomutt/neomutt
yay -S w3m yay -S w3m
#+end_src #+end_src
*** Open PDF from mail
=~/scripts/openfile.sh=
*** Open Url from mail *** Open Url from mail
#+begin_src bash #+begin_src bash
yay -S urlview yay -S urlview
@ -859,7 +856,7 @@ https://github.com/neomutt/neomutt
- https://github.com/LukeSmithxyz/mutt-wizard - https://github.com/LukeSmithxyz/mutt-wizard
** Notification system ** Notification system
A script (=~/scripts/checkmail.sh=) is used to retreive new mails and use =notify=send= is there are new received mails. A script (=checkmail=) is used to retreive new mails and use =notify=send= is there are new received mails.
* File Manager * File Manager
Configuration files: Configuration files:

View File

@ -871,12 +871,12 @@ https://www.donarmstrong.com/posts/org_mode_mutt_capture/
https://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/ https://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/
#+begin_src conf #+begin_src conf
macro index,pager S "<pipe-message>$HOME/scripts/mutt-save-org-link.py\n" macro index,pager S "<pipe-message>$HOME/.config/neomutt/bin/mutt-save-org-link.py\n"
#+end_src #+end_src
**** Link mail to orgmode - Script **** Link mail to orgmode - Script
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/scripts/mutt-save-org-link.py :header-args: :tangle ~/.config/neomutt/bin/mutt-save-org-link.py
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env python3" :header-args+: :shebang "#!/usr/bin/env python3"
:END: :END:
@ -1399,9 +1399,9 @@ Of ranger can be used with the =A= keybinding.
#+begin_src bash #+begin_src bash
if [ $TMUX ]; then if [ $TMUX ]; then
tmux split -v -l 1 ~/scripts/checkmail.sh $1 && tmux select-pane -U tmux split -v -l 1 checkmail $1 && tmux select-pane -U
else else
~/scripts/checkmail.sh $1 checkmail $1
fi fi
#+end_src #+end_src

View File

@ -146,28 +146,28 @@ https://newsboat.org/releases/2.12/docs/newsboat.html
** Macros - Starts with , key ** Macros - Starts with , key
#+BEGIN_SRC conf #+BEGIN_SRC conf
# Default Browser # Default Browser
browser "qutebrowser %u" browser linkhandler
# Open in Browser # Open in Browser
macro , open-in-browser macro , open-in-browser
# Download Video with Youtube-DL # Download Video with Youtube-DL
macro t set browser "~/bin/yt-video %u" ; open-in-browser ; set browser "qutebrowser %u" macro t set browser "~/.local/bin/yt-video %u" ; open-in-browser ; set browser linkhandler
# Download Audio with Youtube-DL # Download Audio with Youtube-DL
macro a set browser "~/bin/yt-audio %u" ; open-in-browser ; set browser "qutebrowser %u" macro a set browser "~/.local/bin/yt-audio %u" ; open-in-browser ; set browser linkhandler
# Open Video with MPV # Open Video with MPV
macro v set browser "setsid nohup mpv %u &> /dev/null &" ; open-in-browser ; set browser "qutebrowser %u" macro v set browser "setsid nohup mpv %u &> /dev/null &" ; open-in-browser ; set browser linkhandler
# Open With W3M # Open With W3M
macro w set browser "w3m %u" ; open-in-browser ; set browser "qutebrowser %u" macro w set browser "w3m %u" ; open-in-browser ; set browser linkhandler
# Copy Address to clipboard # Copy Address to clipboard
macro c set browser "xsel -b <<<" ; open-in-browser ; set browser "qutebrowser %u" macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler
# Quit # Quit
macro q set browser "tmux detach;" ; open-in-browser ; set browser "qutebrowser %u" macro q set browser "tmux detach;" ; open-in-browser ; set browser linkhandler
#+END_SRC #+END_SRC
** hide articles matching ** hide articles matching
@ -286,6 +286,7 @@ https://newsboat.org/releases/2.12/docs/newsboat.html
http://howardism.org/index.xml "~RSS Howardism" emacs http://howardism.org/index.xml "~RSS Howardism" emacs
http://xkcd.com/rss.xml "~RSS XKCD" random http://xkcd.com/rss.xml "~RSS XKCD" random
https://quantasylum.com/blogs/news.atom "~RSS QuantAsylum" audio https://quantasylum.com/blogs/news.atom "~RSS QuantAsylum" audio
https://blog.jethro.dev/index.xml "~RSS Jethro Kuan" emacs
#+end_src #+end_src
** Youtube ** Youtube

View File

@ -386,7 +386,7 @@
:END: :END:
#+begin_src bash #+begin_src bash
dunstify --replace=98465 "Mails " "Syncing..."; dunstify --replace=98465 "Mails " "Syncing...";
~/scripts/checkmail.sh -q && \ checkmail -q && \
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \ mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \
if [ "$mail_nb" -eq "0" ]; then if [ "$mail_nb" -eq "0" ]; then
dunstify --replace=98465 "Mails " "No new mail"; dunstify --replace=98465 "Mails " "No new mail";
@ -546,7 +546,7 @@
dunstify --replace=23198 "VPN" "Disconnected" && \ dunstify --replace=23198 "VPN" "Disconnected" && \
echo "off" > $tmpfile; echo "off" > $tmpfile;
else else
country=`cat ~/bin/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`; country=`cat ~/.local/data/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`;
dunstify --replace=23198 "VPN" "Connecting to $country..."; dunstify --replace=23198 "VPN" "Connecting to $country...";
nordvpn connect $country && \ nordvpn connect $country && \
dunstify --replace=23198 "VPN" "Connected to $country" && \ dunstify --replace=23198 "VPN" "Connected to $country" && \
@ -675,7 +675,7 @@
format-underline = ${colors.bg} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh
click-right = ~/scripts/lockscreen.sh click-right = ~/.local/bin/lockscreen
format = <label> format = <label>
exec = ~/.config/polybar/scripts/lockscreen-status.sh exec = ~/.config/polybar/scripts/lockscreen-status.sh
@ -709,7 +709,7 @@
pkill xautolock && \ pkill xautolock && \
dunstify --replace=13602 'Lock Screen ' 'Desactivated' dunstify --replace=13602 'Lock Screen ' 'Desactivated'
else else
xautolock -locker "~/scripts/lockscreen.sh" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" & xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
dunstify --replace=13602 'Lock Screen ' 'Activated' dunstify --replace=13602 'Lock Screen ' 'Activated'
fi fi
#+end_src #+end_src
@ -806,7 +806,7 @@
[module/screenshot] [module/screenshot]
type = custom/text type = custom/text
content = "" content = ""
click-left = ~/bin/screenshot click-left = ~/.local/bin/screenshot
#+END_SRC #+END_SRC
* Scripts * Scripts

View File

@ -282,7 +282,7 @@ Add page to Bookmarks using =buku=
Open bookmark using =buku= Open bookmark using =buku=
#+begin_src python #+begin_src python
config.bind(',o', 'spawn ~/bin/bukurun') config.bind(',o', 'spawn ~/.local/bin/bukurun')
#+end_src #+end_src
Org Capture Org Capture
@ -293,7 +293,7 @@ Org Capture
Download a torrent Download a torrent
#+begin_src python #+begin_src python
config.bind(',t', 'hint links spawn --userscript ~/scripts/torrent-add.sh {hint-url}') config.bind(',t', 'hint links spawn --userscript torrent-add {hint-url}')
#+end_src #+end_src
Annotate with Hypothesis Annotate with Hypothesis
@ -325,7 +325,7 @@ See Amazon price history using CamelCamelCamel
echo -e "$password\nlogin: $username\nurl: $QUTE_URL" > /tmp/add-password.txt echo -e "$password\nlogin: $username\nurl: $QUTE_URL" > /tmp/add-password.txt
pass insert --multiline "$url/$username" < /tmp/add-password.txt; pass insert --multiline "$url/$username" < /tmp/add-password.txt;
rm /tmp/add-password.txt rm /tmp/add-password.txt
dunstify "Pass" "Password Added" dunstify "Pass" "Password Added"
fi fi
#+end_src #+end_src
@ -375,7 +375,7 @@ See Amazon price history using CamelCamelCamel
:END: :END:
#+begin_src bash #+begin_src bash
readonly CAPTURE_SCRIPT=~/scripts/org-protocol-capture-html.sh readonly CAPTURE_SCRIPT=~/.config/qutebrowser/userscripts/org-protocol-capture-html.sh
if [[ "$QUTE_MODE" = "hints" ]]; then if [[ "$QUTE_MODE" = "hints" ]]; then
# if we start with hints, we juste want to capture the URL # if we start with hints, we juste want to capture the URL
@ -389,6 +389,135 @@ See Amazon price history using CamelCamelCamel
fi fi
#+end_src #+end_src
** Org-Protocol-Capture-HTML
:PROPERTIES:
:header-args: :tangle ~/.config/qutebrowser/userscripts/org-protocol-capture-html.sh
:END:
Defaults
#+begin_src bash
heading="link"
template="pu"
url="https://google.com/"
#+end_src
Functions
#+begin_src bash
function debug {
if [[ -n $debug ]]
then
function debug {
echo "DEBUG: $@" >&2
}
debug "$@"
else
function debug {
true
}
fi
}
function die {
echo "$@" >&2
exit 1
}
function urlencode {
python -c "
from __future__ import print_function
try:
from urllib import quote # Python 2
except ImportError:
from urllib.parse import quote # Python 3
import sys
print(quote(sys.stdin.read()[:-1], safe=''))"
}
#+end_src
Documentation
#+begin_src bash
function usage {
cat <<EOF
$0 [OPTIONS] [HTML]
html | $0 [OPTIONS]
Send HTML to Emacs through org-protocol, passing it through Pandoc to
convert HTML to Org-mode. HTML may be passed as an argument or
through STDIN. If only URL is given, it will be downloaded and its
contents used.
Options:
-h, --heading HEADING Heading
-t, --template TEMPLATE org-capture template key (default: pu)
-u, --url URL URL
--debug Print debug info
--help I need somebody!
EOF
}
#+end_src
Arguments
#+begin_src bash
args=$(getopt -n "$0" -o dh:rt:u: -l debug,help,heading:,template:,url: -- "$@") \
|| die "Unable to parse args. Is getopt installed?"
eval set -- "$args"
while true
do
case "$1" in
-d|--debug)
debug=true
debug "Debugging on"
;;
--help)
usage
exit
;;
-h|--heading)
shift
heading="$1"
;;
-t|--template)
shift
template="$1"
;;
-u|--url)
shift
url="$1"
;;
--)
# Remaining args
shift
rest=("$@")
break
;;
esac
shift
done
debug "ARGS: $args"
debug "Remaining args: ${rest[@]}"
#+end_src
Get HTML
#+begin_src bash
if [[ -n $@ ]]
then
debug "Text from args"
body="$@"
fi
#+end_src
URL-encode
#+begin_src bash
heading=$(urlencode <<<"$heading") || die "Unable to urlencode heading."
url=$(urlencode <<<"$url") || die "Unable to urlencode URL."
body=$(urlencode <<<"$body") || die "Unable to urlencode text."
#+end_src
Send to Emacs
#+begin_src bash
emacsclient "org-protocol://capture?template=$template&url=$url&title=$heading&body=$body"
#+end_src
** Add Url to Buku using Rofi ** Add Url to Buku using Rofi
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/.config/qutebrowser/userscripts/buku-rofi.sh :header-args: :tangle ~/.config/qutebrowser/userscripts/buku-rofi.sh

View File

@ -1,267 +0,0 @@
#+TITLE: Scripts
:DRAWER:
#+STARTUP: overview
#+LANGUAGE: en
#+EMAIL: dehaeze.thomas@gmail.com
#+AUTHOR: Dehaeze Thomas
#+HTML_LINK_HOME: ./index.html
#+HTML_LINK_UP: ./index.html
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
#+PROPERTY: header-args:bash :comments both :mkdirp yes
#+PROPERTY: header-args:bash+ :shebang "#!/usr/bin/env bash"
:END:
* LockScreen
:PROPERTIES:
:header-args: :tangle ~/scripts/lockscreen.sh
:END:
First, turn off dunst
#+begin_src bash
killall -SIGUSR1 dunst && echo "off" > /tmp/dunststatus;
#+end_src
Turn off the music if it is playing.
#+begin_src bash
MPC_STATE=$(mpc | sed -n '2p' | cut -d "[" -f2 | cut -d "]" -f1)
if [[ $MPC_STATE == "playing" ]]; then
mpc pause
fi
#+end_src
Then take a screenshot and process it.
#+begin_src bash
temp_file="/tmp/screen.png"
rm -f $temp_file
maim $temp_file
convert $temp_file -scale 10% -scale 1000% $temp_file
#+end_src
Finally, lock the screen using =i3lock=.
#+begin_src bash
i3lock --no-unlock-indicator --ignore-empty-password --nofork --image=$temp_file && killall -SIGUSR2 dunst && echo "on" > /tmp/dunststatus
#+end_src
#+begin_src bash :tangle no
revert() {
xset dpms 0 0 0
}
trap revert HUP INT TERM
# turn off screen after 5 seconds
xset +dpms dpms 5 5 5
# Parameters
temp_file="/tmp/screen.png"
icon="$HOME/Pictures/Evil_Rick_Sprite.png"
width=1920
height=1080
blur_factor=6
lock_blur_factor=0
# Take the screen shot, blur the image and add the icon
ffmpeg -f x11grab -video_size "${width}x${height}" -y -i $DISPLAY -i $icon -filter_complex "boxblur=$blur_factor:$blur_factor,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2,boxblur=$lock_blur_factor:$lock_blur_factor" -vframes 1 $temp_file
# Alternative
# maim -d 1 $temp_file
# convert -blur 0x8 $temp_file $temp_file
# convert -composite $temp_file $icon -gravity South -geometry -20x1200 $temp_file
# Lock the screen with the image
i3lock --no-unlock-indicator --ignore-empty-password --show-failed-attempts --nofork --image=$temp_file
# Remove the screenshot
rm $temp_file
# Don't turn off screen when back from lock
revert
#+end_src
* TODO Lock / Exit / Suspend / ...
- [ ] Seems duplicated with [[file:binaries.org::*=i3exit= - Manage lock, suspend, reboot, ...][=i3exit= - Manage lock, suspend, reboot, ...]]
#+begin_src bash :tangle ~/scripts/quit.sh
option=$(echo -e "Lock\nExit\nLogout\nSuspend\nHibernate\nReboot\nShutdown" | rofi -i -dmenu)
case "$option" in
"Lock")
i3exit lock ;;
"Exit")
i3exit switch_user ;;
"Logout")
i3exit logout ;;
"Suspend")
i3exit suspend ;;
"Hibernate")
i3exit hibernate ;;
"Reboot")
i3exit reboot ;;
"Shutdown")
i3exit shutdown ;;
esac
#+end_src
* Download Torrent
#+begin_src bash :tangle ~/scripts/torrent-add.sh
transmission-remote 82.64.103.2:9091 --auth tdehaeze:$(pass nas/transmission | sed -n 1p) -a $1 && \
dunstify 'Torrent' 'Successfully added' || \
dunstify 'Torrent' 'Error'
#+end_src
* Org-Protocol-Capture-HTML
:PROPERTIES:
:header-args: :tangle ~/scripts/org-protocol-capture-html.sh
:END:
Defaults
#+begin_src bash
heading="link"
template="pu"
url="https://google.com/"
#+end_src
Functions
#+begin_src bash
function debug {
if [[ -n $debug ]]
then
function debug {
echo "DEBUG: $@" >&2
}
debug "$@"
else
function debug {
true
}
fi
}
function die {
echo "$@" >&2
exit 1
}
function urlencode {
python -c "
from __future__ import print_function
try:
from urllib import quote # Python 2
except ImportError:
from urllib.parse import quote # Python 3
import sys
print(quote(sys.stdin.read()[:-1], safe=''))"
}
#+end_src
Documentation
#+begin_src bash
function usage {
cat <<EOF
$0 [OPTIONS] [HTML]
html | $0 [OPTIONS]
Send HTML to Emacs through org-protocol, passing it through Pandoc to
convert HTML to Org-mode. HTML may be passed as an argument or
through STDIN. If only URL is given, it will be downloaded and its
contents used.
Options:
-h, --heading HEADING Heading
-t, --template TEMPLATE org-capture template key (default: pu)
-u, --url URL URL
--debug Print debug info
--help I need somebody!
EOF
}
#+end_src
Arguments
#+begin_src bash
args=$(getopt -n "$0" -o dh:rt:u: -l debug,help,heading:,template:,url: -- "$@") \
|| die "Unable to parse args. Is getopt installed?"
eval set -- "$args"
while true
do
case "$1" in
-d|--debug)
debug=true
debug "Debugging on"
;;
--help)
usage
exit
;;
-h|--heading)
shift
heading="$1"
;;
-t|--template)
shift
template="$1"
;;
-u|--url)
shift
url="$1"
;;
--)
# Remaining args
shift
rest=("$@")
break
;;
esac
shift
done
debug "ARGS: $args"
debug "Remaining args: ${rest[@]}"
#+end_src
Get HTML
#+begin_src bash
if [[ -n $@ ]]
then
debug "Text from args"
body="$@"
fi
#+end_src
URL-encode
#+begin_src bash
heading=$(urlencode <<<"$heading") || die "Unable to urlencode heading."
url=$(urlencode <<<"$url") || die "Unable to urlencode URL."
body=$(urlencode <<<"$body") || die "Unable to urlencode text."
#+end_src
Send to Emacs
#+begin_src bash
emacsclient "org-protocol://capture?template=$template&url=$url&title=$heading&body=$body"
#+end_src
* Restart Mopidy
#+begin_src bash :tangle ~/scripts/mopidy-restart.sh
pids=( $(pgrep -f mopidy) )
for pid in "${pids[@]}"; do
if [[ $pid != $$ ]]; then
kill "$pid"
fi
done
echo "Killed mopidy."
echo "Restarting mopidy..."
mopidy --config ~/.config/mopidy/mopidy.conf >/dev/null 2>&1 &
echo "Done"
#+end_src

View File

@ -40,9 +40,9 @@
* Set shut down, restart and locking features * Set shut down, restart and locking features
#+begin_src conf #+begin_src conf
XF86PowerOff XF86PowerOff
$HOME/scripts/quit.sh quit
super + 0 super + 0
$HOME/scripts/quit.sh quit
#+end_src #+end_src
* Start Applications * Start Applications
@ -137,7 +137,7 @@ XF86AudioPrev
** Print Screen ** Print Screen
#+begin_src conf #+begin_src conf
Print Print
~/bin/screenshot ~/.local/bin/screenshot
XF86Display XF86Display
rofi -show window rofi -show window
#+end_src #+end_src
@ -183,7 +183,7 @@ XF86Display
# Print Screen # Print Screen
super + space ; shift + p super + space ; shift + p
$HOME/bin/mopidy-restart $HOME/.local/bin/mopidy-restart
# Default Browser # Default Browser
super + space ; i super + space ; i

View File

@ -34,7 +34,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=%h/scripts/pass_git_sync.sh ExecStart=%h/.local/bin/pass_git_sync
#+END_SRC #+END_SRC
** Timer ** Timer
@ -62,7 +62,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
** Script ** Script
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/scripts/pass_git_sync.sh :header-args: :tangle ~/.local/bin/pass_git_sync
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
@ -86,7 +86,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=%h/scripts/buku_git_push.sh ExecStart=%h/.local/bin/buku_git_push
#+END_SRC #+END_SRC
** Timer ** Timer
@ -114,7 +114,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
** Script ** Script
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/scripts/buku_git_push.sh :header-args: :tangle ~/.local/bin/buku_git_push
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
@ -146,7 +146,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=%h/scripts/checkmail.sh -q ExecStart=%h/.local/bin/checkmail -q
#+END_SRC #+END_SRC
** Timer ** Timer
@ -177,7 +177,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
** Script ** Script
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/scripts/checkmail.sh :header-args: :tangle ~/.loca/bin/checkmail
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
@ -188,7 +188,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
-a) opt_all='--all' ;; # Check All inboxes -a) opt_all='--all' ;; # Check All inboxes
-v) opt_verbose='--verbose' ;; # Verbose -v) opt_verbose='--verbose' ;; # Verbose
-q) opt_quiet='--quiet' ;; # Quiet -q) opt_quiet='--quiet' ;; # Quiet
*) echo "Option $1 not recognized" ;; # In case you typed a different option ,*) echo "Option $1 not recognized" ;; # In case you typed a different option
esac esac
shift shift
done done
@ -204,7 +204,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
# ============================================================= # =============================================================
# Retreive mails # Retreive mails
mbsync $opt_all $opt_verbose gmail-Home esrf-Home ulg-Home uliege-Home mbsync $opt_all $opt_verbose gmail-Home esrf-Home ulg-Home uliege-Home 2>/tmp/mbsync.log
# ============================================================= # =============================================================
# ============================================================= # =============================================================
@ -230,12 +230,11 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
# ============================================================= # =============================================================
# Indexation and Tags # Indexation and Tags
# mu update if pgrep -f 'mu server'; then
emacsclient --eval '(mu4e-update-index)'
else
mu index --maildir=~/.mail $opt_verbose $opt_quiet mu index --maildir=~/.mail $opt_verbose $opt_quiet
# Update on Emacs fi
# if [ "$(($new-$old))" -gt 0 ]; then
# emacsclient --eval '(mu4e-update-index)';
# fi
# ============================================================= # =============================================================
#+end_src #+end_src
@ -254,7 +253,7 @@ https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=%h/scripts/checkmail.sh -a -q ExecStart=%h/.local/bin/checkmail -a -q
#+END_SRC #+END_SRC
** Timer ** Timer

View File

@ -429,7 +429,7 @@ Start programs related to display.
unclutter --timeout 5 & unclutter --timeout 5 &
# Autolock screen after x minutes # Autolock screen after x minutes
xautolock -locker "~/scripts/lockscreen.sh" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" & xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
# Redshift # Redshift
pgrep -xu "$USER" redshift >/dev/null || \ pgrep -xu "$USER" redshift >/dev/null || \