diff --git a/.config/guix/cobra/home.scm b/.config/guix/cobra/home.scm new file mode 100644 index 0000000..ab57f20 --- /dev/null +++ b/.config/guix/cobra/home.scm @@ -0,0 +1,547 @@ +(define-module (cobra home) + #:use-module (guix gexp) + #:export (%home:devspec + %home:bashrc + %home:prompt + %home:bash-profile)) + +(define %home:devspec + (plain-file "devspec" "\ +#!/usr/bin/env bash + +if [[ $HOSTNAME == pp ]]; then + PRIV=doas + UPDATE=\"$PRIV sh -c 'apk update && apk upgrade -aiv && apk fix'\" + COPY_COMMAND=\"wl-copy\" + PASTE_COMMAND=\"wl-paste\" + WIFI=wlan0 + WM=\"bash\" +elif [[ $HOSTNAME == Oganesson ]]; then : + #export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 +elif [[ $HOSTNAME == Neon ]]; then + export WLR_NO_HARDWARE_CURSORS=1 +else + PRIV=sudo + UPDATE=\"$PRIV sh -c 'apt update && apt upgrade && apt autoremove'\" + COPY_COMMAND=\"xclip -i -selection clipboard\" + PASTE_COMMAND=\"xclip -o -selection clipboard\" + WIFI=wlp2s0 + WM=\"bash\" +fi")) + +(define %home:bash-profile + (plain-file "bash_profile" "\ +# Honor per-interactive-shell startup file +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi +export PATH=\"~/.local/bin:$PATH\" +export LESS_TERMCAP_mb='' +export LESS_TERMCAP_md='' +export LESS_TERMCAP_me='' +export LESS_TERMCAP_se='' +export LESS_TERMCAP_so='' +export LESS_TERMCAP_ue='' +export LESS_TERMCAP_us='' +export LESS=-R +export PATH=~/.guix-home/profile/bin:$PATH + +PATH=\"/home/cobra/perl5/bin${PATH:+:${PATH}}\"; export PATH; +PERL5LIB=\"/home/cobra/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}\"; export PERL5LIB; +PERL_LOCAL_LIB_ROOT=\"/home/cobra/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}\"; export PERL_LOCAL_LIB_ROOT; +PERL_MB_OPT=\"--install_base \\\"/home/cobra/perl5\\\"\"; export PERL_MB_OPT; +PERL_MM_OPT=\"INSTALL_BASE=/home/cobra/perl5\"; export PERL_MM_OPT; + +. ~/.devspec +. ~/.guix-home/setup-environment +if [[ $(tty) == /dev/tty2 ]]; then + exec $WM +fi")) + +(define %home:prompt + (plain-file "prompt" "\ +#!/bin/bash +# shebang for syntax highlighting purposes + +# Colors +_NON=\"\\[\\033[0m\\]\" +_BLD=\"\\[\\033[1m\\]\" +_BLK=\"\\[\\033[30m\\]\" +_RED=\"\\[\\033[31m\\]\" +_GRN=\"\\[\\033[32m\\]\" +_YLW=\"\\[\\033[33m\\]\" +_BLU=\"\\[\\033[34m\\]\" +_PRP=\"\\[\\033[35m\\]\" +_CYN=\"\\[\\033[36m\\]\" +_WHT=\"\\[\\033[37m\\]\" + +__debug_trap() { + # Set necessary pre-command variables (PROMPT_COMMAND is a + # command so its excluded here) + if [[ \"$BASH_COMMAND\" != \"$PROMPT_COMMAND\" + && \"$LAST_BASH_COMMAND\" == \"$PROMPT_COMMAND\" ]]; then + INC_TIME=1 + LAST_RT=\"$EPOCHREALTIME\" # This should be the last thing done in this function + fi + LAST_BASH_COMMAND=\"$BASH_COMMAND\" +} + +trap '__debug_trap' DEBUG + +__get_cmd_time() { + # Set hours minutes seconds and remove preceding zeros + local YEAR + local DAYS + local HOUR + local MINS + local SECS + ((YEAR=10#$(($(TZ=UTC printf '%(%Y)T' \"$CMD_TIME\")))-1970)) + ((DAYS=10#$(TZ=UTC printf '%(%j)T' \"$CMD_TIME\"))) + ((HOUR=10#$(TZ=UTC printf '%(%H)T' \"$CMD_TIME\"))) + ((MINS=10#$(TZ=UTC printf '%(%M)T' \"$CMD_TIME\"))) + ((SECS=10#$(TZ=UTC printf '%(%S)T' \"$CMD_TIME\"))) + + # Choose whether or not to print hours minutes and seconds + [[ $CMD_TIME -ge 31536000 ]] && printf '%sy ' \"${YEAR}\" + [[ $CMD_TIME -ge 86400 ]] && printf '%sd ' \"${DAYS}\" + [[ $CMD_TIME -ge 3600 ]] && printf '%sh ' \"${HOUR}\" + [[ $CMD_TIME -ge 60 ]] && printf '%sm ' \"${MINS}\" + [[ $CMD_TIME -ge 1 ]] && printf '%ss ' \"${SECS}\" + # If you want to have a limit uncomment the next line and replace somenum with + # the minimum microseconds +# [[ $CMD_US -ge somenum ]] && + printf '%sμs' \"${CMD_US:-0}\" +} + +__sig() { + # Giant switch case for getting the name of the signal (`kill -l`) + local ITR=0 + local RET + for RET in \"$@\"; do + if [[ $ITR != 0 ]]; then + printf '%s|%s' \"$_WHT\" \"$_RED\" + fi + ((ITR++)) + case $RET in + 126): \"ACCES\" ;; + 127): \"NOENT\" ;; + 129): \"HUP\" ;; + 130): \"INT\" ;; + 131): \"QUIT\" ;; + 132): \"ILL\" ;; + 133): \"TRAP\" ;; + 134): \"ABRT\" ;; + 135): \"BUS\" ;; + 136): \"FPE\" ;; + 137): \"KILL\" ;; + 138): \"USR\"1 ;; + 139): \"SEGV\" ;; + 140): \"USR\"2 ;; + 141): \"PIPE\" ;; + 142): \"ALRM\" ;; + 143): \"TERM\" ;; + 144): \"STKFLT\" ;; + 145): \"CHLD\" ;; + 146): \"CONT\" ;; + 147): \"STOP\" ;; + 148): \"TSTP\" ;; + 149): \"TTIN\" ;; + 150): \"TTOU\" ;; + 151): \"URG\" ;; + 152): \"XCPU\" ;; + 153): \"XFSZ\" ;; + 154): \"VTALRM\" ;; + 155): \"PROF\" ;; + 156): \"WINCH\" ;; + 157): \"IO\" ;; + 158): \"PWR\" ;; + 159): \"SYS\" ;; + 16[3-9]|1[7-8][0-9]|19[0-2]): \"RT$((RET-128))\" ;; # Savagery + *): \"$RET\" ;; # Print exit code if not in list + esac + printf '%s' \"$_\" + done +} + +__ssh() { + local CON=($SSH_CONNECTION) + local SRV_IP=\"${CON[2]}\" + [[ -z \"$SRV_IP\" ]] && return + local SRV_PORT=\"${CON[3]}\" + # 4 chars from startand 4 chars from end + local SRV_IP_CUT=\"${_CYN}${SRV_IP}\" + [[ ${#SRV_IP} -gt 8 ]] && local SRV_IP_CUT=\"${_CYN}${SRV_IP:0:4}${_WHT}*${_CYN}${SRV_IP: -4}\" + + printf '%s' \"${_GRN}${_BLU}[${SRV_IP_CUT}${_PRP}${_BLD}:${_NON}${_CYN}${SRV_PORT}${_BLU}]${_NON}\" +} + +__guix_env() { + local re='[\\(]?\\(\"([^\"]*)\"' + if [[ \"$GUIX_ENVIRONMENT\" ]]; then + local PACKAGES=($(while read -r line; do + [[ \"$line\" =~ $re ]] && printf '%s ' \"${BASH_REMATCH[1]}\" + done < $GUIX_ENVIRONMENT/manifest)) + if [[ ${#PACKAGES[@]} -eq 2 ]]; then + printf \"${_BLD}${_BLU}[${_NON}${_YLW}Guix${_NON}: ${_WHT}%s ${_NON}+ ${_PRP}%d ${_NON}pkg${_BLD}${_BLU}] \" \"${PACKAGES[0]}\" \"$((${#PACKAGES[@]}-1))\" + elif [[ ${#PACKAGES[@]} -gt 2 ]]; then + printf \"${_BLD}${_BLU}[${_NON}${_YLW}Guix${_NON}: ${_WHT}%s ${_NON}+ ${_PRP}%d ${_NON}pkgs${_BLD}${_BLU}] \" \"${PACKAGES[0]}\" \"$((${#PACKAGES[@]}-1))\" + else + printf \"${_BLD}${_BLU}[${_NON}${_YLW}Guix${_NON}: ${_WHT}%s${_BLD}${_BLU}] \" \"${PACKAGES[@]}\" + fi + fi +} + +__prompt() { + # Get exit code (must be first) + local PLC=(\"${PIPESTATUS[@]}\") + + # Reset time when prompt was first displayed after command + # this contributes to the ~40 microsecond difference in $CMD_US and the actual time it took + if [[ \"$INC_TIME\" != 0 ]]; then + PROMPT_RT=\"$EPOCHREALTIME\" + INC_TIME=0 + fi + + # *_RT may not be set + LAST_RT=\"${LAST_RT:-$EPOCHREALTIME}\" + PROMPT_RT=\"${PROMPT_RT:-$EPOCHREALTIME}\" + + # Get relative times + + # Remove decimal point, simulating multiplying by 1 million + PROMPT_RT1M=\"${PROMPT_RT/.}\" + PROMPT_RT1M=\"${PROMPT_RT1M/,}\" + LAST_RT1M=\"${LAST_RT/.}\" + LAST_RT1M=\"${LAST_RT1M/,}\" + + ((CMD_US=PROMPT_RT1M-LAST_RT1M)) + + CMD_TIME=0 + + # Divide by 1 million to get a more accurate difference + ((CMD_TIME=CMD_US/1000000)) + + [[ ${#CMD_US} -lt 6 ]] || CMD_US=\"${CMD_US: -6}\" + ((CMD_US=10#$CMD_US)) + + # Set prompt sections + + local SIG + local COL + local UHD + local TIME + local IND + local GUIX + + # Text + + # ssh detection and indicator + [[ \"$SSH_CONNECTION\" ]] && local SSH=\"$(__ssh) \" + + # [INT], [4], etc. + local RET + for RET in \"${PLC[@]}\"; do + if [[ $RET -gt 0 ]]; then + SIG=\"$(printf '%s[%s%s%s] ' \"$_BLU\" \"$_RED\" \"$(__sig \"${PLC[@]}\")\" \"$_BLU\")\" + break + fi + done + + # Guix shell environment + GUIX=\"$(__guix_env)\" + + # [user@homeserver:~] + COL=\"$([[ $UID == 0 ]] && printf '%s' \"$_RED\" || printf '%s' \"$_YLW\")\" + UHD=\"${_BLD}${_BLU}[${COL}\\u${_PRP}@${_CYN}\\h${_PRP}:${_GRN}\\w${_BLU}]\" + + # 2y 351d 12m 43s 382969μs + TIME=\"${_YLW}$(__get_cmd_time)\" + + # Random colored $ or # + _RAND256=\"\\[\\033[38;2;$((RANDOM%256));$((RANDOM%256));$((RANDOM%256))m\\]\" + IND=\"${_RAND256}\\\\$\" + + # Set the prompt + PS1=\"${_NON}${SSH}${GUIX}${SIG}${UHD} ${TIME} ${IND} ${_NON}\" +} + +PROMPT_COMMAND=__prompt")) + +(define %home:bashrc + (plain-file "bashrc" "\ +# Source other files +[ -r ~/.prompt ] && . ~/.prompt +[ -r ~/.devspec ] && . ~/.devspec +[ -r ~/.config/colorscheme ] && . ~/.config/colorscheme + +[ \"$TERM\" == \"screen.linux\" ] && export TERM=\"screen\" + +export EDITOR=\"vim\" +export TERM=xterm-256color + +# History stuff +export HISTCONTROL=ignoredups:erasedups +export HISTFILESIZE=1000 +export HISTSIZE=1000 + +export GPG_TTY=$(tty) + +export MANPATH=/run/current-system/profile/share/man:/home/cobra/.guix-profile/share/man:/run/current-system/profile/share/man:/home/cobra/.guix-home/profile/share/man + +clear() { + printf '\\033c' # faster than ncurses clear by a lot +} + +# Other aliases +alias c='clear' +alias ls='ls --color=auto -FAh' +alias ll='ls -l' +alias nf='hyfetch' +alias ga='git add' +alias gc='git commit -sS' +alias gp='git push' +alias mpv='mpv --no-audio-display' +alias wv='swayhide mpv $($PASTE_COMMAND)' +alias curl='curl -L' +alias prof='profanity' +alias gomuks=\"http_proxy='socks5://127.0.0.1:9050' gomuks\" +alias tut=\"http_proxy='socks5://127.0.0.1:9050' tut\" +alias dico=\"dico -d en-wiktionary\" + +# Random string (passwords) +randstr() { + tr -cd '[:graph:]' >($COPY_COMMAND) +} + +# URL-encode stdin +urlencode() { + LC_COLLATE_OLD=$LC_COLLATE + LC_COLLATE=C + + local TEXT=\"$( /dev/null \\;; } + +fixdh() { + diffhome | while read -r _ SRC _ DEST _; do + cp $SRC $DEST; + done; +} + +strlen() { + N=$(wc -c <<< \"$*\") + ((N--)) + printf '%u\\n' \"$N\" +} + +uppweb() { + ssh vern.cc 'cd ~/public_html; git pull' +} + +caption() { + [ -z \"$3\" ] && { + echo \"Usage: caption [input] [output] [text...]\" + return 1 + } + local FILE=\"$1\" + local OUT=\"$2\" + shift 2 + local TEXT=\"$*\" + local WIDTH=\"$(identify -format \"%[w]\\n\" \"$FILE\" | head -n1)\" + local HEIGHT=\"$(identify -format \"%[h]\\n\" \"$FILE\" | head -n1)\" + local FONT_SIZE=\"$(((HEIGHT+WIDTH)/20))\" + convert -gravity north \\( -size \"${WIDTH}x\" -pointsize \"$FONT_SIZE\" -font 'Liberation-Sans-Bold' caption:\"$TEXT\" -gravity Center -extent \"${WIDTH}x\" \\) \"$FILE\" -append \"$OUT\" +} + +captionvid() { + [ -z \"$3\" ] && { + echo \"Usage: captionvid [input] [output] [text...]\" + return 1 + } + rm /tmp/caption.*.png + FPS=\"$(ffmpeg -i \"$1\" 2>&1 |grep fps | sed 's/.* \\([0-9]\\+\\) fps.*/\\1/')\" + IN=\"$1\" + OUT=\"$2\" + shift 2 + ffmpeg -i \"$IN\" \"/tmp/caption.%02d.png\" + for i in /tmp/caption.*; do + caption \"$i\" \"$i-new.png\" \"$*\" + done + ffmpeg -framerate $FPS -i \"/tmp/caption.%02d.png-new.png\" \"$OUT\" + rm /tmp/caption.*.png +} + +topbottom() { + [ -z \"$3\" ] && { + echo \"Usage: caption [input] [output] [text...]\" + return 1 + } + local FILE=\"$1\" + local OUT=\"$2\" + shift 2 + local WIDTH=\"$(identify -format \"%[w]\\n\" \"$FILE\" | head -n1)\" + local HEIGHT=\"$(identify -format \"%[h]\\n\" \"$FILE\" | head -n1)\" + local FONT_SIZE=\"$(((HEIGHT+WIDTH)/20))\" + convert -size \"${WIDTH}x\" -stroke black -strokewidth 3 -fill white -pointsize \"$FONT_SIZE\" -font 'Liberation-Sans-Bold' -gravity Center -extent \"${WIDTH}x\" -gravity north \\( -annotate +0+0 \"$1\" \\) -gravity south \\( -annotate +0+0 \"$2\" \\) \"$FILE\" -append \"$OUT\" +} + +topbottomvid() { + [ -z \"$3\" ] && { + echo \"Usage: captionvid [input] [output] [text...]\" + return 1 + } + rm /tmp/caption.*.png + FPS=\"$(ffmpeg -i \"$1\" 2>&1 |grep fps | sed 's/.* \\([0-9]\\+\\) fps.*/\\1/')\" + IN=\"$1\" + OUT=\"$2\" + shift 2 + ffmpeg -i \"$IN\" \"/tmp/caption.%02d.png\" + for i in /tmp/caption.*; do + topbottom \"$i\" \"$i-new.png\" \"$1\" \"$2\" + done + ffmpeg -framerate $FPS -i \"/tmp/caption.%02d.png-new.png\" \"$OUT\" + rm /tmp/caption.*.png +} + +subcipher() { + local COLOR PERM L1 line grep word + if [ $# -lt 3 ]; then + if [ $# -lt 2 ] || [[ \"$1\" != \"0\" && \"$1\" != \"1\" ]]; then + printf \"Usage: [0|1] subcipher file [string...]\\n\" + return 1 + fi + fi + COLOR=\"$1\" + shift + PERM=\"$1\" + shift + [ -z \"$*\" ] && set -- \"$( ${1:-$(date -u -I)}.svg +} + + +mnplot() { + ssh mythos \"${1:-/opt/gnuplot/gnuplot.sh}; cat /opt/gnuplot/${1:-$(date -u -I)}.svg\" > ${1:-$(date -u -I)}.svg +} + +vnplot() { + ssh vern \"${1:-/opt/gnuplot/net/gnuplot.sh}; cat /opt/gnuplot/net/${1:-$(date -u -I)}.svg\" > ${1:-$(date -u -I)}.svg +} + +vpplot() { + ssh vern \"${1:-/opt/gnuplot/power/gnuplot.sh}; cat /opt/gnuplot/power/${1:-$(date -u -I)}.svg\" > ${1:-$(date -u -I)}.svg +} + +inplot() { + ssh iceberg \"${1:-~/gnuplot/gnuplot.sh}; cat ~/gnuplot/${1:-$(date -u -I)}.svg\" > ${1:-$(date -u -I)}.svg +} + +cnplot() { + ssh crescent \"${1:-/opt/gnuplot/net/gnuplot.sh}; cat /opt/gnuplot/net/${1:-$(date -u -I)}.svg\" > ${1:-$(date -u -I)}.svg +} + +cpplot() { + ssh crescent \"${1:-/opt/gnuplot/power/gnuplot.sh}; cat /opt/gnuplot/power/${1:-$(date -u -I)}.svg\" > ${1:-$(date -u -I)}.svg +} + +reconf() { + $PRIV guix system reconfigure /etc/guix-config/${HOSTNAME,,}.scm +} + +hreconf() { + guix home reconfigure $HOME/.config/guix/home-config.scm +} + +geng() { + < \"$1\" sed 's/\\s*;.*//' | grep -ve '^$' -e '^T' | awk '{print \"N\"NR\" \"$0}' > \"$2\" +} + +mkmshex() { + FILE=\"${1%.*}\" + microscheme \"$1\" + avr-gcc -B /run/current-system/profile/avr/lib/avr5 -mmcu=\"$2\" -g -Os \"$FILE\".s -o \"$FILE\".elf + avr-objcopy -Oihex \"$FILE\".o \"$FILE\".hex +} + +uploadhex() { + avrdude -C/run/current-system/profile/etc/avrdude.conf -v -p\"$2\" -carduino -P${3:-/dev/ttyS0} -U\"flash:w:$1:i\" +} + +gshpkg() { + local re='[\\(]?\\(\"([^\"]*)\"' + if [[ \"$GUIX_ENVIRONMENT\" ]]; then + local PACKAGES=($(while read -r line; do + [[ \"$line\" =~ $re ]] && printf '%s ' \"${BASH_REMATCH[1]}\" + done < $GUIX_ENVIRONMENT/manifest)) + echo ${PACKAGES[@]} + fi +}")) diff --git a/.config/guix/cobra/home/bin.scm b/.config/guix/cobra/home/bin.scm new file mode 100644 index 0000000..d6d0e25 --- /dev/null +++ b/.config/guix/cobra/home/bin.scm @@ -0,0 +1,210 @@ +(define-module (cobra home bin) + #:use-module (guix gexp) + #:use-module (gnu packages base) + #:export (%bin:torbrowser + %bin:suspend-wrap + %bin:suspend + %bin:start-pipewire + %bin:screenshot + %bin:logout-wofi + %bin:lock + %bin:fss + %bin:beep-wrapper + %bin:beep + %bin:backtick)) + +(define %bin:torbrowser + (computed-file "bin-torbrowser" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash + +cd ~/.local/share/torbrowser/tor-browser/ +guix shell --check --pure --expression='(list (@@ (gnu packages gcc) gcc-11) \"lib\")' coreutils bash grep sed gcc-toolchain patchelf gtk+ dbus-glib libxt libevent openssl file alsa-lib << EOT +set -x +cd Browser +patchelf --set-interpreter \\$LIBRARY_PATH/ld-linux-x86-64.so.2 firefox.real +patchelf --set-interpreter \\$LIBRARY_PATH/ld-linux-x86-64.so.2 TorBrowser/Tor/tor +LD_LIBRARY_PATH=\\$LIBRARY_PATH ./start-tor-browser -v +EOT" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:suspend-wrap + (computed-file "bin-suspend-wrap" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash +sudo ~/.local/bin/__suspend +while grep -v '\\[' /sys/power/state; do + swaylock + break +done" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:suspend + (computed-file "bin-suspend" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash +echo mem > /sys/power/state" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:start-pipewire + (computed-file "bin-start-pipewire" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash + +rm -rf /run/user/$UID/pulse +pkill pulseaudio +rm -rf /run/user/$UID/pulse + +pipewire & +pipewire-pulse & +wireplumber &" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:screenshot + (computed-file "bin-screenshot" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash + +if [ ! -d $HOME/Pictures/Screenshots ] +then + mkdir -p $HOME/Pictures/Screenshots +fi + +fullscreen() { + filename=$HOME/Pictures/Screenshots/$(date +%Y%m%d_%H:%M:%S_Fullscreen).png + grim $filename + cat $filename | wl-copy \ + && notify-send -i $filename \"Fullscreen Screenshot taken\" + } + +selecting() { + filename=$HOME/Pictures/Screenshots/$(date +%Y%m%d_%H:%M:%S_Selected).png + grim -g \"$(slurp -b e3eaf699)\" $filename \ + && notify-send -i $filename \"Selective Screenshot taken\" + cat $filename | wl-copy + } + +wofirun() { + case \"$(printf \"fullscreen\\nselect\\n\" | wofi --dmenu -i -H 500 -W 250 -x 0 -y 0 )\" in + 'fullscreen')fullscreen;; + 'select')selecting;; + esac +} + +helpscreen() { + echo \"Usage: screenshot [-f] [-s] [-w] [-h] \" + echo \"Options:\" + echo \"-f : Fullscreen screenshot\" + echo \"-s : Select a region for the screenshot\" + echo \"-w : Shows a wofi prompt for screenshot\" + echo \"-h : Shows this fucking help menu\" + echo \"If no flags are selected then -f is chosen\" +} +case $1 in + -f)fullscreen;; + -s)selecting;; + -h)helpscreen;; + -w)wofirun;; + *)fullscreen;; +esac" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:logout-wofi + (computed-file "bin-logout-wofi" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash + +case \"$(printf \"logout\\nreboot\\nshutdown\\nsleep\\n\" | wofi --dmenu -i -H 500 -W 250 -x 0 -y 0 )\" in + 'logout') swaymsg exit;; + 'sleep') ~/.local/bin/suspend ;; + 'reboot') sudo reboot ;; + 'shutdown') sudo poweroff ;; + *) exit 1 ;; +esac" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:lock + (computed-file "bin-lock" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash +if ! ps aux | grep -v grep | grep swaylock; then +# if [[ $(playerctl status) != \"Playing\" ]]; then +# swayidle -w timeout 600 'sudo ~/.local/bin/__suspend' & +# SUSPEND=$! +# fi + swayidle -w timeout 15 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"' & + SCREENOFF=$! + swaylock + kill $SUSPEND $SCREENOFF +fi" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:fss + (computed-file "bin-fss" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash +# made by aryak.vern.cc modified by cobra.vern.cc +if [[ -S \"/tmp/mpvfsfsock\" ]]; then + echo quit | socat - /tmp/mpvfsfsock +else + mpv --input-ipc-server=/tmp/mpvfsfsock ~/.local/share/fss.ogg + trap \"rm -rf /tmp/mpvfsfsock\" EXIT +fi" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:beep-wrapper + (computed-file "bin-beep-wrapper" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash +while sleep 1; do + ## Battery beep + if ls /sys/class/power_supply/BAT* &>/dev/null; then + BAT0=$(" #$output "\n" "\ +#!/usr/bin/env sh +echo $1 > /proc/acpi/ibm/beep" "\nEOF")) + (chmod #$output #o755)))) + +(define %bin:backtick + (computed-file "bin-backtick" + #~(begin + (system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\ +#!/usr/bin/env bash + +cpu() { + bc<<<\"scale=3;$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}') / $(nproc --all)\" +} + +ram() { + free -h | sed '2!d' | (read _ _ used _; echo $used) +} + +bat() { + acpi -b | sed 's/Battery /BAT/' +} + +echo \"$(cpu)% $(ram) $(bat)\"" "\nEOF")) + (chmod #$output #o755)))) diff --git a/.config/guix/cobra/home/configs.scm b/.config/guix/cobra/home/configs.scm new file mode 100644 index 0000000..99f07c2 --- /dev/null +++ b/.config/guix/cobra/home/configs.scm @@ -0,0 +1,978 @@ +(define-module (cobra home configs) + #:use-module (guix gexp) + #:export (%waybar:style + %waybar:config + %config:swaylock + %config:sway + %config:mpv + %config:mako + %config:foot + %config:colorscheme + %config:hyfetch + %config:neofetch)) + +(define %waybar:style + (plain-file "waybar-style" "\ +/* ============================================================================= + * + * Waybar configuration + * + * Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration + * + * =========================================================================== */ + +/* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + +@keyframes blink-warning { + 70% { + color: white; + } + + to { + color: white; + background-color: orange; + } +} + +@keyframes blink-critical { + 70% { + color: white; + } + + to { + color: white; + background-color: red; + } +} + + +/* ----------------------------------------------------------------------------- + * Base styles + * -------------------------------------------------------------------------- */ + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: transparent; + color: black; + font-family: 'Fira Mono'; + font-size: 14px; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#memory, +#mode, +#network, +#pulseaudio, +#temperature, +#tray { + padding-left: 10px; + padding-right: 10px; +} + + +/* ----------------------------------------------------------------------------- + * Module styles + * -------------------------------------------------------------------------- */ + +#battery { + background-color: #F79489; + color: black; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + border-top-right-radius: 15px; + border-bottom-right-radius: 15px; +} + +#battery.warning { + color: orange; + font-weight: bold; +} + +#battery.critical { + color: red; + font-weight: bold; +} + +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; + font-weight: bold; +} + +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +#clock { + font-weight: bold; + color: black; + text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white; + border-radius: 50%; +} + +#cpu { + /* No styles */ + background-color: #F9C6C0; + color: black; +} + +#cpu.warning { + color: orange; + font-weight: bold; +} + +#cpu.critical { + color: red; + font-weight: bold; +} + +#memory { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + background-color: #FADCD9; + color: black; +} + +#memory.warning { + color: orange; + font-weight: bold; +} + +#memory.critical { + color: red; + animation-name: blink-critical; + animation-duration: 2s; + font-weight: bold; +} + +#mode { + background: #64727D; + border-top: 2px solid white; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; + margin-left: 10px; +} + +#network { + /* No styles */ + background-color: #F9F1F0; + color: black; + border-top-left-radius: 15px; + border-bottom-left-radius: 15px; +} + +#network.disconnected { +/* color: orange;*/ +} + +#pulseaudio { + /* No styles */ +} + +#pulseaudio.muted { + /* No styles */ +} + +#temperature { + /* No styles */ + background-color: #F8AFA6; + color: black; +} + +#temperature.critical { + color: red; +} + +#tray { + /* No styles */ +} + +#window { + font-weight: bold; + padding-left: 5px; +} + +#workspaces button { + border: 2px solid black; + border-radius: 15px; + padding-left: 10px; + padding-right: 10px; + color: black; +} + +#workspaces button.focused { + background-color: #F79489; +} + +#workspaces button.urgent { + border-color: #f4c815; + color: #f4c815; +}")) + +(define %waybar:config + (plain-file "waybar-config" "\ +// ============================================================================= +// +// Waybar configuration +// +// Configuration reference: https://github.com/Alexays/Waybar/wiki/Configuration +// +// ============================================================================= + +{ + // ------------------------------------------------------------------------- + // Global configuration + // ------------------------------------------------------------------------- + + \"layer\": \"top\", + + \"position\": \"top\", + + // If height property would be not present, it'd be calculated dynamically + \"height\": 30, + + \"modules-left\": [ + \"sway/workspaces\", + \"sway/window\", + \"sway/mode\", + ], +// \"modules-center\": [ +// ], + \"modules-right\": [ + \"network\", + \"memory\", + \"cpu\", + \"temperature\", + \"custom/keyboard-layout\", + \"battery\", + \"tray\", + \"clock#date\", + \"clock#time\" + ], + + + // ------------------------------------------------------------------------- + // Modules + // ------------------------------------------------------------------------- + + \"battery\": { + \"interval\": 10, + \"states\": { + \"warning\": 30, + \"critical\": 15 + }, + // Connected to AC + \"format\": \"{icon} ^{capacity}%\", // Icon: bolt + // Not connected to AC + \"format-discharging\": \"{icon} {capacity}%\", + \"format-icons\": [ + \"\", + \"\", + \"\", + \"\", + \"\" + ], + \"tooltip\": true + }, + + \"clock#time\": { + \"interval\": 1, + \"format\": \"{:%H:%M:%S}\", + \"tooltip\": false + }, + + \"clock#date\": { + \"interval\": 10, + \"format\": \"{:%Y-%m-%d}\", // Icon: calendar-alt + \"tooltip-format\": \"{:%e %B %Y}\" + }, + + \"cpu\": { + \"interval\": 5, + \"format\": \" {usage}%\", // Icon: microchip + \"states\": { + \"warning\": 70, + \"critical\": 90 + } + }, + + \"memory\": { + \"interval\": 5, + \"format\": \"MEM {}%\", // Icon: memory + \"states\": { + \"warning\": 70, + \"critical\": 90 + } + }, + + \"network\": { + \"interval\": 5, + \"format-wifi\": \" {signalStrength}%\", // Icon: wifi + \"format-ethernet\": \" {ifname}: {ipaddr}/{cidr}\", // Icon: ethernet + \"format-disconnected\": \"⚠ Disconnected\", + \"tooltip-format\": \"{ifname}: {ipaddr}\" + }, + + \"sway/mode\": { + \"format\": \" {}\", // Icon: expand-arrows-alt + \"tooltip\": false + }, + + \"sway/window\": { + \"format\": \"{}\", + \"max-length\": 120 + }, + + \"sway/workspaces\": { + \"all-outputs\": false, + \"disable-scroll\": true, + \"format\": \"{name}\", + \"format-icons\": { +// \"1:www\": \"龜\", // Icon: firefox-browser +// \"2:mail\": \"\", // Icon: mail +// \"3:editor\": \"\", // Icon: code +// \"4:terminals\": \"\", // Icon: terminal +// \"5:portal\": \"\", // Icon: terminal +// \"urgent\": \"\", + \"focused\": \"\", + \"default\": \"\" + } + }, + + //\"pulseaudio\": { + // //\"scroll-step\": 1, + // \"format\": \"{icon} {volume}%\", + // \"format-bluetooth\": \"{icon} {volume}%\", + // \"format-muted\": \"\", + // \"format-icons\": { + // \"headphones\": \"\", + // \"handsfree\": \"\", + // \"headset\": \"\", + // \"phone\": \"\", + // \"portable\": \"\", + // \"car\": \"\", + // \"default\": [\"\", \"\"] + // }, + // \"on-click\": \"pavucontrol\" + //}, + + \"temperature\": { + \"critical-threshold\": 80, + \"interval\": 5, + \"format\": \"{icon} {temperatureC}°C\", + \"format-icons\": [ + \"\", // Icon: temperature-empty + \"\", // Icon: temperature-quarter + \"\", // Icon: temperature-half + \"\", // Icon: temperature-three-quarters + \"\" // Icon: temperature-full + ], + \"tooltip\": true + }, + + \"tray\": { + \"icon-size\": 21, + \"spacing\": 10 + } + +}")) + +(define %config:swaylock + (plain-file "config-swaylock" "\ +ignore-empty-password +show-failed-attempts +hide-keyboard-layout +disable-caps-lock-text +bs-hl-color=d88f96 +inside-color=4730327f +inside-clear-color=dbbc2f7f +inside-ver-color=1961e67f +inside-wrong-color=d88f967f +key-hl-color=c6888d +line-color=fcf5f3 +line-clear-color=fcf5f3 +line-ver-color=fcf5f3 +line-wrong-color=fcf5f3 +ring-color=b3787e +ring-clear-color=f3d64d +ring-ver-color=4545db +ring-wrong-color=d88f96 +separator-color=fcf5f3 +text-color=fcf5f3 +text-clear-color=fcf5f3 +text-ver-color=fcf5f3 +text-wrong-color=fcf5f3 +image=~/.config/sway/background.png +font=\"Fira Code\"")) + +(define %config:sway + (plain-file "config-sway" "\ +# SWAY CONFIG + + +# Variables + +set $mod Mod4 +set $menu wofi --show drun -i -H 500 -W 450 +set $term foot + +set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock + +floating_modifier $mod normal +default_border pixel 2 +client.focused #1c81e6 #1c81e6 #771cb7 #bf1541 +client.unfocused #3436a7 #3436a7 #ffffff +client.focused_inactive #3436a7 #3436a7 #ffffff +gaps inner 10 +gaps outer 0 +font pango: Fira Code 12 + +# No gaps if there's only 1 window +smart_gaps on + +# Hides the borders if theres only 1 window +hide_edge_borders smart + +# Output configuration +output * { + bg ~/.config/sway/background.png fill +} + +output LVDS-1 pos 640 1080 +output DP-1 pos 1280 0 +output VGA-1 pos 0 56 + +# Input configuration +input type:touchpad { + dwt disabled + scroll_method edge +} + +# Key bindings +bindsym $mod+Return exec $term +bindsym $mod+Shift+Return exec $term -a float +bindsym $mod+q kill +bindsym $mod+F4 wkill +bindsym $mod+d exec $menu +bindsym $mod+Shift+c reload +bindsym mod1+shift+w exec setbg -s +bindsym $mod+Shift+l exec ~/.local/bin/lock +bindsym $mod+Shift+q exec ~/.local/bin/logout-wofi + +# Moving around: + +# Move your focus around +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 + +#resize +bindsym $mod+mod1+Left exec swaymsg resize shrink right 10px || swaymsg resize grow left 10px +bindsym $mod+mod1+Down exec swaymsg resize grow down 10px || swaymsg resize shrink up 10px +bindsym $mod+mod1+Up exec swaymsg resize shrink down 10px || swaymsg resize grow up 10px +bindsym $mod+mod1+Right exec swaymsg resize grow right 10px || swaymsg resize shrink left 10px + +# Workspaces: + +# 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 + +# Layout stuff: +bindsym $mod+b splith +bindsym $mod+v splitv + +# Switch the current container between different layout styles +bindsym $mod+t layout toggle split +bindsym $mod+Shift+t layout tabbed +bindsym $mod+Shift+s layout stacking + +# Make the current focus fullscreen +bindsym $mod+f fullscreen + +# Toggle the current focus between tiling and floating mode +bindsym $mod+space floating toggle + +# Swap focus between the tiling area and the floating area +bindsym $mod+Shift+space focus mode_toggle + +# Move focus to the parent container +bindsym $mod+a focus parent + +# Sticky +bindsym $mod+s sticky toggle +# Scratchpad: + +bindsym $mod+bracketleft move scratchpad +bindsym $mod+bracketright scratchpad show + +# Tor Browser +bindsym $mod+w exec ~/.local/bin/torbrowser + + +# Resizing containers: + +mode \"resize\" { + 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\" +} + + +# Media Keys +bindsym XF86AudioLowerVolume exec pamixer -d 5 && pamixer --get-volume > $WOBSOCK +bindsym XF86AudioRaiseVolume exec pamixer -i 5 && pamixer --get-volume > $WOBSOCK + +bindsym XF86MonBrightnessUp exec brightnessctl s +5% +bindsym XF86MonBrightnessDown exec brightnessctl s 5%- + +bindsym XF86AudioStop exec cmus-remote -s +bindsym XF86AudioPlay exec cmus-remote -u +bindsym XF86AudioNext exec cmus-remote -n +bindsym XF86AudioPrev exec cmus-remote -r + +# Funny noises +bindsym XF86Launch1 exec mpv ~/Audio/boom.opus +bindsym KP_Enter exec mpv ~/Audio/metal-pipe.opus +bindsym KP_0 exec mpv ~/Audio/running.opus +bindsym KP_Decimal exec mpv ~/Audio/among-us.opus +bindsym KP_Add exec mpv ~/Audio/wah-wah-wah-wah.opus +bindsym KP_1 exec mpv ~/Audio/boowomp.opus +bindsym KP_2 exec mpv ~/Audio/chomp.ogg +bindsym KP_3 exec mpv ~/Audio/slip.opus +bindsym KP_Subtract exec mpv ~/Audio/inception.opus +bindsym KP_4 exec mpv ~/Audio/waltuh.opus +bindsym KP_5 exec mpv ~/Audio/hallway.opus +bindsym KP_6 exec mpv ~/Audio/bell.opus +bindsym KP_Multiply exec mpv ~/Audio/lego.opus +bindsym KP_7 exec mpv ~/Audio/mega.opus + +# clipped +exec ~/.local/bin/make-combined + +bindsym $mod+r exec ~/.local/bin/wf-shadow -r LVDS-1 +bindsym $mod+g exec ~/.local/bin/wf-shadow -r DP-1 + +bindsym XF86ScreenSaver exec ~/.local/bin/lock +bindsym Print exec ~/.local/bin/screenshot -w +bindsym Pause exec ~/.local/bin/logout-wofi + +# Mumble + +bindsym $mod+z exec mumble rpc starttalking +bindsym --release $mod+z exec mumble rpc stoptalking + +# Rules +for_window [app_id=\"float\"] floating enable; + +exec swayidle -w timeout 290 'brightnessctl -s; brightnessctl s 50%-' resume 'brightnessctl -r' +exec swayidle -w timeout 300 '~/.local/bin/lock' +exec rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob +exec ~/.local/bin/beep-wrapper + +# Audio +exec ~/.local/bin/start-pipewire + +bindswitch --reload --locked lid:on exec ~/.local/bin/suspend + +bar { + swaybar_command waybar + } +} + +include /etc/sway/config.d/*")) + +(define %config:mpv + (plain-file "config-mpv" "\ +ytdl-format=\"bestvideo[height=?480][fps<=?30][vcodec!=?vp9]+bestaudio/best\" +user-agent=\"Mozilla/5.0\" + + +msg-level=ffmpeg=fatal +vo=gpu +hwdec=vaapi +hwdec-codecs=all +video-sync=display-resample")) + +(define %config:mako + (plain-file "config-mako" "\ +default-timeout=8000 +# configversion: b2dba52da9a482ccd1a8170517e502c5 +background-color=#22225588 +text-color=#ffffff +border-color=#6666cc +layer=overlay +group-by=app-name + +[urgency=low] +default-timeout=5000 +background-color=#222222 +text-color=#888888 + +[urgency=high] +default-timeout=10000 +background-color=#900000 +text-color=#ffffff +background-color=#ff0000")) + +(define %config:foot + (plain-file "config-foot" "\ +# -*- conf -*- +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot (or xterm-256color if built with -Dterminfo=disabled) +# login-shell=no + +# app-id=foot +# title=foot +# locked-title=no + + font= Fira Code:size=8 + +# font-bold= +# font-italic= +# font-bold-italic= +# line-height= +# letter-spacing=0 +# horizontal-letter-offset=0 +# vertical-letter-offset=0 +# underline-offset= +# box-drawings-uses-font-glyphs=no + +dpi-aware=false + +# initial-window-size-pixels=700x500 # Or, +# initial-window-size-chars= +# initial-window-mode=windowed +pad=10x10 # optionally append 'center' +# resize-delay-ms=100 + +# notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body} + +bold-text-in-bright=yes +# word-delimiters=,│`|:\"'()[]{}<> +# selection-target=primary +# workers= + +[bell] +# urgent=no +# notify=no +# command= +# command-focused=no + +[scrollback] +# lines=1000 +# multiplier=3.0 +# indicator-position=relative +# indicator-format= + +[url] +# launch=xdg-open ${url} +# label-letters=sadfjklewcmpgh +# osc8-underline=url-mode +# protocols=http, https, ftp, ftps, file, gemini, gopher +# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+=\"'()[] + +[cursor] +# style=block +# color= +blink=yes +# beam-thickness=1.5 +# underline-thickness= + +[mouse] +hide-when-typing=yes +# alternate-scroll-mode=yes + +[colors] +alpha=0.7 +#Default + +foreground=e0e0e0 +background=000000 +regular0=2e2016 # black +regular1=d88f96 # red +regular2=16af38 # green +regular3=dbbc2f # yellow +regular4=1961e6 # blue +regular5=b3787e # magenta +regular6=32cbe6 # cyan +regular7=f4e5e7 # white +bright0=473032 # bright black +bright1=e5a7aa # bright red +bright2=27d64d # bright green +bright3=f3d64d # bright yellow +bright4=4545db # bright blue +bright5=c6888d # bright magenta +bright6=67cbe6 # bright cyan +bright7=fcf5f3 # bright white + +## dimmed colors (see foot.ini(5) man page) +# dim0= +# ... +# dim7= + +## The remaining 256-color palette +#16 = <256-color palette #16> +# ... +#255 = <256-color palette #255> + +## Misc colors +#selection-foreground= +#selection-background= +#jump-labels= +#urls= +#scrollback-indicator= + +[csd] +# preferred=server +# size=26 +# font= +# color= +# hide-when-typing=no +# border-width=0 +# border-color= +# button-width=26 +# button-color= +# button-minimize-color= +# button-maximize-color= +# button-close-color= + +[key-bindings] +scrollback-up-page=none +scrollback-up-half-page=Mod1+Shift+e +scrollback-up-line=Mod1+e +scrollback-down-page=none +scrollback-down-half-page=Mod1+Shift+n +scrollback-down-line=Mod1+n +#clipboard-copy=Control+Shift+c XF86Copy +#clipboard-paste=Control+Shift+v XF86Paste +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c \"xurls | fuzzel | xargs -r firefox\"] none +# pipe-scrollback=[sh -c \"xurls | fuzzel | xargs -r firefox\"] none +# pipe-selected=[xargs -r firefox] none +# show-urls-launch=Control+Shift+u +# show-urls-copy=none +# show-urls-persistent=none +# noop=none + +[search-bindings] +# cancel=Control+g Control+c Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+w +# clipboard-paste=Control+v Control+Shift+v Control+y XF86Paste +# primary-paste=Shift+Insert + +[url-bindings] +# cancel=Control+g Control+c Control+d Escape +# toggle-url-visible=t + +[text-bindings] +# \\x03=Mod4+c # Map Super+c -> Ctrl+c + +[mouse-bindings] +# selection-override-modifiers=Shift +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 + +# vim: ft=dosini")) + +(define %config:colorscheme + (plain-file "config-colorscheme" "\ +#!/bin/sh +foreground=e0e0e0 +background=000000 +regular0=2e2016 # black +regular1=d88f96 # red +regular2=16af38 # green +regular3=dbbc2f # yellow +regular4=1961e6 # blue +regular5=b3787e # magenta +regular6=32cbe6 # cyan +regular7=f4e5e7 # white +bright0=473032 # bright black +bright1=e5a7aa # bright red +bright2=27d64d # bright green +bright3=f3d64d # bright yellow +bright4=4545db # bright blue +bright5=c6888d # bright magenta +bright6=67cbe6 # bright cyan +bright7=fcf5f3 # bright white + +if [[ \"$TERM\" = \"vt102\" || \"$TERM\" = \"linux\" ]]; then + printf \"\\e]P$background\\e]P1$regular1\\e]P2$regular2\\e]P3$regular3\\e]P4$regular4\\e]P5$regular5\\e]P6$regular6\\e]P7$foreground\\e]P8$bright0\\e]P9$bright1\\e]PA$bright2\\e]PB$bright3\\e]PC$bright4\\e]PD$bright5\\e]PE$bright6\\e]PF$bright7\" +fi")) + +(define %config:hyfetch + (plain-file "config-hyfetch" "{\"preset\": \"transgender\", \"mode\": \"rgb\", \"light_dark\": \"dark\", \"lightness\": 0.65, \"color_align\": {\"mode\": \"horizontal\", \"custom_colors\": [], \"fore_back\": null}}")) + +(define %config:neofetch + (plain-file "config-neofetch" "\ +print_info() { + info title + info underline + info \"OS\" distro + info \"Host\" model + info \"Kernel\" kernel + info \"Uptime\" uptime + info \"Packages\" packages + info \"Shell\" shell + info \"Resolution\" resolution + info \"DE\" de + info \"WM\" wm + info \"WM Theme\" wm_theme + info \"Theme\" theme + info \"Icons\" icons + info \"Terminal\" term + info \"Terminal Font\" term_font + info \"Font\" font + [[ \"$player\" ]] && prin \"Music Player\" \"$player\" + info \"Song\" song + info \"CPU\" cpu + info \"CPU Usage\" cpu_usage + info \"GPU\" gpu + info \"GPU Driver\" gpu_driver # Linux/macOS only + info \"Disk\" disk + info \"Memory\" memory + info cols +} +title_fqdn=\"off\" +kernel_shorthand=\"on\" +distro_shorthand=\"off\" +os_arch=\"on\" +uptime_shorthand=\"on\" +memory_percent=\"off\" +package_managers=\"on\" +shell_path=\"off\" +shell_version=\"on\" +speed_type=\"bios_limit\" +speed_shorthand=\"off\" +cpu_brand=\"on\" +cpu_speed=\"on\" +cpu_cores=\"logical\" +cpu_temp=\"off\" +gpu_brand=\"on\" +gpu_type=\"all\" +refresh_rate=\"off\" +gtk_shorthand=\"off\" +gtk2=\"on\" +gtk3=\"on\" +public_ip_host=\"http://ident.me\" +public_ip_timeout=2 +de_version=\"off\" +disk_show=('/') +disk_subtitle=\"mount\" +disk_percent=\"on\" +music_player=\"auto\" +song_format=\"%artist% - %album% - %title%\" +song_shorthand=\"off\" +mpc_args=() +colors=(distro) +bold=\"on\" +underline_enabled=\"on\" +underline_char=\"-\" +separator=\":\" +block_range=(0 15) +color_blocks=\"on\" +block_width=3 +block_height=1 +col_offset=\"auto\" +bar_char_elapsed=\"-\" +bar_char_total=\"=\" +bar_border=\"on\" +bar_length=15 +bar_color_elapsed=\"distro\" +bar_color_total=\"distro\" +cpu_display=\"off\" +memory_display=\"off\" +battery_display=\"off\" +disk_display=\"off\" +image_backend=\"ascii\" +image_source=\"auto\" +ascii_distro=\"auto\" +ascii_colors=(distro) +ascii_bold=\"on\" +image_loop=\"off\" +thumbnail_dir=\"${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch\" +crop_mode=\"normal\" +crop_offset=\"center\" +image_size=\"auto\" +gap=3 +yoffset=0 +xoffset=0 +background_color= +stdout=\"off\"")) diff --git a/.config/guix/current b/.config/guix/current new file mode 120000 index 0000000..bd5a309 --- /dev/null +++ b/.config/guix/current @@ -0,0 +1 @@ +/var/guix/profiles/per-user/cobra/current-guix \ No newline at end of file diff --git a/.config/guix/home-config.scm b/.config/guix/home-config.scm new file mode 100644 index 0000000..f065e13 --- /dev/null +++ b/.config/guix/home-config.scm @@ -0,0 +1,195 @@ +(add-to-load-path "/etc/guix-config") +(add-to-load-path "/home/cobra/.config/guix") + +(use-modules (gnu home) + (gnu home services) + (gnu home services mcron) + (gnu home services desktop) + (gnu home services shells) + (gnu packages) + (gnu packages gl) + (gnu services) + (gnu services dbus) + (gnu services mcron) + (guix gexp) + + ;; Deranged Guix Home Usage(TM) + (cobra home) + (cobra home configs) + (cobra home bin) + (cobra packages)) + +(define webfetch-job + #~(job "*/1 * * * *" + "hyfetch > /tmp/fetch; rsync --rsh=\"ssh -i /home/cobra/.ssh/id_fetch\" /tmp/fetch vern.cc:~/public_html/${HOSTNAME,,}")) + +(home-environment + (packages + (map specification->package+output + (list ;; Audio + "alsa-utils" + "cmus" + "mumble" + "pamixer" + "pipewire" + "playerctl" + "pulseaudio" + "pulsemixer" + "wireplumber" + + ;; Browsers + "icecat" + "icedove" + "lynx" + "ungoogled-chromium-wayland" + + ;; CAD + "cura" + "freecad" + "gpx" + "kicad" + "kicad-doc" + "kicad-footprints" + "kicad-packages3d" + "kicad-symbols" + "kicad-templates" + + ;; Chat + "irssi" + "pinentry" + "profanity" + + ;; Desktop + "brightnessctl" + "foot" + "grim" + "libnotify" + "light" + "light" + "mako" + "slurp" + "sway" + "swayhide" + "swayidle" + "swaylock" + "waybar" + "wf-recorder" + "wl-clipboard" + "wlr-randr" + "wob" + "wofi" + "xorg-server-xwayland" + + ;; Development + "at-spi2-core" + "avr-toolchain" + "gcc-toolchain" + "git" + "git:send-email" + "go" + "make" + "microscheme" + "perl" + "python" + + ;; DICT + "dico" + + ;; Encryption + "gnupg" + "password-store" + + ;; Games + "adanaxisgpl" + "minetest" + "red-eclipse" + "supertuxkart" + "teeworlds" + "xonotic" + + ;; Multimedia + "ffmpeg" + "gimp" + "handbrake" + "imagemagick" + "kodi" + "mpv" + "mpv-mpris" + "reptyr" + "ripit" + + ;; Network + "bind:utils" + "i2pd" + "net-tools" + "netcat" + "proxychains-ng" + "socat" + "tmate" + "whois" + "wireguard-tools" + + ;; Utilities + "bc" + "dialog" + "emacs" + "htop" + "hyfetch" + "libqalculate" + "lm-sensors" + "macchanger" + "monero-gui" + "newsboat" + "rsync" + "scdoc" + "screen" + "unzip" + "wget" + "yt-dlp"))) + (services + (list + (service home-dbus-service-type) + (service home-mcron-service-type + (home-mcron-configuration + (jobs (list webfetch-job)))) + (simple-service 'home-env + home-environment-variables-service-type + `(("LIBGL_DRIVERS_PATH" . ,(if (equal? (gethostname) "Neon") + (file-append mesa-i915 "/lib/dri") + (file-append mesa "/lib/dri"))) + ("PRIV" . "sudo") + ("WM" . "sway") + ("WIFI" . "wlp2s0") + ("COPY_COMMAND" . "wl-copy") + ("PASTE_COMMAND" . "wl-paste") + ("UPDATE" . "guix pull --branch=master && reconf && hreconf"))) + (simple-service 'dotfiles + home-files-service-type + (list `(".bashrc" ,%home:bashrc) + `(".prompt" ,%home:prompt) + `(".devspec" ,%home:devspec) + `(".bash_profile" ,%home:bash-profile) + + `(".local/bin/backtick" ,%bin:backtick) + `(".local/bin/beep" ,%bin:beep) + `(".local/bin/beep-wrapper" ,%bin:beep-wrapper) + `(".local/bin/fss" ,%bin:fss) + `(".local/bin/lock" ,%bin:lock) + `(".local/bin/logout-wofi" ,%bin:logout-wofi) + `(".local/bin/screenshot" ,%bin:screenshot) + `(".local/bin/start-pipewire" ,%bin:start-pipewire) + `(".local/bin/__suspend" ,%bin:suspend) + `(".local/bin/suspend" ,%bin:suspend-wrap) + `(".local/bin/torbrowser" ,%bin:torbrowser) + + `(".config/neofetch/config.conf" ,%config:neofetch) + `(".config/hyfetch.json" ,%config:hyfetch) + `(".config/colorscheme" ,%config:colorscheme) + `(".config/foot/foot.ini" ,%config:foot) + `(".config/mako/config" ,%config:mako) + `(".config/mpv/mpv.conf" ,%config:mpv) + `(".config/swaylock/config" ,%config:swaylock) + `(".config/sway/config" ,%config:sway) + + `(".config/waybar/config" ,%waybar:config) + `(".config/waybar/style.css" ,%waybar:style))))))