add sway config

add bashrc
ignore xauthority
add autounlocking keepass desktop entry
add fonts for waybar
add alacritty config
move scripts location and adjust bashrc
use materia
theme sway and lockscreen
add list packages script
add ranger desktop item
add mpd config
add indicator ring to swaylock
remove mpd password
add global asdf tool versions
add mako config
update keys
add swaylock theme
add suspend to lock config
move ssh commands to aliases
tweak mpd section in waybar
add kanshi config for work
update bashrc
This commit is contained in:
shibao 2021-11-17 14:17:36 -05:00
commit e77854b6b5
44 changed files with 1269 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

45
home/default/.bashrc Normal file
View File

@ -0,0 +1,45 @@
# if not running interactively, don't do anything
[[ $- != *i* ]] && return
# hidpi potential fix
export QT_AUTO_SCREEN_SCALE_FACTOR=1
# for waybar
export XDG_CURRENT_DESKTOP=Unity
# dark gtk themes
export GTK_THEME=Materia:dark
# set neovim as default editor
export VISUAL=nvim
export EDITOR=nvim
# add scripts folder to path
export PATH="~/scripts:$PATH"
# dotnet
export MSBuildSDKsPath="/usr/share/dotnet/sdk/`dotnet --version`/Sdks/"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export PATH="~/.dotnet/tools:$PATH"
# fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
# aliases
alias v=nvim
alias ls="ls --color=auto"
alias errors="journalctl -b -p err | less"
# git
export GIT_DISCOVERY_ACROSS_FILESYSTEM=true
source /usr/share/git/completion/git-prompt.sh
source /usr/share/git/completion/git-completion.bash
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
# direnv
eval "$(direnv hook bash)"
# asdf-vm
. /opt/asdf-vm/asdf.sh
proverb

View File

@ -0,0 +1 @@
background_opacity: 0.85

View File

@ -0,0 +1,8 @@
profile {
output eDP-1 scale 2.00 position 0,540 mode 3200x1800
output "Acer Technologies G257HU T1WAA0012432" scale 1.00 position 1600,0 mode 2560x1440
}
profile {
output eDP-1 scale 2.00 position 0,540 mode 3200x1800
}

View File

@ -0,0 +1,6 @@
font=IBMPlexMono 10
background-color=#222222
border-color=#333333
anchor=top-right
default-timeout=6000
width=350

View File

@ -0,0 +1,34 @@
# mpd.conf
pid_file "/home/default/.config/mpd/mpd.pid"
db_file "/home/default/.config/mpd/mpd.db"
state_file "/home/default/.config/mpd/mpd.state"
playlist_directory "/home/default/.config/mpd/music/music/playlists/mpd"
music_directory "/home/default/.config/mpd/music"
sticker_file "/home/default/.config/mpd/sticker.sql"
log_file "syslog"
auto_update "yes"
user "default"
bind_to_address "localhost"
port "6600"
volume_normalization "yes"
# pulse audio
audio_output {
type "pulse"
name "pulse audio"
}
# httpd stream
# audio_output {
# type "httpd"
# name "My HTTP Stream"
# encoder "wave" # optional, vorbis or lame
# port "8000"
# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
# quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
# format "44100:16:1"
# max_clients "0" # optional 0=no limit
#}

View File

@ -0,0 +1,8 @@
configuration {
modi: "combi";
font: "hack 10";
combi-modi: "window,drun,ssh";
show-icons: true;
}
@theme "/usr/share/rofi/themes/solarized_alternate.rasi"

View File

