TMU (Too Many Updates)

This commit is contained in:
Geoffrey Frogeye 2019-10-17 12:44:30 +02:00
parent 392dfed89a
commit 789f26d925
12 changed files with 147 additions and 76 deletions

View file

@ -55,8 +55,8 @@ set geometry(main) 1920x1012+0+18
set geometry(state) normal set geometry(state) normal
set geometry(topwidth) 1920 set geometry(topwidth) 1920
set geometry(topheight) 225 set geometry(topheight) 225
set geometry(pwsash0) "480 1" set geometry(pwsash0) "969 1"
set geometry(pwsash1) "720 1" set geometry(pwsash1) "1454 1"
set geometry(botwidth) 600 set geometry(botwidth) 1202
set geometry(botheight) 782 set geometry(botheight) 782
set permviews {} set permviews {}

View file

@ -38,7 +38,7 @@ bindsym $mod+z kill
bindsym button2 kill bindsym button2 kill
bindsym $mod+c exec --no-startup-id rofi-pass --last-used bindsym $mod+c exec --no-startup-id rofi-pass --last-used
bindsym $mod+i exec --no-startup-id rofimoji --last-used bindsym $mod+i exec --no-startup-id rofimoji
bindsym $mod+plus exec --no-startup-id rofi -modi ssh -show ssh bindsym $mod+plus exec --no-startup-id rofi -modi ssh -show ssh
bindsym $mod+ù exec --no-startup-id rofi -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t "sudo -s -E"' bindsym $mod+ù exec --no-startup-id rofi -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t "sudo -s -E"'
bindsym $mod+Tab exec --no-startup-id rofi -modi window -show window bindsym $mod+Tab exec --no-startup-id rofi -modi window -show window
@ -147,16 +147,16 @@ set $WS9 9
set $WS10 10 set $WS10 10
# Workspace output # Workspace output
workspace "$WS1" output LVDS1 workspace "$WS1" output eDP-1-1
workspace "$WS2" output HDMI1 workspace "$WS2" output HDMI-0
workspace "$WS3" output LVDS1 workspace "$WS3" output eDP-1-1
workspace "$WS4" output HDMI1 workspace "$WS4" output HDMI-0
workspace "$WS5" output LVDS1 workspace "$WS5" output eDP-1-1
workspace "$WS6" output HDMI1 workspace "$WS6" output HDMI-0
workspace "$WS7" output LVDS1 workspace "$WS7" output eDP-1-1
workspace "$WS8" output HDMI1 workspace "$WS8" output HDMI-0
workspace "$WS9" output LVDS1 workspace "$WS9" output eDP-1-1
workspace "$WS10" output HDMI1 workspace "$WS10" output HDMI-0
# switch to workspace # switch to workspace
bindsym $mod+1 workspace $WS1 bindsym $mod+1 workspace $WS1
@ -230,6 +230,9 @@ bindsym $mod+ctrl+shift+Left move workspace to output left
bindsym $mod+Ctrl+Shift+Up move workspace to output above bindsym $mod+Ctrl+Shift+Up move workspace to output above
bindsym $mod+Ctrl+Shift+Down move workspace to output below bindsym $mod+Ctrl+Shift+Down move workspace to output below
# Default layout = tabs, since I mostly exclusively use them
workspace_layout tabbed
# Open specific applications in floating mode # Open specific applications in floating mode
for_window [title="pacmixer"] floating enable border pixel 2 for_window [title="pacmixer"] floating enable border pixel 2
for_window [class="Firefox"] layout tabbed # Doesn't seem to work anymore for_window [class="Firefox"] layout tabbed # Doesn't seem to work anymore
@ -305,16 +308,26 @@ mode "Resize" {
bindsym $mod+r mode "Resize" bindsym $mod+r mode "Resize"
mode "Presentation" { set $mode_pres_main "Presentation (main display)"
# These bindings trigger as soon as you enter the resize mode mode $mode_pres_main {
bindsym e workspace back_and_forth bindsym b workspace $WS3, workspace $WS4, mode $mode_pres_sec
# back to normal: Enter or Escape # back to normal: Enter or Escape
bindsym q mode "default"
# bindsym Escape mode "default"
bindsym Return mode "default"
}
set $mode_pres_sec "Presentation (secondary display)"
mode $mode_pres_sec {
bindsym b workspace $WS2, workspace $WS1, mode $mode_pres_main
# back to normal: Enter or Escape
bindsym q mode "default"
# bindsym Escape mode "default"
bindsym Return mode "default" bindsym Return mode "default"
bindsym Escape mode "default"
} }
bindsym $mod+Shift+p mode "Presentation" bindsym $mod+Shift+p mode $mode_pres_main
set $mode_screen Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default set $mode_screen Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default
bindsym $mod+t mode "$mode_screen" bindsym $mod+t mode "$mode_screen"

