2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+TITLE : Custom Scripts  
						 
					
						
							
								
									
										
										
										
											2020-07-16 14:25:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+setupfile : headers  
						 
					
						
							
								
									
										
										
										
											2020-01-16 19:48:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+PROPERTY : header-args :exports code  
						 
					
						
							
								
									
										
										
										
											2020-09-02 13:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+PROPERTY : header-args:emacs-lisp :exports none :tangle no  
						 
					
						
							
								
									
										
										
										
											2019-10-23 10:18:23 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  Custom Scripts  
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This file will present all the executable scripts I wrote. It is also their
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								original source code, all the following code snippets are exported and tangled
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								from this file to the actual executables.
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 23:10:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Autostart 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/autostart
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Because I sometimes switch from window manager to window manager, creating a
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								script that handles by itself autostarting things for me is way easier than
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								rewriting every time the autostart part of my configuration. As you can every
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								instance will be launched asynchronously, and only if there is no other instance
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								of said command running.
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+NAME : autostart-table  
						 
					
						
							
								
									
										
										
										
											2022-03-06 21:43:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								| Command              | Arguments                                | Run once? |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								|----------------------+------------------------------------------+-----------|  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~pactl~                | ~load-module module-switch-on-connect~     |           |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~mpc~                  | ~stop~                                     | no        |  
						 
					
						
							
								
									
										
										
										
											2022-06-07 19:20:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								| ~xrdb~                 | ~-merge "$XDG_CONFIG_HOME"/X11/Xresources~ | no        |  
						 
					
						
							
								
									
										
										
										
											2022-09-19 12:02:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								| ~picom~                |                                          | yes       |  
						 
					
						
							
								
									
										
										
										
											2022-03-06 21:43:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								| ~numlockx~             | ~on~                                       | yes       |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~xfce-polkit~          |                                          | yes       |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~nm-applet~            |                                          | yes       |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~xwallpaper~           | ~--zoom "$(cat "$HOME"/.cache/wallpaper)"~ | no        |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~xss-lock~             | ~plock~                                    | yes       |  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								| ~/usr/lib/kdeconnectd~ |                                          | yes       |  
						 
					
						
							
								
									
										
										
										
											2022-03-10 22:25:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								| ~dunst~                |                                          | yes       |  
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+NAME : autostart-gen  
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+header : :wrap "src bash :exports code"  
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC emacs-lisp :var table=autostart-table :cache yes
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								(mapconcat (lambda (start-command)
							 
						 
					
						
							
								
									
										
										
										
											2022-07-05 15:29:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								             (let* ((clean-string (lambda (str) (replace-regexp-in-string "~" "" str)))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    (command      (funcall clean-string (nth 0 start-command)))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    (arguments    (funcall clean-string (nth 1 start-command)))
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								                    (oncep        (string= "yes" (nth 2 start-command)))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                    (full-command (replace-regexp-in-string
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                   " +"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                   " "
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                   (format "%s %s &" command arguments))))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								               (concat (format "which %s && %s"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               command
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                               (if (not oncep)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                   full-command
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                 (format (concat "if pgrep -x %s ; then\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                                 "    echo %s already running\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                                 "else\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                                 "    %s\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                                 "    disown\n"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                                 "fi")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                         command
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                         command
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                                         full-command))))))
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								           table
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								           "\n")
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-19 12:02:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+RESULTS[8c42a43989020c61050b2930ae60c81248c2dd44]: autostart-gen
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src bash :exports code
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which pactl && pactl load-module module-switch-on-connect &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								which mpc && mpc stop &
							 
						 
					
						
							
								
									
										
										
										
											2022-06-21 16:38:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which xrdb && xrdb -merge "$XDG_CONFIG_HOME"/X11/Xresources &
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which picom && if pgrep -x picom ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo picom already running
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-09-19 12:02:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    picom &
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which numlockx && if pgrep -x numlockx ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo numlockx already running
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 21:08:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    numlockx on &
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which xfce-polkit && if pgrep -x xfce-polkit ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo xfce-polkit already running
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 21:08:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    xfce-polkit &
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which nm-applet && if pgrep -x nm-applet ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo nm-applet already running
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 21:08:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    nm-applet &
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which xwallpaper && xwallpaper --zoom "$(cat "$HOME"/.cache/wallpaper)" &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								which xss-lock && if pgrep -x xss-lock ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo xss-lock already running
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 21:08:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    xss-lock plock &
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which /usr/lib/kdeconnectd && if pgrep -x /usr/lib/kdeconnectd ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo /usr/lib/kdeconnectd already running
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 21:43:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 21:08:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    /usr/lib/kdeconnectd &
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 22:25:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-05-22 14:11:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								which dunst && if pgrep -x dunst ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo dunst already running
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 22:25:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 21:08:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    dunst &
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 21:43:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    disown
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 21:43:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								I also have an external sound card, a Scarlet 2i2 G3, that I would
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								like to use as my default audio output. However, it might not be
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								always connected, hence the following code:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+NAME : default-soundcard  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								SOUNDCARD=$(pactl list short sinks | grep "Focusrite")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [[ -n $SOUNDCARD  ]]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    pactl set-default-sink "$(echo "$SOUNDCARD" | awk '{print $2}')"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 13:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  cli utilities 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  Backup 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/backup
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								~backup~  is a very simple, one-liner script that will create a local 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								copy of a file and add the date at which it was copied in the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								filename. You can see its source code here:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								cp -r "$1" "$1.bak.$(date +%Y%m%d%H%M%S)"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  CPU Scaling 
						 
					
						
							
								
									
										
										
										
											2022-04-11 14:50:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/cpu-scaling
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								As I am using a laptop, maximum performance isn’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								Sometimes, it’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								battery-demanding performance. It is possible to achieve this by
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								modifying the CPU governor with ~cpupower~ . The [[https://wiki.archlinux.org/title/CPU_frequency_scaling#Scaling_governors ][Arch Wiki ]] has, as usual,
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								some superb documentation on this.
							 
						 
					
						
							
								
									
										
										
										
											2022-04-11 14:50:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The following script asks the user through ~rofi~  which governor to
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								apply, and it relies on [[file:./scripts.md#askpass ][askpass ]] to retrieve the user’ 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-11 14:50:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								governors=("performance" "powersave" "userspace" "ondemand" "conservative" "schedutil")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								governor=$(printf "%s\n" "${governors[@]}" | rofi -dmenu)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								sudo -A cpupower frequency-set -g "$governor"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  docker-running 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:16:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/ .local/bin/docker-running
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								As with =mu-unread=  below, =docker-running=  is a small and simple utility
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								for my StumpWM configuration which indicates how many Docker
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								containers are currently running.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								NB_CONTAINERS=$(docker ps -q | wc -l | tr -d '\n')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								printf "^f3^f0 %d" $NB_CONTAINERS
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Kamoji Generator 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/ .local/bin/kamoji
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								This script comes straight from [[https://charm.sh/blog/kamoji-generator/ ][this blog post ]] and generates kamoji. I
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								modified it a bit in order to work with either =xclipboard=  or =wl-copy= 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								depending on whether I am in an X.org session or a Wayland session.
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Note that it requires the =OPENAI_API_KEY=  environment variable to be
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								set with a valid OpenAI key.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src bash
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# If the user passes '-h', '--help', or 'help' print out a little bit  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# of help. text.  
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								case "$1" in
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 14:23:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    "-h" | "--help" | "help")
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        printf 'Generate kaomojis on request.\n\n'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        printf 'Usage: %s [kind]\n' "$(basename "$0")"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        ;;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								esac
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# The user can pass an argument like "bear" or "angry" to specify the  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# general kind of Kaomoji produced.  
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								sentiment=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [[ $1 != ""  ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 14:23:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    sentiment=" $1"
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Ask mods to generate Kaomojis. Save the output in a variable.  
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								kaomoji="$(mods "generate 10${sentiment} kaomojis. Number them and put each one on its own line.")"
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [[ $kaomoji == ""  ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 14:23:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    exit 1
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# Pipe mods output to gum, so the user can choose the perfect kaomoji.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Save that choice in a variable. Also note that we're using cut to  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# drop the item number in front of the Kaomoji.  
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								choice="$(echo "$kaomoji" | gum choose | cut -d ' ' -f 2)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [[ $choice == ""  ]]; then
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 14:23:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    exit 1
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								# If the current session is Wayland, copy with wl-copy, otherwise copy  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# with xclipboard  
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$XDG_SESSION_TYPE" = "wayland" ]
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 20:34:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								then printf '%s' "$choice" | wl-copy # Wayland
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 14:23:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else printf '%s' "$choice" | xclip -sel clip # X11
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# We're done!  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								printf 'Copied %s to the clipboard\n' "$choice"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  mu-unread 
						 
					
						
							
								
									
										
										
										
											2021-10-14 20:05:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/ .local/bin/mu-unread
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~mu-unread~  is a very simple utility that simply returns the amount of 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								unread emails I have through the use of ~mu~ .
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 23:04:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								As you can see, the output string contains two font switchers for
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								StumpWM so I can switch from the main font to Siji for the character
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 23:04:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								contained between them: U+E072 (an email icon).
							 
						 
					
						
							
								
									
										
										
										
											2021-10-14 20:05:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								UNREAD=$(mu find "flag:unread AND (maildir:/Inbox OR maildir:/Junk)" | wc -l)
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								printf "^f2^f0%s" "$UNREAD"
							 
						 
					
						
							
								
									
										
										
										
											2021-10-14 20:05:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  screenshot 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/screenshot
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								This is a utility only useful with Wayland for now, using =grim= , =slurp= 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								(in order to select which area of the screen I wish to capture) and
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								=wl-copy=  (from =wl-clipboard= ). It saves the screenshot in my 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								=$HOME/Pictures/Screenshots=  directory with a name formatted as 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								=Screenshot_20230425_134550.png=  if the screenshot was taken on the 25th 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								of April 2023 at 1:45:50PM. If the file already exists, the script
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								will suffix the name with an underscore followed by an incremental
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								number like =Screenshot_20230425_134550_1.png=  or
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								=Screenshot_20230425_134550_2.png= . 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								If the argument =select=  is passed to =screenshot= , as in =screenshot
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								select=, then use =slurp=  to select the area to capture.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								OUTFILE_BASE="$HOME/Pictures/Screenshots/Screenshot_ $(date +%Y%m%d)_$(date + %H%M%S)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								OUTFILE="$OUTFILE_BASE.png"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								SUFFIX=0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-03 06:00:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								while getopts ':cd:egs' OPTION; do
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    case "$OPTION" in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        c )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            COPY="yes"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ;;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        d )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            DELAY="$OPTARG"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2024-04-03 06:00:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        e )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            EDIT="yes"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ;;
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								        g )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            GIMP="yes"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ;;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        s )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            SELECT="yes"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ;;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        ? )
							 
						 
					
						
							
								
									
										
										
										
											2024-04-03 06:00:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            echo "Usage: $(basename "$0") [-c] [-d DELAY] [-e] [-g] [-s]"
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								            exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            ;;
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    esac
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-03 06:00:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$SELECT" = "yes" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then AREA="$(slurp)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ -n "$DELAY" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then sleep "$DELAY"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$SELECT" = "yes" ]
							 
						 
					
						
							
								
									
										
										
										
											2024-04-03 06:00:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								then grim -g "$AREA" "$OUTFILE"
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else grim "$OUTFILE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-03 06:00:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$EDIT" = "yes" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then swappy -f "$OUTFILE" -o "$OUTFILE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$GIMP" = "yes" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then gimp "$OUTFILE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$COPY" = "yes" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then wl-copy < "$OUTFILE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# wl-copy < "$OUTFILE"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  sshbind 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/sshbind
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 17:17:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Something that I did not know for quite some time, but that is
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								actually crazy useful about SSH is its ability to bind locally the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								port of a remote machine, and vice versa. The syntax is actually very
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								simple, but I prefer a more intuitive way of writing it. Its usage is
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~sshbind PORT FROMHOST TOHOST~ . 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								ssh -L "$1:$3:$1" "$2" -N
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2020-02-24 21:40:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Nsxiv key handler 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :mkdirp yes :tangle no :noweb yes
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								One thing I like with ~nsxiv~  is you can trigger different behaviours
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								based on keypresses. For instance, with my current nsxiv
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								configuration, if I press the space key followed by a character, it
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								can delete to the trashcan, delete definitively, or open the current
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								image in GIMP. All of that is done through one script file stored in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~$HOME/.config/nsxiv/exec/key-handler~ . The fact it reacts to first 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								thespace bar instead of /Ctrl-x/  is because I use a custom version of
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								nsxiv I first modified to fit the bépo layout, and then I decided to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								change the prefix to fit how I use Emacs and StumpWM. You can read the
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								PKGBUILD and my nsxiv patch [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/Documents/code/PKGBUILDs/sxiv ][in my dotfiles repo ]].
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+header : :shebang "#!/usr/bin/env fish" :tangle ~/.config/nsxiv/exec/key-handler  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								<<nsxiv-read-files >>
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								<<nsxiv-switch-statement >>
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Here is a step by step explanation of the source code. First, we want
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								to store in the variable ~FILES~  all the files marked in nsxiv. This is
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								done with a ~while~  loop and the ~read~  command.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-read-files  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								while read file
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    set -g FILES "$file" $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								end
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								We can then read from the first member of ~argv~  which key the user
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 17:17:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								pressed. Depending on it, we can choose what to execute.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-switch-statement  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								switch "$argv[1]"
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-trash >>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-rm >>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-gimp >>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-jpeg >>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-rotate-clockwise >>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-rotate-counter-clockwise >>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    <<nsxiv-yank >>
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								end
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The first option with the letter ~d~  is to move the file to the trash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								can. For this, we use the ~trash~  command from ~trash-cli~ .
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-trash  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "d"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    trash $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								In case we want to definitively delete a file without using the trash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								can, we can use ~rm~  instead when we press the ~D~  key.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-rm  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "D"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    rm $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								It’ 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								especially since screenshots are automatically open in this image
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								viewer aften they are taken. In that case, a simple command will do.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-gimp  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "g"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    gimp $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 17:17:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Often, I use nsxiv to convert an image to a JPEG file, because my
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								internet connection is not that great and JPEG screenshots are faster
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								to upload than PNG screenshots. So what I do is for each file
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								selected, I take the base name of the file (i.e. remove its
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								extension), and then I use the ~convert~  command from ~imagemagik~  to
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 17:17:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								convert it from its original format to a JPG format --- ~imagemagik~ 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								detects the formats based on the extension.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-jpeg  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "j"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for f in $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        set basename (echo "$f" | sed 's/\.[^.]*$/ /')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        convert "$f" "$basename.jpg"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    end
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								I have two commands to rotate my files, and both only differ by the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								angle of rotation. Once again I rely on ~convert~  in both cases. To
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								rotate clockwise, this is the code needed.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-rotate-clockwise  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "r"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for f in $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        convert -rotate 90 "$f" "$f"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    end
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								On the other hand, to rotate counter-clockwise, we need this code:
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-rotate-counter-clockwise  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "R"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for f in $FILES
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        convert -rotate 270 "$f" "$f"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    end
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Lastly, when I want to copy a file, I just hit the ~y~  key for “yank”
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								(that’ ~file~  to tell me the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								mimetype of the image, then I can pass it to ~xclip~  along with the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								filename to copy it to the clipboard. In this case, we only copy the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								first of the selected files since the clipboard cannot hold several
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								files at once.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+name : nsxiv-yank  
						 
					
						
							
								
									
										
										
										
											2022-02-18 00:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src fish
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								case "y"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    set FILE "$FILES[1]"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    set TYPE (file -i "$FILE" | sed -r 's|.*(image/[a-z]+);.* |\1|')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    xclip -sel clip -t "$TYPE" -i "$FILE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Secure key generator 
						 
					
						
							
								
									
										
										
										
											2023-07-03 11:23:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/ .local/bin/skg
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 | tr -d '\n'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Starwars 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/starwars
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								your terminal. Here is the code:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								telnet towel.blinkenlights.nl
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2020-06-14 20:58:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Emacs stuff 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  Dired 
						 
					
						
							
								
									
										
										
										
											2021-01-27 19:03:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/ .local/bin/dired
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This script allows me to open anything in dired from the command line.
							 
						 
					
						
							
								
									
										
										
										
											2021-01-27 19:03:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								emacsclient -c -a emacs -e "(dired \"$*\")"
							 
						 
					
						
							
								
									
										
										
										
											2021-01-27 19:03:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Ediff 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/ .local/bin/ediff
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								I want Ediff as my merge tool, not just with Git but with other
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								programs tooa, such as =pacdiff= .
							 
						 
					
						
							
								
									
										
										
										
											2023-05-28 16:33:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								emacsclient -c -a emacs -e "(ediff-files \"$1\" \"$2\")"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Emacsmail 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/ .local/bin/emacsmail
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This short script is used in my =~/.local/share/applications/mu4e.desktop=  file
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								in order to send to Emacs any ~mailto:~  requests made in my system.
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2022-02-26 15:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								emacsclient -c -n -a emacs -e "(browse-url-mail \"$*\")"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-07 06:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Restart Emacs 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/ .local/bin/restart-emacs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Believe me or not, it happens I restart Emacs. I generally start Emacs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								manually with =emacs --daemon=  because of an issue rendering =lsp-mode= 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								useless when started by the user systemd service.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								PID_EMACS=$(pidof emacs)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								killall emacs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								echo "Waiting for Emacs to be killed... (pid: $PID_EMACS)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if timeout 30 tail --pid=$PID_EMACS -f /dev/null ; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    emacs --daemon
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo "Failed to kill Emacs after 30s"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Media 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  mp42webm 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/mp42webm
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 17:17:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This function allows me to convert easily a MP4 video to the webm
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								format. Nothing too fancy here.
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								ffmpeg -i "$1" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$1".webm
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  youtube-dl wrappers 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								****  ytplay 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/ytplay
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-12-10 15:09:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								~ytplay~  is a simple script I’  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								any YouTube video at the desired resolution. The script relies on
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								~dmenu~  (or ~rofi~  in dmenu-mode), ~youtube-dl~  and of course ~mpv~  itself. 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								URL=$(rofi -dmenu -i -p "Video URL")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [ -z "$URL" ]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo "You need to provide a URL"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    exit 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RESOLUTION_CHOICE=$(yt-dlp --list-formats "$URL" | \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        grep -E "webm.*[0-9]+x[0-9]" | \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        awk '{print $3 " " $1}' | \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        sort -gu | \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                        rofi -dmenu -i -p "Resolution")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								RESOLUTION_CODE=${RESOLUTION[0]}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								mpv --ytdl-format="${RESOLUTION_CODE}+bestaudio/best" "$URL"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								I’ ~.desktop~  entry for this script:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC conf-desktop :tangle ~/.local/share/applications/ytplay.desktop :mkdirp yes
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								[Desktop Entry]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Type=Application
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Version=1.0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Name=ytplay (YouTube in mpv)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Comment=Play YouTube videos in mpv
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Exec=/home/phundrak/ .local/bin/ytplay
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Path=/home/phundrak/ .local/bin
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Terminal=false
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Categories=Media
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 12:00:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-21 06:20:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Misc 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  Broadway 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/broadway
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								This simple script launches broadwayd, a utility that renders GTK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								applications as web apps, and a program displayed to broadway
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								directly.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export display_screen=:5
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								broadwayd $display_screen &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								GDK_BACKEND=broadway BROADWAY_DISPLAY= $display_screen "$@"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								But let’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh :tangle ~/.local/bin/emacs-web
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export display_screen=:5
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								broadwayd $display_screen &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								GDK_BACKEND=broadway BROADWAY_DISPLAY= $display_screen emacs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Plock 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/plock
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								~plock~  is a simple script that locks the screen with ~i3lock~  while setting as 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the background image of the locked screen a corrupted screenshot of the screen
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								before it was locked.
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								TMPBG="/tmp/screen.png"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$XDG_SESSION_TYPE" = "wayland" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    SCREENER=grim
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    LOCKER="swaylock -feF"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    SCREENER=scrot
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 11:02:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    LOCKER="i3lock -ef"
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								$SCREENER "$TMPBG"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								corrupter -add 0 "$TMPBG" "$TMPBG"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								$LOCKER -ti "$TMPBG"
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								rm $TMPBG
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Polybar-launch (Deprecated)                                       :noexport:  
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2021-11-23 15:01:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/polybar-launch
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This scripts allows the user to kill polybar and relaunch it, or to simply
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								launch it if polybar isn’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								processes.
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								killall -q polybar
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Now we have to wait untill all polybar processes have been shut down.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								Now that our system isn’ ’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								of our screens. By the way, I have two bars, so I’ 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if type "xrandr"; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        MONITOR=$m polybar --reload top &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        MONITOR=$m polybar --reload bottom &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    done
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    polybar --reload top &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    polybar --reload bottom &
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								And we’ ’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								notify-send "Polybar restarted!" -a "polybar-launch"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 12:00:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Rofi utilities 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  askpass 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/askpass
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Askpass is a simple script that invokes ~rofi~  as a way to get from a GUI the
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								user’ https://github.com/ODEX-TOS/tools/blob/master/rofi/askpass ][this original tool ]], rewritten in bash
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								and with [[https://wiki.archlinux.org/index.php/Rofi ][rofi ]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu ][dmenu ]]. As you can see, this is a oneliner if we
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								ignore the initial shebang. This executable is pointed at by the
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								rofi -dmenu -password -no-fixed-num-lines -p $(printf "$*" | sed 's/:/ /')
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  awiki 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/awiki
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								~awiki~  is a simple script used with ~rofi~  that relies on the ~arch-wiki-docs~  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								package in order to provide the user a way to quickly find and display any
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								English page from the Arch Wiki in a browser. The advantage of using this over
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the ~wiki-search~  utility from the ~arch-wiki-lite~  package is you get instant
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								suggestion in rofi using fuzzy-search. The downside is rofi will only help you
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								find pages by their title, and it will not help you find keywords in the content
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								of said pages.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The first step is to create the list of all the pages that are currently stored
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								on disk. ~arch-wiki-docs~  stores them in ~/usr/share/doc/arch-wiki/html/en~ . A
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								simple ~ls~  piped in three ~sed~  will give us a list of page titles. We then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								pipe that into rofi in dmenu mode in order to choose the page we want to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								display. By the way, setting the location of the HTML files will come in handy
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								later.
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								WLOCATION=/usr/share/doc/arch-wiki/html/en/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								WPAGE=$(/bin/ls "$WLOCATION" | \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            sed -e 's/_/  /g' -e 's/ \.html$//' -e 's|.*/ \(.*\)|\1|' | \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            rofi -dmenu -p "Arch Wiki" -i)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								WPAGE=$(echo $WPAGE | sed -r 's/\s+/_/g')
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Now, all I need to do is to send this list into rofi and tell it to open the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								result with our favorite browser with ~xdg-open~ .
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								xdg-open "$WLOCATION$WPAGE.html"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  dmenu 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/dmenu
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								I wrote this very simple script in order to replace =dmenu=  with rofi’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								emulation of dmenu, since I prefer rofi’ ’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								dmenu emulation with the arguments initially passed to dmenu.
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								rofi -dmenu "$*"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Emoji picker 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/rofi-emoji
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								The emoji picker is a simple bash script that uses rofi and
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								[[file:~/.config/emoji.txt ][~/.config/emoji.txt ]] to provide a small, local search for emojis. It is
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								relatively easy to build this file from the Unicode’ https://unicode.org/Public/emoji/15.0/emoji-test.txt ][test file ]]. Once
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the emoji is selected, it is copied to the clipboard using =xclipboard= 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								when in a Xorg session or =wl-copy=  from =wl-clipboard=  when in a Wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								session.
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								SELECTED_EMOJI=$(grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | awk '{print $1}' | tr -d '\n')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$XDG_SESSION_TYPE" = "wayland" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then printf "%s" "$SELECTED_EMOJI" | wl-copy
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								else printf "%s" "$SELECTED_EMOJI" | xclip -sel clip
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								Also, let’ 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ "$XDG_SESSION_TYPE" = "wayland" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								then EMOJI=$(wl-paste)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								else EMOJI=$(xclip -o)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-19 18:22:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								test -z "$EMOJI" && notify-send "No emoji copied" -u low && exit
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								EMOJI="$EMOJI copied to clipboard"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								notify-send -u low "$EMOJI"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-13 15:18:43 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 12:00:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA ][this video ]] from [[https://lukesmith.xyz/ ][Luke Smith ]].
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  rofi-ytdl 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/rofi-ytdl
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This is just a simple wrapper around [[file:./scripts.md#ytdl-a-youtube-dl-wrapper ][ytdl ]] so I can easily download a
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								video from rofi, which we’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								video we want to download, be it from YouTube or other website
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								supported by ~youtube-dl~ .
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								URL=$(echo "Video to download:" | rofi -dmenu -i -p "Video to download:")
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Now, if the variable ~URL~  is not empty (i.e. the user specified a link and did
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								not abort the operation), we’ ’ 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								send a notification saying the download is about to begin. When the ~ytdl~ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								process ends, we’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								or failure of the download.
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC bash
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								if [ -n "$URL" ]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    notify-send -u normal "YTDL" "Starting downloading\n$URL"
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    if [[ $(ytdl "$URL")  ]]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        notify-send -u normal "YTDL" "Finished downloading!"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    else
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        notify-send -u critical "YTDL" "Failed downloading\n$URL"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    fi
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Wallpaper utilities 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  pape-update 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2021-01-04 14:04:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/pape-update
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								This little tool sets a random wallpaper using xwallpaper.
							 
						 
					
						
							
								
									
										
										
										
											2021-01-04 14:04:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								PAPESDIR=$HOME/Pictures/Wallpapers
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								PAPE=$(find "$PAPESDIR" -type f | sort -R | tail -1)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								set-pape "$PAPE"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Select wallpaper 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/select-pape
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This script is based on what ~nsxiv~  can do as an image viewer as well as
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								xwallpaper.
							 
						 
					
						
							
								
									
										
										
										
											2021-01-02 13:52:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 17:13:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								PAPE=$(nsxiv -orbft ~/Pictures/Wallpapers/ *)
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								set-pape "$PAPE"
							 
						 
					
						
							
								
									
										
										
										
											2021-01-04 15:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Set a wallpaper 
						 
					
						
							
								
									
										
										
										
											2021-01-04 15:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/ .local/bin/set-pape
							 
						 
					
						
							
								
									
										
										
										
											2021-01-04 15:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 14:43:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								This utility is not meant to be called by the user directly, but rather by
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								scripts that may be written by the user. Its role is simple: check if the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								provided wallpaper exists and if it is an image. If both requirements are met,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the path to this image is then stored in ~$XDG_CACHE_HOME/wallpaper~ , or if this
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								variable is empty in ~$HOME/.cache/wallpaper~ .
							 
						 
					
						
							
								
									
										
										
										
											2021-01-04 15:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								CACHEFILE=$([ -n "$XDG_CACHE_HOME" ] && echo "$XDG_CACHE_HOME/wallpaper" || echo "$HOME/ .cache/wallpaper")
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								[[ -f $1  ]] &&                              \
							 
						 
					
						
							
								
									
										
										
										
											2022-02-04 17:02:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    grep image <(file -b --mime-type "$1") && \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo "$1" > "$CACHEFILE"                    \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    && xwallpaper --zoom "$1"
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Wayland 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								***  Wayland Environment Variables Setup 
						 
					
						
							
								
									
										
										
										
											2022-11-09 15:29:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/way-env-setup
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#export GDK_BACKEND=wayland # May cause problems with some xorg applications
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export TDESKTOP_DISABLE_GTK_INTEGRATION=1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export CLUTTER_BACKEND=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export BEMENU_BACKEND=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Firefox  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export MOZ_ENABLE_WAYLAND=1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Qt environment  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export QT_QPA_PLATFORM=wayland-egl #error with apps xcb
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export QT_WAYLAND_FORCE_DPI=physical
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Elementary environment  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export ELM_DISPLAY=wl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export ECORE_EVAS_ENGINE=wayland_egl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export ELM_ENGINE=wayland_egl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export ELM_ACCEL=opengl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# export ELM_SCALE=1  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# SDL environment  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export SDL_VIDEODRIVER=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# Java environment  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export _JAVA_AWT_WM_NONREPARENTING=1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export NO_AT_BRIDGE=1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export WINIT_UNIX_BACKEND=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export DBUS_SESSION_BUS_ADDRESS
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export DBUS_SESSION_BUS_PID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Qtile 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:00:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2022-11-18 03:51:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/launch-qtile
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:00:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export SDL_VIDEODRIVER=wayland
							 
						 
					
						
							
								
									
										
										
										
											2022-11-09 15:29:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_SESSION_TYPE=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_SESSION_DESKTOP=wlroots
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_CURRENT_TYPE=wlroots
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_CURRENT_DESKTOP=wlroots
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. way-env-setup
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
							 
						 
					
						
							
								
									
										
										
										
											2022-11-18 03:51:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								exec qtile start -b wayland
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:00:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Newm 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:00:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/launch-newm
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export SDL_VIDEODRIVER=wayland
							 
						 
					
						
							
								
									
										
										
										
											2022-11-09 15:29:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_SESSION_TYPE=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_SESSION_DESKTOP=wlroots
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_CURRENT_TYPE=wlroots
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_CURRENT_DESKTOP=wlroots
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. way-env-setup
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 16:00:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								exec start-newm
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								***  Sway 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2023-03-27 13:21:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/swaybar-cmd
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2023-03-27 13:21:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh :tangle ~/.local/bin/launch-sway
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 15:18:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								export SDL_VIDEODRIVER=wayland
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# export XDG_SESSION_TYPE=wayland  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# export XDG_SESSION_DESKTOP=wlroots  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# export XDG_CURRENT_TYPE=wlroots  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								export XDG_CURRENT_DESKTOP=sway
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								. way-env-setup
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								exec sway --unsupported-gpu
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-27 13:21:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
										 
							
							
								Below is the script I use to display information in sway’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								divided by functions that are then called all together. First, getting
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the date is quite straightforward.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								sb_date() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo "$(date +'%Y-%m-%d %H:%M:%S') | "
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Then we can get what piece of audio is playing. Note however that
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								something will be displayed only if something is playing.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								sb_playerctl() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    PLAYING=""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if [ "$(playerctl status)" = "Playing" ]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        PLAYING_ARTIST="$(playerctl metadata xesam:artist)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        PLAYING_TITLE="$(playerctl metadata xesam:title)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        PLAYING=" $PLAYING_ARTIST - $PLAYING_TITLE | "
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo "$PLAYING"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The battery is relatively straightforward too. I should however find
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								how to get estimates of battery time. I’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								something, but for now I’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								sb_battery() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    CAPACITY="$(cat /sys/class/power_supply/BAT0/capacity)%"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    STATE="$(cat /sys/class/power_supply/BAT0/status)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    echo "$CAPACITY ($STATE)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Now comes an indicator for Docker containers which will be displayed
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								only if at least one is running.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								sb_docker() {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    DOCKER_RUNNING="$(docker ps -q | wc -l)"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    # echo "Docker: $DOCKER_RUNNING"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    if [ "$DOCKER_RUNNING" = "0" ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    then echo ""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    else echo "Docker: $DOCKER_RUNNING | "
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								Finally, let’ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								echo "$(sb_docker)$(sb_playerctl)$(sb_date)$(sb_battery) "
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 18:45:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								**  Weather 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/ .local/bin/we
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
									
										
										
										
											2022-05-08 23:15:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								A quick and useful script I often use is a ~curl~  request to [[http://v2.wttr.in/ ][v2.wttr.in ]] to get a
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								weather forecast in the terminal. By default, I want the request to be about the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								city I live in, but it is also possible for the script to accept as its
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								arguments a search inquiry.
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+BEGIN_SRC sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								if [ $# -gt 0 ]; then
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    SEARCH=$(printf "%s+" "$@")
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    SEARCH=${SEARCH%+}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    curl "http://v2.wttr.in/ ~$SEARCH"
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 11:31:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								else
							 
						 
					
						
							
								
									
										
										
										
											2024-11-08 20:09:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								    curl "http://v2.wttr.in/Aubervilliers"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								fi
							 
						 
					
						
							
								
									
										
										
										
											2020-11-29 23:43:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+END_SRC
							 
						 
					
						
							
								
									
										
										
										
											2024-02-21 04:40:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								**  Wrappers 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:PROPERTIES:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								:END:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								In order to avoid clutter in my =$HOME=  directory, I have some wrappers
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								around some commands that simply add some options by default.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh :tangle ~/.local/bin/adb
							 
						 
					
						
							
								
									
										
										
										
											2024-03-21 06:19:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								HOME="$XDG_DATA_HOME"/android /usr/bin/adb "$@"
							 
						 
					
						
							
								
									
										
										
										
											2024-02-21 04:40:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh :tangle ~/.local/bin/mbsync
							 
						 
					
						
							
								
									
										
										
										
											2024-03-21 06:19:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								/usr/bin/mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc "$@"
							 
						 
					
						
							
								
									
										
										
										
											2024-02-21 04:40:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								#+begin_src sh :tangle ~/.local/bin/wget
							 
						 
					
						
							
								
									
										
										
										
											2024-03-21 06:19:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								/usr/bin/wget --hsts-file="$XDG_DATA_HOME"/wget-hsts "$@"
							 
						 
					
						
							
								
									
										
										
										
											2024-02-21 04:40:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								#+end_src