@ -0,0 +1,234 @@
### sway settings
# logo key. Use Mod1 for Alt.
set $mod Mod4
# home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
set $term alacritty
set $menu rofi -show combi | xargs swaymsg exec --
# wallpaper
output * bg ~/syncthing/default/photos/wallpaper.jpg fill
### daemons
# notification daemon
exec --no-startup-id mako
# display orientation
exec --no-startup-id kanshi
# polkit
exec --no-startup-id lxpolkit
# wifi applet
exec nm-applet --indicator
### gtk settings
set $gnome-schema org.gnome.desktop.interface
exec_always {
gsettings set $gnome-schema gtk-theme 'Materia-dark'
gsettings set $gnome-schema icon-theme 'Papirus-Dark'
}
### idle configuration
# timeout
exec swayidle -w \
timeout 300 'playerctl -a pause && swaylock' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep 'playerctl -a pause' \
lock 'swaylock'
# screen lock
bindsym Ctrl+Shift+l exec playerctl -a pause && \
systemctl suspend && \
swaylock
### input configuration
# fcitx
exec --no-startup-id fcitx -d
### key bindings
# start terminal
bindsym $mod+Return exec $term
# kill focused window
bindsym $mod+Shift+q kill
# start your launcher
bindsym $mod+q exec $menu
# drag floating windows by holding down $mod and left mouse button.
# resize them with right mouse button + $mod.
# despite the name, also works for non-floating windows.
# change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# reload the configuration file
bindsym $mod+Shift+c reload
# exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
# move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# splits
bindsym $mod+b splith
bindsym $mod+v splitv
# switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# make the current focus fullscreen
bindsym $mod+f fullscreen
# toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# move focus to the parent container
bindsym $mod+a focus parent
# move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# show the next scratchpad window or hide the focused scratchpad window.
# if there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# waybar
bar {
swaybar_command waybar
}
### special keys
# volume
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
# mute
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
# keyboard brightness
bindsym XF86MonBrightnessDown exec brightnessctl set 10%-
bindsym XF86MonBrightnessUp exec brightnessctl set +10%
# music controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# bindsym XF86AudioPlay exec mpc toggle
# bindsym XF86AudioNext exec mpc next
# bindsym XF86AudioPrev exec mpc prev
# run menu
bindsym XF86Search exec $menu
# screenshot
bindsym Ctrl+Shift+p exec ~/scripts/screenshot
### gaps
gaps inner 25
# smart_gaps on
# notifications
bindsym $mod+m exec makoctl dismiss
bindsym $mod+n exec makoctl restore
### styles
# class border backgr text
client.focused #333333 #333333 #FFFFFF
client.focused_inactive #222222 #222222 #AAAAAA
client.unfocused #222222 #222222 #AAAAAA
# font
font pango: IBMPlexMono Regular 10
include /etc/sway/config.d/*

View File

@ -0,0 +1,19 @@
daemonize
indicator-idle-visible
color=222222ee
bs-hl-color=333333
key-hl-color=eeeeee
inside-color=00000000
inside-ver-color=eeeeee
inside-clear-color=cccccc
inside-wrong-color=202020
line-color=00000000
line-ver-color=00000000
line-clear-color=00000000
line-wrong-color=00000000
separator-color=00000000
ring-color=777777
ring-ver-color=bbbbbb
ring-clear-color=cccccc
ring-wrong-color=151515
text-wrong-color=eeeeee

View File

@ -0,0 +1,146 @@
{
// "layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right)
"height": 20, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
"modules-center": [],
"modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "battery", "clock", "tray"],
"sway/workspaces": {
"disable-scroll-wraparound": true
},
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"keyboard-state": {
"numlock": true,
"capslock": true,
"format": "{name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
"icon-size": 15,
"spacing": 10
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format": "{:%Y-%m-%d %I:%M:%S %p}",
"interval": 1
},
"cpu": {
"format": " {usage}%",
// "tooltip": false
},
"memory": {
"format": " {}%"
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}% ({time})",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": " {essid} ({signalStrength}%)",
"format-ethernet": " {ifname}: {ipaddr}/{cidr}",
"format-linked": " {ifname} (No IP)",
"format-disconnected": "⚠ Disconnected",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{icon} {volume}%",
"format-bluetooth": "{volume}% {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {volume}%",
// "format-source": "{volume}% ",
// "format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"mpd": {
"server": "localhost",
"port": 6600,
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon} {artist} | {title} | {elapsedTime:%M:%S}/{totalTime:%M:%S}",
// "max-length": 200,
"format-disconnected": "Disconnected",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped",
"interval": 2,
"consume-icons": {
"on": " " // Icon shows only when "consume" is on
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ", // Icon grayed out when "random" is off
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}
}

View File

@ -0,0 +1,243 @@
* {
border: none;
border-radius: 0;
/* `otf-font-awesome` is required to be installed for icons */
font-family: IBMPlexMono, monospace, 'Font Awesome 5 Free Solid';
font-size: 14px;
min-height: 0;
}
window#waybar {
background-color: #000;
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
#workspaces button {
padding: 0 8px;
background-color: transparent;
color: #ffffff;
min-width: 0;
}
#workspaces button.focused {
background-color: #424242;
box-shadow: inset 2px 2px #555555, inset -2px -2px #555555;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 6px;
border-right: 2px solid #424242;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
/*
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
*/
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.warning:not(.charging) {
background-color: #F57C00;
color: black;
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
/*
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
*/
#network.disconnected {
background-color: #424242;
}
#pulseaudio.muted {
background-color: #424242;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
/* background-color: #66cc99; */
/* color: #2a5c45; */
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
/* background-color: #90b1b1; */
}
#mpd.paused {
/* background-color: #51a37a; */
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}