View file

@ -125,9 +125,9 @@ class RamProvider(AlertingSection, PeriodicUpdater):
if self.state < 1: if self.state < 1:
return None return None
text = Text(Section.ramp(1-freePerc)) text = Text(Section.ramp(freePerc))
if self.state >= 2: if self.state >= 2:
freeStr = humanSize(mem.available) freeStr = humanSize(mem.total - mem.available)
text.append(freeStr) text.append(freeStr)
if self.state >= 3: if self.state >= 3:
totalStr = humanSize(mem.total) totalStr = humanSize(mem.total)
@ -696,12 +696,12 @@ class I3WorkspacesProvider(Section, I3Updater):
# if parent.display != workspace["display"]: # if parent.display != workspace["display"]:
# continue # continue
section = I3WorkspacesProviderSection(workspace["name"], self) section = I3WorkspacesProviderSection(workspace.name, self)
section.focused = workspace["focused"] section.focused = workspace.focused
section.urgent = workspace["urgent"] section.urgent = workspace.urgent
section.show() section.show()
parent.addSectionAfter(lastSection, section) parent.addSectionAfter(lastSection, section)
self.sections[workspace["num"]] = section self.sections[workspace.num] = section
lastSection = section lastSection = section

25
config/scripts/diapo Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Don't forget:
# --duration 15m # Specify expected duration of presentation
# --half-screen --geometry 2048x768+0+1 # If presenting with beamer notes on the right, and you have two screens with 1024x768 resolution
/home/geoffrey/Documents/Programmation/Impressive/OutOfTree/impressive.py \
--transition WipeRight \
--bind lmb:=box-zoom --bind lmb=zoom-exit \
--bind rmb:=box-add --bind rmb=box-clear \
--bind ctrl+p:=overview-enter --bind ctrl+a:=overview-confirm \
--bind escape:=time-reset \
--bind e:=goto-last \
--bind b-=fade-to-black \
--bind escape-=quit \
--cursor default \
--fontsize 26 \
--transtime 200 \
--mousedelay 1000 \
--page-progress \
--time-display \
--tracking \
--zoomdarkness 75 \
"$@"

View file

