creton32 4 months ago
parent
commit
13c5635502
  1. 64
      README.md
  2. 2
      bin/.local/bin/cast
  3. 30
      bin/.local/bin/ctc
  4. 21
      bin/.local/bin/ctl
  5. 2
      bin/.local/bin/fzfimg
  6. 13
      bin/.local/bin/lk
  7. 2
      bin/.local/bin/onm
  8. 200
      bin/.local/bin/ro
  9. 30
      bin/.local/bin/vpn
  10. 40
      browser/.config/tridactyl/tridactylrc
  11. BIN
      browser/.mozilla/firefox/profile/extensions/staged/uBlock0@raymondhill.net.xpi
  12. BIN
      browser/.mozilla/firefox/profile/extensions/uBlock0@raymondhill.net.xpi
  13. 2
      browser/.mozilla/firefox/profile/user.js
  14. 5
      display/.config/X11/xresources
  15. 6
      display/.config/picom/picom.conf
  16. 41
      editor/.config/nvim/settings/miscellaneous.vim
  17. 2
      fs/.config/vifm/vifmrc
  18. 2
      reader/.config/zathura/zathurarc
  19. 2
      term/.config/tmux/tmux.conf
  20. 2
      term/.config/zsh/.aliases
  21. 1
      term/.config/zsh/.zshenv
  22. 2
      term/.config/zsh/settings/core
  23. 17
      up
  24. 1
      util/.config/fd/ignore
  25. 2
      video/.config/straw-viewer/straw-viewer.conf

64
README.md

