summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2023-03-20 12:26:50 +0000
committerMarc Vertes <mvertes@free.fr>2023-03-20 12:26:50 +0000
commit8a0058c04f9453a3e3db8c186a550aa10f6c5909 (patch)
treed292e1d6b384bd1ea5f007bf412f111d10aac48c
parent9dcf9d6a3fa8203cef7d57c8e811b300d4ecc97d (diff)
update, switch to fvwm
-rw-r--r--.Xresources13
-rw-r--r--.config/i3/config201
-rw-r--r--.fvwm2rc18
-rw-r--r--.i3status.conf27
-rw-r--r--.profile2
-rw-r--r--.xinitrc35
l---------[-rwxr-xr-x]bin/dv557
-rwxr-xr-xbin/vpac4
8 files changed, 93 insertions, 764 deletions
diff --git a/.Xresources b/.Xresources
index 274ee87..45d9f2d 100644
--- a/.Xresources
+++ b/.Xresources
@@ -1,5 +1,5 @@
! Better to use multiples of 96
-Xft.dpi: 96
+Xft.dpi: 192
! uncomment following to display corretly using font 10x20
! URxvt.boldFont:
@@ -24,15 +24,18 @@ URxvt.keysym.C-Next: font-size:decrease
xterm*termName: xterm-256color
xterm*internalBorder: 4
xterm*VT100.Translations: #override \
- Ctrl <Key> Next: smaller-vt-font() \n\
- Ctrl <Key> Prior: larger-vt-font() \n
+ Ctrl <Key> minus: smaller-vt-font() \n\
+ Ctrl <Key> equal: larger-vt-font() \n
+! Ctrl <Key> Next: smaller-vt-font() \n\
+! Ctrl <Key> Prior: larger-vt-font() \n
! Meta <Key> minus: smaller-vt-font() \n\
! Meta <Key> equal: larger-vt-font() \n
xterm*cursorColor: red
!xterm*visualBell: true
!xterm*geometry: 100x32
-!xterm*faceName: DejaVu Sans Mono
-!xterm*faceSize: 10
+xterm*renderFont: true
+xterm*faceName: DejaVu Sans Mono
+xterm*faceSize: 7
! xterm*font: 7x14
! Allow sixel graphics. (Try: "convert -colors 16 foo.jpg sixel:-").
xterm*decTerminalID: vt340
diff --git a/.config/i3/config b/.config/i3/config
index 6c871ae..13c23bf 100644
--- a/.config/i3/config
+++ b/.config/i3/config
@@ -13,158 +13,63 @@ set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
-#font pango:monospace 8
-#font fixed
-# Same as above X11 fixed 6x13, but with icons
-font pango:MiscFixedSC613 regular 9
-#font pango:monospace 8, Noto sans 8
+font pango:monospace 7
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
-#font pango:DejaVu Sans Mono 8
+font pango:DejaVu Sans Mono 7, Noto sans 7
+
+# Start XDG autostart .desktop files using dex. See also
+# https://wiki.archlinux.org/index.php/XDG_Autostart
+exec --no-startup-id dex --autostart --environment i3
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
-exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 000000 --nofork
+#exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
#exec --no-startup-id nm-applet
-#exec --no-startup-id sudo wpa_gui -t -i wlo1
-
-# Notification daemon (see ~/.config/dunst/dunstrc for configuration)
-exec --no-startup-id dunst
-bindsym $mod+a exec --no-startup-id dunstctl action
-bindsym $mod+c exec --no-startup-id dunstctl context
-bindsym $mod+n exec --no-startup-id dunstctl close
-bindsym $mod+twosuperior exec --no-startup-id dunstctl history-pop
-
-
-# pulse audio systray icon
-exec --no-startup-id pasystray
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
-bindsym $mod+KP_Add exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
-bindsym $mod+KP_Subtract exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
-bindsym $mod+KP_Enter exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
-# enable floating mode and border
-for_window [class="aft-linux-qt"] floating enable
-for_window [class="Arandr"] floating enable
-for_window [class="Asunder"] floating enable
-for_window [class="Brave-browser"] floating enable
-for_window [class="Blueberry.py"] floating enable
-for_window [class="Blueman-manager"] floating enable
-for_window [class="Chromium"] floating enable
-for_window [title="Task Manager - Chromium"] floating enable
-for_window [title="Gestionnaire de tΓ’ches – Chromium"] floating enable
-for_window [class="DeltaChat"] floating enable
-for_window [instance="DOTTY"] floating enable
-for_window [instance="LEFTY text view"] floating enable
-for_window [class="discord"] floating enable
-for_window [class="easyeffects"] floating enable border normal
-for_window [class="Display"] floating enable
-for_window [class="Feedreader"] floating enable
-for_window [class="feh"] floating enable
-for_window [class="firefox"] floating enable
-for_window [class="fluent-reader"] floating enable border normal
-for_window [class="Geeqie"] floating enable
-for_window [class="Google-chrome"] floating enable
-for_window [title="Google Chrome"] floating enable
-for_window [class="Gpicview"] floating enable
-for_window [class="Ghb"] floating enable
-for_window [class="Gitk"] floating enable
-for_window [class="gnuplot_qt"] floating enable
-for_window [instance="gxditview"] floating enable
-for_window [class="index"] floating enable
-for_window [class="Keybase"] floating enable
-for_window [class="libreoffice"] floating enable
-for_window [class="Liferea"] floating enable
-for_window [class="lagrange"] floating enable
-for_window [class="llpp"] floating enable
-for_window [class="MuPDF"] floating enable
-for_window [class="io.elementary.music"] floating enable
-for_window [class="org.gnome.Music"] floating enable
-for_window [class="Org.gnome.Software"] floating enable
-for_window [class="Pavucontrol"] floating enable
-for_window [class="Pcmanfm"] floating enable
-for_window [class="Picard"] floating enable
-for_window [title="QEMU"] floating enable
-for_window [class="Quodlibet"] floating enable
-for_window [class="RSS Guard"] floating enable
-#for_window [class="Navigator"] floating enable
-for_window [class="SeaMonkey"] floating enable
-#for_window [window_role="browser"] floating enable
-for_window [class="Signal"] floating enable
-for_window [class="Slack"] floating enable
-for_window [class="Spotify"] floating enable
-for_window [class="Tauon Music Box"] floating enable
-for_window [class="thunderbird"] floating enable
-for_window [class="UXTerm"] floating enable
-for_window [class="vlc"] floating enable
-for_window [instance="wish"] floating enable
-for_window [class="wpa_gui"] floating enable
-for_window [class="Xdialog"] floating enable
-for_window [class="Xournalpp"] floating enable
-for_window [class="XVroot"] floating enable
-for_window [class="zoom"] floating enable
-
-bindsym button3 floating toggle
+bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl s 1%-
+bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl s 1%+
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
+# move tiling windows via drag & drop by left-clicking into the title bar,
+# or left-clicking anywhere into the window while holding the floating modifier.
+tiling_drag modifier titlebar
+
# start a terminal
-bindsym $mod+Return exec --no-startup-id xt
-bindsym $mod+t exec --no-startup-id uxterm
-bindsym $mod+Shift+t exec --no-startup-id xtb
+bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
-bindsym $mod+q kill
-#bindsym $mod+w kill
-bindsym --release $mod+button2 kill
+bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
-#bindsym $mod+d exec dmenu_run
-# There also is the (new) i3-dmenu-desktop which only displays applications
-# shipping a .desktop file. It is a wrapper around dmenu, so you need that
-# installed.
-#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'"
-#bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Mono-9'"
-#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
-#bindsym F1 exec --no-startup-id i3-dmenu-desktop -entry-type=command
-#bindsym F1 exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Fixed-12'"
-bindsym $mod+d exec --no-startup-id i3-dmenu-desktop -dmenu="dmenu -i -fn 'Fixed-12'"
-
-# Use playerctl to control media player from keyboard
-bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
-bindsym XF86AudioStop exec --no-startup-id playerctl stop
-bindsym XF86AudioNext exec --no-startup-id playerctl next
-bindsym XF86AudioPrev exec --no-startup-id playerctl prev
-bindsym $mod+Home exec --no-startup-id playerctl play-pause
-bindsym $mod+End exec --no-startup-id playerctl stop
-bindsym $mod+Next exec --no-startup-id playerctl next
-bindsym $mod+Prior exec --no-startup-id playerctl previous
-
-# Screen shot
-bindSym --release Print exec --no-startup-id shot
-
-# jump to urgent
-bindsym $mod+x [urgent=latest] focus
+bindsym $mod+d exec --no-startup-id dmenu_run
+# A more modern dmenu replacement is rofi:
+# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
+# There also is i3-dmenu-desktop which only displays applications shipping a
+# .desktop file. It is a wrapper around dmenu, so you need that installed.
+# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
-bindsym $mod+m focus right
+bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
@@ -176,7 +81,7 @@ bindsym $mod+Right focus right
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
-bindsym $mod+Shift+m move right
+bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
@@ -195,7 +100,7 @@ bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
-bindsym $mod+z layout tabbed
+bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
@@ -205,7 +110,7 @@ bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
# focus the parent container
-#bindsym $mod+q focus parent
+bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
@@ -223,33 +128,33 @@ set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
+# Cycle through active workspaces
+bindsym $mod+Tab workspace next
+bindsym $mod+Shift+Tab workspace prev
+
# switch to workspace
-bindsym $mod+ampersand workspace number $ws1
-bindsym $mod+eacute workspace number $ws2
-bindsym $mod+quotedbl workspace number $ws3
-bindsym $mod+apostrophe workspace number $ws4
-bindsym $mod+parenleft workspace number $ws5
-bindsym $mod+minus workspace number $ws6
-bindsym $mod+egrave workspace number $ws7
-bindsym $mod+underscore workspace number $ws8
-bindsym $mod+ccedilla workspace number $ws9
-bindsym $mod+agrave workspace number $ws10
+bindsym $mod+1 workspace number $ws1
+bindsym $mod+2 workspace number $ws2
+bindsym $mod+3 workspace number $ws3
+bindsym $mod+4 workspace number $ws4
+bindsym $mod+5 workspace number $ws5
+bindsym $mod+6 workspace number $ws6
+bindsym $mod+7 workspace number $ws7
+bindsym $mod+8 workspace number $ws8
+bindsym $mod+9 workspace number $ws9
+bindsym $mod+0 workspace number $ws10
# move focused container to workspace
-bindsym $mod+Shift+ampersand move container to workspace number $ws1
-bindsym $mod+Shift+eacute move container to workspace number $ws2
-bindsym $mod+Shift+quotedbl move container to workspace number $ws3
-bindsym $mod+Shift+apostrophe move container to workspace number $ws4
+bindsym $mod+Shift+1 move container to workspace number $ws1
+bindsym $mod+Shift+2 move container to workspace number $ws2
+bindsym $mod+Shift+3 move container to workspace number $ws3
+bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
-bindsym $mod+Shift+minus move container to workspace number $ws6
-bindsym $mod+Shift+egrave move container to workspace number $ws7
-bindsym $mod+Shift+underscore move container to workspace number $ws8
-bindsym $mod+Shift+ccedilla move container to workspace number $ws9
-bindsym $mod+Shift+agrave move container to workspace number $ws10
-
-# Cycle through active workspaces
-bindsym $mod+Tab workspace next
-bindsym $mod+Shift+Tab workspace prev
+bindsym $mod+Shift+6 move container to workspace number $ws6
+bindsym $mod+Shift+7 move container to workspace number $ws7
+bindsym $mod+Shift+8 move container to workspace number $ws8
+bindsym $mod+Shift+9 move container to workspace number $ws9
+bindsym $mod+Shift+0 move container to workspace number $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
@@ -269,7 +174,7 @@ mode "resize" {
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
- bindsym m resize grow width 10 px or 10 ppt
+ bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
@@ -285,14 +190,8 @@ mode "resize" {
bindsym $mod+r mode "resize"
-# Move a workspace to a different monitor
-bindsym $mod+greater move workspace to output right
-bindsym $mod+less move workspace to output left
-
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
-# status_command LANG=fr_FR.UTF-8 i3status
- status_command i3status
- tray_output primary
+ status_command i3status
}
diff --git a/.fvwm2rc b/.fvwm2rc
index 1159092..1973ff7 100644
--- a/.fvwm2rc
+++ b/.fvwm2rc
@@ -1,7 +1,7 @@
HilightColor black IndianRed
-WindowFont fixed
-IconFont fixed
-MenuStyle black grey76 grey30 fixed fvwm
+WindowFont "xft:Sans:bold:size=7:antialias=True"
+IconFont "xft:Sans:bold:size=7:antialias=True"
+MenuStyle black grey76 grey30 "xft:Sans:size=7:antialias=True" fvwm
IgnoreModifiers 2
#Style "*" SloppyFocus
@@ -128,9 +128,9 @@ AddToMenu "Utilities"
+ "&Xterm" Exec exec xt
+ "&Black Xterm" Exec exec bxt
+ "&Top" Exec exec xt -T Top -n Top -e /bin/top
-#+ "&Web" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache
++ "&Web" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache
#+ "&Web" Exec exec brave
-+ "&Web" Exec exec firefox
+#+ "&Web" Exec exec firefox
#+ "&Firefox" Exec exec firefox
#+ "&Chromium" Exec exec chromium --disk-cache-dir=/tmp/chromium-cache
+ "&Mail" Exec exec thunderbird
@@ -288,8 +288,10 @@ Key F10 A M Maximize 100 0
Key F11 A M Maximize 0 100
Key F12 A M Maximize
-#Key XF86MonBrightnessDown A A Exec exec xbacklight -10
-#Key XF86MonBrightnessUp A A Exec exec xbacklight +10
+# Key XF86MonBrightnessDown A A Exec exec xbacklight -10
+# Key XF86MonBrightnessUp A A Exec exec xbacklight +10
+Key XF86MonBrightnessDown A A Exec exec brightnessctl s 1%-
+Key XF86MonBrightnessUp A A Exec exec brightnessctl s 1%+
Key XF86AudioRaiseVolume A A Exec exec amixer set Master 5%+
Key XF86AudioLowerVolume A A Exec exec amixer set Master 5%-
Key XF86AudioMute A A Exec exec amixer set Master toggle
@@ -322,7 +324,7 @@ Key Escape A C WindowList
#*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmPagerFont fixed
*FvwmPagerHilight #c3c3c3
-*FvwmPagerGeometry 80x60-1-1
+*FvwmPagerGeometry 140x100-1-1
*FvwmPagerLabel 0 "swift"
*FvwmPagerSmallFont 5x8
diff --git a/.i3status.conf b/.i3status.conf
index 6cc7210..819c690 100644
--- a/.i3status.conf
+++ b/.i3status.conf
@@ -16,7 +16,7 @@ order += "read_file hostname"
#order += "ipv6"
order += "wireless _first_"
#order += "ethernet _first_"
-order += "battery all"
+order += "battery 0"
order += "disk /"
#order += "disk /boot"
order += "cpu_usage"
@@ -56,16 +56,21 @@ battery all {
low_threshold = 10
}
-#battery 0 {
-# format = "%status %percentage %remaining %emptytime"
-# format_down = "No battery"
-# status_chr = "CHR"
-# status_bat = "BAT"
-# status_unk = "UNK"
-# status_full = "FULL"
-# path = "/sys/class/power_supply/BAT%d/uevent"
-# low_threshold = 10
-#}
+battery 0 {
+ #format = "%status %percentage %remaining %emptytime"
+ format = "%status %percentage"
+ format_down = "No battery"
+ #status_chr = "CHR"
+ #status_bat = "BAT"
+ #status_unk = "UNK"
+ #status_full = "FULL"
+ status_chr = "βš‘πŸ”‹"
+ status_bat = "πŸ”‹"
+ status_unk = "? UNK"
+ status_full = "βš‘πŸ”‹"
+ path = "/sys/class/power_supply/macsmc-battery/uevent"
+ low_threshold = 10
+}
disk "/" {
#format = "πŸ“€ %avail"
diff --git a/.profile b/.profile
index 4de3901..90091ca 100644
--- a/.profile
+++ b/.profile
@@ -1,6 +1,6 @@
# ~/.profile
-PATH=~/bin:$PATH:~/go/bin
+PATH=~/bin:~/mu/bin:$PATH:~/go/bin
[ "${SHELL##*/}" = bash ] && . ~/.bashrc
diff --git a/.xinitrc b/.xinitrc
index c384f84..f095189 100644
--- a/.xinitrc
+++ b/.xinitrc
@@ -1,31 +1,6 @@
-#!/bin/sh
-
-. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
-#eval $(ssh-agent)
-eval $(gnome-keyring-daemon --start)
-export SSH_AUTH_SOCK
-
-# start pulseaudio on crux only. Should be handled by systemd on arch
-#pulseaudio --start --exit-idle-time=-1 --log-target=syslog &
-
-# enable tapping and natural scrolling on touchpad
-# see xinput --list[-props] for ids
-xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Tapping Enabled' 1
-xinput --set-prop 'SYNA7DAB:00 06CB:CD40 Touchpad' 'libinput Natural Scrolling Enabled' 1
-
-# Better use /etc/X11/xorg.conf.d/10-keyboard.conf to handle hot plugged keyboards
-#setxkbmap fr
-#xk
-hdmi
-
-xrdb ~/.Xresources
-#xsetroot -solid rgb:3/4/5
+export GDK_SCALE=2
+export GDK_DPI_SCALE=0.5
xsetroot -solid rgb:1/3/4
-#feh --bg-fill ~/Downloads/Alaska_Range.jpg
-#conky
-#slock
-
-# Start window manager
-#exec fvwm
-#lxpolkit
-exec i3
+xrdb -merge .Xresources
+# exec i3
+exec fvwm
diff --git a/bin/dv b/bin/dv
index 0737295..e92cccd 100755..120000
--- a/bin/dv
+++ b/bin/dv
@@ -1,556 +1 @@
-#!/bin/sh
-
-# Local dv (aka sim)
-
-dv_version='dv-0.23 Copyright 2013-2014 Marc Vertes, Philippe Bergheaud'
-unset CDPATH
-export LC_ALL=C IFS='
-'
-
-anc() {
- usage 'anc [Version]' 'print ancestor' && return
- getdv .dv || die no item
- case $1 in
- (""|.|$PWD)
- [ "$Opt_N" ] && Opt_N=$(($Opt_N - 1))
- [ "$Opt_N" ] && info anc $R2 $Opt_N || echo $R2
- ;;
- (*) info anc $1 ${Opt_N:-1};;
- esac
-}
-
-cache() {
- isremote "$1" || return
- o=$1 _d=$cacheprefix/$1; pd=${_d%/*}; ppd=${pd%/*} t=$pd/.${_d##*/}
- [ -d "$ppd" ] || mkdir -p "$ppd"
- [ -L "$ppd/.dv." ] || ln -s . "$ppd/.dv."
- [ -f "$_d/.dv" ] && return
- [ -d "$pd" ] || mkdir -p "$pd"
- set -- $pd/*; shift $(($# - 1))
- [ -d "$1" ] && ropt="--link-dest=../${1##*/}" || ropt=
- rsync -aDS $ropt "$o/" "$t" && mv "$t" "$_d"
-}
-
-client() {
- usage 'client [Version]' 'print clients' && return
- getdv .dv || die no item
- case $1 in
- (""|.|$PWD)
- while getpdir .dv ..
- do
- cd "$R1"
- getdv ".dv"
- [ "$OptM" ] && echo "$R2 -> $PWD" || echo "$R2"
- ((Opt_N = Opt_N-1)) || break
- done ;;
- (*) info cli $1 ${Opt_N:-9999} | sort -u ;;
- esac
-}
-
-clone() {
- usage 'clone [-A Author] [-m Msg] Version [Dir]' \
- 'Copy version to dir' && return
- [ "$1" ] || die missing argument
- [ "$3" ] && die too many arguments
- getpdir .dv . && root=$R1 && getdv $root/.dv && lib=$R1 item=${R2%/*}
- new_version=${1##*/}
- if [ "$new_version" = "$1" ]
- then
- getdv .dv && lib=$R1 new_item=${R2%/*} || die no item
- else
- v=${1%/$new_version}
- new_item=${v##*/}
- [ "$new_item" = "$v" ] || new_lib=${v%/$new_item}
- fi
- [ "$PWD" = "$root" ] && [ "$item" != "$new_item" ] &&
- die "already a clone of $item"
- lib=${lib:-$new_lib}
- [ "$lib" ] || die no lib
- [ "$new_lib" -a "$new_lib" != "$lib" ] && die "already in lib: $lib"
- if [ "$new_version" = 0 ] # Init item in lib
- then
- initlib "$lib"
- getdvinfo "$lib" || die "could not lock $lib"
- mkdir -p /tmp/dv.$$/$new_item/0
- dv_write $new_item/0 $new_item/0 >/tmp/dv.$$/$new_item/0/.dv
- { cat /tmp/dv.$$/$new_item/0/.dv; echo; } >>/tmp/dv.$$/.dvinfo.0
- ln -f /tmp/dv.$$/.dvinfo.0 /tmp/dv.$$/.dvinfo.1
- rsync -a /tmp/dv.$$/ "$lib"
- fi
- if [ ! "$2" ] # Use the item name as default directory (a la git)
- then
- set -- "$1" "${1%/*}"
- set -- "$1" "${2##*/}"
- echo cloning into "$2"
- fi
- [ ! -d "$2" ] && mkdir "$2"
- cd "$2" || die cannot chdir to "$2"
- # Rename existing supplier directories to allow supplier symlinks
- find . -name .dv | while read l
- do
- l=${l%/.dv} && [ "$l" = "." ] && continue
- mv "$l" "$l.dvold"
- done
- # Sync from lib, starting from most client item, up to last supplier
- d=. s=$new_item/$new_version
- while [ "$d" ]
- do
- [ -L "$d" ] && {
- rm -f "$d"
- [ -d "$d.dvold" ] && mv "$d.dvold" "$d"
- }
- cache "$lib/$s" && pref=$cacheprefix/ || pref=
- rsync -aDS "$pref$lib/$s/" "$d"
- dv_header "$d" Anc "$s"
- dv_header "$d" Lib "$lib"
- # Find next symlink pointing to a supplier
- d= l=
- eval "$(find . -type l | while read -r l
- do
- f=$(readlink "$l")
- case $f in
- (*/.dv./*) echo "d=\"$l\" s=\"${f#*/.dv./}\""
- break;;
- esac
- done)"
- done
-}
-
-desc() {
- usage 'desc [Version]' 'print descendants' && return
- getdv .dv || die no item
- case $1 in
- (""|.|$PWD) ;;
- (*) info desc $1 ;;
- esac
-}
-
-die() { echo "$0: fatal: $@" >&2; exit 1; }
-
-diff() {
- usage 'diff [-x pat] [-F File] [V1 [V2]]' 'Print differences' && return
- getpdir .dv && getdv "$R1/.dv" || die not in a clone
- lib=$R1 item=${R2%/*} old=${R2#*/}
- [ "$lib" = "" ] && [ -L "../../.dv." ] && lib=${PWD%/*/*}
- if [ "$2" ]
- then
- case $2 in
- (.) new=. new_is_clone=1 ;;
- (*) new=$lib/$item/$2 ;;
- esac
- cache "$new" && np=$cacheprefix/ || np=
- old=$lib/$item/$1
- elif [ "$1" ]
- then
- case $1 in
- (.) new=. new_is_clone=1 ;;
- (*) new=$lib/$item/$1 ;;
- esac
- cache "$new" && np=$cacheprefix/ || np=
- getdv "$np$new/.dv" && old=${R1:-$lib}/$R2
- else
- new=$PWD new_is_clone=1
- cache "$new" && np=$cacheprefix/ || np=
- getdv "$np$new/.dv" && old=${R1:-$lib}/$R2
- fi
- cache "$old" && op=$cacheprefix/ || op=
- [ "$Opts" ] || printf "old %s\nnew %s\n" "$old" "$new"
- # Itemized diff for all suppliers, deepest first
- cd "$np$new" && for f in $(find . -type f -name .dv | sort -r)
- do
- d=${f%/.dv}
- [ "$d" = . ] && prefix= || prefix=${d#./}/
- getdv "$f" && cache "$lib/$R2"
- [ "$new_is_clone" ] && dest=$np$d || dest=$prefix$d
- diffdir "$op$lib/$R2" "$dest"
- Optx="$Optx --exclude=${d##*/}"
- done
-}
-
-# Usage: diffdir oldpath newpath
-# Print differences between 2 directories
-diffdir() {
- [ -f "$2/.dvignore" ] && xf=--exclude-from=$2/.dvignore || xf=
- rsync -aDSniv $xf --delete --exclude=".dv.*/" $Optx "$2/" "$1" |
- awk -v OptF="${OptF#./}" -v prefix=$prefix '
- NF == 0 {exit}
- NR < 2 || /\/*\.dv$/ || /\/$/ {next}
- # Match an itemized status for all versions of rsync -i
- $1 !~ /^[<>ch.*][fdLDS+][.+?cstpoguaxz]+$/ {next}
- {key = $1; file = substr($0, length(key) + 2)}
- OptF && OptF != file {next}
- key == "*deleting" {print "deleted " prefix file; next}
- substr(key, 3, 7) == "+++++++" {print "created " prefix file; next}
- { # Avoid false positive if only mtime is changed.
- of = "'$1'/" file; gsub("'\''", "'\'\\\\\'\''", of)
- nf = "'$2'/" file; gsub("'\''", "'\'\\\\\'\''", nf)
- if (substr(key, 2, 1) == "L") { # Symlink
- src = target = file
- sub(/.* -> /, "", target);
- sub(/ -> .*/, "", src);
- "readlink '$2'/" src | getline otarget
- if (target != otarget)
- print "changed " src
- } else if (system("cmp -s '\''" of "'\'\ \''" nf "'\''"))
- print "changed " file
- }'
- # Or: scan key for file/link size, checksum or permission change
- # rsync -c is required
- #key ~ /[cps]/ { print "changed " prefix file }'
-}
-
-dv_write() {
- cat <<- EOT
- From $(username)
- Date: $(date +"%F %T %z")
- Version: $1
- Anc: $2
- EOT
-
- [ "$OptA" ] && echo "Author: $OptA"
- printf "\n%s\n" "$Optm"
-}
-
-dv_header() {
- awk -v val="$3" '/^'$2':/ {print "'$2': " val; done = 1; next}
- NF == 0 && done == 0 {print "'$2': " val; done = 1}
- {print}' $1/.dv >$1/.dv.$$ && mv $1/.dv.$$ $1/.dv
-}
-
-# Usage: getdv path
-# Return lib in R1, anc in R2, version in R3
-getdv() {
- R1= R2=
- while read -r line
- do
- case $line in
- ("Lib: "*) R1=${line#Lib: };;
- ("Anc: "*) R2=${line#Anc: };;
- ("Version: "*) R3=${line#Version: };;
- esac
- done <$1
- [ "$R1" -o "$R2" ]
-}
-
-# Usage: getdvinfo lib
-# Get exclusive write access to a dvlib, for new version commit
-getdvinfo() {
- [ -d /tmp/dv.$$ ] || mkdir /tmp/dv.$$
- [ "$Optn" ] && { rsync "$1/.dvinfo.1" /tmp/dv.$$/.dvinfo.0; return; }
- t=0
- for i in 1 2 3 4 5
- do
- rsync --remove-source-files "$1/.dvinfo.0" /tmp/dv.$$/ && break
- t=$(($t + $i)) && sleep $t
- done
- test -f /tmp/dv.$$/.dvinfo.0
-}
-
-putdvinfo() {
- [ "$Optn" ] && return
- ln -f /tmp/dv.$$/.dvinfo.0 /tmp/dv.$$/.dvinfo.1
- rsync -a /tmp/dv.$$/.dvinfo.[01] "$1/"
- isremote "$1" && cp /tmp/dv.$$/.dvinfo.0 "$cacheprefix/$1/"
-}
-
-# Usage: getpdir file [path]
-# Return absolute parent dir of path or PWD containing file
-getpdir() {
- R1="$([ -d "${2:-.}" ] && cd "${2:-.}" && pwd)"
- while [ "$R1" ]
- do
- [ -f "$R1/$1" ] && return || R1=${R1%/*}
- done
- return 1
-}
-
-# Usage: getprd file [path]
-# Return relative path to parent directory containing file
-getprd() {
- R2="$(cd "${2:-.}" && pwd)"; R2=${R2%/*} R1=..
- while [ "$R2" ]
- do
- [ -f "$R2/$1" ] && return || R2=${R2%/*} R1=$R1/..
- done
- return 1
-}
-
-info() {
- usage info && return
- case $2 in
- (*:*) lib=${2%/*/*} ;;
- (*) getpdir .dv && getdv $R1/.dv && lib=$R1 || die no dvlib found
- esac
- case $2 in # $2 specifies:
- (*/*/*) v=${2%/*/*}; v=${2#$v/} ;; # lib/item/version
- (*/*) v=$2 ;; # item/version
- (*) v=${R2%/*}/$2 ;; # version
- esac
- isremote "$lib" && {
- p=$cacheprefix
- [ -d "$p/$lib" ] || mkdir -p "$p/$lib"
- [ "$Optl" ] || rsync -a "$lib/.dvinfo.1" "$p/$lib/"
- } || p=
- info_query $1 $v $3 <$p/$lib/.dvinfo.1
-}
-
-info_query()
-{
- awk -v arg0=$1 -v arg1=$2 -v arg2=$3 '
- /^From / {
- if (v) msg[v] = var["Body"]
- delete var
- var["From"] = substr($0, 6)
- header = 1
- next
- }
- header == 1 && NF == 0 {
- v = var["Version"]; a = var["Anc"]; s = var["Sup"]
- if (a != v) {
- anc[v] = a; desc[a] = desc[a] ? desc[a] " " v : v
- }
- n = split(s, as)
- for (i = 1; i <= n; i++) {
- cli[as[i]] = cli[as[i]] ? cli[as[i]] " " v : v
- }
- sup[v] = s; msg[v] = var["Msg"]; date[v] = var["Date"]
- if (var["Root"]) root[v] = var["Root"]
- header = 0
- next
- }
- header == 1 {
- i = index($0, ":")
- var[substr($0, 1, i-1)] = substr($0, i+2)
- next
- }
- header == 0 {
- if ($0 ~ />+From /) sub(/>/, "")
- var["Body"] = var["Body"] ? var["Body"] "\n" $0 : $0
- }
- END {
- if (v) msg[v] = var["Body"]
- if (arg0 == "graph") anc_graph()
- else if (arg0 == "anc") query_anc(arg1, arg2)
- else if (arg0 == "sup") query_sup(arg1, arg2)
- else if (arg0 == "cli") query_cli(arg1, arg2)
- else if (arg0 == "log") print msg[arg1]
- else if (arg0 == "from") print from[arg1]
- else if (arg0 == "date") print date[arg1]
- else if (arg0 == "desc") printl(desc[arg1])
- }
- function anc_graph() {
- print "digraph G {"
- for (v in anc) print "\"" anc[v] "\" -> \"" v "\""
- print "}"
- }
- function query_anc(v, n) { while (n-- > 0) v = anc[v]; print v }
- function query_cli(v, n) {
- while (n-- > 0 && v != "") {
- num = split(v, av); v = ""
- for (i = 1; i <= num; i++) {
- printl(cli[av[i]])
- v = v ? v " " cli[av[i]] : cli[av[i]]
- }
- }
- }
- function query_sup(v, n) {
- while (n-- > 0 && v != "") {
- num = split(v, av); v = ""
- for (i = 1; i <= num; i++) {
- printl(sup[av[i]])
- v = v ? v " " sup[av[i]] : sup[av[i]]
- }
- }
- }
- function printl(l, i, n) {
- n = split(l, al)
- for (i = 1; i <= n; i++)
- if (root[al[i]])
- print al[i] " -> '"$PWD/"'" root[al[i]]
- else
- print al[i]
- }'
-}
-
-initlib() {
- rsync --list-only "$1/.dv." >/dev/null 2>&1 && return
- mkdir -p /tmp/dv.$$
- ln -s . /tmp/dv.$$/.dv.
- >/tmp/dv.$$/.dvinfo.0
- >/tmp/dv.$$/.dvinfo.1
- chmod g+w /tmp/dv.$$/.dvinfo.[01]
- rsync -a /tmp/dv.$$/ "$1"
-}
-
-isremote() { case $1 in (*:*) return;; esac; return 1; }
-
-help_all() {
- printf "$dv_version\nUsage: dv command [options] [args]\n"
- Opth=1; for c in $Cmdlist; do $c; done
-}
-
-newversion() {
- [ "$OptV" ] && R1=$OptV && return
- case $OptB in
- ('') R1=$1 ;;
- (*[-/]*) die 'illegal character [-/] in branch name' ;;
- (*[0-9.]) die 'illegal end character [0-9.] in branch name' ;;
- (*) case $1 in (*-${OptB}[1-9]*) R1=$1;; (*) R1=$1-${OptB}0;; esac ;;
- esac
- R2=${R1##*[!0-9]}
- optb=$Optb
- [ "$optb" ] && R3=.1 optb=${optb%b} || R3= R1=${R1%$R2}$(($R2 + 1))
- while [ "${optb}" ]; do optb=${optb%b} R3=.0$R3; done
- R1=$R1$R3
- while grep -q "^Version: $item/$R1\$" /tmp/dv.$$/.dvinfo.0
- do
- R2=${R1##*[!0-9]}
- [ "$R2" ] && R1=${R1%$R2}$(($R2 - 1)).1 || R1=${R1}1
- done
-}
-
-patch() {
- usage 'patch [-x pat] [-F File] [Dir|Version]' \
- 'Print patch diff from ancestor' && return
- diff "$@" | awk -v wdflag="-v${OptD:+3}${OptN:+1}${OptO:+2}" '
- { key = $1; file = substr($0, length(key) + 2) }
- key == "old" { old = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next }
- key == "new" { new = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next }
- {
- of = old "/" file; gsub("'\''", "'\'\\\\\'\''", of)
- nf = new "/" file; gsub("'\''", "'\'\\\\\'\''", nf)
- system("diff -Naup '\''" of "'\'\ \''" nf "'\''; echo")
- }'
-}
-
-save() {
- usage 'save [-bln] [-A Author] [-m msg] [-x pat] [-B Branch|-V Version] [Dir]'\
- 'Save dir into a new version' && return
- [ "$2" ] && die 'too many arguments'
- getpdir .dv "$1" || die "not in a clone: ${1:-$PWD}" && root=$R1
- cd "$root"
- getdv .dv && lib=$R1 && getdvinfo "$lib"
- # Process supplier subdirs from the deepest up to "." (most client)
- for d in $(find . -type f -name .dv | sort -r)
- do
- d=${d%/.dv}
- cd "$root/$d"
- OptF= save1 "$d" && nanc=$R1 && echo $nanc
- [ "$d" = . ] && continue # not a supplier, done
-
- # Replace supplier subdir by symlink in lib
- getprd .dv && s=$R1/../.dv./$nanc
- t=${d##*/}; t=.dv.$t
- mv "$root/$d" "$root/${d%/*}/$t"
- ln -s "$s" "$root/$d"
- done
- putdvinfo "$lib"
- # Restore supplier subdirs and remove links to lib, deepest first
- find . -type d -name ".dv.*" | sort -r | while read d
- do
- t=${d##*/.dv.}; t=${d%/*}/$t
- rm -f "$t" && mv "$d" "$t"
- done
-}
-
-save1() {
- getdv .dv && lib=$R1 anc=$R2 && item=${anc%/*} old=${anc#*/}
- [ "$(diffdir "$lib/$anc" .)" ] || { R1=$anc; return; }
- newversion $old && new=$item/$R1
- [ "$Optn" ] || dv_write "$new" "$anc" >.dv
- # Compute list of direct suppliers, for caching in .dvinfo.0
- lsup=$(find . -type l | while read -r l
- do
- case $l in (*/.dv.*) continue ;; esac
- f=$(readlink "$l")
- case $f in (*/.dv./*) printf "%s " ${f#*/.dv./} ;; esac
- done)
- [ ! "$Optn" ] && [ "$lsup" ] && dv_header . Sup "$lsup"
- { cat .dv; echo; } >>/tmp/dv.$$/.dvinfo.0
- [ -f ".dvignore" ] && xf=--exclude-from=.dvignore || xf=
- rsync -aDS$Optn$Optv --link-dest=../$old $xf --exclude=".dv.*/" \
- ./ "$lib/$new"
- R1=$new
- [ "$Optn" ] && return
- isremote "$lib" && rsync -aDS --link-dest=../$old --exclude=".dv.*/" \
- ./ "$cacheprefix/$lib/$new"
- dv_header . Anc "$new"
- dv_header . Lib "$lib"
-}
-
-supplier() {
- usage 'supplier [Version]' 'print suppliers' && return
- getdv .dv || die no item
- case $1 in
- (""|.|$PWD) # create a temporary dvinfo file, query it
- V=$R2; find . -name .dv |
- while read dv
- do
- [ "$dv" = "./.dv" ] && continue
- # get the supplier
- getdv "$dv"; v=$R2; dv=${dv%/.dv}
- # get the client
- getpdir .dv "${dv%/*}"; getdv "$R1/.dv"
- # declare the client as supplier
- printf "From \nVersion: %s\nSup: %s\n" "$v" "$R2"
- [ "$OptM" ] && echo "Root: ${dv#./}"; echo
- done | info_query cli $V ${Opt_N:-9999} ;;
- (*) info sup $1 ${Opt_N:-9999} ;;
- esac | sort -u
-}
-
-usage() { [ "$Opth" ] && printf " %-34s %s\n" "$1" "$2"; }
-
-username() {
- case $(uname -s) in
- (Darwin) id -P | awk -v FS=: '{print $8}' ;;
- (*) awk -v FS=[:,] '/^'$USER':/ {print $5; exit}' /etc/passwd ;;
- esac
-}
-
-wdiff() {
- usage 'wdiff [-DNO] [-x pat] [-F File] [Dir|Version]' \
- 'Print word diffs from ancestor' && return
- diff "$@" |
- awk -v wdflag="-v${OptD:+3}${OptN:+1}${OptO:+2}" '
- { key = $1; file = substr($0, length(key) + 2) }
- key == "old" { old = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next }
- key == "new" { new = (file ~ /:/ ? "'$cacheprefix'/" : "") file; next }
- {
- of = old "/" file; gsub("'\''", "'\'\\\\\'\''", of)
- nf = new "/" file; gsub("'\''", "'\'\\\\\'\''", nf)
- system("wd " wdflag " '\''" of "'\'\ \''" nf "'\''; echo")
- }' | less -FCimnqGrX -j5 -h0 +/'\[0'
-}
-
-cacheprefix=$HOME/.cache/dv
-Cmdlist='anc client clone desc diff info patch save supplier wdiff'
-while getopts :nvV opt # Parse global options
-do
- case $opt in
- (V) echo "$dv_version"; exit ;;
- (*) help_all; exit ;;
- esac
-done
-shift $((OPTIND - 1))
-[ $1 ] && C=$1 && shift 1 || { help_all; exit 1; }
-for c in $Cmdlist
-do
- case $c in
- ($C|_$C) cmd=$c; break;;
- ($C*) [ $cmd ] && die ambiguous command $C || cmd=$c;;
- esac
-done
-while getopts :0123456789A:bB:F:hl:m:MnNOsvV:x: opt # Parse command options
-do
- case $opt in
- ([0-9]) Opt_N=$Opt_N$opt;;
- ([bhlnMNOsv]) eval Opt$opt=\${Opt$opt}$opt ;;
- ([ABFmV]) eval Opt$opt=\$OPTARG ;;
- (x) Optx="$Optx --exclude=$OPTARG" ;;
- (*) Opth=1; $cmd; exit 1;;
- esac
-done
-shift $(($OPTIND - 1))
-trap "rm -rf /tmp/dv.$$" EXIT
-[ "$cmd" ] || die "no command \"$C\"" && $cmd "$@"
+../src/dv/dv \ No newline at end of file
diff --git a/bin/vpac b/bin/vpac
index 3b8c25c..0a12a1c 100755
--- a/bin/vpac
+++ b/bin/vpac
@@ -7,8 +7,8 @@ remove() {
pacman -Qqe |
fzf --no-clear --multi --bind=left:preview-page-up --bind=right:preview-page-down \
--preview-window=right:66% \
- --preview 'cat <(yay -Si {1}) <(pacman -Fl {1} 2>/dev/null | awk "!/\/$/ {print $2}")' |
- xargs -ro yay -Rns
+ --preview 'cat <(pacman -Si {1}) <(pacman -Fl {1} 2>/dev/null | awk "!/\/$/ {print $2}")' |
+ xargs -ro sudo pacman -Rns
}
remove