@ -1,11 +1,19 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# pylint: disable=C0103
"""
Find the subjectively best software
to open the file given in arguments with.
Doesn't use that XDG mess (only in last resort).
"""
import os import os
import sys
import magic
import subprocess import subprocess
import urllib.request import sys
import tempfile import tempfile
import urllib.request
import magic
# Getting what's needed # Getting what's needed
path = sys.argv[1] path = sys.argv[1]
@ -25,7 +33,7 @@ else:
mime = tuple(mime.split('/')) mime = tuple(mime.split('/'))
assert len(mime) == 2 assert len(mime) == 2
graphical = not not os.environ.get('DISPLAY') graphical = os.environ.get('DISPLAY')
# Some energumens # Some energumens
if mime[0] == "application" and mime[1] in ("json", "javascript"): if mime[0] == "application" and mime[1] in ("json", "javascript"):
@ -34,7 +42,7 @@ if mime[0] == "application" and mime[1] in ("json", "javascript"):
# Determine stuff # Determine stuff
ex = None # Executable needed to open the file ex = None # Executable needed to open the file
forcelocal = False # If we need to copy the file locally before opening it forcelocal = False # If we need to copy the file locally before opening it
isterm = False # Executable should run in a terminal isterm = False # Executable should run in a terminal
if mime[0] == "text": if mime[0] == "text":
if not ishttp: if not ishttp:
@ -46,13 +54,14 @@ elif mime[0] in ("audio", "video"):
ex = "mpv" ex = "mpv"
isterm = True isterm = True
elif mime == ("application", "pdf"): elif mime == ("application", "pdf"):
ex = "llpp.inotify" ex = "zathura"
forcelocal = True forcelocal = True
# Open stuff # Open stuff
tmp = None tmp = None
if ex: if ex:
if forcelocal and ishttp: if forcelocal and ishttp:
assert buf
tmp = tempfile.NamedTemporaryFile(prefix='o') tmp = tempfile.NamedTemporaryFile(prefix='o')
tmp.write(chunk) tmp.write(chunk)
tmp.write(buf.read()) tmp.write(buf.read())
@ -66,6 +75,7 @@ if buf:
# TODO Launch a new terminal window for some # TODO Launch a new terminal window for some
assert ex
p = subprocess.run([ex, path]) p = subprocess.run([ex, path])
if tmp: if tmp:
tmp.close() tmp.close()

View file

@ -129,7 +129,7 @@ do
replace "$prog" "$image" replace "$prog" "$image"
done <<< "$(find "$dir" -type f -iregex ".+.jpe?g$")" done <<< "$(find "$dir/" -type f -iregex ".+.jpe?g$")"
# PNG (requires optipng) # PNG (requires optipng)
while read image while read image
@ -144,7 +144,7 @@ do
replace "$temp" "$image" replace "$temp" "$image"
done <<< "$(find "$dir" -type f -iname "*.png")" done <<< "$(find "$dir/" -type f -iname "*.png")"
# # SVG (requires scour) # # SVG (requires scour)
# while read image # while read image
@ -158,7 +158,7 @@ done <<< "$(find "$dir" -type f -iname "*.png")"
# #
# replaceImg "$temp" "$image" # replaceImg "$temp" "$image"
# #
# done <<< "$(find "$dir" -type f -iname "*.svg")" # done <<< "$(find "$dir/" -type f -iname "*.svg")"
# NOTE Explicitely disabled since: # NOTE Explicitely disabled since:
# - I only have ~50 MiB of SVG in TOTAL # - I only have ~50 MiB of SVG in TOTAL

View file

