Compare commits

...

15 Commits

17 changed files with 108 additions and 300 deletions

View File

@@ -8,7 +8,7 @@ import:
incremental: yes incremental: yes
quiet_fallback: skip quiet_fallback: skip
timid: no timid: no
plugins: fetchart embedart plugins: fetchart embedart musicbrainz
art_filename: folder art_filename: folder
fetchart: fetchart:
cover_format: jpeg cover_format: jpeg

View File

@@ -15,6 +15,7 @@ alias jc "journalctl -eu"
alias jcu "journalctl --user -eu" alias jcu "journalctl --user -eu"
alias webtorrent "webtorrent -i -o /tmp/webtorrent --mpv --player-args='--sub-auto=all --sub-file-paths=Subs:subs'" alias webtorrent "webtorrent -i -o /tmp/webtorrent --mpv --player-args='--sub-auto=all --sub-file-paths=Subs:subs'"
alias ns "nix-shell -p" alias ns "nix-shell -p"
alias tmpdir "cd $(mktemp -d)"
# Additional paths # Additional paths
set PATH $PATH $HOME/.emacs.d/bin set PATH $PATH $HOME/.emacs.d/bin

View File

@@ -3,7 +3,7 @@
SETUVAR __fish_init_2_39_8:\x1d SETUVAR __fish_init_2_39_8:\x1d
SETUVAR __fish_init_2_3_0:\x1d SETUVAR __fish_init_2_3_0:\x1d
SETUVAR __fish_init_3_x:\x1d SETUVAR __fish_init_3_x:\x1d
SETUVAR __fish_initialized:3400 SETUVAR __fish_initialized:3800
SETUVAR fish_color_autosuggestion:555\x1ebrblack SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:white\x1e\x2d\x2dbold SETUVAR fish_color_command:white\x1e\x2d\x2dbold
@@ -22,7 +22,7 @@ SETUVAR fish_color_operator:red
SETUVAR fish_color_param:cyan SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:green SETUVAR fish_color_quote:green
SETUVAR fish_color_redirection:red SETUVAR fish_color_redirection:red
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen SETUVAR fish_color_user:brgreen

View File

@@ -7,6 +7,7 @@ Debug/
.ccls .ccls
.ccls-cache .ccls-cache
.cache .cache
.clang_complete
*.o *.o
# LaTeX # LaTeX
auto auto
@@ -35,3 +36,5 @@ __pycache__
.settings .settings
# Emacs # Emacs
.projectile-cache.eld .projectile-cache.eld
# Platformio
.pio

View File

@@ -1,21 +1,21 @@
profile multihead-dock { profile multihead-dock {
output eDP-1 enable output eDP-1 enable position 1920,0
output DP-1 enable mode 1920x1080 output DP-1 enable mode 1920x1080 position 0,0
exec swaymsg workspace "1: ", move workspace to eDP-1 exec swaymsg workspace "1: ", move workspace to eDP-1
exec swaymsg workspace "3: ", move workspace to eDP-1 exec swaymsg workspace "3: ", move workspace to eDP-1
exec swaymsg workspace "2: ", move workspace to DP-1 exec swaymsg workspace "2: ", move workspace to DP-1
exec swaymsg workspace "4: ", move workspace to DP-1 exec swaymsg workspace "4: 󱓷", move workspace to DP-1
exec light -S 100 exec light -S 100
exec light -s sysfs/leds/tpacpi::kbd_backlight -S 0 exec light -s sysfs/leds/tpacpi::kbd_backlight -S 0
} }
profile multihead-HDMI { profile multihead-HDMI {
output eDP-1 enable output eDP-1 enable position 0,0
output HDMI-A-1 enable mode 1920x1080 output HDMI-A-1 enable mode 1920x1080 position 1920,0
exec swaymsg workspace "1: ", move workspace to eDP-1 exec swaymsg workspace "1: ", move workspace to eDP-1
exec swaymsg workspace "3: ", move workspace to eDP-1 exec swaymsg workspace "3: ", move workspace to eDP-1
exec swaymsg workspace "2: ", move workspace to HDMI-A-2 exec swaymsg workspace "2: ", move workspace to HDMI-A-2
exec swaymsg workspace "4: ", move workspace to HDMI-A-2 exec swaymsg workspace "4: 󱓷", move workspace to HDMI-A-2
exec light -S 100 exec light -S 100
exec light -s sysfs/leds/tpacpi::kbd_backlight -S 0 exec light -s sysfs/leds/tpacpi::kbd_backlight -S 0
} }

