Merge branch 'arch' into gentoo

This commit is contained in:
ItsDrike 2022-02-02 00:28:10 +01:00
commit d2ca79a5bc
No known key found for this signature in database
GPG key ID: FB8CA11A2CF3A843
54 changed files with 1687 additions and 687 deletions

3
.gitmodules vendored
View file

@ -13,3 +13,6 @@
[submodule "root/usr/local/src/z.lua"] [submodule "root/usr/local/src/z.lua"]
path = "root/usr/local/src/z.lua" path = "root/usr/local/src/z.lua"
url = "https://github.com/skywind3000/z.lua" url = "https://github.com/skywind3000/z.lua"
[submodule "home/.config/nvim"]
path = home/.config/nvim
url = https://github.com/ItsDrike/Stellar-Nvim

View file

@ -1,60 +1,87 @@
# Dotfiles # Dotfiles
These are my personal dotfiles. This also include an automated installer for certain packages (Arch Linux specific) and for putting the dotfiles in place. These are my personal dotfiles. They're split into `home/` and `root/` folders where the home folder holds all files
Source code for this automated script is in `src` directory, and the dotfiles are located in `home` and `root` directories respectively. that should be put directly into your `$HOME` directory, while all of the files in the root folder can be put directly
into `/`
You are highly adviced to first go through these dotfiles yourself and adjust them to your liking. You are highly advised to first go through these dotfiles yourself and adjust them to your liking.
## Sample images ## Sample images
- Custom prompt (defined [here](home/.config/shell/theme). - Custom prompt (defined [here](home/.config/shell/theme)).
- Colorscheme showcase: ![image](https://user-images.githubusercontent.com/20902250/117699472-69ab5d80-b1b4-11eb-85a8-2b039bc1599a.png) - Colorscheme showcase: ![image](https://user-images.githubusercontent.com/20902250/117699472-69ab5d80-b1b4-11eb-85a8-2b039bc1599a.png)
- Command timing showcase: ![image](https://user-images.githubusercontent.com/20902250/129356038-f1373183-ee50-4cc9-a602-a1215b5d1e5f.png) - Command timing showcase: ![image](https://user-images.githubusercontent.com/20902250/129356038-f1373183-ee50-4cc9-a602-a1215b5d1e5f.png)
- Neovim configuration (defined [`here`](home/.config/nvim/)) ![image](https://user-images.githubusercontent.com/20902250/129356722-9eb1e813-62c4-4ad1-ad49-114f69700f80.png) - Neovim configuration written in lua: ![Screenshot_2021-12-06_14-31-37](https://user-images.githubusercontent.com/20902250/144854879-f35de259-cea1-4415-9a3b-b093fe008836.png)
- Automatic unknown command package handler ![image](https://user-images.githubusercontent.com/20902250/129359888-629a4f28-64bd-4c90-8e87-de75a9b8997d.png) - Automatic unknown command package handler: ![image](https://user-images.githubusercontent.com/20902250/129359888-629a4f28-64bd-4c90-8e87-de75a9b8997d.png)
- `lf` file manager previews with ueberzug ![image](https://user-images.githubusercontent.com/20902250/129359042-b0594788-bc14-4294-bba2-8cba8e30cd94.png) - `lf` file manager previews with ueberzug: ![image](https://user-images.githubusercontent.com/20902250/129359042-b0594788-bc14-4294-bba2-8cba8e30cd94.png)
## Features ## Features
- Full fledged ZSH configuration without the need to rely on oh-my-zsh - Full fledged ZSH configuration without the need to rely on oh-my-zsh
- oh-my-zsh configuration is also supported, but it is off by default, adjust [`.zshrc`](home/.config/zsh/.zshrc) to enable it - oh-my-zsh configuration is also supported, but it is off by default, adjust [`.zshrc`](home/.config/zsh/.zshrc) to
- Even though enabling it is an option, it is not a necessary thing to do, oh-my-zsh has a lot of code that is mostly irrelevant and unused, these dotfiles give you the ability to completely avoid it, if you desire to do so enable it
- Even though enabling it is an option, it is not a necessary thing to do, oh-my-zsh has a lot of code that is mostly
irrelevant and unused, these dotfiles give you the ability to completely avoid it, if you desire to do so
- Custom [prompt](home/.config/shell/theme), both for oh-my-zsh configuration or for standalone usage - Custom [prompt](home/.config/shell/theme), both for oh-my-zsh configuration or for standalone usage
- Custom [VIM configuration](home/.config/nvim) - Custom [NVIM configuration](home/.config/nvim)
- When you open nvim for the first time, it will automatically try to install addons using VimPlug - When you open nvim for the first time, it will automatically try to install Packer plugin manager
- It is complatible with TTY usage, in which case the color support is downgraded and use of special fonts is disabled. - It is compatible with TTY usage, in which case the color support is downgraded and use of special fonts is
- There isn't a single huge configuration file, but rather multiple config files that are being sourced by the main init.vim, this is done to avoid clutter with comments in the main file and it also provides a very easy way to disable parts of configuration, by simply not sourcing that file. disabled.
- NOTE: This configuration is mostly designed for neovim, not regular vim, however it should work with some adjustments - The configuration is split into multiple smaller files to keep everything clearn and avoid clutter in the main
- Many handy [aliases](home/.config/shell/aliases) and [functions](home/.config/shell/functions) (likely too many, you should adjust that to your needs) configuration file (`init.lua`). It also allows for us to quickly disable certain parts of the config.
- The whole configuration is written in lua rather than vimscript. This allows us to do some nicer things, however
it also means that this config will NOT work for regular vim, it's only meant to be used for neovim.
- Many handy [aliases](home/.config/shell/aliases) and [functions](home/.config/shell/functions) (likely too many, you
should adjust that to your needs)
- [Many pre-defined environmental variables](home/.config/shell/environ), these include - [Many pre-defined environmental variables](home/.config/shell/environ), these include
- XDG paths configuration to avoid too much cluttering in home directory - XDG paths configuration to avoid too much cluttering in home directory
- Colorful man pages using LESS_TERMCAP, or if `bat` is installed, using it as MANPAGER - Colorful man pages using LESS_TERMCAP, or if `bat` is installed, using it as MANPAGER
- [Automatic handlers](home/.config/shell/handlers) which override default command not found behavior to show the package to which given command belongs (requires pkgfile on Arch Linux) - [Automatic handlers](home/.config/shell/handlers) which override default command not found behavior to show the
- Automated package installation for Arch Linux, which includes many handy packages. You should certainly take a look at which packages will be installed and adjust [`packages.yaml`](packages.yaml) before you run it. package to which given command belongs (requires pkgfile on Arch Linux)
- [Opensnitch firewall rules](root/etc/opensnitchd/rules), which block most unauthorized traffic and only allow needed things. This also blocks spotify ads. - List of useful packages that I often install on most of my systems. (These are the package names for arch linux, but
you should be able to find these for any distro, perhaps with a bit different name) located in
[`packages.yaml`](packages.yaml)
- [Opensnitch firewall rules](root/etc/opensnitchd/rules), which block most unauthorized traffic and only allow needed
things. This also blocks spotify ads.
- Automatic logout for TTY sessions or for root logins after 10 minutes of inactivity - Automatic logout for TTY sessions or for root logins after 10 minutes of inactivity
- NetworkManager configuration which assigns new mac for each network - NetworkManager configuration which assigns new mac for each network
- `lf` file manager configuration with support for ueberzug image previews within the terminal - `lf` file manager configuration with support for ueberzug image previews within the terminal
- Tons of handy scripts for automating common tasks - Tons of handy scripts for automating common tasks
- [`incremental-backup`](root/usr/local/bin/incremental-backup): Easy way to utilize rsync for all backups, without the need for external software - [`incremental-backup`](root/usr/local/bin/incremental-backup): Easy way to utilize rsync for all backups, without
- [`auto-chroot`](root/usr/local/bin/auto-chroot): Quick way to chroot into any other linux system, without typing the very repetetive mount and umount commands the need for external software
- [`tamper-check`](root/usr/local/bin/tamper-check): Script that uses checksums to verify that given files weren't adjusted in any way. - [`auto-chroot`](root/usr/local/bin/auto-chroot): Quick way to chroot into any other linux system, without typing
- [`brightness`](home/.local/bin/scripts/brightness): Script to quickly change screen brightness, you may need to adjust the BRIGHTNESS_FILE, this can be different from machine to machine the very repetitive mount and umount commands
- [`setbg`](home/.local/bin/scripts/setbg): Quick way to set desktop background to specific image, or random image, or previously used image - [`tamper-check`](root/usr/local/bin/tamper-check): Script that uses checksums to verify that given files weren't
adjusted in any way.
- [`brightness`](home/.local/bin/scripts/brightness): Script to quickly change screen brightness, you may need to
adjust the BRIGHTNESS_FILE, this can be different from machine to machine
- [`setbg`](home/.local/bin/scripts/setbg): Quick way to set desktop background to specific image, or random image,
or previously used image
- Many smaller dmenu scripts to make life easier - Many smaller dmenu scripts to make life easier
## Requirements
`curl` and `tar`, or `git` to clone the repository itself.
## Installation ## Installation
Clone this repository anywhere you like Clone this repository anywhere you like
`$ git clone https://github.com/ItsDrike/dotfiles` `$ git clone https://github.com/ItsDrike/dotfiles`
If you don't want to install git (running straight from newly installed os), you can use `curl`: <br> If you don't want to install git (running straight from newly installed OS), you can use `curl`: <br>
`$ curl -LJO https://github.com/ItsDrike/dotfiles/tarball/master` <br> `$ curl -LJO https://github.com/ItsDrike/dotfiles/tarball/master` <br>
And extract from `.tar.gz` archive: And extract from `.tar.gz` archive:
`$ tar xvf [archive name]` `$ tar xvf [archive name]`
## Attribution
The open-source community has an incredible amount of resources that people have offered to others free of charge and
we all depend on many of these sources. This project is no different and there were many open-source projects that were
utilized in some parts of this project. For that reason, I'd like to thank all of these projects and their
contributors for keeping their content open and available to everyone. This is the list of projects that helped me
build this repository to the stage it's in now. Many of the aliases, config files and other resources aren't my
original creations, but rather just small improvements and adjustments to get everything set in the way I like. Below
is the list of all projects which helped the existence of this repository:
- [Lukesmith's dotfiles/voidrice](https://github.com/LukeSmithxyz/voidrice)
- [BrodieRobertson's dotfiles](https://github.com/BrodieRobertson/dotfiles)
- [BrodieRobertson's scripts](https://github.com/BrodieRobertson/scripts)
- [Derek Taylor's dotfiles](https://gitlab.com/dwt1/dotfiles)

View file

@ -111,11 +111,10 @@ font:
# - (macOS) Menlo # - (macOS) Menlo
# - (Linux/BSD) monospace # - (Linux/BSD) monospace
# - (Windows) Consolas # - (Windows) Consolas
family: monospace family: JetBrains Mono
#family: Source Code Pro
# The `style` can be specified to pick a specific face. # The `style` can be specified to pick a specific face.
style: Regular style: Medium
# Bold font face # Bold font face
#bold: #bold:
@ -135,7 +134,7 @@ font:
# #
# If the italic family is not specified, it will fall back to the # If the italic family is not specified, it will fall back to the
# value specified for the normal font. # value specified for the normal font.
family: monospace #family: monospace
#family: Source Code Pro #family: Source Code Pro
# The `style` can be specified to pick a specific face. # The `style` can be specified to pick a specific face.

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=Discord
StartupWMClass=discord
Comment=All-in-one voice and text chat for gamers that's free, secure, and works on both your desktop and phone.
GenericName=Internet Messenger
Exec=/opt/discord/Discord --start-minimized
Icon=discord
Type=Application
Categories=Network;InstantMessaging;
Path=/usr/bin

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=Element
StartupWMClass=element
Comment=Chat client for matrix protocl
GenericName=Internet Messenger
Exec=/usr/bin/element-desktop --hidden
Icon=element
Type=Application
Categories=Network;InstantMessaging;
Path=/usr/bin

View file

@ -0,0 +1,16 @@
[Desktop Entry]
Type=Application
Name=OpenSnitch
Exec=/bin/sh -c 'pkill -15 opensnitch-ui; opensnitch-ui'
Icon=opensnitch-ui
GenericName=OpenSnitch Firewall
GenericName[hu]=OpenSnitch-tűzfal
Comment=Application firewall
Comment[es]=Firewall de aplicaciones
Comment[hu]=Alkalmazási tűzfal
Terminal=false
NoDisplay=false
Categories=System;Filesystem;Network;
Keywords=system;firewall;policies;security;polkit;policykit;
X-GNOME-Autostart-Delay=3
X-GNOME-Autostart-enabled=true

View file

@ -25,7 +25,7 @@
# positive x is measured from the left, negative from right # positive x is measured from the left, negative from right
# Y is measured from the top and bottom respectively. # Y is measured from the top and bottom respectively.
# width can be negative, making it the screen width - width # width can be negative, making it the screen width - width
geometry = "300x5-30+30" geometry = "300x0-30+30"
# Show how many messages are currently hidden (because of geometry) # Show how many messages are currently hidden (because of geometry)
indicate_hidden = yes indicate_hidden = yes
@ -153,7 +153,7 @@
max_icon_size = 32 max_icon_size = 32
# Paths to default icons # Paths to default icons
icon_path = /usr/share/icons/hicolor/16x16/status/:/usr/share/icons/hicolor/16x16/devices/:/usr/share/icons/hicolor/16x16/apps/:/usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/:/usr/share/icons/Adwaita/16x16/apps/ icon_path = /usr/share/icons/hicolor/16x16/status/:/usr/share/icons/hicolor/16x16/devices/:/usr/share/icons/hicolor/16x16/apps/
### History ### ### History ###
@ -218,7 +218,7 @@
# Close all notifications. # Close all notifications.
close_all = ctrl+shift+space close_all = ctrl+shift+space
# Redisplay last message(s) # Redisplay last message(s)
history = ctrl+grave history = ctrl+shift+grave
# Context menu # Context menu
context = ctrl+shift+period context = ctrl+shift+period
@ -226,7 +226,7 @@
background = "#35383b" background = "#35383b"
foreground = "#fcf7e2" foreground = "#fcf7e2"
frame_color = "#27292c" frame_color = "#27292c"
timeout = 3 timeout = 5
# Icon for notifications with low urgency, uncomment to enable # Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon #icon = /path/to/icon

View file

@ -0,0 +1,44 @@
[General]
contrastOpacity=188
disabledTrayIcon=true
drawColor=#ad00ff
drawThickness=1
filenamePattern=Screenshot_%Y-%m-%d_%H-%M-%S
savePath=/home/itsdrike/Pictures/Screenshots
savePathFixed=false
setSaveAsFileExtension=Portable Network Graphic file (PNG) (*.png)
showStartupLaunchMessage=true
startupLaunch=true
[Shortcuts]
TYPE_ARROW=A
TYPE_CIRCLE=C
TYPE_CIRCLECOUNT=
TYPE_COMMIT_CURRENT_TOOL=Ctrl+Return
TYPE_COPY=Ctrl+C
TYPE_DELETE_CURRENT_TOOL=Del
TYPE_DRAWER=D
TYPE_EXIT=Ctrl+Q
TYPE_MARKER=M
TYPE_MOVESELECTION=Ctrl+M
TYPE_MOVE_DOWN=Down
TYPE_MOVE_LEFT=Left
TYPE_MOVE_RIGHT=Right
TYPE_MOVE_UP=Up
TYPE_OPEN_APP=Ctrl+O
TYPE_PENCIL=P
TYPE_PIN=
TYPE_PIXELATE=B
TYPE_RECTANGLE=R
TYPE_REDO=Ctrl+Shift+Z
TYPE_RESIZE_DOWN=Shift+Down
TYPE_RESIZE_LEFT=Shift+Left
TYPE_RESIZE_RIGHT=Shift+Right
TYPE_RESIZE_UP=Shift+Up
TYPE_SAVE=Ctrl+S
TYPE_SELECTION=S
TYPE_SELECTIONINDICATOR=
TYPE_SELECT_ALL=Ctrl+A
TYPE_TEXT=T
TYPE_TOGGLE_PANEL=Space
TYPE_UNDO=Ctrl+Z

View file

@ -1,22 +1,77 @@
# This is Git's per-user configuration file.
[user] [user]
name = ItsDrike name = ItsDrike
email = itsdrikeofficial@gmail.com email = itsdrike@protonmail.com
signingkey = B5F6B41F708C3ADD signingkey = FB8CA11A2CF3A843
[credential]
helper = store --file ~/.config/git/git-credentials
[alias] [alias]
l = log --oneline --decorate --all --graph quickclone = "clone --single-branch --depth=1"
lol = log --pretty=oneline --abbrev-commit --graph bareclone = "!sh -c 'git clone --bare \"$0\" \"$1\"/.bare; echo \"gitdir: ./.bare\" > \"$1/.git\"'"
lg = log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
m = "merge"
p = "push"
pl = "pull"
f = "fetch"
s = "status --short --branch"
ss = "status"
ch = "checkout"
chb = "checkout -b"
undo = "reset --soft HEAD~"
redo = "reset HEAD@{1}"
unstage = "restore --staged"
c = "commit"
ca = "commit --ammend"
ci = "commit --interactive"
cm = "commit --message"
cv = "commit --verbose"
a = "add"
aa = "add --all"
ap = "add --patch"
au = "add --update"
d = "diff"
dc = "diff --cached"
ds = "diff --staged"
dw = "diff --word-diff"
b = "branch"
ba = "branch --all"
bd = "branch --delete"
bD = "branch --delete --force"
bm = "branch --move"
bM = "branch --move --force"
l = "log --oneline --decorate --all --graph"
lp = "log --patch"
lo = "log --pretty=oneline --abbrev-commit --graph"
lg = "log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
set-upstream = "!git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`"
stash-staged = "!sh -c 'git stash --keep-index; git stash push -m \"staged\" --keep-index; git stash pop stash@{1}'"
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
[credential]
helper = store --file ~/.config/git/git-credentials
[core]
excludefile = ~/.config/git/global_gitignore
editor = nvim
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
line-numbers = true
[merge] [merge]
tool = meld conflictstyle = diff3
[mergetool]
keepbackup = false
keeptemporaries = false
[diff] [diff]
tool = meld tool = vimdiff
[fetch]
prune = true
[commit] [commit]
gpgsign = true gpgsign = true
[gpg] [init]
program = /usr/bin/gpg defaultBranch = main

View file

@ -0,0 +1,25 @@
# vim: filetype=conf
# Byte-compiled / optimized / DLL Files
__pycache__/
*.py[cod]
*$py.class
# Virtual Environments
.venv/
# Editor project settings
## VSCode
.vscode/
## PyCharm intellij
.idea/
## repl.it
.replit
## spyder
.spyproject/
.spyderproject/
# Custom attributes for folders on Mac OS
.DS_Store
# Personal TODO files
TODO

View file

@ -12,7 +12,7 @@ set scrolloff 5
cmd open ${{ cmd open ${{
case $(file --mime-type "$f" -bL) in case $(file --mime-type "$f" -bL) in
text/*|application/json) $EDITOR "$f";; text/*|application/json) $EDITOR "$f";;
*) xdg-open "$f" ;; *) devour xdg-open "$f" ;;
esac esac
}} }}

View file

@ -1,5 +1,22 @@
# Vim keys seeking
l seek 5 l seek 5
h seek -5 h seek -5
j seek -60 j seek -60
k seek 60 k seek 60
S cycle sub
# Set A-B Loop key to g, since l was rebound
g ab-loop
# Swap i and I, use lowercase for toggle
i script-binding stats/display-stats-toggle
I script-binding stats/display-stats
# Zooming
- add video-zoom -.25
+ add video-zoom .25
# Moving/panning video
kp8 add video-pan-y .05
kp6 add video-pan-x -.05
kp2 add video-pan-y -.05
kp4 add video-pan-x .05
kp5 set video-pan-x 0; set video-pan-y 0; set video-zoom 0

View file

@ -0,0 +1,180 @@
# mpv keybindings
#
# Location of user-defined bindings: ~/.config/mpv/input.conf
#
# Lines starting with # are comments. Use SHARP to assign the # key.
# Copy this file and uncomment and edit the bindings you want to change.
#
# List of commands and further details: DOCS/man/input.rst
# List of special keys: --input-keylist
# Keybindings testing mode: mpv --input-test --force-window --idle
#
# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
#
# Strings need to be quoted and escaped:
# KEY show-text "This is a single backslash: \\ and a quote: \" !"
#
# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
#
# The default keybindings are hardcoded into the mpv binary.
# You can disable them completely with: --no-input-default-bindings
# Developer note:
# On compilation, this file is baked into the mpv binary, and all lines are
# uncommented (unless '#' is followed by a space) - thus this file defines the
# default key bindings.
# If this is enabled, treat all the following bindings as default.
#default-bindings start
#MBTN_LEFT ignore # don't do anything
#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen
#MBTN_RIGHT cycle pause # toggle pause/playback mode
#MBTN_BACK playlist-prev # skip to the previous file
#MBTN_FORWARD playlist-next # skip to the next file
# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
# numeric value accordingly
#WHEEL_UP seek 10 # seek 10 seconds forward
#WHEEL_DOWN seek -10 # seek 10 seconds backward
#WHEEL_LEFT add volume -2 # lower the volume
#WHEEL_RIGHT add volume 2 # raise the volume
## Seek units are in seconds, but note that these are limited by keyframes
#RIGHT seek 5 # seek 5 seconds forward
#LEFT seek -5 # seek 5 seconds backward
#UP seek 60 # seek 1 minute forward
#DOWN seek -60 # seek 1 minute backward
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
# Don't show them on the OSD (no-osd).
#Shift+RIGHT no-osd seek 1 exact # seek exactly 1 second forward
#Shift+LEFT no-osd seek -1 exact # seek exactly 1 second backward
#Shift+UP no-osd seek 5 exact # seek exactly 5 seconds forward
#Shift+DOWN no-osd seek -5 exact # seek exactly 5 seconds backward
#Ctrl+LEFT no-osd sub-seek -1 # seek to the previous subtitle
#Ctrl+RIGHT no-osd sub-seek 1 # seek to the next subtitle
#Ctrl+Shift+LEFT sub-step -1 # change subtitle timing such that the previous subtitle is displayed
#Ctrl+Shift+RIGHT sub-step 1 # change subtitle timing such that the next subtitle is displayed
#Alt+left add video-pan-x 0.1 # move the video right
#Alt+right add video-pan-x -0.1 # move the video left
#Alt+up add video-pan-y 0.1 # move the video down
#Alt+down add video-pan-y -0.1 # move the video up
#Alt++ add video-zoom 0.1 # zoom in
#Alt+- add video-zoom -0.1 # zoom out
#Alt+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 # reset zoom and pan settings
#PGUP add chapter 1 # seek to the next chapter
#PGDWN add chapter -1 # seek to the previous chapter
#Shift+PGUP seek 600 # seek 10 minutes forward
#Shift+PGDWN seek -600 # seek 10 minutes backward
#[ multiply speed 1/1.1 # decrease the playback speed
#] multiply speed 1.1 # increase the playback speed
#{ multiply speed 0.5 # halve the playback speed
#} multiply speed 2.0 # double the playback speed
#BS set speed 1.0 # reset the speed to normal
#Shift+BS revert-seek # undo the previous (or marked) seek
#Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
#q quit # exit
#Q quit-watch-later # exit and remember the playback position
#q {encode} quit 4 # exit
#ESC set fullscreen no # leave fullscreen
#ESC {encode} quit 4 # exit
#p cycle pause # toggle pause/playback mode
#. frame-step # advance one frame and pause
#, frame-back-step # go back by one frame and pause
#SPACE cycle pause # toggle pause/playback mode
#> playlist-next # skip to the next file
#ENTER playlist-next # skip to the next file
#< playlist-prev # skip to the previous file
#O no-osd cycle-values osd-level 3 1 # toggle displaying the OSD on user interaction or always
#o show-progress # show playback progress
#P show-progress # show playback progress
#i script-binding stats/display-stats # display information and statistics
#I script-binding stats/display-stats-toggle # toggle displaying information and statistics
#` script-binding console/enable # open the console
#z add sub-delay -0.1 # shift subtitles 100 ms earlier
#Z add sub-delay +0.1 # delay subtitles by 100 ms
#x add sub-delay +0.1 # delay subtitles by 100 ms
#ctrl++ add audio-delay 0.100 # change audio/video sync by delaying the audio
#ctrl+- add audio-delay -0.100 # change audio/video sync by shifting the audio earlier
#Shift+g add sub-scale +0.1 # increase the subtitle font size
#Shift+f add sub-scale -0.1 # decrease the subtitle font size
#9 add volume -2 # lower the volume
#/ add volume -2 # lower the volume
#0 add volume 2 # raise the volume
#* add volume 2 # raise the volume
#m cycle mute # toggle mute
#1 add contrast -1 # decrease the contrast
#2 add contrast 1 # increase the contrast
#3 add brightness -1 # decrease the brightness
#4 add brightness 1 # increase the brightness
#5 add gamma -1 # decrease the gamma
#6 add gamma 1 # increase the gamma
#7 add saturation -1 # decrease the saturation
#8 add saturation 1 # increase the saturation
#Alt+0 set current-window-scale 0.5 # halve the window size
#Alt+1 set current-window-scale 1.0 # reset the window size
#Alt+2 set current-window-scale 2.0 # double the window size
#d cycle deinterlace # toggle the deinterlacing filter
#r add sub-pos -1 # move subtitles up
#R add sub-pos +1 # move subtitles down
#t add sub-pos +1 # move subtitles down
#v cycle sub-visibility # hide or show the subtitles
#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles
#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer
#u cycle-values sub-ass-override "force" "no" # toggle overriding SSA/ASS subtitle styles with the normal styles
#j cycle sub # switch subtitle track
#J cycle sub down # switch subtitle track backwards
#SHARP cycle audio # switch audio track
#_ cycle video # switch video track
#T cycle ontop # toggle placing the video on top of other windows
#f cycle fullscreen # toggle fullscreen
#s screenshot # take a screenshot of the video in its original resolution with subtitles
#S screenshot video # take a screenshot of the video in its original resolution without subtitles
#Ctrl+s screenshot window # take a screenshot of the window with OSD and subtitles
#Alt+s screenshot each-frame # automatically screenshot every frame; issue this command again to stop taking screenshots
#w add panscan -0.1 # decrease panscan
#W add panscan +0.1 # shrink black bars by cropping the video
#e add panscan +0.1 # shrink black bars by cropping the video
#A cycle-values video-aspect-override "16:9" "4:3" "2.35:1" "-1" # cycle the video aspect ratio ("-1" is the container aspect)
#POWER quit # exit
#PLAY cycle pause # toggle pause/playback mode
#PAUSE cycle pause # toggle pause/playback mode
#PLAYPAUSE cycle pause # toggle pause/playback mode
#PLAYONLY set pause no # unpause
#PAUSEONLY set pause yes # pause
#STOP quit # exit
#FORWARD seek 60 # seek 1 minute forward
#REWIND seek -60 # seek 1 minute backward
#NEXT playlist-next # skip to the next file
#PREV playlist-prev # skip to the previous file
#VOLUME_UP add volume 2 # raise the volume
#VOLUME_DOWN add volume -2 # lower the volume
#MUTE cycle mute # toggle mute
#CLOSE_WIN quit # exit
#CLOSE_WIN {encode} quit 4 # exit
#ctrl+w quit # exit
#E cycle edition # switch edition
#l ab-loop # set/clear A-B loop points
#L cycle-values loop-file "inf" "no" # toggle infinite looping
#ctrl+c quit 4 # exit
#DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always
#ctrl+h cycle-values hwdec "auto" "no" # toggle hardware decoding
#F8 show-text ${playlist} # show the playlist
#F9 show-text ${track-list} # show the list of video, audio and sub tracks
#
# Legacy bindings (may or may not be removed in the future)
#
#! add chapter -1 # seek to the previous chapter
#@ add chapter 1 # seek to the next chapter
#
# Not assigned by default
# (not an exhaustive list of unbound commands)
#
# ? cycle sub-forced-only # toggle DVD forced subs
# ? stop # stop playback (quit or enter idle mode)

View file

@ -0,0 +1,47 @@
unbind-key j
unbind-key k
unbind-key h
unbind-key H
unbind-key L
unbind-key c
unbind-key ,
browser "xdg-open %u"
# Feed settings
prepopulate-query-feeds yes
refresh-on-startup yes
# Macros
macro w set browser "mpv %u" ; open-in-browser ; set browser "xdg-open %u"
macro r set browser "w3m %u" ; open-in-browser ; set browser "xdg-open %u"
# bind keys
bind-key ; macro-prefix
bind-key BACKSPACE quit
bind-key h quit
bind-key j down
bind-key k up
bind-key l open
bind-key H prev-feed
bind-key L next-feed
bind-key c toggle-show-read-feeds
color background default default
color listnormal default default
color listnormal_unread default default
color listfocus color16 cyan
color listfocus_unread color16 cyan
color info default black
color article default default
highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold
highlight article "(^Link:.*|^Date:.*)" default default
highlight article "https?://[^ ]+" green default
highlight article "^(Title):.*$" blue default
highlight article "\\[[0-9][0-9]*\\]" magenta default bold
highlight article "\\[image\\ [0-9]+\\]" green default bold
highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold
highlight article ":.*\\(link\\)$" cyan default
highlight article ":.*\\(image\\)$" blue default
highlight article ":.*\\(embedded flash\\)$" magenta default

View file

@ -0,0 +1,2 @@
https://itsdrike.com/posts/index.xml
https://archlinux.org/feeds/news

1
home/.config/nvim Submodule

@ -0,0 +1 @@
Subproject commit 5e10bd30328a890bc2f62d8687b3c346a8032b14

View file

@ -1,14 +0,0 @@
" Let init.vim handle sourcing other more specific
" vim configuration files, rather than keeping everything
" in a single huge config file
let config_dir = system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim"')
let rc_dir = config_dir.'/rc'
execute 'source '.rc_dir.'/base.vim'
execute 'source '.rc_dir.'/mappings.vim'
execute 'source '.rc_dir.'/abbreviations.vim'
execute 'source '.rc_dir.'/autocmd.vim'
execute 'source '.rc_dir.'/plugins.vim'
" Needs to be below plugins for colorscheme
execute 'source '.rc_dir.'/theme.vim'

View file

@ -1,11 +0,0 @@
cnoreabbrev Wq wq
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev Wa wa
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev Qall! qall!

View file

@ -1,15 +0,0 @@
" Move ~/.viminfo to XDG_CACHE_HOME
"set viminfofile=$XDG_CACHE_HOME/vim/viminfo
" Disable automatic commenting on newline
autocmd FileType * setlocal formatoptions-=cro
" Have Vim jump to the last position when reopening a file
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" Automatically deletes all trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e
" Enable spellcheck for certain file types
autocmd FileType tex,latex,markdown,gitcommit setlocal spell spelllang=en_us

View file

@ -1,28 +0,0 @@
filetype plugin on " Enable filetype detection
" Tab settings
set expandtab " Expand tabs to spaces
set tabstop=4 " Tab size
set shiftwidth=4 " Indentation size
set softtabstop=4 " Tabs/Spaces interrop
set tabpagemax=50 " More tabs
" In-file Search (/)
set ignorecase " Do case insensitive matching
set incsearch " Show partial matches for a search phrase
set hlsearch " Highlight Search
" Command-mode search
set path+=** " Search down into subfolders with tab completion
set wildmode=longest,list,full " Enable autocompletion
set wildmenu " Display all matching files when we tab complete
" Misc
set autoindent " Enable autoindent
set autoread " Reload files on change
set undolevels=999 " Lots of these
set history=1000 " More history
set encoding=utf-8 " Use UTF-8 encoding
set mouse=a " Enable mouse mode
set splitbelow splitright " Split in more natural way

View file

@ -1,60 +0,0 @@
" Unmap arrow keys in normal mode to remove bad habits
nnoremap <Down> <nop>
nnoremap <Left> <nop>
nnoremap <Right> <nop>
nnoremap <Up> <nop>
" Stop search highlight on Ctrl+l (until next search)
map <silent> <C-l> :noh<CR>
" System clipboard interactions
map <C-c> "+y
vnoremap <C-v> "+p
" Start spell-check
map <leader>s :setlocal spell! spelllang=en_us<CR>
" Use shift to move 10 lines up/down quickly
noremap <silent> K 10k
noremap <silent> J 10j
" Enable/Disable auto comment
map <leader>c :setlocal formatoptions-=cro<CR>
map <leader>C :setlocal formatoptions=cro<CR>
" Tab navigation
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <silent> <A-t> :tabnew<CR>
nnoremap <silent> <A-2> :tabmove +<CR>
nnoremap <silent> <A-1> :tabmove -<CR>
nnoremap <A-p> :tabp<CR>
nnoremap <A-n> :tabn<CR>
" Remap splits navigation to just CTRL + hjkl
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Make adjusting split sizes a bit more friendly
noremap <silent> <C-Left> :vertical resize +3<CR>
noremap <silent> <C-Right> :vertical resize -3<CR>
noremap <silent> <C-Up> :resize +3<CR>
noremap <silent> <C-Down> :resize -3<CR>
" Alias replace all
nnoremap <A-s> :%s//gI<Left><Left><Left>
" Save file as sudo when no write permissions
cmap w!! w !sudo tee > /dev/null %
" Don't leave visual mode after indenting
vmap < <gv
vmap > >gv
" Compile opened file (using custom comp script)
nnoremap <A-c> :w \| !comp <c-r>%<CR>
" Shell check
nnoremap <leader>p :!shellcheck %<CR>

View file

@ -1,13 +0,0 @@
" Airline specific theming settings
let g:airline_theme='codedark' " Use codedark theme from vim-ariline-themes
let g:airline_right_sep = "" " Don't use special separators (<)
let g:airline_left_sep = "" " Don't use special separators (>)
let g:airline#extensions#tabline#enabled = 1 " Enable tabline (top line)
let g:airline#tabline#formatter = 'unique_tail' " Tabline filename formatter
let g:webdevicons_enable_airline_statusline = 0 " Use special icons from vim-devicons (requires nerdfonts)
let g:airline_powerline_fonts = 1 " Use special symbols from powerline fonts (line no, col no)
if empty($DISPLAY) " Use ASCII-only if we're in TTY
let g:airline_symbols_ascii = 1
endif

View file

@ -1,12 +0,0 @@
" NERDTree config
map <C-n> :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable = '►'
let g:NERDTreeDirArrowCollapsible = '▼'
let NERDTreeShowLineNumbers=1
let NERDTreeShowHidden=1
let NERDTreeMinimalUI = 1
let g:NERDTreeWinSize=38
if empty($DISPLAY) " Disable devicons for nerdtree in TTY
let g:webdevicons_enable_nerdtree = 0
endif

View file

@ -1,12 +0,0 @@
" Define python-specific neomake config
" Neomake is python syntax checker, in this case, we use flake8
" Requires: pip install flake8
let g:neomake_python_enabled_makers = ['flake8']
let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']}
call neomake#configure#automake('nrwi', 500)
" Enable deoplete on startup
" Deoplete provides autosuggestions from python standard library
" Requires: pip install pynvim
let g:deoplete#enable_at_startup = 1

View file

@ -1,8 +0,0 @@
let wiki_conf = {}
let wiki_conf.path = '~/Personal/vimwiki'
let wiki_conf.path_html = '~/Personal/vimwiki-html'
let wiki_conf.html_template = '~/Personal/vimwiki-html/template.tpl'
let wiki_conf.syntax = 'markdown'
let wiki_conf.ext = '.md'
let g:vimwiki_list = [wiki_conf]

View file

@ -1,43 +0,0 @@
" This file handles plugin management with plug.vim
" It contains an automatic first-time installer for plug.vim and plugins
" It also sources plugin specific config files
" Install plugins automatically
if ! filereadable(config_dir."/autoload/plug.vim")
echo "Downloading junegunn/vim-plug to manage plugins..."
let x = system('mkdir -p '.config_dir.'/autoload')
let x = system('curl https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > '.config_dir.'/autoload/plug.vim')
autocmd VimEnter * PlugInstall
endif
" Plug.vim plugin list
call plug#begin(config_dir."/plugged")
" Code completion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Themes
Plug 'tomasiser/vim-code-dark'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
" Python
Plug 'neomake/neomake'
Plug 'zchee/deoplete-jedi'
" Misc
Plug 'dhruvasagar/vim-table-mode'
Plug 'vimwiki/vimwiki'
Plug 'wakatime/vim-wakatime'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
call plug#end()
" Source more plugin-specific configuration files from here
let plugins_rc_dir = rc_dir."/plugins.d"
execute "source ".plugins_rc_dir."/airline.vim"
execute "source ".plugins_rc_dir."/nerdtree.vim"
execute "source ".plugins_rc_dir."/vimwiki.vim"
execute "source ".plugins_rc_dir."/python.vim"

View file

@ -1,26 +0,0 @@
" General colorscheme settings
syntax on " Turn syntax highlighting on
colorscheme codedark " Requires vim-code-dark plugin
set cursorline " Highlight cursor line
set laststatus=2 " Always show status line
set number relativenumber " Show relative line numbers
set showmatch " Show matching brackets
set scrolloff=5 " Keep 5 lines horizonal scrolloff
set sidescrolloff=5 " Keep 5 characters vertical scrolloff
set guioptions-=m " Remove menubar
set guioptions-=T " Remove toolbar
set guioptions-=r " Remove right-hand scrollbar
set guioptions-=L " Remove left-hand scrollbar
" Use more noticable cursor line color
highlight CursorLine guibg=#2b2b2b
" Don't use true colors in TTY
if empty($DISPLAY)
set notermguicolors
else
set termguicolors
endif

View file

@ -1,16 +1,175 @@
# Apply blur to terminals # NOTE 1: This configuration when used as-is, requires --experimental-backends
# command line option to be used, in order to enable the usage of the
# dual-kawase blur method.
# NOTE 2: With the picom from standard repositories, currently using experimental
# backends will disable the support for rounded corners. If you want to use both
# the dual-kawase blur method and rounded corners, you will need to use a fork.
# However it is not mandantory. If you will use the standard version, you will just
# see a warning in picom's logs each time it's started, you can disable rounded
# corners completely to prevent this. If you do want to use a fork, I recommend this:
# <https://github.com/jonaburg/picom> (picom-jonaburg-git on AUR).
# NOTE 3: The shadows are currently disabled, the reason for this are the issues
# that occur with combining rounded corners and shadows, for more info, check:
# <https://github.com/jonaburg/picom/issues/62>
# General settings
###################
# Daemonize process. Fork to background after initialization.
# Causes issues with certain (badly-written) drivers.
daemon = false
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
# We use GLX since it's generally a lot faster than xrender.
# There usually aren't anny issues with this, but if you do experience some
# try falling back to xrender.
backend = "glx";
# To properly use the GLX backend, we need to enable experimental backends
experimental-backends = true;
# Enable/Disable VSync.
vsync = true;
# Enable remote control via D-Bus.
dbus = false;
# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
mark-wmwin-focused = true;
# Mark override-redirect windows that doesn't have a child window
# with 'WM_STATE' focused.
mark-ovredir-focused = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
detect-rounded-corners = true;
# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_OPACITY' of client windows to frame windows.
detect-client-opacity = true;
# Specify refresh rate of the screen. If not specified or 0, picom will
# try detecting this with X RandR extension.
refresh-rate = 0;
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
glx-no-stencil = true;
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
glx-no-rebind-pixmap = true;
# Disable/Enable the use of damage information.
# Disabling cause the whole screen to be redrawn everytime, instead of the part
# of the screen has actually changed. Potentially degrades the performance,
# but might fix some artifacts. It is recommended to keep this enabled.
# The opposing option is no-use-damage
use-damage = true
# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
# "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
# fade, shadow:::
# Controls window-type-specific shadow and fade settings.
#
# opacity:::
# Controls default opacity of the window type.
#
# focus:::
# Controls whether the window of this type is to be always considered focused.
# (By default, all window types except "normal" and "dialog" has this on.)
#
# full-shadow:::
# Controls whether shadow is drawn under the parts of the window that you
# normally won't be able to see. Useful when the window has parts of it
# transparent, and you want shadows in those areas.
#
# redir-ignore:::
# Controls whether this type of windows should cause screen to become
# redirected again after been unredirected. If you have unredir-if-possible
# set, and doesn't want certain window to cause unnecessary screen redirection,
# you can set this to `true`.
#
wintypes:
{
normal = { full-shadow = true; blur-background = true; };
splash = { blur-background = false; };
menu = { full-shadow = true; };
tooltip = { fade = true; shadow = false; focus = true;};
dock = { shadow = false; };
dnd = { shadow = false; };
popup_menu = { full-shadow = true; };
utility = { full-shadow = true; };
toolbar = { full-shadow = true; };
notification = { opacity = 1; }
};
# Transparency / Opacity
#########################
# Specify a list of opacity rules.
# format: "[Opacity level]:[xprop info name] = '[xprop value]'" # format: "[Opacity level]:[xprop info name] = '[xprop value]'"
# class_g reffers to class in position #0, # - class_g reffers to class in position #0,
# class_i reffers to class in position #1 # - class_i reffers to class in position #1
# Note we don't make any guarantee about possible conflicts with other
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
# Apply blur to terminals
opacity-rule = [ opacity-rule = [
"90:class_g = 'Alacritty'", "100:name = 'Dunst'",
"90:class_g = 'st-256color'", # Opacities with enabled shadows (shadows allow for higher alpha - lower number)
"90:class_g = 'URxvt'", #"70:class_g = 'Alacritty'",
"90:class_g = 'kitty'", #"70:class_g = 'st-256color'",
"90:class_g = 'tabbed'" #"70:class_g = 'URxvt'",
#"70:class_g = 'kitty'",
#"82:class_g = 'Spotify'"
# Opacities without shadows
"80:class_g = 'Alacritty'",
"80:class_g = 'st-256color'",
"80:class_g = 'URxvt'",
"80:class_g = 'kitty'",
"92:class_g = 'Spotify'"
]; ];
# Blur # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
active-opacity = 1;
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
inactive-opacity = 1;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
frame-opacity = 1.0;
# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
opacity = 1.0
# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
inactive-opacity-override = false
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
inactive-dim = 0.0
# Use fixed inactive dim value, instead of adjusting according to window opacity.
inactive-dim-fixed = 1.0
# Specify a list of conditions of windows that should always be considered focused.
focus-exclude = []
# Background blurring
########################
blur: blur:
{ {
# dual_kawase blur method requires GLX as backend # dual_kawase blur method requires GLX as backend
@ -18,28 +177,113 @@ blur:
# dual_kawase allows for multi-threaded bluring that's # dual_kawase allows for multi-threaded bluring that's
# very fast. # very fast.
method = "dual_kawase"; method = "dual_kawase";
strength = 1; #method = "kernel";
#kernel = "11x11gaussian";
strength = 4;
deviation = 1.0;
# When true, blur background of semi-transparent / ARGB window.
background = false;
# When true, the background of windows when the window frame
# is not opaque is blurred, implies background=true
background-frame = false;
# Whe true, use fixeed blur strength rather than adjusing
# according to window opacity
background-fixed = false;
# Specify the blur convolution kernel
kern = "3x3box"
} }
wintypes: # Exclude conditions for background blur
{ blur-background-exclude = [
normal = { blur-background = true }; # Prevents picom from blurring the background
splash = { blur-background = false }; # when taking selection screenshot with `maim`
}; "class_g = 'slop'",
"_GTK_FRAME_EXTENTS@:c"
];
# Fading
# Shadows
################
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
shadow = false;
# The blur radius for shadows, in pixels. (defaults to 12)
shadow-radius = 12;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
shadow-opacity = 0.75;
# The left offset for shadows, in pixels. (defaults to -15)
shadow-offset-x = -15;
# The top offset for shadows, in pixels. (defaults to -15)
shadow-offset-y = -15;
# Red color value of shadow (0.0 - 1.0, defaults to 0).
shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
shadow-blue = 0
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
xinerama-shadow-crop = false
# Specify a list of conditions of windows that should have no shadow.
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"class_g = 'slop'",
"class_g = 'Polybar'",
"_GTK_FRAME_EXTENTS@:c"
];
# Window Fading
################
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
fading = false; fading = false;
fade-in-step = 0.07;
fade-out-step = 0.07;
fade-exclude = [ ];
# GLX backend # Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
# Use GLX as a backend instead of default xrender. fade-in-step = 0.07;
# GLX will generally be a lot faster than xrender. # Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
# There shouldn't be any issues with this, but if you fade-out-step = 0.1;
# do experience any, you should try falling back to xrender. # The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
backend = "glx"; fade-delta = 10
glx-no-stencil = true; # Do not fade on window open/close.
glx-copy-from-front = false; no-fading-openclose = false
use-damage = true # Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox,
glx-no-rebind-pixmap = true; # Fluxbox, etc.
no-fading-destroyed-argb = false
# Specify a list of conditions of windows that should not be faded.
# don't need this, we disable fading for all normal windows with wintypes: {}
fade-exclude = [
"class_g = 'slop'" # maim
]
# Corners
################
# Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows.
corner-radius = 12;
rounded-corners-exclude = [
"class_g = 'Rofi'",
"class_g = 'dmenu'",
"name = 'Notification area'",
"name = 'Dunst'"
]
# Rounded corners alone only changes the window, but the borders
# around it still remain rectangular, round-borders option allows
# the borders to also be round.
round-borders = 1;
# Specify a list of border width rules.
# format: "[pixels]:[xprop info name] = '[xprop value]'"
# Note this doesn't have any guarantee about not conflicting with the
# border width set by the window manager.
round-borders-rule = [];

View file

@ -1,4 +1,4 @@
#!/usr/bin/env zsh #!/bin/sh
# I'm not the greatest typist # I'm not the greatest typist
alias sl='ls' alias sl='ls'
@ -8,6 +8,14 @@ alias souce='source'
alias suod='sudo ' alias suod='sudo '
alias sduo='sudo ' alias sduo='sudo '
# Replacements (adding flags)
alias cp='cp -iv' # Ask before overwriting, verbose
alias mv='mv -iv' # Ask before overwriting, verbose
alias rm='trash-put' # Use trash-cli instead of true removal
alias rmr='\rm -v' # True rm, verbose (asking here is too annoying)
alias wget='wget -c' # Resume wget by default
alias df='df -H' # Show sizes as powers of 1000
# Directory changing # Directory changing
alias ..='cd ..' alias ..='cd ..'
alias ...='cd ../../' alias ...='cd ../../'
@ -17,47 +25,34 @@ alias .2='cd ../../'
alias .3='cd ../../../' alias .3='cd ../../../'
alias .4='cd ../../../../' alias .4='cd ../../../../'
alias .5='cd ../../../../../' alias .5='cd ../../../../../'
# z.lua script
alias j='z' # for the sake of autojump old habits
alias zz='z -c' # restrict matches to subdirs of $PWD
alias zb='z -b' # restrict matches to parent directories
alias zi='z -I' # cd with interactive fzf selection
alias zbi='z -b -I' # pick parent directory to cd into with fzf
# Files/Directories utilities # Files/Directories utilities
alias mkdir='mkdir -p' alias mkdir='mkdir -p'
alias md='mkdir' alias md='mkdir'
alias fhere='find . -name' alias fhere='find . -name'
alias rr='rm -r' alias rr='rmr -r'
alias rf='rm -f' alias rf='rmr -f'
alias rrf='rm -rf' alias rrf='rmr -rf'
alias vimdiff='nvim -d' alias vimdiff='nvim -d'
# Replacements (adding flags)
alias cp='cp -iv' # Ask before overwriting, verbose
alias mv='mv -iv' # Ask before overwriting, verbose
alias rm='rm -v' # Verbose (asking here is too annoying)
alias wget='wget -c' # Resume wget by default
alias df='df -H' # Show sizes as powers of 1000
# Directory listing aliases, defaults to exa, if aviable # Directory listing aliases, defaults to exa, if aviable
if command -v exa > /dev/null; then if command -v exa > /dev/null; then
alias ls='exa' alias ls='exa'
alias l='exa -glah --classify' alias l='exa -glah --classify'
alias ll='exa -glah --classify -s=size --group-directories-first -r' alias ll='exa -glah --classify -s=size --group-directories-first -r'
alias ldir='exa -glahD' alias ldir='exa -glahD'
alias tree='exa -Tlagh' alias tree='exa -Tlagh'
alias dotall='exa -hulad .[a-z]*' # Show both dotdirs and dotfiles alias dotall='exa -hulad .[a-z]*' # Show both dotdirs and dotfiles
alias dotfiles='dotall | grep -v ^d' # Show all dotfiles alias dotfiles='dotall | grep -v ^d' # Show all dotfiles
alias dotdirs='dotall | grep --color=never ^d' # Show all dotdirs alias dotdirs='dotall | grep --color=never ^d' # Show all dotdirs
else else
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias l='ls -lahX --classify' alias l='ls -lahX --classify'
alias ll='ls -lahX --classify --group-directories-first' alias ll='ls -lahX --classify --group-directories-first'
alias ldir='ls -lahX --classify | grep --color=never ^d' alias ldir='ls -lahX --classify | grep --color=never ^d'
alias dotall='ls -lahXd .[a-z]*' alias dotall='ls -lahXd .[a-z]*'
alias dotfiles='dotall | grep -v ^d' alias dotfiles='dotall | grep -v ^d'
alias dotdirs='dotall | grep --color=never ^d' alias dotdirs='dotall | grep --color=never ^d'
fi fi
# Config access shortcuts # Config access shortcuts
@ -70,16 +65,40 @@ alias cfenv='cfenvironment'
alias cfhandlers='vim ~/.config/shell/handlers' alias cfhandlers='vim ~/.config/shell/handlers'
alias cfprompt='vim ~/.config/shell/prompt' alias cfprompt='vim ~/.config/shell/prompt'
alias cfkeybinds='vim ~/.config/shell/keybinds' alias cfkeybinds='vim ~/.config/shell/keybinds'
alias cfxprofile='vim ~/.config/x11/xprofile'
alias cfxmonad='vim ~/.config/xmonad/xmonad.hs && xmonad --recompile && xmonad --restart' alias cfxmonad='vim ~/.config/xmonad/xmonad.hs && xmonad --recompile && xmonad --restart'
alias cfxmobar='vim ~/.config/xmobar/xmobarrc.hs && ~/.config/xmobar/multi_mon.sh 2' alias cfxmobar='vim ~/.config/xmobar/xmobarrc.hs && ~/.config/xmobar/multi_mon.sh 2'
alias cftodo='vim ~/Personal/todo' alias cftodo='vim ~/Personal/vimwiki/todo.md'
alias cfnvim='vim ~/.config/nvim'
alias cfvim='cfnvim'
# Python # z.lua shortcuts
alias py3='python3' alias j='z' # for the sake of autojump old habits
alias py2='python2' alias zz='z -c' # restrict matches to subdirs of $PWD
alias ipy='ipython' alias zb='z -b' # restrict matches to parent directories
alias bpy='bpython' alias zi='z -I' # cd with interactive fzf selection
command -v ipython > /dev/null && alias py='ipython' || alias py='python' alias zbi='z -b -I' # pick parent directory to cd into with fzf
## Make aliases for individual cpython/pypy versions
py_versions="\n2\n3\n3.6\n3.7\n3.8\n3.9\n3.10"
# shellcheck disable=SC2139
echo "$py_versions" | while read -r version; do
for python in python pypy; do
[ "$python" = "python" ] && prefix="py" || prefix="pypy"
if command -v "$python$version" >/dev/null; then
if [ "$python" = "python" ]; then
alias "pip$version=$python$version -m pip"
else
alias "ppip$version=$python$version -m pip"
fi
alias "$prefix${version}pip=$python$version -m pip"
alias "$prefix$version=$python$version"
alias "i$prefix$version=$python$version -c 'import IPython;IPython.start_ipython()'"
alias "b$prefix$version=$python$version -c 'from bpython.curtsies import main;import sys;sys.exit(main())'"
fi
done
done
# Fallbacks # Fallbacks
command -v hd > /dev/null || alias hd='hexdump -C' # Cannonical hex dump; some systems have this symlinked command -v hd > /dev/null || alias hd='hexdump -C' # Cannonical hex dump; some systems have this symlinked
@ -87,6 +106,7 @@ command -v md5sum > /dev/null || alias md5sum='md5' # Fallback from `md5sum` to
command -v sha1sum > /dev/null || alias sha1sum='shasum' # Fallback from `sha1sum` to `shasum` command -v sha1sum > /dev/null || alias sha1sum='shasum' # Fallback from `sha1sum` to `shasum`
command -v vim > /dev/null && alias vi='vim' # Let vim take precedence over vi command -v vim > /dev/null && alias vi='vim' # Let vim take precedence over vi
command -v nvim > /dev/null && alias vi='nvim' && alias vim='nvim' # Let nvim take precedence over vi/vim command -v nvim > /dev/null && alias vi='nvim' && alias vim='nvim' # Let nvim take precedence over vi/vim
command -v vimtutor > /dev/null || alias vimtutor='nvim -c Tutor' # Let vimtutor fallback to nvim's tutor
# X11 clipboard (either using xclip or xsel, xsel takes precedence if both) # X11 clipboard (either using xclip or xsel, xsel takes precedence if both)
command -v xclip > /dev/null && alias pbcopy='xclip -selection clipboard' command -v xclip > /dev/null && alias pbcopy='xclip -selection clipboard'
@ -102,6 +122,13 @@ alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.p
alias encrypt='gpg -c --no-symkey-cache --cipher-algo AES256' # Encrypt file with AES256 symetric encryption alias encrypt='gpg -c --no-symkey-cache --cipher-algo AES256' # Encrypt file with AES256 symetric encryption
alias decrypt='gpg' # For the sake of completeness, include decrypt command to the above, though it's only just gpg alias alias decrypt='gpg' # For the sake of completeness, include decrypt command to the above, though it's only just gpg alias
# Terminal window swallowing for blocking programs (devour)
alias xdg-open='devour xdg-open'
alias mpv='devour mpv'
alias nomacs='devour nomacs'
alias pcmanfm='devour pcmanfm'
alias spotify='devour spotify'
# Regular expressions # Regular expressions
alias reg_email='echo "[a-Z0-9._%-]+@[a-Z0-9.-]+\.[a-Z]{2,10}"' alias reg_email='echo "[a-Z0-9._%-]+@[a-Z0-9.-]+\.[a-Z]{2,10}"'
alias reg_mac='echo "([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"' alias reg_mac='echo "([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'
@ -116,7 +143,7 @@ alias grep_mac='grep -E `reg_mac`'
alias massgrep='grep -RHIni' alias massgrep='grep -RHIni'
# Network # Network
alias ip-show='curl https://api.ipify.org' # Get global IP address alias ip-show='curl https://ifconfig.co' # Get global IP address
alias ips="ifconfig -a | grep -oE \"inet6? (addr:)?s?\`reg_ip\`\" | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" alias ips="ifconfig -a | grep -oE \"inet6? (addr:)?s?\`reg_ip\`\" | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias lan-device-scan='nmap -T5 -sP 192.168.0.0-255' alias lan-device-scan='nmap -T5 -sP 192.168.0.0-255'
alias lan-vuln-scan='nmap -sT -O --script vuln 192.168.0.0-255' alias lan-vuln-scan='nmap -sT -O --script vuln 192.168.0.0-255'
@ -143,13 +170,16 @@ alias kernel-configure='cd /usr/src/linux && make menuconfig'
# System actions # System actions
alias sv='systemctl' alias sv='systemctl'
alias pacnew="find / -name '*.pacnew' 2>/dev/null" # Search for all new configurations after pacman update
alias backup="rsync -avHAXS --delete --filter='dir-merge /.rsync-filter'" # Make full rsync backup, respecting .rsync-filter files for exclusions alias backup="rsync -avHAXS --delete --filter='dir-merge /.rsync-filter'" # Make full rsync backup, respecting .rsync-filter files for exclusions
alias upload='curl -F "f:1=<-" ix.io' alias upload='curl -F "f:1=<-" ix.io'
alias upload-journal='sudo journalctl -b -1 | upload' # Upload journalctl from last boot to ix.io alias upload-journal='sudo journalctl -b -1 | upload' # Upload journalctl from last boot to ix.io
alias auth-log='journalctl SYSLOG_FACILITY=10 -r'
alias cpu-stress='for i in $(seq $(getconf _NPROCESSORS_ONLN)); do yes > /dev/null & done' # Run `yes > /dev/null` on all cores as stress test alias cpu-stress='for i in $(seq $(getconf _NPROCESSORS_ONLN)); do yes > /dev/null & done' # Run `yes > /dev/null` on all cores as stress test
alias nvidia='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia' # Run app with nvidia (on hybrid mode with optimus) alias nvidia='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia' # Run app with nvidia (on hybrid mode with optimus)
alias swapout='sudo swapoff -a; sudo swapon -a' # Reset swap (move everything to RAM) alias swapout='sudo swapoff -a; sudo swapon -a' # Reset swap (move everything to RAM)
alias mount-ram='mount -t tmpfs tmpfs' # Mount RAM disk for fast filesystem alias mount-ram='mount -t tmpfs tmpfs' # Mount RAM disk for fast filesystem
alias screenlock='xset s activate' # Use DPMS to trigger xss-lock and handle screen locking
# System info # System info
alias meminfo='free -m -l -t' alias meminfo='free -m -l -t'
@ -184,26 +214,22 @@ alias cleanup='clean-trash && clean-down && clean-journal && clean-pacman'
# Git aliases # Git aliases
alias g='git' alias g='git'
alias gs='git status' alias gp='git push'
alias gpl='git pull'
alias gf='git fetch'
alias gs='git status --short --branch'
alias gss='git status'
alias ga='git add'
alias gap='git add --patch'
alias gc='git commit'
alias gcm='git commit --message'
alias gb='git branch'
alias gch='git checkout'
alias gchb='git checkout -b'
alias gd='git diff' alias gd='git diff'
alias gdc='git diff --cached' alias gdc='git diff --cached'
alias gm='git merge' alias gundo='git reset --soft HEAD~'
alias ga='git add'
alias gaa='git add all'
alias gc='git commit'
alias gcm='git commit -m' && alias commit='git commit -m'
alias gp='git push' && alias push='git push'
alias gpl='git pull' && alias pull='git pull'
alias gf='git fetch' && alias fetch='git fetch'
alias gb='git branch' && alias branch='git branch'
alias gch='git checkout' && alias checkout='git checkout'
alias gau='git add -u' && alias addup='git add -u'
alias gchb='git checkout -b'
alias gcda='git diff --cached' # Diff any files staged for commit
alias glog='git log --oneline --decorate --graph'
alias gundo='git reset HEAD~'
alias gredo="git reset 'HEAD@{1}'" alias gredo="git reset 'HEAD@{1}'"
alias gundopush="git push -f origin HEAD^:master"
# Youtube-dl aliases # Youtube-dl aliases
alias ytv-best='youtube-dl -f bestvideo+bestaudio' alias ytv-best='youtube-dl -f bestvideo+bestaudio'
@ -211,6 +237,12 @@ alias yta-best='youtube-dl --extract-audio --audio-format best'
alias yta-mp3='youtube-dl --extract-audio --audio-format mp3' alias yta-mp3='youtube-dl --extract-audio --audio-format mp3'
alias yta-wav='youtube-dl --extract-audio --audio-format wav' alias yta-wav='youtube-dl --extract-audio --audio-format wav'
# Terminal vim-like exits, in case I think the terminal is vim
alias :q='exit'
alias :q!='exit'
alias :wq='exit'
alias :wq!='exit'
# Shell aliases # Shell aliases
alias reload="exec \$SHELL" # Reload the shell (i.e. invoke as a login shell) alias reload="exec \$SHELL" # Reload the shell (i.e. invoke as a login shell)
alias path='echo -e ${PATH//:/\\n}' # Print each PATH entry on a separate line alias path='echo -e ${PATH//:/\\n}' # Print each PATH entry on a separate line
@ -221,22 +253,22 @@ alias tty-clock='tty-clock -Ssc' # Terminal clock screensaver
alias rick='curl -s -L https://raw.githubusercontent.com/ItsDrike/rickrollrc/master/roll.sh| bash' # Terminal rickroll alias rick='curl -s -L https://raw.githubusercontent.com/ItsDrike/rickrollrc/master/roll.sh| bash' # Terminal rickroll
# If user is not root, pass all commands via sudo/doas # If user is not root, pass all commands via sudo/doas
if [ $UID -ne 0 ]; then if [ "$(id -u)" -ne 0 ]; then
# Enable aliases to be sudoed/doased # Enable aliases to be sudoed/doased
# with doas having precedence over sudo if found # with doas having precedence over sudo if found
## Uncomment if you are using autocompletion (is ZSH) ## Uncomment if you are using autocompletion (is ZSH)
#command -v /usr/bin/sudo > /dev/null && alias doas='nocorrect sudo ' && alias sudo='nocorrect sudo ' #command -v /usr/bin/sudo > /dev/null && alias doas='nocorrect sudo ' && alias sudo='nocorrect sudo '
#command -v /usr/bin/doas > /dev/null && alias doas='nocorrect doas ' && alias sudo='nocorrect doas ' #command -v /usr/bin/doas > /dev/null && alias doas='nocorrect doas ' && alias sudo='nocorrect doas '
## if the above is uncommented, comment this ## if the above is uncommented, comment this
command -v /usr/bin/sudo > /dev/null && alias doas='sudo ' && alias sudo='sudo ' command -v /usr/bin/sudo > /dev/null && alias doas='sudo ' && alias sudo='sudo '
command -v /usr/bin/doas > /dev/null && alias doas='doas ' && alias sudo='doas ' command -v /usr/bin/doas > /dev/null && alias doas='doas ' && alias sudo='doas '
fi fi
# enable color support # enable color support
if [ -x /usr/bin/dircolors ]; then if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" (test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)") || eval "$(dircolors -b)"
alias dir='dir --color=auto' alias dir='dir --color=auto'
alias vdir='vdir --color=auto' alias vdir='vdir --color=auto'
@ -254,21 +286,23 @@ fi
# Normalize `open` across Linux, macOS, and Windows. # Normalize `open` across Linux, macOS, and Windows.
# This is needed to make `open` function (see below) cross-platform # This is needed to make `open` function (see below) cross-platform
if [ ! $(uname -s) = 'Darwin' ]; then if [ ! "$(uname -s)" = 'Darwin' ]; then
if grep -q Microsoft /proc/version; then if grep -q Microsoft /proc/version; then
# Ubuntu on Windows using the Linux subsystem # Ubuntu on Windows using the Linux subsystem
alias open='explorer.exe' alias open='explorer.exe'
else else
alias open='xdg-open' alias open='xdg-open'
fi fi
fi fi
# Functions # Functions
if [ -f ~/.config/shell/functions ]; then if [ -f ~/.config/shell/functions ]; then
source ~/.config/shell/functions # shellcheck source=/home/itsdrike/.config/shell/functions
. "$HOME/.config/shell/functions"
fi fi
# Extra # Extra
if [ -f ~/.config/shell/extra ]; then if [ -f ~/.config/shell/extra ]; then
source ~/.config/shell/extra # shellcheck source=/home/itsdrike/.config/shell/extra
. "$HOME/.config/shell/extra"
fi fi

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
# Environmental variable definitions. # Environmental variable definitions.
# This file is only sourced once after login, unlike .zshrc/.bashrc # This file is only sourced once after login, unlike .zshrc/.bashrc
@ -8,6 +8,8 @@
# which means the XDG definitions will be ignored anyway, and # which means the XDG definitions will be ignored anyway, and
# defining them may break programs when root is actually logged in. # defining them may break programs when root is actually logged in.
# Define some variables for POSIX compatibility
uid="$(id -u)"
# Default programs # Default programs
export EDITOR="nvim" export EDITOR="nvim"
@ -18,7 +20,7 @@ export TERMINAL="alacritty"
export XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache" export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share" export XDG_DATA_HOME="$HOME/.local/share"
export XDG_RUNTIME_DIR="/run/user/$UID" export XDG_RUNTIME_DIR="/run/user/$uid"
# Per-Application XDG settings # Per-Application XDG settings
export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
@ -42,6 +44,7 @@ export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
# Colorful man pages # Colorful man pages
# If bat is installed, use it as manpager # If bat is installed, use it as manpager
# shellcheck disable=SC2155
if command -v bat > /dev/null; then if command -v bat > /dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'" export MANPAGER="sh -c 'col -bx | bat -l man -p'"
else else
@ -56,7 +59,12 @@ fi
# Other program settings # Other program settings
export SUDO_ASKPASS="$HOME/.local/bin/scripts/dmenu/dmenupass" export SUDO_ASKPASS="$HOME/.local/bin/scripts/dmenu/dmenupass"
export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv
export XSECURELOCK_SHOW_HOSTNAME=0 # Don't show hostname in xsecurelock export XSECURELOCK_SHOW_HOSTNAME=0 # Don't show hostname in xsecurelock
#export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. export XSECURELOCK_SHOW_DATETIME=1 # Show current date and time in xsecurelock
export QT_QPA_PLATFORMTHEME="qt5ct" # Have QT use theme from qt5ct.
#export QT_STYLE_OVERRIDE="gtk2" # Have QT use the gtk2 theme (needs aur/qt5-styleplugins)
# Remove irrelevant variables added for posix compatibility
unset posix

View file

@ -1,55 +1,58 @@
#!/usr/bin/env zsh #!/bin/sh
# TODO: Currently, this file isn't entirely POSIX compatible,
# it will run fine with bash or zsh, however some functions may cause
# issues with pure POSIX. The fill will however run fine, the errors
# would only occur if the incompatible functions would be started.
# Show application listening on given port # Show application listening on given port
function port() { port() {
sudo netstat -pln | grep $1 | awk '{print $NF}' sudo netstat -pln | grep "$1" | awk '{print $NF}'
} }
# Create a new directory and enter it # Create a new directory and enter it
function mkd() { mkd() {
mkdir -p "$@" && cd "$_"; # shellcheck disable=SC2164
mkdir -p "$1" && cd "$1";
} }
# `o` with no arguments opens the current directory, otherwise opens the given # `o` with no arguments opens the current directory, otherwise opens the given
# location # location
function o() { o() {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
open .; open .;
else else
open "$@"; open "$@";
fi; fi;
} }
# Use bat for nicer git diffs # Use bat for nicer git diffs
function batdiff() { batdiff() {
git diff --name-only --diff-filter=d | xargs bat --diff git diff --name-only --diff-filter=d | xargs bat --diff
} }
# Determine size of a file or total size of a directory # Determine size of a file or total size of a directory
function dir-size() { dirsize() {
if du -b /dev/null > /dev/null 2>&1; then if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh; arg=-sbh;
else else
local arg=-sh; arg=-sh;
fi fi
if [[ -n "$@" ]]; then if [[ -n "$*" ]]; then
\du $arg -- "$@"; \du $arg -- "$@";
else else
\du $arg .[^.]* ./*; \du $arg .[^.]* ./*;
fi; fi;
} }
function randmac() { randmac() {
sudo ip link set dev $1 down sudo ip link set dev "$1" down
sudo macchanger -A $1 sudo macchanger -A "$1"
sudo ip link set dev $1 up sudo ip link set dev "$1" up
} }
# Go to the root of a git tree # Go to the root of a git tree
cdgit () { cdgit () {
git rev-parse --is-inside-work-tree > /dev/null 2>&1 if [ "$(git rev-parse --is-inside-work-tree > /dev/null 2>&1)" -eq 0 ]; then
if [ $? -eq 0 ]; then
TEMP_PWD=`pwd`
while ! [ -d .git ]; do while ! [ -d .git ]; do
cd .. cd ..
done done
@ -61,76 +64,76 @@ cdgit () {
} }
# Create a data URL from a file # Create a data URL from a file
function dataurl() { dataurl() {
local mimeType=$(file -b --mime-type "$1"); mimeType="$(file -b --mime-type "$1")"
if [[ $mimeType == text/* ]]; then if echo "$mimeType" | grep -e "^text/.*$" >/dev/null; then
mimeType="${mimeType};charset=utf-8"; mimeType="${mimeType};charset=utf-8"
fi fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"; echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
} }
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring # `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into # the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is # `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen. # small enough for one screen.
function tre() { tre() {
tree -I '.git|node_modules|bower_components' --group-directories-first "$@" | less -FRNX; tree -I '.git|node_modules|bower_components' --group-directories-first "$@" | less -FRNX;
} }
# Show all the names (CNs and SANs) listed in the SSL certificate # Show all the names (CNs and SANs) listed in the SSL certificate
# for a given domain # for a given domain
function getcertnames() { getcertnames() {
if [ -z "${1}" ]; then if [ -z "${1}" ]; then
echo "ERROR: No domain specified."; echo "ERROR: No domain specified.";
return 1; return 1;
fi; fi;
local domain="${1}"; domain="${1}";
echo "Testing ${domain}…"; echo "Testing ${domain}…";
echo ""; # newline echo ""; # newline
local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \ tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1); | openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \ certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \ | openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version"); no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:"; echo "Common Name:";
echo ""; # newline echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//"; echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline echo ""; # newline
echo "Subject Alternative Name(s):"; echo "Subject Alternative Name(s):";
echo ""; # newline echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \ echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2; | sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0; return 0;
else else
echo "ERROR: Certificate not found."; echo "ERROR: Certificate not found.";
return 1; return 1;
fi; fi;
} }
# Compare original and gzipped file size # Compare original and gzipped file size
function gz-compare() { gz_compare() {
local origsize=$(wc -c < "$1"); origsize=$(wc -c < "$1");
local gzipsize=$(gzip -c "$1" | wc -c); gzipsize=$(gzip -c "$1" | wc -c);
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l); ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize"; printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio"; printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
} }
# Extract almost any archive # Extract almost any archive
function extract { extract() {
if [ -z "$1" ]; then if [ -z "$1" ]; then
# display usage if no parameters given # display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>" echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]" echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
return 1 return 1
else else
for n in $@ for n in "$@"
do do
if [ -f "$n" ] ; then if [ -f "$n" ] ; then
case "${n%,}" in case "${n%,}" in
@ -160,44 +163,47 @@ fi
} }
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression # Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
function targz() { targz() {
local tmpFile="${@%/}.tar"; # Combine given names spearated with spaces as the filename
tar -cvf "${tmpFile}" "${@}" || return 1; tmpFile="${*%/}.tar"
size=$( tar -cvf "${tmpFile}" "${@}" || return 1
stat -f"%z" "${tmpFile}" 2> /dev/null; # macOS `stat`
stat -c"%s" "${tmpFile}" 2> /dev/null; # GNU `stat`
);
local cmd=""; size=$(
if (( size < 52428800 )) && hash zopfli 2> /dev/null; then stat -f"%z" "${tmpFile}" 2> /dev/null; # macOS `stat`
# the .tar file is smaller than 50 MB and Zopfli is available; use it stat -c"%s" "${tmpFile}" 2> /dev/null; # GNU `stat`
cmd="zopfli"; );
else
if hash pigz 2> /dev/null; then
cmd="pigz";
else
cmd="gzip";
fi;
fi;
echo "Compressing .tar ($((size / 1000)) kB) using \`${cmd}\`…"; cmd="";
"${cmd}" -v "${tmpFile}" || return 1; if (( size < 52428800 )) && hash zopfli 2> /dev/null; then
[ -f "${tmpFile}" ] && rm "${tmpFile}"; # the .tar file is smaller than 50 MB and Zopfli is available; use it
cmd="zopfli";
else
if hash pigz 2> /dev/null; then
cmd="pigz";
else
cmd="gzip";
fi;
fi;
zippedSize=$( echo "Compressing .tar ($((size / 1000)) kB) using \`${cmd}\`…";
stat -f"%z" "${tmpFile}.gz" 2> /dev/null; # macOS `stat` "${cmd}" -v "${tmpFile}" || return 1;
stat -c"%s" "${tmpFile}.gz" 2> /dev/null; # GNU `stat` [ -f "${tmpFile}" ] && rm "${tmpFile}";
);
echo "${tmpFile}.gz ($((zippedSize / 1000)) kB) created successfully."; zippedSize=$(
stat -f"%z" "${tmpFile}.gz" 2> /dev/null; # macOS `stat`
stat -c"%s" "${tmpFile}.gz" 2> /dev/null; # GNU `stat`
);
echo "${tmpFile}.gz ($((zippedSize / 1000)) kB) created successfully.";
} }
function anonymize { anonymize() {
# Reset the prompt on initial run to allow this script # Reset the prompt on initial run to allow this script
# to be ran multiple times without user having to reload # to be ran multiple times without user having to reload
# PS1 manually # PS1 manually
source ${XDG_CONFIG_DIR:-$HOME/.config}/shell/prompt # shellcheck source=/home/itsdrike/.config/shell/prompt
. "${XDG_CONFIG_DIR:-$HOME/.config}/shell/prompt"
# Regular expression to match 0-255 numbers (color) # Regular expression to match 0-255 numbers (color)
color_int_re='^(0+)?([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' color_int_re='^(0+)?([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
@ -212,7 +218,7 @@ function anonymize {
AT_COLOR="%F{004}" AT_COLOR="%F{004}"
MACHINE_COLOR="%F{070}" MACHINE_COLOR="%F{070}"
while [[ $# -gt 0 ]]; do while [ $# -gt 0 ]; do
key=$1 key=$1
case $key in case $key in

View file

@ -1,43 +1,40 @@
#!/usr/bin/env bash #!/bin/sh
if command -v pkgfile > /dev/null; then if command -v pkgfile > /dev/null; then
# Command not found hook that uses `pkgfile` package # Command not found hook that uses `pkgfile` package
# to search through the package index in order to find # to search through the package index in order to find
# a package which includes given command, which was resolved # a package which includes given command, which was resolved
# and not found, if there are no such packages, only print # and not found, if there are no such packages, only print
# command not found message # command not found message
command_not_found_handler() { command_not_found_handler() {
local pkgs cmd="$1" files=() cmd="$1"
printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages
files=(${(f)"$(pkgfile ${cmd})"}) repos="$(pkgfile "$cmd")"
if (( ${#files[@]} )); then if [ -n "$repos" ]; then
printf '\r%s may be found in the following packages:\n' "$cmd" printf '\r%s may be found in the following packages:\n' "$cmd"
local res=() repo package version file echo "$repos" | while read -r pkg; do
for file in "$files[@]"; do printf ' %s\n' "$pkg"
res=("${(0)file}") done
repo="$res[1]" else
printf ' %s\n' "$repo" printf '\n'
done fi
else return 127
printf '\n' }
fi elif [ -x /usr/lib/command-not-found ] || [ -x /usr/share/command-not-found/command-not-found ]; then
return 127 # Ubuntu handle for bash default command-not-found
} # it works similarely to the above arch alternative,
elif [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then # this is based on the original bash implementation
# Ubuntu handle for bash default command-not-found command_not_found_handler() {
# it works similarely to the above arch alternative, # check because cmd not found could've been removed in the meantime
# this is based on the original bash implementation if [ -x /usr/lib/command-not-found ]; then
command_not_found_handler() { /usr/lib/command-not-found -- "$1"
# check because cmd not found could've been removed in the meantime return $?
if [ -x /usr/lib/command-not-found ]; then elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/lib/command-not-found -- "$1" /usr/share/command-not-found/command-not-found -- "$1"
return $? return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then else
/usr/share/command-not-found/command-not-found -- "$1" printf "%s: command not found\n" "$1" >&2
return $? return 127
else fi
printf "%s: command not found\n" "$1" >&2 }
return 127
fi
}
fi fi

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# shellcheck disable=SC2030,SC2031,SC2015
# Set default keybindings (mostly from oh-my-zsh) # Set default keybindings (mostly from oh-my-zsh)
# Make sure that the terminal is in application mode when zle is active, since # Make sure that the terminal is in application mode when zle is active, since
@ -18,30 +19,30 @@ fi
bindkey -e bindkey -e
# Start typing + [Up-Arrow] - fuzzy find history forward # Start typing + [Up-Arrow] - fuzzy find history forward
if [[ -n "${terminfo[kcuu1]}" ]]; then if [ -n "${terminfo[kcuu1]}" ]; then
autoload -U up-line-or-beginning-search autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search zle -N up-line-or-beginning-search
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
fi fi
# Start typing + [Down-Arrow] - fuzzy find history backward # Start typing + [Down-Arrow] - fuzzy find history backward
if [[ -n "${terminfo[kcud1]}" ]]; then if [ -n "${terminfo[kcud1]}" ]; then
autoload -U down-line-or-beginning-search autoload -U down-line-or-beginning-search
zle -N down-line-or-beginning-search zle -N down-line-or-beginning-search
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
fi fi
# [Home] - Go to beginning of line # [Home] - Go to beginning of line
[[ -n "${terminfo[khome]}" ]] && bindkey "${terminfo[khome]}" beginning-of-line || bindkey "^[[H" beginning-of-line [ -n "${terminfo[khome]}" ] && bindkey "${terminfo[khome]}" beginning-of-line || bindkey "^[[H" beginning-of-line
# [End] - Go to end of line # [End] - Go to end of line
[[ -n "${terminfo[kend]}" ]] && bindkey "${terminfo[kend]}" end-of-line || bindkey "^[[F" end-of-line [ -n "${terminfo[kend]}" ] && bindkey "${terminfo[kend]}" end-of-line || bindkey "^[[F" end-of-line
# [Shift-Tab] - move through the completion menu backwards # [Shift-Tab] - move through the completion menu backwards
[[ -n "${terminfo[kcbt]}" ]] && bindkey "${terminfo[kcbt]}" reverse-menu-complete [ -n "${terminfo[kcbt]}" ] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
# [Backspace] - delete backward # [Backspace] - delete backward
bindkey '^?' backward-delete-char bindkey '^?' backward-delete-char
# [Delete] - delete forward # [Delete] - delete forward
[[ -n "${terminfo[kdch1]}" ]] && bindkey "${terminfo[kdch1]}" delete-char || bindkey "^[[3~" delete-char [ -n "${terminfo[kdch1]}" ] && bindkey "${terminfo[kdch1]}" delete-char || bindkey "^[[3~" delete-char
# [Ctrl-Delete] - delete whole forward-word # [Ctrl-Delete] - delete whole forward-word
bindkey '^[[3;5~' kill-word bindkey '^[[3;5~' kill-word
@ -53,9 +54,9 @@ bindkey '^[[1;5D' backward-word
# [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
bindkey '^r' history-incremental-search-backward bindkey '^r' history-incremental-search-backward
# [PageUp] - Up a line of history # [PageUp] - Up a line of history
[[ -n "${terminfo[kpp]}" ]] && bindkey "${terminfo[kpp]}" up-line-or-history [ -n "${terminfo[kpp]}" ] && bindkey "${terminfo[kpp]}" up-line-or-history
# [PageDown] - Down a line of history # [PageDown] - Down a line of history
[[ -n "${terminfo[knp]}" ]] && bindkey "${terminfo[knp]}" down-line-or-history [ -n "${terminfo[knp]}" ] && bindkey "${terminfo[knp]}" down-line-or-history
# [Space] - do history expansion on space # [Space] - do history expansion on space
bindkey ' ' magic-space bindkey ' ' magic-space

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# shellcheck disable=SC2155
# Configuration variables: # Configuration variables:
@ -30,20 +31,20 @@ export PROMPT_EOL_MARK=""
# (unless you change it in kernel), respect this and downgrade # (unless you change it in kernel), respect this and downgrade
# the color scheme accordingly (it won't look best, but it's # the color scheme accordingly (it won't look best, but it's
# still better than no colors) # still better than no colors)
if [ $TERM = "linux" ]; then if [ "$TERM" = "linux" ]; then
GREEN="%F{002}" GREEN="%F{002}"
RED="%F{001}" RED="%F{001}"
ORANGE="%F{003}" ORANGE="%F{003}"
BLUE="%F{004}" BLUE="%F{004}"
LBLUE="%F{006}" LBLUE="%F{006}"
PURPLE="%F{005}" PURPLE="%F{005}"
else else
GREEN="%F{047}" GREEN="%F{047}"
RED="%F{196}" RED="%F{196}"
ORANGE="%F{214}" ORANGE="%F{214}"
BLUE="%F{027}" BLUE="%F{027}"
LBLUE="%F{075}" LBLUE="%F{075}"
PURPLE="%F{105}" PURPLE="%F{105}"
fi fi
RESET="%f" RESET="%f"
@ -52,34 +53,34 @@ git_prompt() {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo -n " $ORANGE${ref#refs/heads/}" echo -n " $ORANGE${ref#refs/heads/}"
if [ ! -z "$(git status --short)" ]; then if [ -n "$(git status --short 2>/dev/null)" ]; then
echo "$RED+" echo "$RED+"
fi fi
} }
# Adds @chroot or @ssh # Adds @chroot or @ssh
foreign_prompt() { foreign_prompt() {
if [ "$(awk '$5=="/" {print $1}' </proc/1/mountinfo)" != "$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)" ]; then if [ "$(awk '$5=="/" {print $1}' </proc/1/mountinfo)" != "$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)" ]; then
echo -n "@${ORANGE}chroot" echo -n "@${ORANGE}chroot"
elif [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then elif [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
echo -n "@${ORANGE}ssh" echo -n "@${ORANGE}ssh"
fi fi
} }
# Prints appropriate working directory #nd Prints appropriate working directory
working_directory() { working_directory() {
# By default up to 5 directories will be tolerated before shortening # By default up to 5 directories will be tolerated before shortening
# After we surpass that, first directory (or ~) will be printed together with last 3 # After we surpass that, first directory (or ~) will be printed together with last 3
# This feature uses special symbol '…', but this isn't aviable when in TTY. Because # This feature uses special symbol '…', but this isn't aviable when in TTY. Because
# of this, when we are in TTY, we fall back to longer '...' # of this, when we are in TTY, we fall back to longer '...'
if [ $USE_SHORTENED_WORKDIR != 1 ]; then if [ $USE_SHORTENED_WORKDIR != 1 ]; then
echo -n " $BLUE$~" echo -n " $BLUE$~"
elif [ $TERM = "linux" ]; then elif [ "$TERM" = "linux" ]; then
echo -n " $BLUE%(5~|%-1~/.../%3~|%4~)" echo -n " $BLUE%(5~|%-1~/.../%3~|%4~)"
else else
echo -n " $BLUE%(5~|%-1~/…/%3~|%4~)" echo -n " $BLUE%(5~|%-1~/…/%3~|%4~)"
fi fi
} }
# Execution time tracking hooks, this is unique to zsh, as it can add # Execution time tracking hooks, this is unique to zsh, as it can add
@ -96,7 +97,7 @@ exec_time_preexec_hook() {
exec_time_precmd_hook() { exec_time_precmd_hook() {
[[ $SHOW_CMD_TIME == 0 ]] && return [[ $SHOW_CMD_TIME == 0 ]] && return
[[ -z $PROMPT_EXEC_TIME_START ]] && return [[ -z $PROMPT_EXEC_TIME_START ]] && return
local PROMPT_EXEC_TIME_STOP=$(date +%s.%N) local PROMPT_EXEC_TIME_STOP="$(date +%s.%N)"
PROMPT_EXEC_TIME_DURATION=$(echo "($PROMPT_EXEC_TIME_STOP - $PROMPT_EXEC_TIME_START) * 1000" | bc -l) PROMPT_EXEC_TIME_DURATION=$(echo "($PROMPT_EXEC_TIME_STOP - $PROMPT_EXEC_TIME_START) * 1000" | bc -l)
unset PROMPT_EXEC_TIME_START unset PROMPT_EXEC_TIME_START
} }
@ -104,24 +105,24 @@ format_time() {
# Do some formatting to get nice time (e.g. 2m 12s) from miliseconds # Do some formatting to get nice time (e.g. 2m 12s) from miliseconds
# $1 is the milisecond amount (int or float) # $1 is the milisecond amount (int or float)
# $2 is the precision (ms/s/m/h/d) # $2 is the precision (ms/s/m/h/d)
local T=$1 local T="$1"
local D=$(echo "scale=0;$T/1000/60/60/24" | bc -l) local D="$(echo "scale=0;$T/1000/60/60/24" | bc -l)"
local H=$(echo "scale=0;$T/1000/60/60%24" | bc -l) local H="$(echo "scale=0;$T/1000/60/60%24" | bc -l)"
local M=$(echo "scale=0;$T/1000/60%60" | bc -l) local M="$(echo "scale=0;$T/1000/60%60" | bc -l)"
local S=$(echo "scale=0;$T/1000%60" | bc -l) local S="$(echo "scale=0;$T/1000%60" | bc -l)"
local MS=$(echo "scale=0;$T%1000" | bc -l) local MS="$(echo "scale=0;$T%1000" | bc -l)"
local precision=$2 local precision=$2
local out="" local out=""
case "$precision" in case "$precision" in
"ms") [[ $MS > 0 ]] && out="$(printf "%dms" $MS) ${out}"; precision="s" ;& "ms") [[ "$MS" -gt 0 ]] && out="$(printf "%dms" "$MS") ${out}"; precision="s" ;&
"s") [[ $S > 0 ]] && out="$(printf "%ds" $S) ${out}"; precision="m" ;& "s") [[ "$S" -gt 0 ]] && out="$(printf "%ds" "$S") ${out}"; precision="m" ;&
"m") [[ $M > 0 ]] && out="$(printf "%dm" $M) ${out}"; precision="h" ;& "m") [[ "$M" -gt 0 ]] && out="$(printf "%dm" "$M") ${out}"; precision="h" ;&
"h") [[ $H > 0 ]] && out="$(printf "%dh" $H) ${out}"; precision="d" ;& "h") [[ "$H" -gt 0 ]] && out="$(printf "%dh" "$H") ${out}"; precision="d" ;&
"d") [[ $D > 0 ]] && out="$(printf "%dd" $D) ${out}" ;; "d") [[ "$D" -gt 0 ]] && out="$(printf "%dd" "$D") ${out}" ;;
*) out="$T" ;; # Return $1 ($T) if precision wasn't specified/valid *) out="$T" ;; # Return $1 ($T) if precision wasn't specified/valid
esac esac
printf "$out" printf "%s" "$out"
} }
display_cmd_time() { display_cmd_time() {
[[ $CMD_TIME_SHOW == 0 ]] && return [[ $CMD_TIME_SHOW == 0 ]] && return
@ -134,7 +135,7 @@ display_cmd_time() {
# this happens when all fields (seconds/minutes/...) are 0, # this happens when all fields (seconds/minutes/...) are 0,
# if we use milisecond precision, this will likely never happen # if we use milisecond precision, this will likely never happen
# but with other precisions, it could # but with other precisions, it could
[[ "$(expr length "$time_took")" == 0 ]] && return [ ${#time_took} -eq 0 ] && return
echo -n " ${LBLUE}took ${time_took}" echo -n " ${LBLUE}took ${time_took}"
} }
@ -151,14 +152,14 @@ PS1+="$(foreign_prompt)"
PS1+="$(working_directory)" PS1+="$(working_directory)"
PS1+="\$(git_prompt)" PS1+="\$(git_prompt)"
PS1+="\$(display_cmd_time)" PS1+="\$(display_cmd_time)"
PS1+=" $PURPLE%(!.#.$)$RESET " # Final symbol (# or $) PS1+=" $PURPLE%(!.#.$)$RESET " # Final symbol (# or $)
# Next line prompt # Next line prompt
PS2="$RED\ $RESET" PS2="$RED\ $RESET"
# Right side prompt # Right side prompt
RPS1="" RPS1=""
if [ $TERM = "linux" ]; then if [ "$TERM" = "linux" ]; then
# Displaying cmd time here works, but often causes issues when we # Displaying cmd time here works, but often causes issues when we
# resize the terminal, since right prompts can be annoying to deal # resize the terminal, since right prompts can be annoying to deal
# with when resizing. This would run relatively often so it makes # with when resizing. This would run relatively often so it makes
@ -172,7 +173,15 @@ if [ $TERM = "linux" ]; then
RPS1+="%(?..${RED}%? X$RESET)" RPS1+="%(?..${RED}%? X$RESET)"
else else
# Read comments for the section above. # Read comments for the section above.
#RPS+="\$(display_cmd_time)" #RPS1+="\$(display_cmd_time)"
# NOTE: "↵" symbol could cause issues with on some terminals/machines that
# don't handle unicode well, this issue could be very confusing to debug,
# and it would not be apparent what's wrong since the symbol itself will
# be drawn, however when it is drawn, it will also move the cursor line
# 2 places back since this symbol is made up of 3 bytes (in unicode) and
# regular ASCII characters only take up 1 byte, this means that whenever
# the right-side prompt appears (on error), the prompt would have this issue.
RPS1="%(?..${RED}%? ↵$RESET)" RPS1="%(?..${RED}%? ↵$RESET)"
fi fi

View file

@ -0,0 +1,98 @@
# Don't ask for confirmations
#assume_yes = true
# Disable specific steps - same options as the command line flag
#disable = ["system", "emacs"]
# Ignore failures for these steps
#ignore_failures = ["powershell"]
# Run specific steps - same options as the command line flag
only = ["system", "pip3", "flatpak", "node", "pipx", "rustup", "dotnet", "tldr", "vim"]
# Do not ask to retry failed steps (default: false)
#no_retry = true
# Run inside tmux
#run_in_tmux = true
# List of remote machines with Topgrade installed on them
#remote_topgrades = ["toothless", "pi", "parnas"]
# Arguments to pass SSH when upgrading remote systems
#ssh_arguments = "-o ConnectTimeout=2"
# Path to Topgrade executable on remote machines
#remote_topgrade_path = ".cargo/bin/topgrade"
# Arguments to pass tmux when pulling Repositories
#tmux_arguments = "-S /var/tmux.sock"
# Do not set the terminal title
#set_title = false
# Cleanup temporary or old files
#cleanup = true
[git]
#max_concurrency = 5
# Additional git repositories to pull
#repos = [
# "~/src/*/",
# "~/.config/something"
#]
# Don't pull the predefined git repos
#predefined_repos = false
# Arguments to pass Git when pulling Repositories
#arguments = "--rebase --autostash"
[composer]
#self_update = true
# Commands to run before anything
[pre_commands]
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
# Custom commands
[commands]
#"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
[brew]
#greedy_cask = true
[linux]
# Arch Package Manager to use. Allowed values: autodetect, trizen, paru, yay, pacman.
#arch_package_manager = "pacman"
# Arguments to pass yay (or paru) when updating packages
#yay_arguments = "--nodevel"
#show_arch_news = true
#trizen_arguments = "--devel"
#enable_tlmgr = true
#emerge_sync_flags = "-q"
#emerge_update_flags = "-uDNa --with-bdeps=y world"
#redhat_distro_sync = false
#rpm_ostree = false
[windows]
# Manually select Windows updates
#accept_all_updates = false
#open_remotes_in_new_terminal = true
# Causes Topgrade to rename itself during the run to allow package managers
# to upgrade it. Use this only if you installed Topgrade by using a package
# manager such as Scoop to Cargo
#self_rename = true
[npm]
# Use sudo if the NPM directory isn't owned by the current user
#use_sudo = true
[firmware]
# Offer to update firmware; if false just check for and display available updates
#upgrade = true
[flatpak]
# Use sudo for updating the system-wide installation
#use_sudo = true

View file

@ -6,18 +6,14 @@
# Set monitor order # Set monitor order
xrandr --output HDMI-1 --auto --output eDP-1 --right-of HDMI-1 --auto & xrandr --output HDMI-1 --auto --output eDP-1 --right-of HDMI-1 --auto &
# Set X11 lockscreen delays (DPMS) # Start xsecurelock lockscreen with xss-lock
xset s on & ~/.local/bin/scripts/lockscreen start &
xset s 600 5 & # 10 minutes, 5s for dimmer
# XSS lock with xsecurelock
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
# Set the background with a custom `setbg` script # Set the background with a custom `setbg` script
setbg & setbg &
# Use xresources file in ~/.config/x11 # Use xresources file in ~/.config/x11
xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources &
# Start compositor manager to allow transparency # Start compositor manager to allow transparency
picom -b --experimental-backends & picom -b --experimental-backends &
@ -41,12 +37,11 @@ aa-notify -p &
# Enable numlock with numlockx # Enable numlock with numlockx
numlockx & numlockx &
# Run emacs daemon # Udiskie for simple mounting and notifications, no automount for security reasons
#emacs --daemon & udiskie -A -s &
# Run urxvt daemon
#urxvtd -q -o -f &
# Enable running applications from chroot # Enable running applications from chroot
xhost +local: xhost +local:
# Change x shaped default cursor (fonts are located in /usr/include/X11/cursorfont.h)
xsetroot -cursor_name left_ptr

View file

@ -33,41 +33,50 @@ commands = [
-- Gather and format CPU usage information -- Gather and format CPU usage information
-- if it's above 50%, we consider it high and make it red -- if it's above 50%, we consider it high and make it red
Run Cpu [ Run Cpu [
"-t", "<fn=1>\xf108</fn> cpu: <total>%", "-t", "<fn=1>\xf2db</fn> <total>%",
"-H","50", "-H","50",
"--high","red" "--high","red"
] 20, ] 20,
-- Ram used number and percent -- Ram used number and percent
Run Memory ["-t", "<fn=1>\xf233</fn> mem: <used>M (<usedratio>%)"] 20, Run Memory ["-t", "<fn=1>\xf538</fn> <used>M (<usedratio>%)"] 20,
-- Battery information. This is likely to require some customization -- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want -- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely. -- to just remove this section entirely.
Run Battery [ --Run Battery [
"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>", --"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
"--", --"--",
"-i", "<fc=#75c44c>AC</fc>", --"-i", "<fc=#75c44c>AC</fc>",
"-O", "<fc=#75c44c>AC</fc>", --"-O", "<fc=#75c44c>AC</fc>",
"-o", "<fc=#ff0000>AUX</fc>", --"-o", "<fc=#ff0000>AUX</fc>",
"-L", "12", --"-L", "12",
"-h", "green", --"-h", "green",
"-l", "red" --"-l", "red"
] 10, --] 10,
-- Time and date -- Time and date
Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50, Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50,
-- Network up and down -- Network up and down
Run Network "wlp2s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20, --Run Network "wlp4s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20, --Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
-- Uptime
Run Uptime ["-t", "<fn=1>\xf011</fn> <days>d <hours>h"] 360,
-- Show free disk space on / -- Show free disk space on /
Run DiskU [("/", "<fn=1>\xf0c7</fn> hdd: <free>")] [] 60, Run DiskU [("/", "<fn=1>\xf0c7</fn> <free>")] [] 60,
-- Get kernel version from uname -r -- Get kernel version from uname -r
Run Com "uname" ["-r"] "" 3600, Run Com "uname" ["-r"] "" 3600,
-- Volume info
Run Volume "default" "Master" ["-t", "<fn=1>\xf028</fn> <volume>%"] 5,
-- Get bitcoin price from a custom script
Run Com "/home/itsdrike/.local/bin/scripts/bitcoin" [] "bitcoin" 300,
-- Add dynamic invisible XPM icon that resizes to accomodate trayer -- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted -- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others -- this should only be on 1 monitor (single file), so ignore this comment on others
@ -93,14 +102,21 @@ template = "\
\<icon=haskell_20.xpm/> \ \<icon=haskell_20.xpm/> \
\<fc=#666666>|</fc> %UnsafeStdinReader% }{ \ \<fc=#666666>|</fc> %UnsafeStdinReader% }{ \
\<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \ \<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \
\<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \ \<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \
\<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \ \<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %wlp2s0% </fc> \ \<fc=#666666>|</fc> <fc=#78db32> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %default:Master% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %uptime% </fc> \
\<fc=#666666>|</fc> <fc=#efcb10><fn=2></fn> %bitcoin% </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \ \<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\<fc=#666666>|</fc> %trayerpad%\ \<fc=#666666>|</fc> %trayerpad%\
\ " \ "
} }
-- Abandoned template strings
-- Network Wifi:
-- \<fc=#666666>|</fc> <fc=#98be65> %wlp4s0% </fc> \
-- Network Ethernet:
-- \<fc=#666666>|</fc> <fc=#98be65> %enp3s0% </fc> \
-- Battery:
-- \<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \

View file

@ -33,41 +33,50 @@ commands = [
-- Gather and format CPU usage information -- Gather and format CPU usage information
-- if it's above 50%, we consider it high and make it red -- if it's above 50%, we consider it high and make it red
Run Cpu [ Run Cpu [
"-t", "<fn=1>\xf108</fn> cpu: <total>%", "-t", "<fn=1>\xf2db</fn> <total>%",
"-H","50", "-H","50",
"--high","red" "--high","red"
] 20, ] 20,
-- Ram used number and percent -- Ram used number and percent
Run Memory ["-t", "<fn=1>\xf233</fn> mem: <used>M (<usedratio>%)"] 20, Run Memory ["-t", "<fn=1>\xf538</fn> <used>M (<usedratio>%)"] 20,
-- Battery information. This is likely to require some customization -- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want -- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely. -- to just remove this section entirely.
Run Battery [ --Run Battery [
"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>", --"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
"--", --"--",
"-i", "<fc=#75c44c>AC</fc>", --"-i", "<fc=#75c44c>AC</fc>",
"-O", "<fc=#75c44c>AC</fc>", --"-O", "<fc=#75c44c>AC</fc>",
"-o", "<fc=#ff0000>AUX</fc>", --"-o", "<fc=#ff0000>AUX</fc>",
"-L", "12", --"-L", "12",
"-h", "green", --"-h", "green",
"-l", "red" --"-l", "red"
] 10, --] 10,
-- Time and date -- Time and date
Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50, Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50,
-- Network up and down -- Network up and down
Run Network "wlp2s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20, --Run Network "wlp4s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20, --Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
-- Uptime
Run Uptime ["-t", "<fn=1>\xf011</fn> <days>d <hours>h"] 360,
-- Show free disk space on / -- Show free disk space on /
Run DiskU [("/", "<fn=1>\xf0c7</fn> hdd: <free>")] [] 60, Run DiskU [("/", "<fn=1>\xf0c7</fn> <free>")] [] 60,
-- Get kernel version from uname -r -- Get kernel version from uname -r
Run Com "uname" ["-r"] "" 3600, Run Com "uname" ["-r"] "" 3600,
-- Volume info
Run Volume "default" "Master" ["-t", "<fn=1>\xf028</fn> <volume>%"] 5,
-- Get bitcoin price from a custom script
Run Com "/home/itsdrike/.local/bin/scripts/bitcoin" [] "bitcoin" 300,
-- Add dynamic invisible XPM icon that resizes to accomodate trayer -- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted -- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others -- this should only be on 1 monitor (single file), so ignore this comment on others
@ -93,12 +102,21 @@ template = "\
\<icon=haskell_20.xpm/> \ \<icon=haskell_20.xpm/> \
\<fc=#666666>|</fc> %UnsafeStdinReader% }{ \ \<fc=#666666>|</fc> %UnsafeStdinReader% }{ \
\<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \ \<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \
\<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \ \<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \
\<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \ \<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %wlp2s0% </fc> \ \<fc=#666666>|</fc> <fc=#78db32> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %default:Master% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %uptime% </fc> \
\<fc=#666666>|</fc> <fc=#efcb10><fn=2></fn> %bitcoin% </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \ \<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\<fc=#666666>|</fc> %trayerpad%\ \<fc=#666666>|</fc> %trayerpad%\
\ " \ "
} }
-- Abandoned template strings
-- Network Wifi:
-- \<fc=#666666>|</fc> <fc=#98be65> %wlp4s0% </fc> \
-- Network Ethernet:
-- \<fc=#666666>|</fc> <fc=#98be65> %enp3s0% </fc> \
-- Battery:
-- \<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \

View file

@ -33,41 +33,50 @@ commands = [
-- Gather and format CPU usage information -- Gather and format CPU usage information
-- if it's above 50%, we consider it high and make it red -- if it's above 50%, we consider it high and make it red
Run Cpu [ Run Cpu [
"-t", "<fn=1>\xf108</fn> cpu: <total>%", "-t", "<fn=1>\xf2db</fn> <total>%",
"-H","50", "-H","50",
"--high","red" "--high","red"
] 20, ] 20,
-- Ram used number and percent -- Ram used number and percent
Run Memory ["-t", "<fn=1>\xf233</fn> mem: <used>M (<usedratio>%)"] 20, Run Memory ["-t", "<fn=1>\xf538</fn> <used>M (<usedratio>%)"] 20,
-- Battery information. This is likely to require some customization -- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want -- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely. -- to just remove this section entirely.
Run Battery [ --Run Battery [
"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>", --"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
"--", --"--",
"-i", "<fc=#75c44c>AC</fc>", --"-i", "<fc=#75c44c>AC</fc>",
"-O", "<fc=#75c44c>AC</fc>", --"-O", "<fc=#75c44c>AC</fc>",
"-o", "<fc=#ff0000>AUX</fc>", --"-o", "<fc=#ff0000>AUX</fc>",
"-L", "12", --"-L", "12",
"-h", "green", --"-h", "green",
"-l", "red" --"-l", "red"
] 10, --] 10,
-- Time and date -- Time and date
Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50, Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50,
-- Network up and down -- Network up and down
Run Network "wlp2s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20, --Run Network "wlp4s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20, --Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
-- Uptime
Run Uptime ["-t", "<fn=1>\xf011</fn> <days>d <hours>h"] 360,
-- Show free disk space on / -- Show free disk space on /
Run DiskU [("/", "<fn=1>\xf0c7</fn> hdd: <free>")] [] 60, Run DiskU [("/", "<fn=1>\xf0c7</fn> <free>")] [] 60,
-- Get kernel version from uname -r -- Get kernel version from uname -r
Run Com "uname" ["-r"] "" 3600, Run Com "uname" ["-r"] "" 3600,
-- Volume info
Run Volume "default" "Master" ["-t", "<fn=1>\xf028</fn> <volume>%"] 5,
-- Get bitcoin price from a custom script
Run Com "/home/itsdrike/.local/bin/scripts/bitcoin" [] "bitcoin" 300,
-- Add dynamic invisible XPM icon that resizes to accomodate trayer -- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted -- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others -- this should only be on 1 monitor (single file), so ignore this comment on others
@ -92,11 +101,20 @@ template = "\
\<icon=haskell_20.xpm/> \ \<icon=haskell_20.xpm/> \
\<fc=#666666>|</fc> %UnsafeStdinReader% }{ \ \<fc=#666666>|</fc> %UnsafeStdinReader% }{ \
\<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \ \<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \
\<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \ \<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \
\<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \ \<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %wlp2s0% </fc> \ \<fc=#666666>|</fc> <fc=#78db32> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %default:Master% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %uptime% </fc> \
\<fc=#666666>|</fc> <fc=#efcb10><fn=2></fn> %bitcoin% </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \ \<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\ " \ "
} }
-- Abandoned template strings
-- Network Wifi:
-- \<fc=#666666>|</fc> <fc=#98be65> %wlp4s0% </fc> \
-- Network Ethernet:
-- \<fc=#666666>|</fc> <fc=#98be65> %enp3s0% </fc> \
-- Battery:
-- \<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \

View file

@ -4,4 +4,4 @@
AUTOSTART_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/autostart" AUTOSTART_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/autostart"
find $AUTOSTART_DIR -name '*.desktop' -exec ~/.local/bin/scripts/deskopen {} + find $AUTOSTART_DIR -name "*.desktop" | xargs -I {} sh -c "~/.local/bin/scripts/deskopen {} &"

View file

@ -64,6 +64,8 @@ myModMask = mod4Mask
-- Preferred programs -- Preferred programs
myTerminal = "alacritty" myTerminal = "alacritty"
myBrowser = "firefox" myBrowser = "firefox"
myFileManager = "pcmanfm"
myCliFileManager = "lf"
-- Preferred font -- Preferred font
myFont :: String myFont :: String
@ -82,7 +84,7 @@ myFocusedBorderColor :: String
myFocusedBorderColor = "#bc96da" myFocusedBorderColor = "#bc96da"
-- Default workspaces. Number of workspaces is determined by the list length. -- Default workspaces. Number of workspaces is determined by the list length.
myWorkspaces = ["dev", "www", "sys", "chat", "mus", "vid", "doc", "virt", "etc"] myWorkspaces = [" dev ", " www ", " sys ", " chat ", " mus ", " vid ", " doc ", " virt ", " etc "]
myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y) myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y)
-- Make the workspaces clickable -- Make the workspaces clickable
@ -104,12 +106,11 @@ myKeys =
[ ("M-S-r", spawn "xmonad --recompile; xmonad --restart") -- Recompiles xmonad [ ("M-S-r", spawn "xmonad --recompile; xmonad --restart") -- Recompiles xmonad
, ("M-S-q", io exitSuccess) -- Quits xmonad , ("M-S-q", io exitSuccess) -- Quits xmonad
-- Lock screen
, ("C-M-l", spawn "xset s activate") -- Send DPMS trigger for lockscreen
-- Programs -- Programs
, ("M-b", spawn (myBrowser))
, ("M-<Return>", spawn (myTerminal)) , ("M-<Return>", spawn (myTerminal))
, ("M-b", spawn (myBrowser))
, ("M-v", spawn (myFileManager))
, ("M-M1-v", spawn (myTerminal ++ " -e " ++ myCliFileManager))
, ("M-M1-h", spawn (myTerminal ++ " -e htop")) , ("M-M1-h", spawn (myTerminal ++ " -e htop"))
, ("M-M1-b", spawn (myTerminal ++ " -e bpytop")) , ("M-M1-b", spawn (myTerminal ++ " -e bpytop"))
, ("M-M1-p", spawn (myTerminal ++ " -e ipython")) , ("M-M1-p", spawn (myTerminal ++ " -e ipython"))
@ -127,7 +128,9 @@ myKeys =
-- Script shortcuts -- Script shortcuts
, ("M-S-p", spawn "setbg ~/Pictures/Wallpapers/Active") -- Set random background , ("M-S-p", spawn "setbg ~/Pictures/Wallpapers/Active") -- Set random background
, ("M-S-d", spawn "displayselect") , ("M-S-d", spawn "displayselect") -- Set display configurations
, ("M-C-l", spawn "lockscreen lock") -- Lock the screen
, ("M-C-S-l", spawn "lockscreen toggle") -- Toggle automatic locking
-- Kill windows -- Kill windows
, ("M-w", kill1) -- Kill the currently focused client , ("M-w", kill1) -- Kill the currently focused client
@ -141,12 +144,13 @@ myKeys =
, ("M-.", nextScreen) -- Switch focus to next monitor , ("M-.", nextScreen) -- Switch focus to next monitor
, ("M-,", prevScreen) -- Switch focus to prev monitor , ("M-,", prevScreen) -- Switch focus to prev monitor
, ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws , ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
, ("M-S-<KP-Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws , ("M-S-<KP_Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
-- Floating windows -- Floating windows
, ("M-f", sendMessage (T.Toggle "floats")) -- Toggles 'floats' layout , ("M-f", withFocused $ float) -- Make window float
, ("M-t", withFocused $ windows . W.sink) -- Push floating window back to tile , ("M-t", withFocused $ windows . W.sink) -- Push floating window back to tile
, ("M-S-t", sinkAll) -- Push all floating windows to tile , ("M-S-t", sinkAll) -- Push all floating windows to tile
, ("M-S-f", sendMessage (T.Toggle "floats")) -- Toggles 'floats' layout
-- Increase/decrease spacing (gaps) -- Increase/decrease spacing (gaps)
, ("C-M1-j", decWindowSpacing 4) -- Decrease window spacing , ("C-M1-j", decWindowSpacing 4) -- Decrease window spacing
@ -315,9 +319,11 @@ myManageHook = composeAll
, className =? "splash" --> doFloat , className =? "splash" --> doFloat
, className =? "toolbar" --> doFloat , className =? "toolbar" --> doFloat
, className =? "Qalculate-gtk" --> doFloat , className =? "Qalculate-gtk" --> doFloat
, className =? "udiskie" --> doFloat
, isFullscreen --> doFullFloat , isFullscreen --> doFullFloat
-- auto-shift applications to their respecitve workspaces -- auto-shift applications to their respecitve workspaces
, className =? "discord" --> doShift ( myWorkspaces !! 3 ) , className =? "discord" --> doShift ( myWorkspaces !! 3 )
, className =? "Element" --> doShift ( myWorkspaces !! 3 )
, className =? "Code" --> doShift ( myWorkspaces !! 0 ) , className =? "Code" --> doShift ( myWorkspaces !! 0 )
, className =? "Stremio" --> doShift ( myWorkspaces !! 5 ) , className =? "Stremio" --> doShift ( myWorkspaces !! 5 )
, title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 ) , title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 )
@ -347,15 +353,18 @@ myLogHook :: Handle -> Handle -> X ()
myLogHook xmproc0 xmproc1 = dynamicLogWithPP $ xmobarPP myLogHook xmproc0 xmproc1 = dynamicLogWithPP $ xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc0 x -- xmobar on monitor 1 { ppOutput = \x -> hPutStrLn xmproc0 x -- xmobar on monitor 1
>> hPutStrLn xmproc1 x -- xmobar on monitor 2 >> hPutStrLn xmproc1 x -- xmobar on monitor 2
, ppCurrent = xmobarColor "#98be65" "" . wrap " [" "] " -- Current workspace
, ppVisible = xmobarColor "#98be65" "" . wrap " " " " . clickable -- Visible but not current workspace , ppCurrent = xmobarColor "#98be65" "" -- Current workspace
, ppHidden = xmobarColor "#82AAFF" "" . wrap " *" " " . clickable -- Hidden workspaces . wrap "<box type=Bottom width=2 mb=2 color=#98be65>" "</box>" . clickable
, ppHiddenNoWindows = xmobarColor "#c792ea" "" . wrap " " " " . clickable -- Hidden workspaces (no windows) , ppVisible = xmobarColor "#98be65" "" .clickable -- Visible but not current workspace
, ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window , ppHidden = xmobarColor "#82aaff" "" . clickable -- Hidden workspaces
, ppSep = "<fc=#666666> | </fc>" -- Separator character , ppHiddenNoWindows = xmobarColor "#c792ea" "" . clickable -- Hidden workspaces (no windows)
, ppUrgent = xmobarColor "#C45500" "" . wrap " !" "! " -- Urgent workspace
, ppExtras = [windowCount] -- # of windows current workspace , ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] -- order of things in xmobar , ppSep = "<fc=#666666> | </fc>" -- Separator character
, ppUrgent = xmobarColor "#c45500" "" . wrap "!" "!" -- Urgent workspace
, ppExtras = [windowCount] -- # of windows current workspace
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] -- order of things in xmobar
} }

12
home/.local/bin/scripts/bitcoin Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
BTC_DATA=$(curl https://api.coindesk.com/v1/bpi/currentprice.json 2>/dev/null || echo 'ERR')
if [ "$BTC_DATA" != "ERR" ]; then
BTC_PRICE=$(echo $BTC_DATA | jq -r ".bpi.USD.rate_float")
BTC_PRICE=$(printf "%.2f" "$BTC_PRICE")
echo \$"$BTC_PRICE"
else
echo "N/A"
fi

111
home/.local/bin/scripts/cheat.sh Executable file
View file

@ -0,0 +1,111 @@
#!/bin/sh
# rm_trailing_slashes(string)
#
# Prints a string without any trailing slashes.
# This is used because cheat.sh doesn't play nicely with multiple slashes in
# URLs.
rm_trailing_slashes() {
string="$1"
last_char="$(printf "$string" | tail -c 1)"
if [ "$last_char" = "/" ]; then
echo "$(rm_trailing_slashes "${string%?}")"
else
echo "$string"
fi
}
# pick_category(must_match, query, argument, recurse)
#
# Pick cheat.sh category.
# if must_match is 1, only allow listed options to be picked.
# if query is specified, pick sub-category of it, else pick global categories.
# if argument is specified, optionally perform must_match check and print it.
# if recurse is 1, if the selected option ends with /, run the function again.
#
# Prints the chosen category
pick_category() {
must_match="$1"
query="$(rm_trailing_slashes "$2")"
argument="$3"
recurse="$4"
# Query all possible options
if [ -n "$query" ]; then
url="cheat.sh/$query/:list"
else
url="cheat.sh/:list"
fi
selectable="$(curl -s "$url")"
# If argument is specified, print it, optionally perform must_match check.
if [ -n "$argument" ]; then
if [ "$must_match" -ne 1 ] || echo "$selectable" | grep -qe "\b$1\b"; then
selected="$argument"
else
echo "Invalid selection: '$argument'"
echo "For all selections, query $url"
exit 1
fi
# Select the option with fzf, optionally allow other matches if must_match isn't set.
else
if [ "$must_match" -ne 1 ]; then
if [ -z "$selectable" ]; then
header="No selections found, you can use empty query to show category help, or type a custom query."
else
header="Use alt-enter to enter non-listed query. You can use empty queries to show category help."
fi
selected="$(printf "\n$selectable" | \
fzf --bind=alt-enter:print-query \
--print-query \
--prompt="cheat.sh/$query query>" \
--header="$header"\
)"
else
selected=$(printf "$selectable" | fzf --prompt="cheat.sh/$query category>")
if [ $? -ne 0 ]; then
echo "Invalid selection: '$selected'"
echo "For all selections, query $url"
exit 1
fi
fi
selected=$(printf "$selected" | tail -1)
fi
# Replace spaces with '+' (cheat.sh resolves those as spaces)
selected="$(echo "$selected" | tr ' ' '+')"
# Prepend the original query, if we have one
# Print the selected category, or subcategory with the category
if [ -n "$query" ]; then
result="$query/$selected"
else
result="$selected"
fi
# Recurse, if specified and the result ended with /
if [ "$recurse" -eq 1 ]; then
if [ "$(printf "$selected" | tail -c 1)" = "/" ]; then
result="$(pick_category "$must_match" "$result" "$argument" 1)"
fi
fi
# Print the result
printf "$result"
}
# Select the cheatsheat category (language/core-util/...)
query=$(pick_category 1 "" "$1" 0)
# If the query isn't already complete, select a sub-category
if ! echo "$query" | grep -qe ":"; then
query="$(pick_category 0 "$query" "$2" 1)"
fi
# Construct the URL from given query and print it
url="cheat.sh/$query"
echo "$url"
# Show the output of cheat.sh request
curl -s "$url"

View file

@ -7,5 +7,5 @@ exec_line=$(grep '^Exec' "$1" | tail -1)
cmd=$(echo $exec_line | sed 's/^Exec=//' | sed 's/%.//') cmd=$(echo $exec_line | sed 's/^Exec=//' | sed 's/%.//')
# Remove "" around command (if present) # Remove "" around command (if present)
cmd=$(echo $cmd | sed 's/^"//g' | sed 's/" *$//g') cmd=$(echo $cmd | sed 's/^"//g' | sed 's/" *$//g')
# Run the exec line of the application in the background # Run the exec line of the application using /bin/sh
$($cmd) & /bin/sh -c "$cmd"

View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
import feedparser
import subprocess
URL = "https://itsdrike.com/posts/index.xml"
def main():
feed = feedparser.parse(URL)
titles = {entry['title']: entry['link'] for entry in feed['entries']}
selected_page = subprocess.check_output(
["dmenu", "-i", "-p", "Post"],
input="\n".join(titles.keys()), universal_newlines=True
)
link = titles[selected_page.strip()]
subprocess.check_output(["xsel", "-bi"], input=link, universal_newlines=True)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,44 @@
#!/bin/sh
if [ "$1" = "start" ]; then
MODE="start"
elif [ "$1" = "stop" ]; then
MODE="stop"
elif [ "$1" = "toggle" ]; then
if pidof -s xss-lock > /dev/null 2>&1; then
MODE="stop"
else
MODE="start"
fi
elif [ "$1" = "lock" ]; then
MODE="lock"
else
echo "Invalid command usage, use: lockscreen [start/stop/toggle/lock]"
exit 1
fi
if [ "$MODE" = "start" ]; then
echo "Starting xss-lock"
# Set X11 lockscreen delays (DPMS)
xset s on
xset s 600 10 # Dim screen after 10 minutes, lock 10s later
# XSS lock with xsecurelock
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
elif [ "$MODE" = "stop" ]; then
echo "Stopping xss-lock"
# Remove X11 lockscreen delays (DPMS)
xset s off
# Stop XSS lock
killall xss-lock
elif [ "$MODE" = "lock" ]; then
# Send a DPMS trigger if xss-lock is running to inform it
# about the lockstate, if it's not running, run xsecurelock directly
if pidof -s xss-lock > /dev/null 2>&1; then
echo "Locking screen - using DPMS (xss-lock active)"
xset s activate
else
echo "Locking screen - running xsecurelock directly (xss-lock isn't running)"
xsecurelock
fi
fi

View file

@ -0,0 +1,7 @@
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "Tapping" "on"
EndSection

62
root/etc/default/grub Normal file
View file

@ -0,0 +1,62 @@
# GRUB boot loader configuration
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
GRUB_CMDLINE_LINUX="cryptdevice=UUID=9a400ce4-df98-43eb-b88c-009a359873a5:cryptroot:allow-discards lukskeyfile=UUID=80c09daa-c562-4242-90a9-8258f6442bec:/root-key"
# Grub should automatically detect the root UUID after decryption and set
# that as root, we could also use root=/dev/mapper/cryptroot cmdline arg,
# however that could lead to problems, since GRUB defines the root anyway,
# so we'd have 2 root definitions, we could also use the UUID manually by using
# root=7173b256-9d90-41f5-beac-4d01b3b5bbd5
# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
# Uncomment to enable booting with LUKS encrypted /boot drive
#GRUB_ENABLE_CRYPTODISK=y
# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=menu
# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console
# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto
# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep
# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
# modes only. Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"
# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"
# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT=true
# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

View file

@ -0,0 +1,52 @@
#!/bin/ash
run_hook() {
# This is a needed kernel parameter for this hook
if [ -n "$lukskeyfile" ]; then
modprobe -a -q loop dm-crypt >/dev/null 2>&1
# Refer to help from `mkinitcpio -H lukskeyfile`.
IFS=: read rootKeyDev rootKey cryptkeyLoc <<EOF
$lukskeyfile
EOF
if [ -z "${cryptkeyLoc}" ]; then
cryptkeyLoc=/crypto_keyfile.bin
fi
# Ask user whether to detect the device (detecting may
# take up a while and asking is faster)
while true; do
read -t5 -p "Use external key file? (default: yes, waiting 5s): " yn
if [ $? -gt 0 ]; then
echo "Timed out, assuming yes"
break
fi
case $yn in
[Yy]*)
break
;;
[Nn]*) return 0;;
"")
echo "Default (yes)"
break
;;
*) echo "Please answer yes or no.";;
esac
done
# Resolve and mount the device, in case we can't mount, show error
echo "Mounting device..."
if resoleved=$(resolve_device "${rootKeyDev}" $rootdelay); then
if mount -o noatime "${rootKeyDev}" /mnt>/dev/null 2>&1; then
# Copy the keyfile present in the device into the
# ramfs filesystem to be read by dm-crypt
cat "/mnt/${rootKey}" > "${cryptkeyLoc}"
else
echo "Failed to mount ${rootKeyDev} on /mnt"
/bin/sh
fi
else
echo "Failed to find ${rootKeyDev} containing LUKS root key."
fi
fi
}

View file

@ -0,0 +1,27 @@
#!/bin/bash
build() {
add_dir "/mnt"
add_module loop
add_module dm-crypt
add_runscript
}
help() {
cat <<EOF
Open root partition with LUKS root key present on internal
or external accessible non-encrypted partition.
To use this hook, specify lukskeyfile in kernel parameters.
This hook is designed to copy over the specified key file into
initramfs internal path designated as cryptkey by encrypt hook.
lukskeyfile=rootKeyDev:rootKey[:cryptkeyLoc]
rootKeyDev = /path/to/rootKeyDev, UUID=uuid-of-rootKeyDev
rootKey = /path/to/rootKey in rootKeyDev
cryptkeyLoc = /path/to/cryptkey in initramfs.
Default values
cryptkeyLoc=/crypto_keyfile.bin
EOF
}

View file

@ -51,7 +51,7 @@ FILES=()
# usr, fsck and shutdown hooks. # usr, fsck and shutdown hooks.
# #
## Edits applied: numlock (requires mkinitcpio-numlock (AUR)), encrypt ## Edits applied: numlock (requires mkinitcpio-numlock (AUR)), encrypt
HOOKS=(base udev autodetect keyboard numlock modconf block encrypt filesystems fsck) HOOKS=(base udev autodetect keyboard numlock modconf block lukskeyfile encrypt filesystems fsck)
# COMPRESSION # COMPRESSION
# Use this to compress the initramfs image. By default, zstd compression # Use this to compress the initramfs image. By default, zstd compression

View file

@ -0,0 +1 @@
blacklist pcspkr

View file

@ -0,0 +1,15 @@
# Pacman hook to automatically recompile xmonad if it or any of it's dependencies were updated
[Trigger]
Operation = Upgrade
Operation = Install
Type = Package
Target = xmonad*
Target = haskell*
[Action]
Description = Recompiling Xmonad after package update...
When = PostTransaction
Depends = coreutils
Depends = xmonad
Exec = /usr/bin/bash -euc "command -v xmonad > /dev/null || exit 0; find /home -mindepth 1 -maxdepth 1 -type d -printf '%P\0' | xargs -0I'{}' su '{}' -c 'xmonad --recompile || true'"

@ -1 +0,0 @@
Subproject commit 8e6bb7b92f421489aef49d98985bb8aaf0ddc0ce