@ -3,11 +3,13 @@
# Normalisation is done at the default of each program, # Normalisation is done at the default of each program,
# which is usually -89.0 dB # which is usually -89.0 dB
import os
import coloredlogs
import logging import logging
import r128gain import os
import sys import sys
import typing
import coloredlogs
import r128gain
coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s') coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s')
log = logging.getLogger() log = logging.getLogger()
@ -18,51 +20,49 @@ log = logging.getLogger()
FORCE = '-f' in sys.argv FORCE = '-f' in sys.argv
if FORCE: if FORCE:
sys.argv.remove('-f') sys.argv.remove('-f')
SOURCE_FOLDER = os.path.realpath(sys.argv[1]) if len(sys.argv) >= 2 else os.path.join(os.path.expanduser("~"), "Musiques") if len(sys.argv) >= 2:
SOURCE_FOLDER = os.path.realpath(sys.argv[1])
else:
SOURCE_FOLDER = os.path.join(os.path.expanduser("~"), "Musiques")
def isMusic(f):
def isMusic(f: str) -> bool:
ext = os.path.splitext(f)[1][1:].lower() ext = os.path.splitext(f)[1][1:].lower()
return ext in r128gain.AUDIO_EXTENSIONS return ext in r128gain.AUDIO_EXTENSIONS
# Get album paths # Get album paths
log.info("Listing albums and tracks") log.info("Listing albums and tracks")
albums = set() albums = list()
singleFiles = set() singleFiles = list()
for root, dirs, files in os.walk(SOURCE_FOLDER): for root, dirs, files in os.walk(SOURCE_FOLDER):
folder_has_music = False
for f in files:
if isMusic(f):
folder_has_music = True
fullPath = os.path.join(root, f)
singleFiles.append(fullPath)
relRoot = os.path.relpath(root, SOURCE_FOLDER) if folder_has_music:
albums.append(root)
head, tail = os.path.split(relRoot) # log.info("Processing single files")
# 1 component in the path: save files path as single # r128gain.process(singleFiles, album_gain=False,
if not len(head): # skip_tagged=not FORCE, report=True)
for f in files:
if isMusic(f):
fullPath = os.path.join(root, f)
singleFiles.add(fullPath)
head, tail = os.path.split(head)
if len(head):
continue
# 2 components in the path: save album path
albums.add(root)
log.info("Processing single files")
# r128gain.process(list(singleFiles), album_gain=False, skip_tagged=not FORCE, report=True)
for album in albums: for album in albums:
albumName = os.path.relpath(album, SOURCE_FOLDER) albumName = os.path.relpath(album, SOURCE_FOLDER)
log.info("Processing album {}".format(albumName)) log.info("Processing album {}".format(albumName))
musicFiles = set() musicFiles = list()
for root, dirs, files in os.walk(album): for f in os.listdir(album):
for f in files: if isMusic(f):
if isMusic(f): fullPath = os.path.join(album, f)
fullPath = os.path.join(root, f) musicFiles.append(fullPath)
musicFiles.add(fullPath)
# print(musicFiles) if not musicFiles:
if not len(musicFiles):
continue continue
r128gain.process(list(musicFiles), album_gain=True, skip_tagged=not FORCE, report=True)
r128gain.process(musicFiles, album_gain=True,
skip_tagged=not FORCE, report=True)
print("==============================") print("==============================")

View file