View File

@@ -1,8 +1,72 @@
[Default Applications] [Default Applications]
application/pdf=org.pwmt.zathura.desktop
text/html=firefox.desktop
x-scheme-handler/http=firefox.desktop x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop x-scheme-handler/https=firefox.desktop
x-scheme-handler/about=firefox.desktop x-scheme-handler/about=firefox.desktop
x-scheme-handler/unknown=firefox.desktop x-scheme-handler/unknown=firefox.desktop
x-scheme-handler/msteams=teams-for-linux.desktop
application/vnd.ms-asf=mpv.desktop
application/vnd.rn-realmedia=mpv.desktop
application/smil+xml=mpv.desktop
application/x-matroska=mpv.desktop
application/mxf=mpv.desktop
application/ogg=mpv.desktop
application/x-shorten=mpv.desktop
application/x-mobipocket-ebook=calibre-gui.desktop
application/x-sony-bbeb=calibre-gui.desktop
application/pdf=org.pwmt.zathura.desktop
application/vnd.oasis.opendocument.spreadsheet-flat-xml=calc.desktop
application/vnd.ms-works=calc.desktop
application/vnd.ms-excel=calc.desktop
application/x-quattropro=calc.desktop
application/vnd.dbf=calc.desktop
application/vnd.stardivision.calc=calc.desktop
application/vnd.oasis.opendocument.spreadsheet-template=calc.desktop
application/vnd.oasis.opendocument.chart=calc.desktop
application/vnd.oasis.opendocument.chart-template=calc.desktop
application/vnd.sun.xml.calc.template=calc.desktop
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=calc.desktop
application/x-gnumeric=calc.desktop
application/vnd.apple.numbers=calc.desktop
application/vnd.lotus-1-2-3=calc.desktop
application/vnd.oasis.opendocument.spreadsheet=calc.desktop
application/vnd.sun.xml.calc=calc.desktop
application/vnd.openxmlformats-officedocument.spreadsheetml.template=calc.desktop
application/vnd.stardivision.chart=calc.desktop
image/jpeg=swayimg.desktop
image/tiff=swayimg.desktop
image/x-tga=swayimg.desktop
image/png=swayimg.desktop
image/x-exr=swayimg.desktop
image/gif=swayimg.desktop
image/x-portable-anymap=swayimg.desktop
image/webp=swayimg.desktop
image/heif=swayimg.desktop
image/avif=swayimg.desktop
image/bmp=swayimg.desktop
image/svg+xml=swayimg.desktop
text/x-tex=emacsclient.desktop
text/x-c++src=emacsclient.desktop
text/x-java=emacsclient.desktop
text/x-chdr=emacsclient.desktop
text/tcl=emacsclient.desktop
text/markdown=emacsclient.desktop
text/x-pascal=emacsclient.desktop
text/x-makefile=emacsclient.desktop
text/x-moc=emacsclient.desktop
text/plain=emacsclient.desktop
text/x-csrc=emacsclient.desktop
text/x-c++hdr=emacsclient.desktop
text/html=firefox.desktop
application/bitwig-device=com.bitwig.BitwigStudio.desktop
application/bitwig-remote-controls=com.bitwig.BitwigStudio.desktop
application/bitwig-package=com.bitwig.BitwigStudio.desktop
application/bitwig-preset=com.bitwig.BitwigStudio.desktop
application/bitwig-module=com.bitwig.BitwigStudio.desktop
application/bitwig-scene=com.bitwig.BitwigStudio.desktop
application/vnd.bitwig.dawproject=com.bitwig.BitwigStudio.desktop
application/bitwig-project=com.bitwig.BitwigStudio.desktop
application/bitwig-template=com.bitwig.BitwigStudio.desktop
application/bitwig-modulator=com.bitwig.BitwigStudio.desktop
application/bitwig-extension=com.bitwig.BitwigStudio.desktop
application/bitwig-clip=com.bitwig.BitwigStudio.desktop