Binary file not shown.

View File

@ -0,0 +1,15 @@
[Desktop Entry]
Name=KeePassXC
GenericName=Password Manager
GenericName[zh_TW]=
Comment=Community-driven port of the Windows application KeePass Password Safe
Exec=sh -c "cat /etc/password | keepassxc --pw-stdin ~/syncthing/default/docs/passwords.kdbx" %f
TryExec=keepassxc
Icon=keepassxc
StartupWMClass=keepassxc
StartupNotify=true
Terminal=false
Type=Application
Version=1.0
Categories=Utility;Security;Qt;
MimeType=application/x-keepass2;

View File

@ -0,0 +1,14 @@
[Desktop Entry]
Version=1.0
Name=ranger
GenericName=File Manager
Comment=Launches the ranger file manager
# needs full path to bin
Exec=/home/path-to/open-tui ranger %F
Icon=utilities-terminal
Terminal=false
X-MultipleArgs=false
Type=Application
MimeType=inode/directory;
StartupNotify=true
Categories=System;FileTools;FileManager

View File

@ -0,0 +1,3 @@
elixir 1.12.2-otp-23
erlang 23.3
nodejs 14.16.0

View File

@ -0,0 +1,23 @@
#!/usr/bin/env sh
set pipefail -eou
# Old script to get json url for some reason? Don't know why I did this
# youtube-dl -j --flat-playlist -a - | \
# jq -r '.id' | \
# sed 's_^_https://youtu.be/_' | \
# wget-titles-from-urls >> titles.txt
test -f append.txt
if [[ $? -ne 0 ]]; then
echo No append.txt found! Cannot append
exit
fi
if [[ ! -s append.txt ]]; then
echo append.txt is empty
exit
fi
cat append.txt | wget-titles-from-urls >> titles.txt
cat append.txt | youtube-audio
> append.txt

