[Fish, Bin, Bootstrap] Sxiv to Nsxiv, install custom packages
Change all references of sxiv to nsxiv. In bootstrap, install my custom packages from their PKGBUILD rather than from repositories.
This commit is contained in:
parent
490772669b
commit
8bc5d228dd
@ -234,15 +234,18 @@ nemo \
|
|||||||
nemo-fileroller \
|
nemo-fileroller \
|
||||||
nemo-preview \
|
nemo-preview \
|
||||||
obs-studio \
|
obs-studio \
|
||||||
rofi \
|
rofi
|
||||||
sent \
|
|
||||||
sxiv
|
|
||||||
|
|
||||||
printf "\n# Installing APPSPKG ##################################################\n\n"
|
printf "\n# Installing APPSPKG ##################################################\n\n"
|
||||||
for pkg in $APPSPKG
|
for pkg in $APPSPKG
|
||||||
paru -S --skipreview --needed $pkg
|
paru -S --skipreview --needed $pkg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/emacs && makepkg -si; cd ..
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/nsxiv && makepkg -si; cd ..
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/pumopm-git && makepkg -si; cd ..
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/sent && makepkg -si; cd ..
|
||||||
|
|
||||||
mkdir -p $HOME/.config/fish
|
mkdir -p $HOME/.config/fish
|
||||||
mkdir -p $HOME/.config/gtk-2.0
|
mkdir -p $HOME/.config/gtk-2.0
|
||||||
mkdir -p $HOME/.config/gtk-3.0
|
mkdir -p $HOME/.config/gtk-3.0
|
||||||
|
@ -288,12 +288,12 @@ printf "^f2^f0%s" "$UNREAD"
|
|||||||
:END:
|
:END:
|
||||||
It is possible to call a script on the resulting image of a ~scrot~
|
It is possible to call a script on the resulting image of a ~scrot~
|
||||||
command. Not only do I want to move them to a specific directory, I
|
command. Not only do I want to move them to a specific directory, I
|
||||||
also want to be able to see them in ~sxiv~ in case I want to edit the
|
also want to be able to see them in ~nsxiv~ (a replacement for ~sxiv~) in
|
||||||
image, copy it or simply delete it (sometimes I take screenshots by
|
case I want to edit the image, copy it or simply delete it (sometimes
|
||||||
accident).
|
I take screenshots by accident).
|
||||||
#+begin_src sh
|
#+begin_src sh
|
||||||
mv "$@" ~/Pictures/Screenshots/
|
mv "$@" ~/Pictures/Screenshots/
|
||||||
sxiv -abfs f "$HOME/Pictures/Screenshots/$*"
|
nsxiv -abfs f "$HOME/Pictures/Screenshots/$*"
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** sshbind
|
** sshbind
|
||||||
@ -309,33 +309,33 @@ intuitive way of writing it. Its usage is ~sshbind PORT FROMHOST TOHOST~.
|
|||||||
ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N
|
ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Sxiv key handler
|
** Nsxiv key handler
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:HEADER-ARGS: :mkdirp yes :tangle no :noweb yes
|
:HEADER-ARGS: :mkdirp yes :tangle no :noweb yes
|
||||||
:CUSTOM_ID: cli-utilities-Sxiv-key-handler-atganx41adj0
|
:CUSTOM_ID: cli-utilities-Sxiv-key-handler-atganx41adj0
|
||||||
:END:
|
:END:
|
||||||
One thing I like with ~sxiv~ is you can trigger different behaviors
|
One thing I like with ~nsxiv~ is you can trigger different behaviors
|
||||||
based on keypresses. For instance, with my current sxiv configuration,
|
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
|
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
|
trashcan, delete definitively, or open the current image in GIMP. All
|
||||||
of that is done through one script file stored in
|
of that is done through one script file stored in
|
||||||
~$HOME/.config/sxiv/exec/key-handler~. The fact it reacts to first the
|
~$HOME/.config/nsxiv/exec/key-handler~. The fact it reacts to first the
|
||||||
spacebar instead of /Ctrl-x/ is because I use a custom version of sxiv I
|
spacebar 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
|
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
|
the prefix to fit how I use Emacs and StumpWM. You can read the
|
||||||
PKGBUILD and my sxiv patch [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/Documents/code/PKGBUILDs/sxiv][in my dotfiles repo]].
|
PKGBUILD and my nsxiv patch [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/Documents/code/PKGBUILDs/sxiv][in my dotfiles repo]].
|
||||||
|
|
||||||
#+header: :shebang "#!/usr/bin/env fish" :tangle ~/.config/sxiv/exec/key-handler
|
#+header: :shebang "#!/usr/bin/env fish" :tangle ~/.config/nsxiv/exec/key-handler
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
<<sxiv-read-files>>
|
<<nsxiv-read-files>>
|
||||||
|
|
||||||
<<sxiv-switch-statement>>
|
<<nsxiv-switch-statement>>
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Here is a step by step explanation of the source code. First, we want
|
Here is a step by step explanation of the source code. First, we want
|
||||||
to store in the variable ~FILES~ all the files marked in sxiv. This is
|
to store in the variable ~FILES~ all the files marked in nsxiv. This is
|
||||||
done with a ~while~ loop and the ~read~ command.
|
done with a ~while~ loop and the ~read~ command.
|
||||||
#+name: sxiv-read-files
|
#+name: nsxiv-read-files
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
while read file
|
while read file
|
||||||
set -g FILES "$file" $FILES
|
set -g FILES "$file" $FILES
|
||||||
@ -344,22 +344,22 @@ end
|
|||||||
|
|
||||||
We can then read from the first member of ~argv~ which key the user
|
We can then read from the first member of ~argv~ which key the user
|
||||||
pressed. Depending on it, we can chose what to execute.
|
pressed. Depending on it, we can chose what to execute.
|
||||||
#+name: sxiv-switch-statement
|
#+name: nsxiv-switch-statement
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
switch "$argv[1]"
|
switch "$argv[1]"
|
||||||
<<sxiv-trash>>
|
<<nsxiv-trash>>
|
||||||
<<sxiv-rm>>
|
<<nsxiv-rm>>
|
||||||
<<sxiv-gimp>>
|
<<nsxiv-gimp>>
|
||||||
<<sxiv-jpeg>>
|
<<nsxiv-jpeg>>
|
||||||
<<sxiv-rotate-clockwise>>
|
<<nsxiv-rotate-clockwise>>
|
||||||
<<sxiv-rotate-counter-clockwise>>
|
<<nsxiv-rotate-counter-clockwise>>
|
||||||
<<sxiv-yank>>
|
<<nsxiv-yank>>
|
||||||
end
|
end
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The first option with the letter ~d~ is to move the file to the trash
|
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~.
|
can. For this, we use the ~trash~ command from ~trash-cli~.
|
||||||
#+name: sxiv-trash
|
#+name: nsxiv-trash
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "d"
|
case "d"
|
||||||
trash $FILES
|
trash $FILES
|
||||||
@ -367,29 +367,29 @@ case "d"
|
|||||||
|
|
||||||
In case we want to definitively delete a file without using the trash
|
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.
|
can, we can use ~rm~ instead when we press the ~D~ key.
|
||||||
#+name: sxiv-rm
|
#+name: nsxiv-rm
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "D"
|
case "D"
|
||||||
rm $FILES
|
rm $FILES
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
It’s not rare I want to modify an image I have open in sxiv,
|
It’s not rare I want to modify an image I have open in nsxiv,
|
||||||
especially since screenshots are automatically open in this image
|
especially since screenshots are automatically open in this image
|
||||||
viewer aften they are taken. In that case, a simple command will do.
|
viewer aften they are taken. In that case, a simple command will do.
|
||||||
#+name: sxiv-gimp
|
#+name: nsxiv-gimp
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "g"
|
case "g"
|
||||||
gimp $FILES
|
gimp $FILES
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Often, I use sxiv to convert an image to a jpeg file, because my
|
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
|
internet connection is not that great and jpeg screenshots are faster
|
||||||
to upload than png screenshots. So what I do is for each file
|
to upload than png screenshots. So what I do is for each file
|
||||||
selected, I take the base name of the file (i.e. remove its
|
selected, I take the base name of the file (i.e. remove its
|
||||||
extension), and then I use the ~convert~ command from ~imagemagik~ to
|
extension), and then I use the ~convert~ command from ~imagemagik~ to
|
||||||
convert it from its original format to a jpg format --- ~imagemagik~
|
convert it from its original format to a jpg format --- ~imagemagik~
|
||||||
detects the formats based on the extension.
|
detects the formats based on the extension.
|
||||||
#+name: sxiv-jpeg
|
#+name: nsxiv-jpeg
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "j"
|
case "j"
|
||||||
for f in $FILES
|
for f in $FILES
|
||||||
@ -401,7 +401,7 @@ case "j"
|
|||||||
I have two commands to rotate my files, and both only differ by the
|
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
|
angle of rotation. Once again I rely on ~convert~ in both cases. To
|
||||||
rotate clockwise, this is the code needed.
|
rotate clockwise, this is the code needed.
|
||||||
#+name: sxiv-rotate-clockwise
|
#+name: nsxiv-rotate-clockwise
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "r"
|
case "r"
|
||||||
for f in $FILES
|
for f in $FILES
|
||||||
@ -410,7 +410,7 @@ case "r"
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
On the other hand, to rotate counter-clockwise, we need this code:
|
On the other hand, to rotate counter-clockwise, we need this code:
|
||||||
#+name: sxiv-rotate-counter-clockwise
|
#+name: nsxiv-rotate-counter-clockwise
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "R"
|
case "R"
|
||||||
for f in $FILES
|
for f in $FILES
|
||||||
@ -424,7 +424,7 @@ 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
|
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
|
first of the selected files since the clipboard cannot hold several
|
||||||
files at once.
|
files at once.
|
||||||
#+name: sxiv-yank
|
#+name: nsxiv-yank
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
case "y"
|
case "y"
|
||||||
set FILE "$FILES[1]"
|
set FILE "$FILES[1]"
|
||||||
@ -2060,10 +2060,10 @@ set-pape "$PAPE"
|
|||||||
:CUSTOM_ID: Wallpaper-utilities-Select-wallpaper-42f477a9
|
:CUSTOM_ID: Wallpaper-utilities-Select-wallpaper-42f477a9
|
||||||
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/.local/bin/select-pape
|
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/.local/bin/select-pape
|
||||||
:END:
|
:END:
|
||||||
This script is based on what ~sxiv~ can do as an image viewer as well as
|
This script is based on what ~nsxiv~ can do as an image viewer as well as
|
||||||
xwallpaper.
|
xwallpaper.
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
PAPE=$(sxiv -orbft ~/Pictures/Wallpapers/*)
|
PAPE=$(nsxiv -orbft ~/Pictures/Wallpapers/*)
|
||||||
set-pape "$PAPE"
|
set-pape "$PAPE"
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
@ -440,8 +440,6 @@ Let’s install some desktop applications too, shall we?
|
|||||||
| nemo-preview | Quick file previewer for Nemo |
|
| nemo-preview | Quick file previewer for Nemo |
|
||||||
| obs-studio | Simply the best screen recording and streaming software |
|
| obs-studio | Simply the best screen recording and streaming software |
|
||||||
| rofi | A beautiful ~dmenu~ replacement |
|
| rofi | A beautiful ~dmenu~ replacement |
|
||||||
| sent | Dead simple presentation tool |
|
|
||||||
| sxiv | The best keyboard-driven image viewer (after Emacs) |
|
|
||||||
|
|
||||||
All these packages will be installed with the command ~paru -S
|
All these packages will be installed with the command ~paru -S
|
||||||
--skipreview --needed~ so it won’t nag me about the PKGBUILD when I
|
--skipreview --needed~ so it won’t nag me about the PKGBUILD when I
|
||||||
@ -457,7 +455,7 @@ installed it paru won’t try to reinstall it.
|
|||||||
(mapconcat #'identity packages " \\\n"))
|
(mapconcat #'identity packages " \\\n"))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+RESULTS[c695e04be22173bb49245f65a25c375d0ad865bf]: gen-package-list
|
#+RESULTS[3ba0427505dea021df862ce544adec325416ecf1]: gen-package-list
|
||||||
#+begin_src fish :exports none :tangle no
|
#+begin_src fish :exports none :tangle no
|
||||||
set APPS bitwarden \
|
set APPS bitwarden \
|
||||||
discord \
|
discord \
|
||||||
@ -468,8 +466,7 @@ nemo-fileroller \
|
|||||||
nemo-preview \
|
nemo-preview \
|
||||||
obs-studio \
|
obs-studio \
|
||||||
rofi \
|
rofi \
|
||||||
sent \
|
sent
|
||||||
sxiv
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+name: gen-package-install
|
#+name: gen-package-install
|
||||||
@ -519,6 +516,38 @@ end
|
|||||||
<<gen-package-install(varname="APPSPKG")>>
|
<<gen-package-install(varname="APPSPKG")>>
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Finally, I wish to install some custom packages for which I’ve written
|
||||||
|
a ~PKGBUILD~ file myself. I store all of them in a dedicated directory
|
||||||
|
located in ~$HOME/Documents/code/PKGBUILDs~. I want to install some of
|
||||||
|
them immediately.
|
||||||
|
#+name: packages-pkgbuild
|
||||||
|
| Package Name | What it is |
|
||||||
|
|--------------+------------------------------------------------------------------|
|
||||||
|
| emacs | My custom Emacs build, it will replace the one already installed |
|
||||||
|
| nsxiv | The best image viewer after Emacs |
|
||||||
|
| pumopm-git | My very simple battery manager |
|
||||||
|
| sent | A very simple presentation tool |
|
||||||
|
|
||||||
|
#+name: gen-package-pkgbuild
|
||||||
|
#+header: :wrap "src fish :exports none"
|
||||||
|
#+header: :exports none
|
||||||
|
#+begin_src emacs-lisp :var packages=packages-pkgbuild[,0]
|
||||||
|
(let ((base-dir "~/Documents/code/PKGBUILDs"))
|
||||||
|
(mapconcat (lambda (dir)
|
||||||
|
(format "cd %s && makepkg -si; cd .."
|
||||||
|
(expand-file-name dir base-dir)))
|
||||||
|
packages
|
||||||
|
"\n"))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+RESULTS[82db1c3f1b9c80b3c24075d1a20933be59baac47]: gen-package-pkgbuild
|
||||||
|
#+begin_src fish :exports none
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/emacs && makepkg -si; cd ..
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/nsxiv && makepkg -si; cd ..
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/pumopm-git && makepkg -si; cd ..
|
||||||
|
cd /home/phundrak/Documents/code/PKGBUILDs/sent && makepkg -si; cd ..
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Tangle configuration files from Org files
|
** Tangle configuration files from Org files
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: Execute_bootstrap-Tangle_configuration_files_from_Org_files-cc524361
|
:CUSTOM_ID: Execute_bootstrap-Tangle_configuration_files_from_Org_files-cc524361
|
||||||
|
@ -625,11 +625,11 @@ videoIdentifier~ to get it through ~youtube-dl~.
|
|||||||
abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"'
|
abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"'
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Some sane default options for ~sxiv~, a simple X image Viewer. This includes
|
Some sane default options for [[https://github.com/nsxiv/nsxiv][~nsxiv~]]. This includes playing GIFs and
|
||||||
playing GIFs and not displaying the filename below. Sxiv will also open in
|
not displaying the filename below. Nsxiv will also open in fullscreen
|
||||||
fullscreen and will fit the displayed image to the frame.
|
and will fit the displayed image to the frame.
|
||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish
|
||||||
abbr sxiv 'sxiv -abfs f'
|
abbr nsxiv 'nsxiv -abfs f'
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Finally, let's declare the following abbreviation that will launch an mpv
|
Finally, let's declare the following abbreviation that will launch an mpv
|
||||||
|
Loading…
Reference in New Issue
Block a user