View File

@@ -1,38 +0,0 @@
#!/bin/sh
NIGHTSCOUT_URL="https://nightscout.coolneng.duckdns.org"
CONNECTIVITY_URL="freebsd.org"
fetch_value() {
CGM_VALUE=$(curl -s -H "api-secret: $(pass api/nightscout)" -H "accept: application/json" \
"$NIGHTSCOUT_URL/api/v1/entries?count=1")
GLUCOSE=$(echo "$CGM_VALUE" | grep -o '"sgv":[0-9]*' | cut -d ":" -f 2)
DIRECTION=$(
echo "$CGM_VALUE" | grep -o '"direction":"[a-zA-Z]*"' | cut -d ":" -f 2 | tr -d \"
)
}
format_output() {
case "$DIRECTION" in
*"Up"*)
printf "{\"text\": \"%s\",\"alt\": \"up\"}" "$GLUCOSE"
;;
*"Down"*)
printf "{\"text\": \"%s\",\"alt\": \"down\"}" "$GLUCOSE"
;;
"Flat")
printf "{\"text\": \"%s\",\"alt\": \"flat\"}" "$GLUCOSE"
;;
esac
}
check_connectivity() {
if nc -zw1 "$CONNECTIVITY_URL" 443; then
fetch_value
else
echo "{\"text\": \"NA\"}"
fi
}
check_connectivity
format_output

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
tmp_dir="/tmp/cliphist"
rm -rf "$tmp_dir"
if [[ -n "$1" ]]; then
cliphist decode <<<"$1" | wl-copy
exit
fi
mkdir -p "$tmp_dir"
read -r -d '' prog <<EOF
/^[0-9]+\s<meta http-equiv=/ { next }
match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) {
system("echo " grp[1] "\\\\\t | cliphist decode >$tmp_dir/"grp[1]"."grp[3])
print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3]
next
}
1
EOF
cliphist list | gawk "$prog"

View File

@@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
search_directory=~/Documents search_directory=~/Documents
downloads=~/Downloads
xdg-open "$(rg --no-messages --no-ignore --files $search_directory -g "*.{pdf,docx,doc,xlsx,xls,pptx,ppt}" | xdg-open "$(rg --no-messages --no-ignore --files $search_directory $downloads -g "*.{pdf,docx,doc,xlsx,xls,pptx,ppt}" |
rofi -threads 0 -dmenu -sort -sorting-method fzf -i -p "find")" rofi -threads 0 -dmenu -sort -sorting-method fzf -i -p "find")"

View File

@@ -1,48 +0,0 @@
#!/usr/bin/env bash
DOCKER_IMAGE=magnetikonline/acestream-server:3.1.49_debian_8.11
PORT=6878
select_channel() {
channel_list=(
"Gol TV"
"Gol 2 TV"
"beIN Sports 1 France"
"BBC One"
)
channel=$(printf '%s\n' "${channel_list[@]}" | rofi -no-auto-select -i "$@" -dmenu -p "Choose a channel")
channel_selection "$channel"
}
streaming_server() {
if [ "$1" = "start" ]; then
echo "Spinning up the server"
docker run --publish "$PORT:$PORT" --name acestream-server --rm --tmpfs "/dev/disk/by-id:noexec,rw,size=4k" \
--tmpfs "/root/ACEStream:noexec,rw,size=4096m" \
"$DOCKER_IMAGE" >/dev/null 2>&1
echo "Server started"
else
echo "Stopping the server"
docker stop acestream-server >/dev/null 2>&1
echo "Server stopped"
fi
}
stream_channel() {
echo "Starting the stream"
nix-shell -p vlc --run "$HOME/.local/share/scripts/playstream.py --ace-stream-pid $1 --player '$(whereis vlc | cut -d ":" -f 2)'"
}
channel_selection() {
echo "Selection time"
case "$1" in
"Gol ") stream_channel "dfffbcdd9c7e32d5dc88d268dee830ff2a0d3ab6" ;;
"Gol 2") stream_channel "2aab272d05089ce881538a1b3288d391de152d53" ;;
"beIN Sports 1 France") stream channel "bba1905fcd1c4975aec544047bf8e4cd23ce3fe0" ;;
"BBC One") stream channel "243eaccd38b9a0c43b800b6c7a30b1ad2cadc1f1" ;;
esac
}
streaming_server "start"
select_channel "$@"
streaming_server "stop"