View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -uo pipefail #set -e causes errors since most playlist will throw errors
PARENT='/run/media/default/backup'
# audio
PARENT_AUDIO="$PARENT/audio"
(cd "$PARENT_AUDIO/anjunadeep" && echo https://www.youtube.com/playlist?list=UUbDgBFAketcO26wz-pR6OKA | youtube-archive-audio)
(cd "$PARENT_AUDIO/eeuphonious" && echo https://www.youtube.com/playlist?list=UUaHM7hKCwJ_eR-dP3c7PKHw | youtube-archive-audio)
(cd "$PARENT_AUDIO/trianglemusic" && echo https://www.youtube.com/playlist?list=UUDBdeEaSnlu-AU-ITBTRkeQ | youtube-archive-audio)
(cd "$PARENT_AUDIO/ikiru" && echo https://www.youtube.com/playlist?list=UUVg1vfzDjkT9T_F-PZGC5Mw | youtube-archive-audio)
# video
PARENT_VIDEO="$PARENT/youtube"
(cd "$PARENT_VIDEO/yotsu" && echo https://www.youtube.com/playlist?list=UU0FplT88irKbHeZucDiFplw | youtube-archive)
(cd "$PARENT_VIDEO/jeb-gardener" && echo https://www.youtube.com/playlist?list=UU5zdi4KM3ewwfYMNo_KnU0A | youtube-archive)
(cd "$PARENT_VIDEO/vagrant-holiday" && echo https://www.youtube.com/channel/UCgNqlRGqHdxNRPR6ycynWhw | youtube-archive)
(cd "$PARENT_VIDEO/fredrik-knudsen" && echo https://www.youtube.com/channel/UCbWcXB0PoqOsAvAdfzWMf0w | youtube-archive)
(cd "$PARENT_VIDEO/internet-historian" && echo https://www.youtube.com/channel/UCR1D15p_vdP3HkrH8wgjQRw | youtube-archive)
(cd "$PARENT_VIDEO/breadsword" && echo https://www.youtube.com/channel/UCcScIr2iskFm-zRo8FZ7cRw | youtube-archive)
#(cd "$PARENT_VIDEO/" && echo | youtube-archive)
# git
PARENT_GIT="$PARENT/git"
(cd "$PARENT_GIT/deluge" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/calibre" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/hydrus" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/kdeconnect-kde" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/keepassxc" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/liferea" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/mpd" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/mpv" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/quassel" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/syncthing" && git remote update && git fetch --all && git reset --hard origin/main)
(cd "$PARENT_GIT/syncthing-android" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/trackma" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/bibanon" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/deemix" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/deemix-pyweb" && git remote update && git fetch --all && git reset --hard origin/master)
(cd "$PARENT_GIT/deemix-webui" && git remote update && git fetch --all && git reset --hard origin/master)

46
home/default/scripts/booksplit Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
# Requires ffmpeg (audio splitting) and my `tag` wrapper script.
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
echo "Enter the album/book title:"; read -r booktitle
echo "Enter the artist/author:"; read -r author
echo "Enter the publication year:"; read -r year
inputaudio="$1"
# Get a safe file name from the book.
#escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
escbook="$(echo "$booktitle" | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && exit 1
# As long as the extension is in the tag script, it'll work.
ext="opus"
#ext="${1#*.}"
# Get the total number of tracks from the number of lines.
total="$(wc -l < "$2")"
while read -r x;
do
end="$(echo "$x" | cut -d' ' -f1)"
[ -n "$start" ] &&
echo "From $start to $end; $track $title"
file="$escbook/$(printf "%.2d" "$track") - $author - $esctitle.$ext"
[ -n "$start" ] && echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn "$file" &&
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
title="$(echo "$x" | cut -d' ' -f 2-)"
# esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
esctitle="$(echo "$title" | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
track="$((track+1))"
start="$end"
done < "$2"
# The last track must be done outside the loop.
echo "From $start to the end: $title"
file="$escbook/$track - $author - $esctitle.$ext"
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn "$file" &&
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"

View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
find . -type f -iregex ".*\.\(mp3\|opus\|flac\|aac\)" | sort > playlist.m3u

View File

@ -0,0 +1,3 @@
#/usr/bin/env bash
set -v #echo on
find . -type d -name '__MACOSX' -print -exec rm -rf {} \;

View File

@ -0,0 +1,68 @@
#!/usr/bin/env sh
set -ou pipefail
# Generates playlists for all mp3 and flac files in a directory, ignoring itself in the "parent" folder
PLAYLIST_FOLDER="/home/default/Music/playlists/mpd" # Playlist folder for mpd
PREFIX="music/playlists" # relative links to add to playlists, based on mpd virtual file structure
EXTENSIONS=("mp3" "opus" "flac" "m4a" "mkv" "webm")
# Disable nullglob and set pattern matching to fix spaces
shopt -s nullglob
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
cd $PLAYLIST_FOLDER || { echo "Could not cd into PLAYLIST_FOLDER"; exit 1; }
parent=`basename $PWD`
# Delete old generated playlists
if [[ -f "*.gen.m3u" ]]; then
rm *.gen.m3u
fi
if [[ -f ".trackNames" ]]; then
rm .trackNames
fi
# For all playlist directories to generate
for playlistDir in ../*; do
if [[ -d "$playlistDir" ]] && [[ "$playlistDir" != "../$parent" ]]; then
# playlist filename needed for mpd
playlist=`echo "$playlistDir" | sed "s/^\.\.\///g"`
# escaped version of filename needed for bash
escaped=`printf '%q\n' "$playlist"`
# echo "playlist=$playlist"
# echo "escaped=$escaped"
# touch file
> "$playlist.gen.m3u"
# write all files with newlines
> .track-names
for EXT in ${EXTENSIONS[@]}; do
# echo `find "../$playlist" -mindepth 1 -type f -name "*.$EXT" -printf x | wc -c`
if [[ `find "../$playlist" -mindepth 1 -type f -name "*.$EXT" -printf x | wc -c` != 0 ]]; then
ls -1 ../$escaped/*.$EXT >> .track-names 2> /dev/null
# echo `ls -1 ../$playlist/*.$EXT >> 2> /dev/null`
fi
done
# echo `cat .track-names`
cat .track-names | while IFS="" read -r song || [ -n "$song" ] ; do
unprefixed=`echo "$song" | sed "s/^\.\.\///g"`
# echo "$PREFIX/$unprefixed"
echo "$PREFIX/$unprefixed" >> "$playlist.gen.m3u"
done < .track-names
if [[ -f ".track-names" ]]; then
rm .track-names
fi
fi
done
# Use mpc to update mpd database
update-mpd > /dev/null
restart-music
IFS=$SAVEIFS

View File

@ -0,0 +1 @@
git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -n 20

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eou pipefail
read -rep $'Do you want to rename all files in this dir to their hash? [Y/n] \n> ' -n 1 REPLY
REPLY=${REPLY:-Y}
if [[ $REPLY =~ ^[Yy]$ ]]
then
for file in *; do
if [[ -f "./$file" ]]; then
sum=$(echo -n "$file" | md5sum)
echo "$file --> ${sum%% *}.${file##*.}"
mv "$file" "${sum%% *}.${file##*.}"
fi
done
fi

View File

@ -0,0 +1,6 @@
#!/bin/bash
set -eou pipefail
echo $(pacman -Qqn) $(pacman -Qqm) | \
tr " " "\n" | \
sort

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
for i in *.mp3; do ffmpeg -i "$i" -c:a libopus "${i%.*}.opus"; done
trash *.mp3

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -eou pipefail
echo $(pacman -Qqn) $(pacman -Qqm) | \
tr " " "\n" | \
sort

12
home/default/scripts/phoenix Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
while [ 1 ]
do
ping -c5 https://google.com
if [ $? -eq 0]; then
echo Ping check ok, waiting...
else
poweroff
fi
done

3
home/default/scripts/proverb Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
clear
fortune | cowsay -W 70

View File

@ -0,0 +1,30 @@
#!/usr/bin/env sh
# rename .JPG -> .jpg
count=`ls -1 *.JPG 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename JPG jpg *.JPG
fi
# remove exif except orientation from .jpg
count=`ls -1 *.jpg 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.jpg; do
exiftool -all= -overwrite_original -tagsfromfile @ -Orientation "$i"
done
fi
# rename .PNG -> .png
count=`ls -1 *.PNG 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename PNG png *.PNG
fi
# remove exif except orientation from .png
count=`ls -1 *.png 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.png; do
exiftool -all= -overwrite_original -tagsfromfile @ -Orientation "$i"
done
fi

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
CANTATA_RUNNING=0
if pgrep -f cantata &>/dev/null 2>&1; then
echo killing cantata...
CANTATA_RUNNING=1
pkill -f cantata
fi
# echo stopping pipewire-media-session...
# systemctl --user stop pipewire-media-session
echo stopping pipewire...
systemctl --user stop pipewire
echo starting pipewire...
systemctl --user start pipewire
# echo starting pipewire-media-session...
# systemctl --user start pipewire-media-session
echo stopping mpDris2...
systemctl --user stop mpd-mpris
echo stopping mpd...
systemctl --user stop mpd
echo starting mpd...
systemctl --user start mpd
echo starting mpDris2...
systemctl --user start mpd-mpris
if [[ $CANTATA_RUNNING == 1 ]]; then
echo starting cantata...
cantata& &>/dev/null
fi

View File

@ -0,0 +1,6 @@
#!/bin/sh
# Take a screenshot
dir=~/Downloads/temp
(cd $dir && grim -g "$(slurp)")
xdg-open $dir

16
home/default/scripts/scrub-ufw Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
echo "Stopping firewall and allowing everyone..."
ipt="/usr/bin/iptables"
## Failsafe - die if /sbin/iptables not found
[ ! -x "$ipt" ] && { echo "$0: \"${ipt}\" command not found."; exit 1; }
$ipt -P INPUT ACCEPT
$ipt -P FORWARD ACCEPT
$ipt -P OUTPUT ACCEPT
$ipt -F
$ipt -X
$ipt -t nat -F
$ipt -t nat -X
$ipt -t mangle -F
$ipt -t mangle -X
$ipt iptables -t raw -F
$ipt -t raw -X

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cat input.txt | awk '{ print length, $0 }' | sort -n | cut -d" " -f2-

59
home/default/scripts/tag Executable file
View File

@ -0,0 +1,59 @@
#!/bin/sh
err() { echo "Usage:
tag [OPTIONS] file
Options:
-a: artist/author
-t: song/chapter title
-A: album/book title
-n: track/chapter number
-N: total number of tracks/chapters
-d: year of publication
-g: genre
-c: comment
You will be prompted for title, artist, album and track if not given." && exit 1 ;}
while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
a) artist="${OPTARG}" ;;
t) title="${OPTARG}" ;;
A) album="${OPTARG}" ;;
n) track="${OPTARG}" ;;
N) total="${OPTARG}" ;;
d) date="${OPTARG}" ;;
g) genre="${OPTARG}" ;;
c) comment="${OPTARG}" ;;
f) file="${OPTARG}" ;;
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
esac done
shift $((OPTIND - 1))
file="$1"
[ ! -f "$file" ] && echo "Provide file to tag." && err
[ -z "$title" ] && echo "Enter a title." && read -r title
[ -z "$artist" ] && echo "Enter an artist." && read -r artist
[ -z "$album" ] && echo "Enter an album." && read -r album
[ -z "$track" ] && echo "Enter a track number." && read -r track
case "$file" in
*.ogg) echo "Title=$title
Artist=$artist
Album=$album
Track=$track
Total=$total
Date=$date
Genre=$genre
Comment=$comment" | vorbiscomment -w "$file" ;;
*.opus) echo "Title=$title
Artist=$artist
Album=$album
Track=$track
Total=$total
Date=$date
Genre=$genre
Comment=$comment" | opustags -i -S "$file" ;;
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
*) echo "File type not implemented yet." ;;
esac

View File

@ -0,0 +1,37 @@
#!/bin/python
# From https://webapps.stackexchange.com/questions/72787/how-to-create-a-youtube-playlist-from-a-list-of-links
# Only adds youtube links!
import os, io
import webbrowser
import urllib.request, urllib.error, urllib.parse
inputFileName = 'titles.txt'
def ReadMultipleDataFrom(thisTextFile, thisPattern):
inputData = []
file = open(thisTextFile, "r")
for iLine in file:
if iLine.startswith(thisPattern):
iLine = iLine.rstrip()
# print(iLine)
if ('v=') in iLine: # https://www.youtube.com/watch?v=aBcDeFGH
iLink = iLine.split('v=')[1]
iLink = iLink.split('&')[0]
inputData.append(iLink)
# print(iLink)
if ('be/') in iLine: # https://youtu.be/aBcDeFGH
iLink = iLine.split('be/')[1]
iLink = iLink.split('&')[0]
inputData.append(iLink)
# print(iLink)
return inputData
videoLinks = ReadMultipleDataFrom(inputFileName, "https")
listOfVideos = "http://www.youtube.com/watch_videos?video_ids=" + ','.join(videoLinks)
response = urllib.request.urlopen(listOfVideos)
playListLink = response.geturl()
playListLink = playListLink.split('list=')[1]
playListURL = "https://www.youtube.com/playlist?list="+playListLink+"&disable_polymer=true"
webbrowser.open(playListURL)

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -eoux pipefail
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist.backup
rankmirrors -n 20 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist

View File

@ -0,0 +1,5 @@
#!/bin/sh
set -eoux pipefail
# uses mpc to manually trigger a mpd update
mpc -h localhost -p 6600 --password update

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -eoux pipefail
yay -Syu \
--ignore=linux \
--ignore=linux-headers \
--ignore=nvidia \
--ignore=nvidia-utils

View File

@ -0,0 +1,8 @@
#!/bin/bash
# Appends the title of a URL in the format of
# "# Title\nURL\n\n"
while read -r URL; do
TITLE=`curl -L "$URL" | grep -o "<title>.*</title>" | sed -E "s/<title>(.*)<\/title>/\1/"`
printf "# $TITLE\n$URL\n\n"
done

View File

@ -0,0 +1,17 @@
#!/usr/bin/env sh
set -eou pipefail
# --write-description \
# --write-info-json \
# --write-annotations \
# --write-all-thumbnails \
# --write-auto-sub \
youtube-dl \
--ignore-errors \
--geo-bypass \
--sub-lang en --embed-subs \
--output "%(title)s.%(ext)s" \
--add-metadata \
--embed-thumbnail \
--download-archive downloaded.txt \
-a -

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -eou pipefail
# --write-description \
# --write-info-json \
# --write-annotations \
# --write-all-thumbnails \
# --embed-thumbnail \
# --write-auto-sub \
# --audio-format opus \
youtube-dl \
--ignore-errors \
--geo-bypass \
--sub-lang en --embed-subs \
--extract-audio \
--no-post-overwrites \
--output "%(title)s.%(ext)s" \
--add-metadata \
--download-archive downloaded.txt \
-a -

View File

@ -0,0 +1,12 @@
#!/bin/sh
# --embed-thumbnail \
# --audio-format opus \
youtube-dl \
--ignore-errors \
-f bestaudio \
--rm-cache-dir \
--extract-audio \
--output "%(title)s.%(ext)s" --add-metadata \
--download-archive downloaded.txt \
-a -