diff --git a/Xresources b/Xresources index 6a06d00..b9f2436 100644 --- a/Xresources +++ b/Xresources @@ -1,4 +1,4 @@ #include ".Xresources.d/xft" -#include ".Xresources.d/theme" +! #include ".Xresources.d/theme" #include ".Xresources.d/xterm" #include ".Xresources.d/urxvt" diff --git a/Xresources.d/urxvt b/Xresources.d/urxvt index e94c0e2..08f7754 100644 --- a/Xresources.d/urxvt +++ b/Xresources.d/urxvt @@ -37,7 +37,7 @@ URxvt.keysym.C-S-V: eval:paste_clipboard ! Extensions -URxvt.perl-ext-common: resize-font,bell-command,readline,selection +URxvt.perl-ext-common: resize-font,bell-command,readline,selection,matcher ! Changing font size on the fly (extension: resize-font, package: urxvt-resize-font-git) URxvt.keysym.C-KP_Subtract: resize-font:smaller @@ -53,3 +53,9 @@ urxvt*shading: 30 ! Bell command (extension: bell-command) URxvt.bell-command: play -n synth sine C5 sine E4 remix 1-2 fade 0.1 0.2 0.1 &> /dev/null + +! Open URL in browser (extension: matcher) +URxvt.url-launcher: o +URxvt.matcher.button: 1 +URxvt.matcher.rend.0: Uline Bold fg5 + diff --git a/bashrc b/bashrc index 7891bee..b85ce1f 100644 --- a/bashrc +++ b/bashrc @@ -55,10 +55,8 @@ alias please=sudo alias ll="ls -l $LS_OPTIONS" alias la="ls -la $LS_OPTIONS" alias x='startx; logout' +alias nx='nvidia-startx; logout' alias s='sudo -s -E' -alias po='eval $(proxy off)' -alias nw="sudo systemctl restart NetworkManager" -alias mc="machines" alias tracefiles="strace -f -t -e trace=file" alias n='urxvtc &' diff --git a/config/i3/config b/config/i3/config index d21d640..e4cd3d7 100644 --- a/config/i3/config +++ b/config/i3/config @@ -74,7 +74,7 @@ bindsym Print exec scrot -ue 'mv $f ~/Screenshots/' bindsym $mod+Print exec scrot -e 'mv $f ~/Screenshots/' bindsym Ctrl+Print exec sleep 1 && scrot -se 'mv $f ~/Screenshots/' -focus_follows_mouse yes +focus_follows_mouse no mouse_warping output # change focus diff --git a/config/lemonbar/providers.py b/config/lemonbar/providers.py index 6b2df58..c229607 100755 --- a/config/lemonbar/providers.py +++ b/config/lemonbar/providers.py @@ -44,8 +44,8 @@ def randomColor(seed=0): class TimeProvider(StatefulSection, PeriodicUpdater): FORMATS = ["%H:%M", - "%d/%m %H:%M:%S", - "%a %d/%m/%y %H:%M:%S"] + "%m-%d %H:%M:%S", + "%a %y-%m-%d %H:%M:%S"] NUMBER_STATES = len(FORMATS) DEFAULT_STATE = 1 @@ -666,11 +666,20 @@ class I3WorkspacesProviderSection(Section): self.parent = parent self.setName(name) self.setDecorators(clickLeft=self.switchTo) + self.tempText = None def empty(self): self.updateTheme(self.parent.themeNormal) self.updateText(None) + def tempShow(self): + self.updateText(self.tempText) + + def tempEmpty(self): + self.tempText = self.dstText[1] + self.updateText(None) + + class I3WorkspacesProvider(Section, I3Updater): # TODO FEAT Multi-screen @@ -735,11 +744,11 @@ class I3WorkspacesProvider(Section, I3Updater): if e.change == 'default': self.modeSection.updateText(None) for section in self.sections.values(): - section.show() + section.tempShow() else: self.modeSection.updateText(e.change) for section in self.sections.values(): - section.empty() + section.tempEmpty() def __init__(self, theme=0, themeFocus=3, themeUrgent=1, themeMode=2, customNames=dict()): I3Updater.__init__(self) diff --git a/config/linuxColors.sh b/config/linuxColors.sh index 192b39a..90fc1e6 100644 --- a/config/linuxColors.sh +++ b/config/linuxColors.sh @@ -19,6 +19,6 @@ if [ "$TERM" = "linux" ]; then \e]PFcfd0c2 " # get rid of artifacts - clear + # clear fi diff --git a/config/llpp.conf b/config/llpp.conf new file mode 100644 index 0000000..298f180 --- /dev/null +++ b/config/llpp.conf @@ -0,0 +1 @@ +savepath-command='echo %s' diff --git a/config/mpd/mpd.conf b/config/mpd/mpd.conf index dc2f3cd..6d11e7e 100644 --- a/config/mpd/mpd.conf +++ b/config/mpd/mpd.conf @@ -93,7 +93,7 @@ sticker_file "~/.cache/mpd/sticker.sql" # argument is recommended for troubleshooting, though can quickly stretch # available resources on limited hardware storage. # -log_level "verbose" +log_level "default" # # If you have a problem with your MP3s ending abruptly it is recommended that # you set this argument to "no" to attempt to fix the problem. If this solves diff --git a/config/systemd/user/default.target.wants/psd.service b/config/systemd/user/default.target.wants/psd.service new file mode 120000 index 0000000..6f74548 --- /dev/null +++ b/config/systemd/user/default.target.wants/psd.service @@ -0,0 +1 @@ +/usr/lib/systemd/user/psd.service \ No newline at end of file diff --git a/config/systemd/user/ipfs.service b/config/systemd/user/ipfs.service new file mode 100644 index 0000000..af0d3a4 --- /dev/null +++ b/config/systemd/user/ipfs.service @@ -0,0 +1,10 @@ +[Unit] +Description=IPFS daemon +After=network.target + +[Service] +ExecStart=/usr/bin/ipfs daemon +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/config/systemd/user/sockets.target.wants/urxvtd.socket b/config/systemd/user/sockets.target.wants/urxvtd.socket new file mode 120000 index 0000000..f0c0dd4 --- /dev/null +++ b/config/systemd/user/sockets.target.wants/urxvtd.socket @@ -0,0 +1 @@ +/home/geoffrey/.config/systemd/user/urxvtd.socket \ No newline at end of file diff --git a/config/systemd/user/urxvtd.service b/config/systemd/user/urxvtd.service new file mode 100644 index 0000000..c2904a4 --- /dev/null +++ b/config/systemd/user/urxvtd.service @@ -0,0 +1,10 @@ +[Unit] +Description=Urxvt Terminal Daemon +Requires=urxvtd.socket + +[Service] +ExecStart=/usr/bin/urxvtd -o -q +Environment=RXVT_SOCKET=%t/urxvtd-%H + +[Install] +WantedBy=default.target diff --git a/config/systemd/user/urxvtd.socket b/config/systemd/user/urxvtd.socket new file mode 100644 index 0000000..bfbfde3 --- /dev/null +++ b/config/systemd/user/urxvtd.socket @@ -0,0 +1,9 @@ +[Unit] +Description=urxvt daemon (socket activation) +Documentation=man:urxvtd(1) man:urxvt(1) + +[Socket] +ListenStream=%t/urxvtd-%H + +[Install] +WantedBy=sockets.target diff --git a/profile b/profile index 614b95f..27e9836 100644 --- a/profile +++ b/profile @@ -5,8 +5,5 @@ # SSH agent [[ -z "$SSH_AUTH_SOCK" && -x "$(which ssh-agent)" ]] && eval `ssh-agent -s` &> /dev/null -# TTY Colors -[ -f "$HOME/.config/linuxColors.sh" ] && . "$HOME/.config/linuxColors.sh" - # Bashrc [ -f ~/.bashrc ] && source ~/.bashrc diff --git a/scripts/changeColors b/scripts/changeColors index 5dc7110..e80fd4a 100755 --- a/scripts/changeColors +++ b/scripts/changeColors @@ -33,9 +33,11 @@ curl "https://raw.githubusercontent.com/theova/base16-qutebrowser/4a17eea8a39f72 curl "https://raw.githubusercontent.com/0xdec/base16-rofi/master/themes/base16-${scheme}.rasi" > ~/.config/rofi/theme.rasi curl "https://raw.githubusercontent.com/0xdec/base16-rofi/master/themes/base16-${scheme}.config" > ~/.config/rofi/theme.config +# qutebrowser +curl "https://raw.githubusercontent.com/theova/base16-qutebrowser/master/themes/base16-${scheme}.config.py" > ~/.config/qutebrowser/theme.py + # TODO dunst (template online, but not to my liking) # TODO bar (might change bar in the future, so...) -# TODO qutebrowser (need to fiddle with the config thing) # TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config) # Reload a bunch of things to make changes immediate diff --git a/scripts/gitCheckoutModes b/scripts/gitCheckoutModes new file mode 100755 index 0000000..f4bdbb2 --- /dev/null +++ b/scripts/gitCheckoutModes @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# From https://stackoverflow.com/a/2083563 + +git diff --summary | grep --color 'mode change 100755 => 100644' | cut -d' ' -f7- | xargs -d'\n' chmod +x +git diff --summary | grep --color 'mode change 100644 => 100755' | cut -d' ' -f7- | xargs -d'\n' chmod -x diff --git a/scripts/install-prefs b/scripts/install-prefs index 35405b7..38f2c27 100755 --- a/scripts/install-prefs +++ b/scripts/install-prefs @@ -191,7 +191,7 @@ if [ $TERMUX == 1 ]; then inst tsu fi fi -inst moreutils screen ncdu lsof htop proxytunnel pv curl wget netcat mosh bash-completion rsync pwgen fzf highlight +inst moreutils screen ncdu lsof htop proxytunnel pv curl wget socat mosh bash-completion rsync pwgen fzf highlight # TODO Test those who are on Debian machines and those who aren't if [ $ARCH == 1 ]; then inst bash-completion @@ -261,7 +261,7 @@ if [ $EXTRA == 1 ]; then fi # Extra CLI - inst ffmpeg optipng syncthing mutt msmtp notmuch mbsync jq lynx + inst ffmpeg optipng syncthing mutt msmtp notmuch mbsync jq lynx strace inst unzip unrar jdupes bedup p7zip inst youtube-dl megatools speedtest-cli systemdUserUnit syncthing @@ -291,11 +291,11 @@ if [ $EXTRA == 1 ]; then # Extra GUI if [ $GUI == 1 ]; then - inst vlc gimp inkscape mpd thunar musescore evince pdfpc texlive-{most,lang} + inst vlc gimp inkscape mpd thunar musescore llpp pdfpc texlive-{most,lang} if [ $ARCH == 1 ]; then inst simplescreenrecorder mpc - altInst vimpc-git ashuffle-git ttf-emojione-color + altInst vimpc-git ashuffle-git ttf-emojione-color puddletag # FPGA goodness inst gtkwave diff --git a/scripts/logstasync b/scripts/logstasync new file mode 100755 index 0000000..f781bc8 --- /dev/null +++ b/scripts/logstasync @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +serv="$1" +shift + +ssh "$serv" 'sudo tail --follow=name --retry --quiet $(sudo find $(echo /var/log/$([ -d /var/log/httpd/ ] && echo httpd || echo apache2)) -type f -name *access.log)' | logstalgia --sync "$@" diff --git a/scripts/o b/scripts/o new file mode 100755 index 0000000..b48bb58 --- /dev/null +++ b/scripts/o @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +import os +import sys +import magic +import subprocess +import urllib.request +import tempfile + +# Getting what's needed +path = sys.argv[1] + +# Getting the MIME type +ishttp = path.startswith('http') + +buf = None +if ishttp: + buf = urllib.request.urlopen(path) + chunk = buf.read(1024) + mime = magic.from_buffer(chunk, mime=True) +else: + assert os.path.isfile(path), f"Not a file: {path}" + path = os.path.realpath(path) + mime = magic.from_file(path, mime=True) +mime = tuple(mime.split('/')) +assert len(mime) == 2 + +graphical = not not os.environ.get('DISPLAY') + +# Some energumens +if mime[0] == "application" and mime[1] in ("json", "javascript"): + mime = ("text", mime[1]) + +# Determine stuff +ex = None # Executable needed to open the file +forcelocal = False # If we need to copy the file locally before opening it +isterm = False # Executable should run in a terminal + +if mime[0] == "text": + if not ishttp: + ex = os.environ.get('VISUAL' if graphical else 'EDITOR', None) + isterm = True +elif mime[0] == "image": + ex = "feh" +elif mime[0] in ("audio", "video"): + ex = "mpv" + isterm = True +elif mime == ("application", "pdf"): + ex = "llpp.inotify" + forcelocal = True + +# Open stuff +tmp = None +if ex: + if forcelocal and ishttp: + tmp = tempfile.NamedTemporaryFile(prefix='o') + tmp.write(chunk) + tmp.write(buf.read()) + path = tmp.name +else: + ex = 'xdg-open' + if ishttp: + ex = os.environ.get('BROWSER', ex) +if buf: + buf.close() + +# TODO Launch a new terminal window for some + +p = subprocess.run([ex, path]) +if tmp: + tmp.close() +sys.exit(p.returncode) diff --git a/scripts/pdfpages b/scripts/pdfpages index 0854df5..1b86e2d 100755 --- a/scripts/pdfpages +++ b/scripts/pdfpages @@ -1,7 +1,7 @@ #!/usr/bin/bash # From https://stackoverflow.com/a/14736593 -for FILE in $* +for FILE in "$@" do printf "$FILE: " pdftk "$FILE" dump_data | grep NumberOfPages | awk '{print $2}' diff --git a/scripts/pushToTalk b/scripts/pushToTalk old mode 100644 new mode 100755 diff --git a/scripts/rankmirrors b/scripts/rankmirrors old mode 100644 new mode 100755 diff --git a/scripts/replayGain b/scripts/replayGain index c6178ce..fe57e2a 100755 --- a/scripts/replayGain +++ b/scripts/replayGain @@ -18,7 +18,7 @@ log = logging.getLogger() FORCE = '-f' in sys.argv if FORCE: sys.argv.remove('-f') -SOURCE_FOLDER = os.path.realpath(sys.argv[1]) if len(sys.argv) >= 2 else os.path.join(os.path.expanduser("~"), "Musique") +SOURCE_FOLDER = os.path.realpath(sys.argv[1]) if len(sys.argv) >= 2 else os.path.join(os.path.expanduser("~"), "Musiques") def isMusic(f): ext = os.path.splitext(f)[1][1:].lower() diff --git a/scripts/rmf b/scripts/rmf new file mode 100755 index 0000000..ebe5094 --- /dev/null +++ b/scripts/rmf @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# Rename sync-conflict files to normal files + +# WARNING Does not check for conclicts + +import os +import re + +for root, dirs, files in os.walk('.'): + for f in files: + if '.sync-conflict' not in f: + continue + nf = re.sub('.sync-conflict-\d{8}-\d{6}-\w{7}', '', f) + F = os.path.join(root, f) + NF = os.path.join(root, nf) + if os.path.exists(NF): + print(f"'{F}' → '{NF}': file already exists") + else: + print(f"'{F}' → '{NF}': done") + os.rename(F, NF) + + diff --git a/scripts/tunnel b/scripts/tunnel index e0e1f91..23b4bcf 100755 --- a/scripts/tunnel +++ b/scripts/tunnel @@ -8,7 +8,7 @@ host="$1" port="$2" if [ -z "$http_proxy" ]; then - nc "$host" "$port" + socat "TCP:$host:$port" - else proxy=$(echo "$http_proxy" | sed 's/^https\?:\/\///' | sed 's/\/$//') port=443 # Most won't want this diff --git a/scripts/updateCompressedMusic b/scripts/updateCompressedMusic index 252fc5e..6fb60cc 100755 --- a/scripts/updateCompressedMusic +++ b/scripts/updateCompressedMusic @@ -10,8 +10,8 @@ coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s') log = logging.getLogger() # Constants -SOURCE_FOLDER = os.path.join(os.path.expanduser("~"), "Musique") -OUTPUT_FOLDER = os.path.join(os.path.expanduser("~"), ".MusiqueCompressed") +SOURCE_FOLDER = os.path.join(os.path.expanduser("~"), "Musiques") +OUTPUT_FOLDER = os.path.join(os.path.expanduser("~"), ".musicCompressed") CONVERSIONS = {"flac": "opus"} FORBIDDEN_EXTENSIONS = ["jpg", "pdf", "ffs_db"] FORGIVEN_FILENAMES = ["cover.jpg"] diff --git a/vimrc b/vimrc index 7fa3628..9ee290a 100644 --- a/vimrc +++ b/vimrc @@ -96,6 +96,10 @@ nmap :Autoformat let g:pymode_virtualenv = 1 let g:pymode_lint_ignore = ["W0401"] let g:pymode_lint_cwindow = 0 +let g:pymode_lint_on_fly = 1 +" let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe'] +let g:pymode_lint_checkers = ['pyflakes', 'mccabe'] +" Pymode temporarly disabled for battle dev " TODO Even with magic pymod_motion complains about the option `magic&` being not set :/ let g:pymode_motion = 0