View File

@@ -1,5 +0,0 @@
#!/bin/sh
niv init
niv update nixpkgs -b nixpkgs-unstable
sed "s/pkgs ? import <nixpkgs>/sources ? import .\/nix\/sources.nix, pkgs ? import sources.nixpkgs/" -i shell.nix

View File

@@ -1,187 +0,0 @@
#!/usr/bin/env python3
import argparse
import hashlib
import json
import re
import signal
import subprocess
import sys
import time
import urllib.request
DEFAULT_SERVER_HOSTNAME = "127.0.0.1"
DEFAULT_SERVER_PORT = 6878
SERVER_POLL_TIME = 2
SERVER_STATUS_STREAM_ACTIVE = "dl"
def exit_error(message):
print(f"Error: {message}", file=sys.stderr)
sys.exit(1)
class WatchSigint:
_sent = None
def __init__(self):
if WatchSigint._sent is None:
# install handler
WatchSigint._sent = False
signal.signal(signal.SIGINT, self._handler)
def _handler(self, signal, frame):
# Ctrl-C (SIGINT) sent to process
WatchSigint._sent = True
def sent(self):
return WatchSigint._sent
def read_arguments():
# create parser
parser = argparse.ArgumentParser(
description="Instructs server to commence a given program ID. "
"Will optionally execute a local media player once playback has started."
)
parser.add_argument(
"--ace-stream-pid", help="program ID to stream", metavar="HASH", required=True
)
parser.add_argument("--player", help="media player to execute once stream active")
parser.add_argument(
"--progress",
action="store_true",
help=f"continue to output stream statistics (connected peers/transfer rates) every {SERVER_POLL_TIME} seconds",
)
parser.add_argument(
"--server",
default=DEFAULT_SERVER_HOSTNAME,
help="server hostname, defaults to %(default)s",
metavar="HOSTNAME",
)
parser.add_argument(
"--port",
default=DEFAULT_SERVER_PORT,
help="server HTTP API port, defaults to %(default)s",
)
arg_list = parser.parse_args()
if not re.search(r"^[a-f0-9]{40}$", arg_list.ace_stream_pid):
exit_error(f"invalid stream program ID of [{arg_list.ace_stream_pid}] given")
# return arguments
return (
arg_list.ace_stream_pid,
arg_list.player,
arg_list.progress,
arg_list.server,
arg_list.port,
)
def api_request(url):
response = urllib.request.urlopen(url)
return json.load(response).get("response", {})
def start_stream(server_hostname, server_port, stream_pid):
# build stream UID from PID
stream_uid = hashlib.sha1(stream_pid.encode()).hexdigest()
# call API to commence stream
response = api_request(
f"http://{server_hostname}:{server_port}/ace/getstream?format=json&sid={stream_uid}&id={stream_pid}"
)
# return statistics API endpoint and HTTP video stream URLs
return (response["stat_url"], response["playback_url"])
def stream_stats_message(response):
return (
f'Peers: {response.get("peers", 0)} // '
f'Down: {response.get("speed_down", 0)}KB // '
f'Up: {response.get("speed_up", 0)}KB'
)
def await_playback(watch_sigint, statistics_url):
while True:
response = api_request(statistics_url)
if response.get("status") == SERVER_STATUS_STREAM_ACTIVE:
# stream is ready
print("Ready!\n")
return True
if watch_sigint.sent():
# user sent SIGINT, exit now
print("\nExit!")
return False
# pause and check again
print(f"Waiting... [{stream_stats_message(response)}]")
time.sleep(SERVER_POLL_TIME)
def execute_media_player(media_player_bin, playback_url):
subprocess.Popen(
media_player_bin.split() + [playback_url],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
def stream_progress(watch_sigint, statistics_url):
print()
while True:
print(f"Streaming... [{stream_stats_message(api_request(statistics_url))}]")
if watch_sigint.sent():
# user sent SIGINT, exit now
print("\nExit!")
return
time.sleep(SERVER_POLL_TIME)
def main():
# read CLI arguments
(
stream_pid,
media_player_bin,
progress_follow,
server_hostname,
server_port,
) = read_arguments()
# create Ctrl-C watcher
watch_sigint = WatchSigint()
print(f"Connecting to program ID [{stream_pid}]")
statistics_url, playback_url = start_stream(
server_hostname, server_port, stream_pid
)
print("Awaiting successful connection to stream")
if not await_playback(watch_sigint, statistics_url):
# exit early
return
print(f"Playback available at [{playback_url}]")
if media_player_bin is not None:
print("Starting media player...")
execute_media_player(media_player_bin, playback_url)
if progress_follow:
stream_progress(watch_sigint, statistics_url)
if __name__ == "__main__":
main()

View File

@@ -15,7 +15,6 @@ usage() {
copy_nix_files() { copy_nix_files() {
if [ "$1" = "flake" ]; then if [ "$1" = "flake" ]; then
cp ~/Projects/devenv/flake-template.nix flake.nix cp ~/Projects/devenv/flake-template.nix flake.nix
cp ~/Projects/devenv/shell.nix .
elif [ "$1" = "nix-ld" ]; then elif [ "$1" = "nix-ld" ]; then
cp ~/Projects/devenv/nix-ld.nix shell.nix cp ~/Projects/devenv/nix-ld.nix shell.nix
elif [ "$1" = "datasci" ]; then elif [ "$1" = "datasci" ]; then

Binary file not shown.

View File

@@ -284,11 +284,12 @@ bindsym XF86Favorites exec mpc next
# Program keybindings # Program keybindings
# #
# clipman # clipman
bindsym $mod+c exec clipman pick -t rofi --max-items=50 bindsym $mod+c exec rofi -modi clipboard:~/.local/share/scripts/cliphist-rofi-img -show clipboard -show-icons
# grim # grim
bindsym Print exec grim bindsym Print exec grim
# slurp + grim to clipboard # slurp + grim to clipboard
bindsym Shift+Print exec slurp | grim -g - - | wl-copy bindsym Shift+Print exec slurp | grim -g - - | wl-copy
#bindsym Shift+Super_L exec slurp | grim -g - - | wl-copy
# find PDFs with rofi # find PDFs with rofi
bindsym $mod+f exec ~/.local/share/scripts/finder bindsym $mod+f exec ~/.local/share/scripts/finder
# recurrent action launcher # recurrent action launcher
@@ -325,7 +326,8 @@ output eDP-1 color_profile icc ~/.config/colord/E14-G3.icm
# Autostart programs # Autostart programs
# #
# clipman # clipman
exec wl-paste -t text --watch clipman store --max-items=50 exec wl-paste -t text --watch cliphist store
exec wl-paste -t image --watch cliphist store
# kanshi # kanshi
exec kanshi exec kanshi
# easyeffects # easyeffects
@@ -357,7 +359,7 @@ assign [app_id="mpv"] $workspace9
# calibre # calibre
assign [app_id="calibre"] $workspace10 assign [app_id="calibre"] $workspace10
# chromium # chromium
assign [class="Chromium-browser"] $workspace10 assign [app_id="chromium-browser"] $workspace10
# teams # teams
assign [class="teams-for-linux"] $workspace6 assign [class="teams-for-linux"] $workspace6

View File

@@ -59,10 +59,5 @@
}, },
"on-click": "", "on-click": "",
"ignored-sinks": ["Easy Effects Sink"] "ignored-sinks": ["Easy Effects Sink"]
},
"custom/org-pomodoro": {
"format": "<span foreground='#88C0D0'>󰅐</span> {}",
"exec": "$HOME/.local/share/scripts/org-clock-status",
"interval": 60
} }
} }

View File

@@ -1,7 +1,6 @@
# Zathura configuration # Zathura configuration
set adjust-open "best-fit" set adjust-open "best-fit"
set selection-clipboard clipboard set selection-clipboard clipboard
set recolor true
set recolor-keephue true set recolor-keephue true
set window-title-basename true set window-title-basename true
set completion-bg "#161821" set completion-bg "#161821"