@ -1,8 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# pylint: disable=C0103
import logging import logging
import os import os
import subprocess import subprocess
import typing
import re
import coloredlogs import coloredlogs
import progressbar import progressbar
@ -18,6 +21,9 @@ FORBIDDEN_EXTENSIONS = ["jpg", "png", "pdf", "ffs_db"]
FORGIVEN_FILENAMES = ["cover.jpg", "front.jpg", "folder.jpg", FORGIVEN_FILENAMES = ["cover.jpg", "front.jpg", "folder.jpg",
"cover.png", "front.png", "folder.png"] "cover.png", "front.png", "folder.png"]
IGNORED_EMPTY_FOLDER = [".stfolder"] IGNORED_EMPTY_FOLDER = [".stfolder"]
RESTRICT_CHARACTERS = '[\0\\/:*"<>|]' # FAT32, NTFS
# RESTRICT_CHARACTERS = '[:/]' # HFS, HFS+
# RESTRICT_CHARACTERS = '[\0/]' # ext2-4, linux-based?
# TODO FEAT Make the directory structure the same as the base one and # TODO FEAT Make the directory structure the same as the base one and
# remove IGNORED_EMPTY_FOLDER variable # remove IGNORED_EMPTY_FOLDER variable
@ -43,16 +49,20 @@ remainingConversions = dict()
extraFiles = set(outputFiles.keys()) extraFiles = set(outputFiles.keys())
def convertPath(path): def convertPath(path: str) -> typing.Optional[str]:
filename, extension = os.path.splitext(path) filename, extension = os.path.splitext(path)
extension = extension[1:].lower() extension = extension[1:].lower()
# Remove unwanted characters from filename
filename_parts = os.path.normpath(filename).split(os.path.sep)
filename_parts = [re.sub(RESTRICT_CHARACTERS, '_', part) for part in filename_parts]
filename = os.path.sep.join(filename_parts)
# If the extension isn't allowed # If the extension isn't allowed
if extension in FORBIDDEN_EXTENSIONS: if extension in FORBIDDEN_EXTENSIONS:
basename = os.path.basename(path) basename = os.path.basename(path)
# And the filename is not an exception # And the filename is not an exception
if basename not in FORGIVEN_FILENAMES: if basename not in FORGIVEN_FILENAMES:
# This file shouldn't be copied nor converted # This file shouldn't be copied nor converted
return False return None
# If this needs a conversion # If this needs a conversion
elif extension in CONVERSIONS: elif extension in CONVERSIONS:
extension = CONVERSIONS[extension] extension = CONVERSIONS[extension]
@ -61,11 +71,11 @@ def convertPath(path):
return path return path
log.info("Determining action over {} files".format(len(sourceFiles))) log.info("Determining action over %d files", len(sourceFiles))
for sourceFile in sourceFiles: for sourceFile in sourceFiles:
outputFile = convertPath(sourceFile) outputFile = convertPath(sourceFile)
# If the file should not be converted, do nothing # If the file should not be converted, do nothing
if outputFile == False: if not outputFile:
continue continue
# If the file already has something as an output # If the file already has something as an output
elif outputFile in outputFiles: elif outputFile in outputFiles:
@ -77,7 +87,7 @@ for sourceFile in sourceFiles:
# If the file needs to be converted, do it # If the file needs to be converted, do it
remainingConversions[sourceFile] = outputFile remainingConversions[sourceFile] = outputFile
log.debug("{} actions will need to be taken".format(len(remainingConversions))) log.debug("%d actions will need to be taken", len(remainingConversions))
log.info("Copying files that do not require a conversion") log.info("Copying files that do not require a conversion")
conversions = set() conversions = set()
for sourceFile in remainingConversions: for sourceFile in remainingConversions:
@ -91,7 +101,7 @@ for sourceFile in remainingConversions:
# Converting # Converting
fullSourceFile = os.path.join(SOURCE_FOLDER, sourceFile) fullSourceFile = os.path.join(SOURCE_FOLDER, sourceFile)
if sourceFile == outputFile: if sourceFile == outputFile:
log.debug('{} → {}'.format(fullSourceFile, fullOutputFile)) log.debug('%s → %s', fullSourceFile, fullOutputFile)
if os.path.isfile(fullOutputFile): if os.path.isfile(fullOutputFile):
os.remove(fullOutputFile) os.remove(fullOutputFile)
os.link(fullSourceFile, fullOutputFile) os.link(fullSourceFile, fullOutputFile)
@ -101,12 +111,12 @@ for sourceFile in remainingConversions:
log.info("Removing extra files") log.info("Removing extra files")
for extraFile in extraFiles: for extraFile in extraFiles:
fullExtraFile = os.path.join(OUTPUT_FOLDER, extraFile) fullExtraFile = os.path.join(OUTPUT_FOLDER, extraFile)
log.debug('× {}'.format(fullExtraFile)) log.debug('× %s', fullExtraFile)
os.remove(fullExtraFile) os.remove(fullExtraFile)
log.info("Listing files that will be converted") log.info("Listing files that will be converted")
for fullSourceFile, fullOutputFile in conversions: for fullSourceFile, fullOutputFile in conversions:
log.debug('{} ⇒ {}'.format(fullSourceFile, fullOutputFile)) log.debug('%s ⇒ %s', fullSourceFile, fullOutputFile)
log.info("Converting files") log.info("Converting files")
for fullSourceFile, fullOutputFile in progressbar.progressbar(conversions): for fullSourceFile, fullOutputFile in progressbar.progressbar(conversions):

View file

