From 3315dddb731033150d284adab29fe24b182357a7 Mon Sep 17 00:00:00 2001 From: Breizh Date: Tue, 12 May 2020 18:25:43 +0200 Subject: [PATCH] Modifications diverses --- .Xresources | 8 +- .bash_profile | 8 -- .bashrc | 15 +-- .config/cava/config | 4 +- .config/conky/conkyrc1 | 3 +- .config/conky/conkyrc2 | 9 +- .config/fish/config.fish | 9 ++ .config/i3/config | 25 +---- .config/mpv/mpv.conf | 1 + .i3blocks/internet | 2 +- .local/bin/open_with_linux.py | 186 ++++++++++++++++++++++++++++++++++ .local/bin/rtcwake | 6 ++ .local/bin/set_wall_clock | 14 +++ .vim/.netrwhist | 4 +- .xprofile | 24 ----- 15 files changed, 244 insertions(+), 74 deletions(-) create mode 100755 .local/bin/open_with_linux.py create mode 100755 .local/bin/rtcwake create mode 100755 .local/bin/set_wall_clock delete mode 100644 .xprofile diff --git a/.Xresources b/.Xresources index 72621fa..3579513 100644 --- a/.Xresources +++ b/.Xresources @@ -57,7 +57,7 @@ Xautolock.locker: i3lock-wrapper -e XTerm*reverseVideo: on XTerm*selectToClipboard: true -URxvt.font: xft:xos4 Terminus:pixsize=16,xft:DejaVu Sans Mono:pixsize=16 +URxvt.font: xft:IBM Plex Mono:antialias=true:pixelsize=13,xft:DejaVu Sans Mono:antialias=true:pixelsize=13,xft:Noto Sans Mono:pixelsize=13:antialias=true !URxvt.letterSpace: -1 !URxvt.depth: 32 !URxvt.background: [100]#000000 @@ -70,9 +70,9 @@ URxvt*cursorBlink: true URxvt*saveLines: 0 ! for 'fake' transparency (without Compton) uncomment the following three lines -!URxvt*inheritPixmap: true -!URxvt*transparent: true -!URxvt*shading: 25 +URxvt*inheritPixmap: true +URxvt*transparent: true +URxvt*shading: 30 !URxvt*blurRadius: 24x24 ! other possible settings: diff --git a/.bash_profile b/.bash_profile index 25752b9..7868b09 100644 --- a/.bash_profile +++ b/.bash_profile @@ -16,14 +16,6 @@ export KRESUS_PYTHON_EXEC=python export MAGICK_TMPDIR="$HOME/.cache/ImageMagick/" export HIGHLIGHT_STYLE="base16/eighties" -export LESS_TERMCAP_mb=$(tput blink) -export LESS_TERMCAP_md=$(tput bold) -export LESS_TERMCAP_me=$(tput sgr0) -export LESS_TERMCAP_so=$(tput smso) -export LESS_TERMCAP_se=$(tput rmso) -export LESS_TERMCAP_us=$(tput sitm) -export LESS_TERMCAP_ue=$(tput sgr0) - eval $(ssh-agent -s) if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then diff --git a/.bashrc b/.bashrc index 4e3c296..af6092b 100644 --- a/.bashrc +++ b/.bashrc @@ -96,13 +96,14 @@ On_White='\e[47m' # White # On_IWhite='\e[0;107m' # White # Less colors -#export LESS_TERMCAP_mb=$'\E[01;31m' -#export LESS_TERMCAP_md=$'\E[01;31m' -#export LESS_TERMCAP_me=$'\E[0m' -#export LESS_TERMCAP_so=$'\E[01;44;33m' -#export LESS_TERMCAP_se=$'\E[0m' -#export LESS_TERMCAP_us=$'\E[01;32m' -#export LESS_TERMCAP_ue=$'\E[0m' +export LESS_TERMCAP_mb=$(tput blink) +export LESS_TERMCAP_md=$(tput bold) +export LESS_TERMCAP_me=$(tput sgr0) +export LESS_TERMCAP_so=$(tput smso) +export LESS_TERMCAP_se=$(tput rmso) +export LESS_TERMCAP_us=$(tput sitm) +export LESS_TERMCAP_ue=$(tput sgr0) + export LESS="-RI" use_color=true diff --git a/.config/cava/config b/.config/cava/config index 3cbadd1..be80f25 100644 --- a/.config/cava/config +++ b/.config/cava/config @@ -7,7 +7,7 @@ ; mode = normal # Accepts only non-negative values. -framerate = 60 +; framerate = 60 # 'autosens' will attempt to decrease sensitivity if the bars peak. 1 = on, 0 = off # new as of 0.6.0 autosens of low values (dynamic range) @@ -124,7 +124,7 @@ gradient_color_3 = '#D50000' # Accepts only non-negative values. 50 means half gravity, 200 means double. Set to 0 to disable "drop off". ; gravity = 100 ; gravity = 200 -; gravity = 0 +gravity = 0 # In bar height, bars that would have been lower that this will not be drawn. diff --git a/.config/conky/conkyrc1 b/.config/conky/conkyrc1 index d9d7802..e1ef68d 100644 --- a/.config/conky/conkyrc1 +++ b/.config/conky/conkyrc1 @@ -5,9 +5,10 @@ conky.config = { double_buffer = true, font = 'xos4 Terminus:size=8', draw_graph_borders = true, + draw_outline = true, minimum_width = 260, maximum_width = 260, - minimum_height = 900, + minimum_height = 0, gap_x = 5, gap_y = 5, no_buffers = true, diff --git a/.config/conky/conkyrc2 b/.config/conky/conkyrc2 index 64f0eb3..825020a 100644 --- a/.config/conky/conkyrc2 +++ b/.config/conky/conkyrc2 @@ -1,15 +1,16 @@ conky.config = { - alignment = 'top_left', + alignment = 'top_right', background = true, cpu_avg_samples = 4, xinerama_head = 1, double_buffer = true, font = 'xos4 Terminus:size=8', draw_graph_borders = true, + draw_outline = true, minimum_width = 260, maximum_width = 260, - minimum_height = 900, - gap_x = 275, + minimum_height = 0, + gap_x = 5, gap_y = 5, no_buffers = true, own_window = true, @@ -24,7 +25,7 @@ conky.config = { short_units = true, if_up_strictness = 'link', use_spacer = left, - text_buffer_size = 1024, + text_buffer_size = 2048, color2 = 'F2F0EC', font2 = 'xos4 Terminus:size=12', diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 4900417..53610ea 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -21,6 +21,15 @@ set base0D 6699CC set base0E CC99CC set base0F D27B53 +set -x LESS_TERMCAP_mb (tput blink) +set -x LESS_TERMCAP_md (tput bold) +set -x LESS_TERMCAP_me (tput sgr0) +set -x LESS_TERMCAP_so (tput smso) +set -x LESS_TERMCAP_se (tput rmso) +set -x LESS_TERMCAP_us (tput sitm) +set -x LESS_TERMCAP_ue (tput sgr0) + + #if status --is-interactive if test "$XDG_CURRENT_DESKTOP" = "i3" source $HOME/.config/base16-shell/profile_helper.fish diff --git a/.config/i3/config b/.config/i3/config index 1d7e50f..5ee604b 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -138,7 +138,7 @@ bindsym Print exec --no-startup-id i3-scrot bindsym $mod+Print --release exec --no-startup-id i3-scrot -w bindsym $mod+Shift+Print --release exec --no-startup-id i3-scrot -s bindsym $mod+Ctrl+x --release exec --no-startup-id xkill -bindsym $mod+l exec passmenu --type -l 10 +bindsym $mod+l exec passmenu --type -l 10 $DMENU_OPTIONS bindsym Shift+XF86MyComputer exec i3-input -f "xft:xos4 Terminus" -F 'mark %s' -P 'Mark: ' bindsym XF86MyComputer exec i3-input -f "xft:xos4 Terminus" -F '[con_mark="%s"] focus' -P 'Go to: ' bindsym Ctrl+XF86MyComputer exec i3-input -f "xft:xos4 Terminus" -F 'unmark %s' -P 'Unmark: ' @@ -284,34 +284,16 @@ workspace $ws8 output HDMI-A-1 assign [class="projectM-pulseaudio"] $ws4 # Open specific applications in floating mode -#for_window [title="alsamixer"] floating enable border pixel 1 -#for_window [class="Calamares"] floating enable border normal -#for_window [class="Clipgrab"] floating enable for_window [title="File Transfer*"] floating enable -for_window [class="Galculator"] floating enable border pixel 1 -#for_window [class="GParted"] floating enable border normal -#for_window [title="i3_help"] floating enable sticky enable border normal -#for_window [class="octopi"] floating enable -#for_window [class="Pamac-manager"] floating enable for_window [class="Pavucontrol"] floating enable for_window [class="qt5ct"] floating enable sticky enable border normal for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal -for_window [class="Simple-scan"] floating enable border normal for_window [class="(?i)TransportFever2"] border none fullscreen disable for_window [class="(?i)factorio"] border none for_window [class="(?i)System-config-printer.py"] floating enable border normal -for_window [class="Skype"] floating enable border normal -for_window [class="Thus"] floating enable border normal -for_window [class="Timeset-gui"] floating enable border normal -#for_window [class="(?i)virtualbox"] floating enable border normal -for_window [class="Xfburn"] floating enable for_window [class="(?i)variety"] floating enable -for_window [class="Yad"] floating enable -#for_window [class="firefox"] border pixel 1 -for_window [title="(?i)pinentry"] floating enable # switch to workspace with urgent window automatically for_window [urgent=latest] focus -for_window [title="dclock"] floating enable border pixel 1 # reload the configuration file bindsym $mod+Shift+c reload @@ -380,7 +362,7 @@ exec --no-startup-id conky --config "$HOME/.config/conky/conkyrc2" exec_always --no-startup-id setcursor exec claws-mail --online #exec claws-mail --alternate-config-dir $HOME/.claws-mail-cognix --online -exec --no-startup-id jami-gnome -r +#exec --no-startup-id jami-gnome -r exec --no-startup-id sleep 2 && urxvtc -e newsboat exec --no-startup-id sleep 7 && i3-msg '[title="newsboat"] move scratchpad' #exec --no-startup-id variety @@ -390,7 +372,6 @@ exec --no-startup-id redshift-gtk exec --no-startup-id sudo radeontop -d /dev/shm/radeontop #exec --no-startup-id ${HOME}/.screenlayout/home.sh #exec --no-startup-id sleep 5 && mocp -S -#exec --no-startup-id mpv ~/Vidéos/wallpapers/pirate_flag.mp4 --wid 0 --loop-file -quiet #exec --no-startup-id setxkbmap fr oss exec --no-startup-id nm-applet exec --no-startup-id steam-native -silent -noverifyfiles -language french @@ -413,7 +394,7 @@ bar { bindsym button4 nop bindsym button5 nop # font -xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso10646-1 - # font xft:IBM Plex Mono, DejaVu Sans Mono 11 + # font xft:IBM Plex Mono, DejaVu Sans Mono 13px font xft:Terminus, DejaVu Sans Mono 10 strip_workspace_numbers yes diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf index 7ed08c5..0725d3e 100644 --- a/.config/mpv/mpv.conf +++ b/.config/mpv/mpv.conf @@ -16,6 +16,7 @@ sub-back-color=0.0/0.0/0.0/0.5 sub-use-margins sub-file-paths=~/Sous-titres/ sub-font=IBM Plex Sans +sub-font-size=35 # Codecs hwdec=auto-copy diff --git a/.i3blocks/internet b/.i3blocks/internet index 60b6a0b..af125f9 100755 --- a/.i3blocks/internet +++ b/.i3blocks/internet @@ -10,7 +10,7 @@ then claws-mail --offline touch /dev/shm/claws_offline fi -elif ping -c 1 1.1.1.1 -W 1 &>/dev/null +elif ping -c 1 1.1.1.1 -W 1 &>/dev/null || ping -c 1 8.8.8.8 -W 1 &>/dev/null then color="#99CC99" if [ -f /dev/shm/claws_offline ] diff --git a/.local/bin/open_with_linux.py b/.local/bin/open_with_linux.py new file mode 100755 index 0000000..6a4f979 --- /dev/null +++ b/.local/bin/open_with_linux.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python +from __future__ import print_function + +import os +import sys +import json +import struct +import subprocess + +VERSION = '7.2.2' + +try: + sys.stdin.buffer + + # Python 3.x version + # Read a message from stdin and decode it. + def getMessage(): + rawLength = sys.stdin.buffer.read(4) + if len(rawLength) == 0: + sys.exit(0) + messageLength = struct.unpack('@I', rawLength)[0] + message = sys.stdin.buffer.read(messageLength).decode('utf-8') + return json.loads(message) + + # Send an encoded message to stdout + def sendMessage(messageContent): + encodedContent = json.dumps(messageContent).encode('utf-8') + encodedLength = struct.pack('@I', len(encodedContent)) + + sys.stdout.buffer.write(encodedLength) + sys.stdout.buffer.write(encodedContent) + sys.stdout.buffer.flush() + +except AttributeError: + # Python 2.x version (if sys.stdin.buffer is not defined) + # Read a message from stdin and decode it. + def getMessage(): + rawLength = sys.stdin.read(4) + if len(rawLength) == 0: + sys.exit(0) + messageLength = struct.unpack('@I', rawLength)[0] + message = sys.stdin.read(messageLength) + return json.loads(message) + + # Send an encoded message to stdout + def sendMessage(messageContent): + encodedContent = json.dumps(messageContent) + encodedLength = struct.pack('@I', len(encodedContent)) + + sys.stdout.write(encodedLength) + sys.stdout.write(encodedContent) + sys.stdout.flush() + + +def install(): + home_path = os.getenv('HOME') + + manifest = { + 'name': 'open_with', + 'description': 'Open With native host', + 'path': os.path.realpath(__file__), + 'type': 'stdio', + } + locations = { + 'chrome': os.path.join(home_path, '.config', 'google-chrome', 'NativeMessagingHosts'), + 'chrome-beta': os.path.join(home_path, '.config', 'google-chrome-beta', 'NativeMessagingHosts'), + 'chrome-unstable': os.path.join(home_path, '.config', 'google-chrome-unstable', 'NativeMessagingHosts'), + 'chromium': os.path.join(home_path, '.config', 'chromium', 'NativeMessagingHosts'), + 'firefox': os.path.join(home_path, '.mozilla', 'native-messaging-hosts'), + } + filename = 'open_with.json' + + for browser, location in locations.items(): + if os.path.exists(os.path.dirname(location)): + if not os.path.exists(location): + os.mkdir(location) + + browser_manifest = manifest.copy() + if browser == 'firefox': + browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net'] + else: + browser_manifest['allowed_origins'] = [ + 'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/', # Chrome + 'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/', # Opera + ] + + with open(os.path.join(location, filename), 'w') as file: + file.write( + json.dumps(browser_manifest, indent=2, separators=(',', ': '), sort_keys=True).replace(' ', '\t') + '\n' + ) + + +def _read_desktop_file(path): + with open(path, 'r') as desktop_file: + current_section = None + name = None + command = None + for line in desktop_file: + if line[0] == '[': + current_section = line[1:-2] + if current_section != 'Desktop Entry': + continue + + if line.startswith('Name='): + name = line[5:].strip() + elif line.startswith('Exec='): + command = line[5:].strip() + + return { + 'name': name, + 'command': command + } + + +def find_browsers(): + apps = [ + 'Chrome', + 'Chromium', + 'chromium-browser', + 'firefox', + 'Firefox', + 'Google Chrome', + 'google-chrome', + 'opera', + 'Opera', + 'SeaMonkey', + 'seamonkey', + ] + paths = [ + os.path.join(os.getenv('HOME'), '.local/share/applications'), + '/usr/local/share/applications', + '/usr/share/applications' + ] + suffix = '.desktop' + + results = [] + for p in paths: + for a in apps: + fp = os.path.join(p, a) + suffix + if os.path.exists(fp): + results.append(_read_desktop_file(fp)) + return results + + +def listen(): + receivedMessage = getMessage() + if receivedMessage == 'ping': + sendMessage({ + 'version': VERSION, + 'file': os.path.realpath(__file__) + }) + elif receivedMessage == 'find': + sendMessage(find_browsers()) + else: + for k, v in os.environ.items(): + if k.startswith('MOZ_'): + try: + os.unsetenv(k) + except: + os.environ[k] = '' + + devnull = open(os.devnull, 'w') + subprocess.Popen(receivedMessage, stdout=devnull, stderr=devnull) + sendMessage(None) + + +if __name__ == '__main__': + if len(sys.argv) == 2: + if sys.argv[1] == 'install': + install() + sys.exit(0) + elif sys.argv[1] == 'find_browsers': + print(find_browsers()) + sys.exit(0) + + allowed_extensions = [ + 'openwith@darktrojan.net', + 'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/', + 'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/', + ] + for ae in allowed_extensions: + if ae in sys.argv: + listen() + sys.exit(0) + + print('Open With native helper, version %s.' % VERSION) diff --git a/.local/bin/rtcwake b/.local/bin/rtcwake new file mode 100755 index 0000000..0acd9cb --- /dev/null +++ b/.local/bin/rtcwake @@ -0,0 +1,6 @@ +#!/bin/bash + +sudo /usr/bin/rtcwake -n -m mem -t $(date "+%s" -d "$1") +read || exit 1 +sleep 15 +sudo /usr/bin/rtcwake -m mem -t $(date "+%s" -d "$1") diff --git a/.local/bin/set_wall_clock b/.local/bin/set_wall_clock new file mode 100755 index 0000000..6c5f0b9 --- /dev/null +++ b/.local/bin/set_wall_clock @@ -0,0 +1,14 @@ +#!/bin/bash + +feh --bg-center /tmp/output.png + +cd ~/Images/clocks/Traveler/ + +date="date -d now+1minute" + +month=$($date +%-m) +day=$($date +%-d) +hour=$(( ($($date +%-H)%12)*5 + $($date +%-M)/12)) +minute=$($date +%-M) + +convert "bg.jpg" "month${month}.png" -composite "day${day}.png" -composite "hour${hour}.png" -composite "minute${minute}.png" -composite "/tmp/output.png" diff --git a/.vim/.netrwhist b/.vim/.netrwhist index 7220860..9b70254 100644 --- a/.vim/.netrwhist +++ b/.vim/.netrwhist @@ -1,5 +1,7 @@ let g:netrw_dirhistmax =10 -let g:netrw_dirhistcnt =4 +let g:netrw_dirhistcnt =6 +let g:netrw_dirhist_6='/home/breizh/.config/fish' +let g:netrw_dirhist_5='/home/breizh/.config/i3' let g:netrw_dirhist_4='/home/breizh/.config/fish' let g:netrw_dirhist_3='/home/breizh/.cache/dmenu-recent' let g:netrw_dirhist_2='/home/breizh/.mozilla/firefox/5i4s6px2.tmp' diff --git a/.xprofile b/.xprofile deleted file mode 100644 index 5ba51c1..0000000 --- a/.xprofile +++ /dev/null @@ -1,24 +0,0 @@ -# -# ~/.xprofile -# -# sourced by /etc/lxdm/Xsession -# - -if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then - eval "$(dbus-launch --sh-syntax --exit-with-session)" -fi - -# Environment variables -# -export GTK2_RC_FILES="$HOME/.gtkrc-2.0" -export EDITOR=vim -export PAGER=less -export QT_QPA_PLATFORMTHEME=qt5ct -export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1 -export PATH=$PATH:~/bin:~/.gem/ruby/2.4.0/bin - -export LANG=br_FR.UTF-8 -export LANGUAGE=br_FR:fr:en -#export LANG=fr_FR.UTF-8 - -#eval $(ssh-agent -s)