@ -101,34 +101,14 @@ I currently manage my plugins with [vim-plug](https://github.com/junegunn/vim-pl
I decided to start to use a cli Mail User Agent as I disliked accessing my emails through a browser (potentially missing out on important notifications) and I wasn't satisfied with the GUI alternatives on Linux such as [Thunderbird](https://thunderbird.net/) or [Mailspring](https://getmailspring.com/) ([Electron](https://josephg.com/blog/electron-is-flash-for-the-desktop/)).
I configured NeoMutt with vim-like keybindings and multi-account support. It should be noted that NeoMutt in and of itself wouldn't satisfy all of your needs, as its built-in IMAP support is quite slow in my experience and it doesn't have all the features other fancy desktop GUI mail clients do.
Therefore, I use NeoMutt in conjunction with many other tools listed below, following the UNIX philosophy of having each program do one thing and do it well.
+ To fetch and perform a two-way synchronization of my IMAP mailboxes I use [isync](https://isync.sourceforge.io/mbsync.html). With it, you are able to fetch emails from a remote email server and store them locally in your directory of choice (mine is `$XDG_DATA_HOME/Mail`). Config usually takes the form of
+ To fetch and perform a two-way synchronization of my IMAP mailboxes I use [isync](https://isync.sourceforge.io/mbsync.html). With it, you are able to fetch emails from a remote email server and store them locally.
```sh
IMAPAccount {account}
Host imap_account_server
User user_name
PassCmd "pass mail/account"
IMAPStore account-remote
Account {account}
Path $XDG_DATA_HOME/Mail/{account}
Inbox $XDG_DATA_HOME/Mail/{account}/Inbox
Channel {account}
Master :{account}-remote:
Slave :{account}-local:
Create Both
SyncState *
```
Then, one needs to make sure the `$XDG_DATA_HOME/Mail/{account}` directory exists and if we want to store this config in an XDG compliant way (that is, in `$XDG_CONFIG_HOME`), we can create the following shell alias `alias mbsync=mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc`.
Then we can simply do `mbsync -a` to synchronize all of our accounts or `mbsync {account}` for a specific account.
It should be noted that most accounts work OOTB with this setup, but some Google accounts which implement a form of OAUTH2 (such as G-suite accounts), usually embed a special token into IMAP. The simplest way to solve this is, if your server admin hasn't disabled the feature, to add an _App Password_ to your Google Account. To do this go to your [account settings](https://myaccount.google.com/security) and navigate to `Security > Signing in to Google > App passwords`, and generate a new app password for a device. Then, you can simply replace your account's password through `pass edit mail/{account}` with the newly generated app password.
If your Google Account is configured more strictly than this, you may want to have a look at this [Arch Wiki section](https://wiki.archlinux.org/index.php/Isync#Using_XOAUTH2) or this great [post on OAUTH2](http://mmogilvi.users.sourceforge.net/software/oauthbearer.html).
* [abook](http://abook.sourceforge.net/): text-based addressbook with NeoMutt integration and autocompletion.
* [msmtp](https://marlam.de/msmtp/): SMTP client to send emails.
* [lynx](https://lynx.invisible-island.net/):text-only browser I use to view HTML emails inside NeoMutt.
* [lynx](https://lynx.invisible-island.net/): text-only browser I use to view HTML emails inside NeoMutt.
* To listen on IMAP mailbox changes I use [goimapnotify](https://gitlab.com/shackra/goimapnotify), a program which allows me to execute scripts when a new message is received by the mail server, for example. I use this to call `isync` on the accound where the new message is received, and therefore I can get real time notifications by including the following in my `imapnotify_{account}.conf`, which is based on my [onm script](bin/.local/bin/onm) and displays a notification of the latest email received.
```sh
@ -137,12 +117,13 @@ If your Google Account is configured more strictly than this, you may want to ha
This is great as it prevents me from polling the email servers with a `cronjob`, which is far from efficient.
+ **File manager** - [vifm](https://vifm.info/) with personal fork of [vifm](https://github.com/cirala/vifmimg) which adds SVG file previews using `inkscape`. [ueberzug](https://github.com/seebye/ueberzug) is used for image previews.
+ **File manager** - [vifm](https://vifm.info/) with personal fork of [vifmimg](https://github.com/cirala/vifmimg) which adds SVG file previews using `inkscape`. [ueberzug](https://github.com/seebye/ueberzug) is used for image previews.
![vf](assets/vf.png "vf")
+ **Fuzzy finder** - [fzf](https://github.com/junegunn/fzf): extremely fast list filter, I use it to find files, directories, images, packages, among other as described in my [zsh fzf settings](term/.config/zsh/settings/fzf) in cojunction with these other tools:
* [fd](https://github.com/sharkdp/fd): simple, fast and user-friendly alternative to `find`
+ [proximity-sort](https://github.com/jonhoo/proximity-sort): sort files based on current `$PWD`
+ [ripgrep](https://github.com/BurntSushi/ripgrep): regex pattern based search tool for files in current directory
+ [bat](https://github.com/sharkdp/bat) as a `cat` clone with syntax highlighting and Git integration
![fzf](assets/fzf.png "fzf")
+ **Browser** - [Firefox](https://www.mozilla.org/en-US/firefox/new/)
Firefox is the best browser in terms of privacy and customisation available. You can tweak the browser appearance through a [userChrome.css](browser/.mozilla/firefox/profile/chrome/userChrome) file, I personally am a strong keyboard-only proponent so I've removed most of its UI buttons and features.
@ -151,8 +132,8 @@ Currently, I only have a single bar for everything I use, which includes a urlba
One can also alter arbitrary web content through a [userContent.css](browser/.mozilla/firefox/profile/chrome/userContent) or even edit its behaviour with a [user.js](browser/.mozilla/firefox/profile/user.js), which I use to harden some default settings in terms of security, tweak the default UI and improve the browser performance.
The following is the list of addons I use and if applicable, its configuration file:
+ [Bitwarden](https://github.com/bitwarden/browser): password manager. *Note: for some reason, this is the only extension I can access through my keyboard with `Ctrl+Shift+U`*.
+ [Cookie AutoDelete](https://github.com/Cookie-AutoDelete/Cookie-AutoDelete) [*config*](browser/.mozilla/firefox/profile/addons/cad): manage cookies and other storage settings on active tabs with support for Firefox Container Tabs.
+ [Stylus](https://github.com/openstyles/stylus) [*config*](browser/.mozilla/firefox/profile/addons/stylus): userstyles manager with live editor and support for CSS preprocessors.
+ [Cookie AutoDelete](https://github.com/Cookie-AutoDelete/Cookie-AutoDelete) [*\[config\]*](browser/.mozilla/firefox/profile/addons/cad): manage cookies and other storage settings on active tabs with support for Firefox Container Tabs.
+ [Stylus](https://github.com/openstyles/stylus) [*\[config\]*](browser/.mozilla/firefox/profile/addons/stylus): userstyles manager with live editor and support for CSS preprocessors.
+ [tridactyl](https://github.com/tridactyl/tridactyl) [*config*](browser/.config/tridactyl)
This is my favourite addon for the amount of extensibility it provides, rather than just adding vim-like bindings to the browser. In my experience, it truly is a whole new control mechanism, as I'm able to do things such as:
+ Redirect rules using the [webRequest](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest) API
@ -161,18 +142,19 @@ The following is the list of addons I use and if applicable, its configuration f
+ Set custom search engines.
![tri1](assets/tri1.png "tri1")
![tri2](assets/tri2.png "tri2")
+ [uBlock Origin](https://github.com/gorhill/uBlock) [*config*](browser/.mozilla/firefox/profile/addons/ubo): powerful content blocker with dynamic host filtering and custom filter lists.
+ [uBlock Origin](https://github.com/gorhill/uBlock) [*\[config\]*](browser/.mozilla/firefox/profile/addons/ubo): powerful content blocker with dynamic host filtering and custom filter lists.
+ **GTK3 theme** - [personal](gui/.config/gtk-3.0)
+ **Image manipulation** - [GIMP](https://github.com/GNOME/gimp)
+ **Vector manipulation** - [Inkscape](https://gitlab.com/inkscape/inkscape) is a FOSS vector drawing tool. It also provides a powerful cli that can convert SVGs to PNGs, which I use for `vifm` SVG previews.
+ **Image viewer** - [imv](https://github.com/eXeC64/imv)
I use [imv](https://github.com/eXeC64/imv) in most of my scripts as it natively supports gifs and SVGs, but for some odd reason its `.desktop` file doesn't let me use it as my default image viewer as defined with `xdg-mime default`, so for the moment I'm using [feh](https://feh.finalrewind.org/) as a fallback.
+ **Media payer** - [mpv](https://mpv.io/)
+ **Media player** - [mpv](https://mpv.io/)
I mostly use it to play YouTube videos when accessed from the browser with a redirect rule set in [Tridactyl](https://github.com/tridactyl/tridactyl). Additionally, I occassionally use [straw-viewer](https://github.com/trizen/straw-viewer) as a YouTube cli client that uses the Invidious API, but it is quite unstable as of lately because Invidious development [has almost stopped](https://omar.yt/posts/stepping-away-from-open-source). To stream audio, I use [tuner](https://github.com/Pauloo27/tuner) which provides search functionality for YouTube and Soundcloud without using their official APIs. Some of the scripts I use for `mpv` include:
+ [mpv_thumbnail_script](https://github.com/TheAMM/mpv_thumbnail_script) to show video preview thumbnails in the OSC.
+ [mpv_sponsorblock](https://github.com/po5/mpv_sponsorblock) to fully support [SponsorBlock](https://github.com/ajayyy/SponsorBlock) on `mpv`.
+ **Music player** - [Music Player Daemon (MPD)](https://www.musicpd.org/) and [ncmpcpp](https://github.com/ncmpcpp/ncmpcpp) as its client
+ **PDF reader** - [zathura](https://pwmt.org/projects/zathura/)
+ **Password manager** - [pass](https://www.passwordstore.org)
+ **2FA** - [pass-otp](https://github.com/tadfisher/pass-otp)
@ -197,21 +179,22 @@ pass otp otp/{account_name}
* **Wireless daemon** - **wpa_supplicant** with **dhcpcd**
I found [IWD](https://docs.voidlinux.org/config/network/iwd.html?highlight=iwd#iwd) too inconsistent. It may be caused by [this](https://bugzilla.kernel.org/show_bug.cgi?id=203709) or may be wireless-card specific.
* **Boot manager** - [rEFInd](https://www.rodsbooks.com/refind/) is better tailored to EFI operating systems as it doesn't provide a boot loader (which [GRUB](http://www.gnu.org/software/grub/) includes) as the Linux kernel already provides it since version 3.3.0. I particularly like the [rEFInd-minimal-black](https://github.com/andersfischernielsen/rEFInd-minimal-black) theme.
I tried to use [IWD](https://docs.voidlinux.org/config/network/iwd.html?highlight=iwd#iwd), which is said to be an optimized wireless daemon for Linux, but found it too unstable and had connection drops almost daily. It may have been caused by [this bug](https://bugzilla.kernel.org/show_bug.cgi?id=203709) or may be wireless card dependant, but for the moment I'm sticking with [wpa_supplicant](https://w1.fi/wpa_supplicant/).
* **Boot manager** - [rEFInd](https://www.rodsbooks.com/refind/)
Even though the default Void installation gives you the option to install [GRUB](https://www.gnu.org/software/grub/), I chose to opt for rEFInd as it's better tailored to UEFI operating systems due to the fact that it doesn't provide a boot loader (something GRUB does) as the Linux kernel ships one since version 3.3.0. For its theme, I'm very fond of [rEFInd-minimal-black](https://github.com/andersfischernielsen/rEFInd-minimal-black).
* **Audio server/mixer** - [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/)
I try to use [sndio](https://sndio.org/) for most of the applications that support it as it makes the audio experience on Linux dead simple, offering ALSA master control, allows having fallback devices and per application volume control. However, one major gripe I have with it is that it still doesn't support software ALSA PCMs, so projects like [bluez-alsa](https://github.com/Arkq/bluez-alsa) which bring bluetooth compatibility to ALSA, still don't work. I also use [alsa-sndio](https://github.com/Duncaen/alsa-sndio) and [apulse](https://github.com/i-rinat/apulse) for applications that don't support `sndio` or `ALSA` respectively.
Recently, I tried to switch audio servers to [sndio](https://sndio.org/) as Void compiles most of its packages with support for it. I must say, even though it's built on top of ALSA unlike its BSD counterpart, it makes the audio experience on Linux dead simple, offering ALSA master control, allowing having fallback devices and per application volume control. However, one major gripe I have with it is that it still doesn't support software ALSA PCMs, so projects like [bluez-alsa](https://github.com/Arkq/bluez-alsa) which bring bluetooth compatibility to ALSA, don't work. During my attempt, I also tried to incorporate [alsa-sndio](https://github.com/Duncaen/alsa-sndio) and [apulse](https://github.com/i-rinat/apulse) for applications that don't support `sndio` or `ALSA` respectively, but the experience was not what I expected. Eventually, I decided to move back to PulseAudio for the time being.
* **Keyboard firmware** - [QMK](https://github.com/qmk/qmk_firmware): provides keymaps to build custom firmwares for mechanical keyboards.
* **Screenshots utility** - [maim](https://github.com/naelstrof/maim)
* **Screenshot utility** - [maim](https://github.com/naelstrof/maim)
* **Screencast utility** - [ffmpeg](https://ffmpeg.org/)
* **Drag and drop** - [dragon](https://github.com/mwh/dragon)
* **RSS feed reader** - [Newsboat](https://github.com/newsboat/newsboat)
* [pam-gnupg](https://github.com/cruegge/pam-gnupg) to unlock my GPG and SSH keys on login
* [bat](https://github.com/sharkdp/bat) as a `cat` clone with syntax highlighting and Git integration
* **Task manager** - [Taskell](https://taskell.app) for kanban board management
* **Screen lock** - [XSecureLock](https://github.com/google/xsecurelock) for a secure and minimalist X11 screen lock utility
* **System monitor** - [bottom](https://github.com/ClementTsang/bottom) for a fast alternative to `htop`, `bashtop`, `gotop`
* **Task manager** - [Taskell](https://taskell.app) for Kanban board task management
* **Screen lock** - [XSecureLock](https://github.com/google/xsecurelock)
* **System monitor** - [bottom](https://github.com/ClementTsang/bottom)
* **Clibpoard utility** - [xclip](https://github.com/astrand/xclip)
* **VPN** - [wireguard](https://www.wireguard.com/)
* **VM management** - [virt-manager](https://virt-manager.org/) as a libvirt client for the QEMU virtualizer
@ -227,8 +210,12 @@ I try to use [sndio](https://sndio.org/) for most of the applications that suppo
+ [Iosevka Nerd Font Complete](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Iosevka) for Powerline symbols in Polybar
+ [IcoMoon Custom Pack](gui/.local/share/fonts/IcoMoon) for extra icons in Polybar
+ [Google Noto Emoji Fonts](https://github.com/void-linux/void-packages/tree/e013f03f557c876961eb81517577d977e5eeacdf/srcpkgs/noto-fonts-emoji) to support emojis
* **Cursor** - [Bibata Classic](https://github.com/KaizIqbal/Bibata_Cursor)
* **Icon theme** - [Papirus-Dark](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
* **Cursor** - [Bibata](https://github.com/KaizIqbal/Bibata_Cursor)
* **Icon theme** - [Papirus](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
* **Unit conversion** - [GNU Units](https://www.gnu.org/software/units/)
## XDG Base Directory
When possible, I try to stick to software that implements the basics of the [XDG Base Directory specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) as I'd much rather have an uncluttered `$HOME` directory and have an overall consistent file structure. Therefore, for those programs that do not directly support it, I've defined various environment variables or shell aliases that work around the issue in [.aliases](term/.config/zsh/.aliases).
## Scripts
* [au](bin/.local/bin/au)
@ -273,6 +260,7 @@ Makes use of Rofi's [dmenu mode](https://github.com/davatorium/rofi/wiki/dmenu_s
+ A help guide for current `sxhkd` bindings
+ `tmux` session selector
+ PulseAudio sink/source selector
+ Powermenu
* [sc](bin/.local/bin/sc)
@ -302,7 +290,7 @@ Wrapper around `wg-quick` to connect/disconnect to/from Wireguard interfaces and
* [wm](bin/.local/bin/wm)
Utilities for BSPWM, such as controlling the window bordergs/gap/padding, making each window resize on all 4 sides without having to use extra bindings, adding subscription events to listen to connected monitors and assign respective desktops, as well as being able to set desktop presets and providing polybar integration.
Utilities for BSPWM, such as controlling the window borders/gap/padding, listening on subscription events to set up workspaces on connected monitors, as well as being able to set desktop presets and providing polybar integration.
* [wp](bin/.local/bin/wp)

2
bin/.local/bin/cast

@ -47,7 +47,7 @@ stop() {
exit_program() {
printf "$(1)"
notify-send -u critical -t 3000 'Screencast error' "error: ${1}"
notify-send -u critical -t 3000 'Screencast Error' "${1}"
exit 1
}

30
bin/.local/bin/ctc

@ -1,14 +1,29 @@
#!/bin/bash
#!/usr/bin/env bash
clip="$(xclip -o -selection clipboard)"
# Hex to RGB
hr() {
clip="$(xclip -o -selection clipboard)"
([ -n "$clip" ] && [ -z "$1" ]) &&
hex="${clip:1}" || hex="${1:1}"
if ([ -n "$clip" ] && [ -z "$1" ]); then
hex="${clip:1}"
else
hex="${1:1}"
fi
rgb="$(printf "%d %d %d\n" 0x${hex:0:2} 0x${hex:2:2} 0x${hex:4:2})" &&
echo "$rgb" | xclip -selection clipboard && printf "$rgb\n"
}
# RGB to hex
rh() {
if ([ -n "$clip" ] && [ -z "$1" ]); then
rgb="${clip:1}"
else
rgb="${1:1}"
fi
hex="$(printf "#%02X%02X%02X" $rgb)" &&
echo "$hex" | xclip -selection clipboard && printf "$hex\n"
}
# RGB to float
rf() {
[ ! -z "$1" ] &&
@ -25,8 +40,7 @@ rf() {
}
case "$1" in
--hr)
hr "$2" ;;
--rf)
rf "$2";;
--hr) hr "$2" ;;
--rh ) rh "$2" ;;
--rf) rf "$2";;
esac

21
bin/.local/bin/ctl

@ -1,11 +1,14 @@
#!/bin/bash
PCTL_COMMAND="playerctl --player=%any,mpd"
get_metadata() {
position=$(playerctl metadata --format "{{duration(position)}} - {{duration(mpris:length)}}")
position=$($PCTL_COMMAND metadata --format "{{duration(position)}} - {{duration(mpris:length)}}")
echo "$position"
}
loop_status="$(playerctl loop 2>/dev/null)"
shuffle_status="$(playerctl shuffle 2>/dev/null)"
loop_status="$($PCTL_COMMAND loop 2>/dev/null)"
shuffle_status="$($PCTL_COMMAND shuffle 2>/dev/null)"
get_status() {
case "$1" in
--loop)
@ -30,23 +33,23 @@ toggle_status() {
for i in "${!loop_states[@]}"; do
if [[ ${loop_states[$i]} = "$loop_status" ]]; then
case $i in
0) playerctl loop Playlist ;;
1) playerctl loop None ;;
2) playerctl loop Track
0) $PCTL_COMMAND loop Playlist ;;
1) $PCTL_COMMAND loop None ;;
2) $PCTL_COMMAND loop Track
esac
fi
done
;;
--shuffle)
case "$shuffle_status" in
On) playerctl shuffle Off ;;
Off) playerctl shuffle On ;;
On) $PCTL_COMMAND shuffle Off ;;
Off) $PCTL_COMMAND shuffle On ;;
esac
esac
}
case "$1" in
-get)
echo "$(get_metadata) $(get_status --loop) $(get_status --shuffle)";;
echo "%{A4:playerctl position 15+:}%{A5:playerctl position 15-:}$(get_metadata)%{A-}%{A-} $(get_status --loop)";;
-toggle) toggle_status "$@" ;;
esac

2
bin/.local/bin/fzfimg

@ -125,7 +125,7 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
start_ueberzug
export -f draw_preview calculate_position
fd . "$HOME" -e ".png" -e ".jpg" | proximity-sort $PWD | SHELL="${BASH_BINARY}" fzf --prompt " " --preview "draw_preview {}" \
fd . "$HOME" -e ".png" -e ".jpg" | proximity-sort $PWD | SHELL="${BASH_BINARY}" fzf --prompt " " --preview "draw_preview {}" \
--preview-window "${DEFAULT_PREVIEW_POSITION}":noborder \
--bind "${REDRAW_KEY}:${REDRAW_COMMAND}" \
"${@}"

13
bin/.local/bin/lk

@ -0,0 +1,13 @@
#!/bin/sh
env \
XSECURELOCK_SHOW_HOSTNAME=0 \
XSECURELOCK_SHOW_USERNAME=0 \
XSECURELOCK_AUTH_FOREGROUND_COLOR=#9A9FBB \
XSECURELOCK_SAVER=saver_blank \
XSECURELOCK_FONT="Iosevka Custom:style=Regular" \
XSECURELOCK_PASSWORD_PROMPT=asterisks \
XSECURELOCK_AUTH_CURSOR_BLINK=0 \
XSECURELOCK_BLANK_DPMS_STATE=on \
XSECURELOCK_BLANK_TIMEOUT=-1 \
xsecurelock -- xdotool key 0

2
bin/.local/bin/onm

@ -52,7 +52,7 @@ new_unread() {
if [ "$count" -gt 0 ]; then
echo "$new" | while read -r file; do
get_email_content "$file"
notify-send "$from" "$subject" &
echo -e "$from | $subject"
done
fi
}

200
bin/.local/bin/ro

@ -1,15 +1,41 @@
#!/usr/bin/env bash
file_browser() {
rofi -show file-browser -theme launchers/files -file-browser-dir ~/documents/books -selected-row 1
}
app_menu() {
rofi -show drun -theme launchers/apps
}
ssh_menu() {
rofi -show ssh -theme launchers/ssh
}
window_menu() {
rofi -show window -theme launchers/windows
}
binds_help() {
awk '/^[a-z]/ && last {print "<small>",$0,"\t",last,"</small>"} {last=""} /^#/{last=$0}' \
${XDG_CONFIG_HOME:-~/.config}/sxhkd/sxhkdrc |
column -t -s $'\t' |
rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15 -yoffset 40
rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15 -yoffset 40 -theme global
}
tmux_sessions() {
# Currently attached sessions
sessions="$(tmux ls -F "#{?session_attached,1,0}")"
declare -a attached_sessions=()
local counter=0
for session in $sessions; do
if [[ $session -eq 1 ]]; then
attached_sessions+=( "$counter" )
fi
counter=$((counter + 1))
done
active_sessions="$(tmux list-session -F '#S')"
selected_session="$(printf '%s\n' $active_sessions | rofi -dmenu -p "Select tmux session: ")"
selected_session="$(printf '%s\n' $active_sessions | rofi -dmenu -p "" -theme launchers/tmux -a "$(echo ${attached_sessions[@]} | sed 's/ /,/g')")"
is_active_session=true
n_sessions=$(printf '%s\n' $active_sessions | wc -l)
counter=0
@ -19,11 +45,9 @@ tmux_sessions() {
fi
done
if [ "$n_sessions" -eq "$counter" ]; then
if [ "$n_sessions" -eq "$counter" ] && [ -n "$selected_session" ]; then
rofi-sensible-terminal -e tmux new-session -s "$selected_session" &
elif [ -z "$selected_session" ]; then
echo "Cancel"
else
elif [ -n "$selected_session" ]; then
rofi-sensible-terminal -e tmux attach -t "$selected_session"
fi
}
@ -31,31 +55,185 @@ tmux_sessions() {
pulse() {
case "$2" in
--sinks)
active="$(pacmd list-sinks | sed -n -e 's/[[:space:]][[:space:]]\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')"
sinks="$(pacmd list-sinks | sed -n -e 's/.*device.description[[:space:]]=[[:space:]]"\(.*\)"/\1/p')"
indexes="$(pacmd list-sinks | sed -n -e 's/.*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')"
local indexes="$(pacmd list-sinks | sed -n -e 's/.*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')"
for i in ${indexes[@]}; do
if [[ $i -eq $active ]]; then
special="-a $i -selected-row $(( $i + 1))"
fi
done
choices="$(paste -d ' ' <(echo "$indexes") <(echo "$sinks"))"
selected="$(echo "$choices" | rofi -dmenu -i -p "Available sinks" -theme $XDG_CONFIG_HOME/rofi/applets/pulse.rasi)"
selected="$(echo "$choices" | rofi -dmenu -i -p "$(echo "$indexes" | wc -l)" -theme applets/pulse_sinks $special)"
index="$(echo $selected | sed -n -e 's/^\([0-9]\).*/\1/p')"
pacmd set-default-sink "$index"
;;
--sources)
active="$(pacmd list-sources | sed -n -e 's/[[:space:]][[:space:]]\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')"
sources="$(pacmd list-sources | sed -n -e 's/.*device.description[[:space:]]=[[:space:]]"\(.*\)"/\1/p')"
indexes="$(pacmd list-sources | sed -n -e 's/.*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')"
local indexes="$(pacmd list-sources | sed -n -e 's/.*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')"
for i in ${indexes[@]}; do
if [[ $i -eq $active ]]; then
special="-a $i -selected-row $(( $i + 1))"
fi
done
echo "$special"
choices="$(paste -d ' ' <(echo "$indexes") <(echo "$sources"))"
selected="$(echo "$choices" | rofi -dmenu -i -p "Available sources" -theme $XDG_CONFIG_HOME/rofi/applets/pulse.rasi)"
selected="$(echo "$choices" | rofi -dmenu -i -p "$(echo "$indexes" | wc -l)" -theme applets/pulse_sources $special)"
index="$(echo $selected | sed -n -e 's/^\([0-9]\).*/\1/p')"
pacmd set-default-source "$index"
esac
}
utils() {
# Options
full_ss=""
region_ss=""
full_sc=""
region_sc=""
screencolor=""
colorpicker=""
options="$full_ss\n$region_ss\n$full_sc\n$region_sc\n$screencolor\n$colorpicker"
selected="$(echo -e $options | rofi -dmenu -theme menus/utils)"
case "$selected" in
$full_ss) sc -f ;;
$region_ss) sc ;;
$full_sc) cast -sc --f ;;
$region_sc) cast -sc --r ;;
$screencolor) color cp ;;
$colorpicker) color yd ;;
esac
}
power_menu() {
uptime="$(uptime -p | sed 's/up //')"
# Options
shutdown=""
reboot=""
lock=""
suspend=""
logout=""
options="$shutdown\n$reboot\n$lock\n$suspend\n$logout"
selected="$(echo -e "$options" | rofi -theme applets/powermenu -p \
"$uptime" -dmenu -selected-row 2)"
case "$selected" in
$shutdown) doas shutdown now ;;
$reboot) doas shutdown -r now ;;
$lock) [ -x "$(command -v lk)" ] && lk ;;
$suspend) zzz ;;
$logout) bspc quit ;;
esac
}
mail() {
onm --unread | rofi -dmenu -theme "applets/mail" -p "$(onm --count | awk '{print $2}')"
}
vpn_menu() {
connection="$(doas wg | awk '/interface/{print $2}')"
connection_status() {
[ -n "$connection" ] && echo 1
}
case "$2" in
--toggle)
if [[ "$(connection_status)" -eq 1 ]]; then
notify-send "Wireguard" "Disconnecting from $connection..."
doas wg-quick down "$connection" 2>/dev/null
else
config="$(doas find /etc/wireguard -type f -name "*.conf" -printf '%f\n')"
if [ $(printf '%s\n' $config | wc -l) -gt 1 ]; then
config_names=()
for file in ${config[@]}; do
config_name=$(basename "${file%.*}")
config_names+=( $config_name )
done
selected="$(printf '%s\n' ${config_names[@]} | rofi -dmenu -theme applets/vpn -p "$(printf '%s\n' $config | wc -l)")"
else
selected="$(basename "${config%.*}")"
fi
if [ -n "$selected" ]; then
notify-send "Wireguard" "Connecting to $selected..."
doas wg-quick up "$selected" 2>/dev/null
fi
fi
;;
--get)
case "$(connection_status)" in
1) echo \
"%{F#5F6FAB}%{T4}聯%{F-}%{T-}" ;;
*) echo "%{T4}輦%{T-}" ;;
esac
esac
}
wifi_menu() {
local interface="$(iw dev | awk '/Interface/{print $2}')"
local available_networks="$(iwlist $interface scan | awk -F: '/ESSID/{print $2}' | tr -d '""')"
local connection_status="$(iw $interface link)"
if [[ "$connection_status" == "Not connected." ]]; then
if [[ "$(echo $available_networks | wc -l)" -ge 2 ]]; then
local chosen_network="$(printf "$available_networks" | rofi -p "$connection_status" -dmenu -theme global)"
else
local chosen_network="$available_networks"
fi
# Check if network is already set up
if [[ -n "$(wpa_cli list_networks | awk 'FNR==3{print $2}')" ]]; then
notify-send "Connecting to $(wpa_cli list_networks | awk 'FNR==3{print $2}')..."
wpa_cli -i "$interface" reassociate >/dev/null &
else
network_password="$(rofi -p "Password for $chosen_network:" -password -dmenu -theme global)"
if [[ -n "$network_password" ]]; then
doas wpa_supplicant -B -D wext -i $interface -c <(wpa_passphrase "$chosen_network" "$network_password") &
sleep 5
local connection_status="$(iw $interface link)"
if [[ "$connection" == "Not connected." ]]; then
notify-send "Not connected"
else
notify-send "Connected to $chosen_network"
fi
fi
fi
else
notify-send "Disconnecting from $available_networks..."
wpa_cli -i $interface disconnect
fi
}
case "$1" in
--apps) app_menu ;;
--fs) file_browser ;;
--mail) mail ;;
--pm) power_menu ;;
-pulse) pulse ${@} ;;
--ssh) ssh_menu ;;
--sxhkd) binds_help ;;
--tmux) tmux_sessions ;;
-pulse) pulse ${@} ;;
--utils) utils ;;
-vpn) vpn_menu ${@} ;;
--wifi) wifi_menu ;;
--window) window_menu ;;
esac

30
bin/.local/bin/vpn

@ -1,30 +0,0 @@
#!/bin/sh
config="/etc/wireguard/wireguard.conf"
config_name=$(basename "${config%.*}")
connection_status() {
connection=$(doas wg show "$config_name" 2>/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config_name" ]; then
echo "1"
else
echo "2"
fi
}
case "$1" in
--toggle)
if [ "$(connection_status)" = "1" ]; then
notify-send "Wireguard" "Disconnecting from $config_name..."
doas wg-quick down "$config" 2>/dev/null
else
notify-send "Wireguard" "Connecting to $config_name..."
doas wg-quick up "$config" 2>/dev/null
fi
;;
*)
case "$(connection_status)" in
1) echo "%{F#5F6FAB}%{T4}聯%{F-}%{T-}" ;;
3) echo "%{T4}Config not found!%{T-}" ;;
*) echo "%{T4}輦%{T-}" ;;
esac
esac

40
browser/.config/tridactyl/tridactylrc

@ -31,13 +31,17 @@ au BeforeRequest https://*.youtube.com/* (details) => { \
" Open all supported media in mpv
jsb browser.webRequest.onBeforeRequest.addListener( \
details => { \
let url = new URL(details.url); \
url.hostname = "www.youtube.com"; \
tri.excmds.exclaim_quiet('mpv ' + url); \
return { cancel: true }; \
}, \
{ urls: [ "https://www.youtube.com/watch?v=*", "https://tube.cadence.moe/watch?v=*" ], types: [ "main_frame" ] }, [ "blocking" ] \
details => { \
let url = new URL(details.url); \
url.hostname = "www.youtube.com"; \
tri.excmds.exclaim_quiet('mpv ' + url); \
return { cancel: true }; \
}, \
{ \
urls: [ "https://www.youtube.com/watch?v=*", "https://tube.cadence.moe/watch?v=*" ], \
types: [ "main_frame" ] \
}, \
[ "blocking" ] \
);
" Redirect all SoundCloud requests to Soundcloud Redux
@ -48,12 +52,21 @@ au BeforeRequest https://soundcloud.com/* (details) => { \
};
" Redirect all Instagram requests to Bibliogram
au BeforeRequest https://www.instagram.com/* (details) => { \
let url = new URL(details.url); \
url.hostname = "bibliogram.art"; \
url.pathname = "/u" + url.pathname; \
return { redirectUrl: url + "" }; \
};
jsb browser.webRequest.onBeforeRequest.addListener( \
details => { \
let url = new URL(details.url); \
url.hostname = "bibliogram.art"; \
if (! url.pathname.includes('/p')) { \
url.pathname = "/u" + url.pathname; \
}; \
return { redirectUrl: url + "" }; \
}, \
{ \
urls: [ "https://www.instagram.com/*" ], \
types: [ "main_frame" ] \
}, \
[ "blocking" ] \
);
" Redirect all Twitter requests to Nitter
au BeforeRequest https://twitter.com/* (details) => { \
@ -280,6 +293,7 @@ set searchurls.pt https://sepiasearch.org/search?search=%s&sort=-match
set searchurls.yt https://www.youtube.com/search?q=%s
set searchurls.sc https://soundcloud.com/search?q=%s
set searchurls.ig https://www.instagram.com/%s
set searchurls.tw https://twitter.com/search?f=users&q=%s
" Link aggregators
set searchurls.r https://reddit.com/search?q=%s

BIN
browser/.mozilla/firefox/profile/extensions/staged/uBlock0@raymondhill.net.xpi

Binary file not shown.

BIN
browser/.mozilla/firefox/profile/extensions/uBlock0@raymondhill.net.xpi

Binary file not shown.

2
browser/.mozilla/firefox/profile/user.js

@ -192,8 +192,8 @@ user_pref("browser.cache.disk.enable", true);
// Clear history settings when Firefox closes
user_pref("privacy.clearOnShutdown.downloads", true);
user_pref("privacy.clearOnShutdown.formdata", true);
user_pref("privacy.clearOnShutdown.offlineApps", true);
// Disabled as otherwise session restore doesn't work
user_pref("privacy.clearOnShutdown.offlineApps", false);
user_pref("privacy.clearOnShutdown.cache", false);
user_pref("privacy.clearOnShutdown.history", false);
user_pref("privacy.clearOnShutdown.sessions", false);

5
display/.config/X11/xresources

@ -1,10 +1,7 @@
! X11 cursor config
Xcursor.theme: Bibata_Classic
Xcursor.theme: Bibata-Original-Classic
Xcursor.size: 16
! Font
*.font: -*-jetbrains mono-medium-r-normal--*-100-*-*-*-*-*-*
! General appaerance
*.background: #0f111a
*.foreground: #9a9fbb

6
display/.config/picom/picom.conf

@ -17,7 +17,8 @@ rounded-corners-exclude = [
"class_g = 'Dunst'",
"class_g = 'Polybar'",
"class_g = 'Yad'",
"class_g = 'Dragon'"
"class_g = 'Dragon'",
"class_g = 'Rofi'"
];
round-borders = 1;
round-borders-exclude = [
@ -34,7 +35,8 @@ round-borders-exclude = [
"class_g = 'Dunst'",
"class_g = 'Polybar'",
"class_g = 'Yad'",
"class_g = 'Dragon'"
"class_g = 'Dragon'",
"class_g = 'Rofi'"
];
# Specify a list of border width rules, in the format `PIXELS:PATTERN`,

41
editor/.config/nvim/settings/miscellaneous.vim

@ -13,6 +13,9 @@ function! TermToggle(height)
exec "buffer " . g:term_buf
catch
call termopen("cd " . s:currdir . " && " . $SHELL , {"detach": 0})
setlocal laststatus=0
\ noshowmode noruler noshowcmd nonumber signcolumn=no norelativenumber
\ nocursorcolumn nocursorline
let g:term_buf = bufnr("%")
endtry
startinsert!
@ -20,25 +23,35 @@ function! TermToggle(height)
endif
endfunction
" Toggle terminal
nnoremap <silent><C-e> <Esc>:call TermToggle(12)<CR>
inoremap <silent><C-e> <Esc>:call TermToggle(12)<CR>
" Terminal settings
if has ('nvim')
" Toggle terminal
nnoremap <silent><C-e> <Esc>:call TermToggle(12)<CR>
inoremap <silent><C-e> <Esc>:call TermToggle(12)<CR>
" Exit terminal-mode from within nvim terminal
tnoremap <silent><C-e> <C-\><C-n>:call TermToggle(12)<CR>
tnoremap :q! <C-\><C-n>:q!<CR>
" Exit terminal-mode
tnoremap <silent><C-e> <C-\><C-n>:call TermToggle(12)<CR>
tnoremap :q! <C-\><C-n>:q!<CR>
" Terminal go back to normal mode and fix fzf bindings
if has ('nvim')
au TermOpen * tnoremap <buffer><Esc> <c-\><c-n>
au TermOpen * setlocal laststatus=0
\ noshowmode noruler noshowcmd nonumber signcolumn=no norelativenumber
\ nocursorcolumn nocursorline
\| au BufLeave <buffer> setlocal laststatus=2 ruler
au FileType fzf tunmap <buffer><Esc>
" Hide unnecessary UI elements
au TermOpen * tnoremap <buffer><Esc> <C-\><C-n>
au BufEnter * call Hide_status_bar()
function! Hide_status_bar()
if &buftype == 'terminal'
setlocal laststatus=0
\ noshowmode noruler noshowcmd nonumber signcolumn=no norelativenumber
\ nocursorcolumn nocursorline
else
setlocal laststatus=2 ruler
endif
endfunction
endif
" Fix fzf bindings
au FileType fzf tunmap <buffer><Esc>
" Remove distractions in man pages
au FileType man set laststatus=0
\ noshowmode noruler nocursorline nocursorcolumn

2
fs/.config/vifm/vifmrc

@ -200,7 +200,7 @@ fileviewer *.otf,*.ttf,*.woff
\ vifmimg clear
" Audio
filetype <audio/*> ncmpcpp %f 2>/dev/null
filetype <audio/*> mpv --no-video %f 2>/dev/null &
fileviewer <audio/*>
\ vifmimg audiopreview %px %py %pw %ph %c
\ %pc

2
reader/.config/zathura/zathurarc

@ -76,7 +76,7 @@ set notification-warning-bg "#12141E"
set notification-warning-fg "#9A9FBB"
# Change theme
set recolor "false"
set recolor "true"
set recolor-keephue "true"
set recolor-reverse-video "true"
set recolor-lightcolor "#12141E"

2
term/.config/tmux/tmux.conf

@ -228,4 +228,4 @@ setw -g clock-mode-style 24
#
# Load tmux-current-pane-hostname plugin
run-shell ~/.config/tmux/plugins/tmux-current-pane-hostname/current_pane_hostname.tmux
run-shell /usr/share/tmux/current_pane_hostname.tmux

2
term/.config/zsh/.aliases

@ -39,6 +39,7 @@ alias gy="git-crypt"
alias gya="git-crypt add-gpg-user"
alias n="navi"
alias nt="navi --tldr"
alias units_cur="doas units_cur /usr/share/units/currency.units"
# Edit configuration files
@ -60,6 +61,7 @@ alias xsel="xsel --logfile $XDG_CACHE_HOME/xsel/log"
alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config"
alias gcal="gcalcli --config-folder $XDG_CONFIG_HOME/gcalcli"
alias gcalw="gcal calw now --monday --military --color-border black --color-date blue --color-now-marker cyan"
alias units="units --history $XDG_CACHE_HOME/units_history"
# Git

1
term/.config/zsh/.zshenv

@ -51,7 +51,6 @@ export MANROFFOPT="-c" \
NAVI_SNIPPET_COLOR=7 \
NAVI_TAG_WIDTH=10 \
NAVI_COMMENT_WIDTH=50 \
# STOW_DIR="$HOME/dotfiles" \
# ls colors
ls="di=1;34:ln=33:ex=32:tw:0:ow:0:*.md=37:*.css=32:*.txt=32"

2
term/.config/zsh/settings/core

@ -14,7 +14,7 @@ setopt histignorealldups
setopt autocd
# Attach/create main tmux session if not currently attached
[ -z "$TMUX" ] && [ $(tmux ls -F "#{session_name}#{?session_attached,1,0}" | awk '$NF=="main0"{print $1}') >/dev/null 2>&1 ] && tmux new-session -A -s main
[ -z "$TMUX" ] && [ $(tmux ls -F "#S#{?session_attached,1,0}" | awk '$NF=="main0"{print $1}') >/dev/null 2>&1 ] && tmux new-session -A -s main
# Enable colors
autoload -U colors && colors

17
up

@ -136,6 +136,12 @@ options snd-hda-intel index=0 model=alc255-asus,headset-mic
options snd-usb-audio index=1,2 vid=0x0c76,0x046d pid=0x161f,0x0826
EOF
fi
# Set up ddcutil
$(command -v ddcutil) &&
doas modprobe i2c-dev
doas groupadd --sytem i2c
doas usermod -G i2c -a $USER
# Enable bluetooth on startup
sed -i "s/AutoEnabled=no/AutoEnabled=yes" /etc/bluetooth/main.conf
@ -182,6 +188,9 @@ sv() {
# Set up sndio conf
[ -f /etc/sv/sndiod/conf ] &&
echo 'OPTS="-v 127 -f rsnd/PCH -F rsnd/Device"' | doas tee -a /etc/sv/sndiod/conf
# Set up Wireguard
doas chmod 700 /etc/wireguard/
}
# Generate a list of installed packages
@ -194,11 +203,13 @@ perm() {
doas usermod -aG bluetooth,docker,socklog $USER
echo "
permit persist keepenv $USER as root
permit nopass $USER cmd reboot
permit nopass $USER cmd shutdown
permit nopass $USER cmd xi
permit nopass $USER cmd input
permit nopass $USER wg-quick
permit nopass $USER wg
permit nopass $USER cmd wg-quick
permit nopass $USER cmd wg
permit nopass $USER cmd find
permit nopass $USER cmd sv
" | doas tee -a /etc/doas.conf
}

1
util/.config/fd/ignore

@ -2,3 +2,4 @@ node_modules
.git
.cache
Trash
undo

2
video/.config/straw-viewer/straw-viewer.conf

@ -3,7 +3,7 @@
# CLI Straw Viewer 0.1.0 - configuration file
our $CONFIG = {
api_host => "tube.connect.cafe",
api_host => "invidious.site",
auto_captions => 0,
autoplay_mode => 0,
cache_dir => "$ENV{HOME}/.cache/straw-viewer",

Loading…
Cancel
Save