@ -68,6 +68,7 @@ set searchurls.arch https://wiki.archlinux.org/?search=%s
set searchurls.archp https://www.archlinux.org/packages/?q=%s set searchurls.archp https://www.archlinux.org/packages/?q=%s
set searchurls.aur https://aur.archlinux.org/packages/?K=%s set searchurls.aur https://aur.archlinux.org/packages/?K=%s
set searchurls.aw http://www.amp-what.com/unicode/search/%s set searchurls.aw http://www.amp-what.com/unicode/search/%s
set searchurls.fdroid https://search.f-droid.org/?q=%s
set searchurls.gfr https://www.google.fr/search?hl=fr&q=%s set searchurls.gfr https://www.google.fr/search?hl=fr&q=%s
set searchurls.g https://www.google.fr/search?q=%s set searchurls.g https://www.google.fr/search?q=%s
set searchurls.gihpy https://giphy.com/search/%s set searchurls.gihpy https://giphy.com/search/%s
@ -77,6 +78,8 @@ set searchurls.npm https://www.npmjs.com/search?q=%s
set searchurls.pypi https://pypi.org/search/?q=%s set searchurls.pypi https://pypi.org/search/?q=%s
set searchurls.python https://docs.python.org/3/search.html?q=%s set searchurls.python https://docs.python.org/3/search.html?q=%s
set searchurls.qwant https://www.qwant.com/?t=web&q=%s set searchurls.qwant https://www.qwant.com/?t=web&q=%s
set searchurls.invidious https://invidious.drycat.fr/search?q=%s
set searchurls.id https://invidious.drycat.fr/search?q=%s
set searchurls.wa https://www.wolframalpha.com/input/?i=%s set searchurls.wa https://www.wolframalpha.com/input/?i=%s
set searchurls.yt https://www.youtube.com/results?search_query=%s set searchurls.yt https://www.youtube.com/results?search_query=%s
@ -90,6 +93,9 @@ guiset_quiet statuspanel none
" Never autofocus " Never autofocus
set allowautofocus false set allowautofocus false
" Hide the mode indicator in the lower right corner
set modeindicator false
" Hint chars " Hint chars
" As I take more time finding the key I need to type (even if it's on the home " As I take more time finding the key I need to type (even if it's on the home
" row) than moving my fingers to get it, I prefer to reduce the number of keys " row) than moving my fingers to get it, I prefer to reduce the number of keys

View file

@ -90,6 +90,7 @@ let g:LanguageClient_serverCommands = {
\ 'python': ['pyls'], \ 'python': ['pyls'],
\ 'sh': ['bash-language-server', 'start'], \ 'sh': ['bash-language-server', 'start'],
\ } \ }
let g:LanguageClient_loggingFile = expand('~/.cache/vim/LanguageClient.log')
function LC_maps() function LC_maps()

View file

@ -20,7 +20,10 @@ Plug 'chriskempson/base16-vim'
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
" Plug 'tpope/vim-fugitive' " Plug 'tpope/vim-fugitive'
" Plug 'tpope/vim-repeat' " Plug 'tpope/vim-repeat'
" Regex for words, with case in mind
Plug 'tpope/tpope-vim-abolish' Plug 'tpope/tpope-vim-abolish'
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'

View file

@ -13,6 +13,7 @@ set scrolloff=10
set ignorecase set ignorecase
set smartcase set smartcase
set gdefault
if has('nvim') if has('nvim')
set inccommand=nosplit " Shows you in realtime what changes your ex command should make. set inccommand=nosplit " Shows you in realtime what changes your ex command should make.
endif endif
@ -99,3 +100,5 @@ else
nmap <C-J> jjjjjjjjjjjjjjjjjjjjj nmap <C-J> jjjjjjjjjjjjjjjjjjjjj
endif endif
" \s to replace globally the word under the cursor
nnoremap <Leader>s :%s/\<<C-r><C-w>\>/