diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..3ce4669 --- /dev/null +++ b/.config/alacritty/alacritty.toml @@ -0,0 +1,144 @@ + +[colors.bright] +black = "0x9ca5a6" +blue = "0x38B3BF" +cyan = "0xA5CCD5" +green = "0x297889" +magenta = "0x539DA8" +red = "0x23837B" +white = "0xdfecee" +yellow = "0x507785" + +[colors.cursor] +cursor = "0xdfecee" +text = "0x0C0F11" + +[colors.normal] +black = "0x0C0F11" +blue = "0x38B3BF" +cyan = "0xA5CCD5" +green = "0x297889" +magenta = "0x539DA8" +red = "0x23837B" +white = "0xdfecee" +yellow = "0x507785" + +[colors.primary] +background = "0x0C0F11" +foreground = "0xdfecee" + +[cursor] +style = "Beam" + +[env] +TERM = "xterm-256color" + +[font] +size = 9.0 + +[font.bold] +family = "Terminus (TTF)" +style = "Bold" + +[font.italic] +family = "Terminus (TTF)" +style = "Regular" + +[font.normal] +family = "Terminus (TTF)" +style = "Regular" + +[font.offset] +x = 0 +y = 0 + +[[keyboard.bindings]] +action = "SpawnNewInstance" +key = "Return" +mods = "Control|Shift" + +[[keyboard.bindings]] +action = "Paste" +key = "V" +mods = "Alt" + +[[keyboard.bindings]] +action = "IncreaseFontSize" +key = "J" +mods = "Alt" + +[[keyboard.bindings]] +action = "DecreaseFontSize" +key = "K" +mods = "Alt" + +[[keyboard.bindings]] +action = "ScrollPageUp" +key = "PageUp" +mods = "Shift" + +[[keyboard.bindings]] +action = "ScrollPageDown" +key = "PageDown" +mods = "Shift" + +[mouse] +hide_when_typing = true + +[[mouse.bindings]] +action = "PasteSelection" +mods = "Shift" +mouse = "Middle" + +[[mouse.bindings]] +action = "Paste" +mods = "Shift" +mouse = "Right" + +[[mouse.bindings]] +action = "None" +mouse = "Middle" + +[[mouse.bindings]] +action = "None" +mouse = "Right" + + +[scrolling] +history = 10000 +multiplier = 3 + +[selection] +#ave_to_clipboard = true +semantic_escape_chars = ",β”‚`|:\"' ()[]{}<>\t" + +[terminal.shell] +args = ["-l"] +program = "/bin/zsh" + +[window] +decorations = "none" +dynamic_padding = true +dynamic_title = true +opacity = 0.9 + +[window.class] +general = "Alacritty" +instance = "Alacritty" + +[window.dimensions] +columns = 80 +lines = 20 + +[window.padding] +x = 12 +y = 12 + +[window.position] +x = 0 +y = 0 + +[general] +working_directory = "None" + +[terminal] diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 087c152..6a3b515 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -1,5 +1,5 @@ env: - TERM: xterm-256color + TERM: xterm-256color window: dimensions: columns: 80 @@ -34,7 +34,7 @@ font: style: Bold italic: family: Terminus (TTF) - style: Italic + style: Regular size: 9.0 offset: x: 0 @@ -42,7 +42,7 @@ font: selection: semantic_escape_chars: ",β”‚`|:\"' ()[]{}<>\t" - ave_to_clipboard: true + # ave_to_clipboard: true cursor: style: Beam @@ -56,22 +56,22 @@ working_directory: None mouse: hide_when_typing: true - hints: - launcher: - program: xdg-open - args: [] + #hints: +# launcher: +# program: xdg-open +# args: [] mouse_bindings: - { mouse: Middle, mods: Shift, action: PasteSelection } - - { mouse: Right, mods: Shift, action: Paste } - - { mouse: Middle, action: None } - - { mouse: Right, action: None } + - { mouse: Right, mods: Shift, action: Paste } + - { mouse: Middle, action: None } + - { mouse: Right, action: None } key_bindings: - - { key: Return, mods: Control|Shift, action: SpawnNewInstance } - - { key: V, mods: Alt, action: Paste} - - { key: J, mods: Alt, action: IncreaseFontSize } - - { key: K, mods: Alt, action: DecreaseFontSize } + - { key: Return, mods: Control|Shift, action: SpawnNewInstance } + - { key: V, mods: Alt, action: Paste } + - { key: J, mods: Alt, action: IncreaseFontSize } + - { key: K, mods: Alt, action: DecreaseFontSize } # - { key: J, mods: Shift, action: ScrollLineUp} # - { key: K, mods: Shift, action: ScrollLineDown} # { mouse: Middle, action: PasteSelection } @@ -79,8 +79,8 @@ key_bindings: #- { key: Copy, action: Copy } #- { key: L, mods: Control, action: ClearLogNotice } #- { key: L, mods: Control, mode: ~Vi, chars: "\x0c" } - - { key: PageUp, mods: Shift, action: ScrollPageUp, } - - { key: PageDown, mods: Shift, action: ScrollPageDown } + - { key: PageUp, mods: Shift, action: ScrollPageUp } + - { key: PageDown, mods: Shift, action: ScrollPageDown } #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, } #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } @@ -230,41 +230,38 @@ key_bindings: # cyan: '0x8ec07c' # white: '0xebdbb2' - - # Colors (Hyper) -colors: - # Default colors - primary: - background: '0x000000' - foreground: '0xffffff' - cursor: - text: '0xF81CE5' - cursor: '0xffffff' +#colors: +# # Default colors +# primary: +# background: '0x000000' +# foreground: '0xffffff' +# cursor: +# text: '0xF81CE5' +# cursor: '0xffffff' - # Normal colors - normal: - black: '0x000000' - red: '0xfe0100' - green: '0x33ff00' - yellow: '0xfeff00' - blue: '0x0066ff' - magenta: '0xcc00ff' - cyan: '0x00ffff' - white: '0xd0d0d0' +# Normal colors +# normal: +# black: '0x000000' +# red: '0xfe0100' +# green: '0x33ff00' +# yellow: '0xfeff00' +# blue: '0x0066ff' +# magenta: '0xcc00ff' +# cyan: '0x00ffff' +# white: '0xd0d0d0' + +# Bright colors +# bright: +# black: '0x808080' +# red: '0xfe0100' +# green: '0x33ff00' +# yellow: '0xfeff00' +# blue: '0x0066ff' +# magenta: '0xcc00ff' +# cyan: '0x00ffff' +# white: '0xFFFFFF' - # Bright colors - bright: - black: '0x808080' - red: '0xfe0100' - green: '0x33ff00' - yellow: '0xfeff00' - blue: '0x0066ff' - magenta: '0xcc00ff' - cyan: '0x00ffff' - white: '0xFFFFFF' - - # Colors (Gotham) # colors: # # Default colors @@ -296,28 +293,28 @@ colors: # BEGIN ACE colors: primary: - background: '0x0C0F11' - foreground: '0xdfecee' + background: '0x0f0e09' + foreground: '0xdbcdac' cursor: - text: '0x0C0F11' - cursor: '0xdfecee' + text: '0x0f0e09' + cursor: '0xdbcdac' normal: - black: '0x0C0F11' - red: '0x23837B' - green: '0x297889' - yellow: '0x507785' - blue: '0x38B3BF' - magenta: '0x539DA8' - cyan: '0xA5CCD5' - white: '0xdfecee' + black: '0x0f0e09' + red: '0x6B5835' + green: '0x324443' + yellow: '0x746A46' + blue: '0x8C552E' + magenta: '0x89784D' + cyan: '0x9F8D5E' + white: '0xdbcdac' bright: - black: '0x9ca5a6' - red: '0x23837B' - green: '0x297889' - yellow: '0x507785' - blue: '0x38B3BF' - magenta: '0x539DA8' - cyan: '0xA5CCD5' - white: '0xdfecee' + black: '0x998f78' + red: '0x6B5835' + green: '0x324443' + yellow: '0x746A46' + blue: '0x8C552E' + magenta: '0x89784D' + cyan: '0x9F8D5E' + white: '0xdbcdac' # END ACE diff --git a/.config/gtk-2.0/gtkfilechooser.ini b/.config/gtk-2.0/gtkfilechooser.ini index 430a6bc..f0f7b87 100644 --- a/.config/gtk-2.0/gtkfilechooser.ini +++ b/.config/gtk-2.0/gtkfilechooser.ini @@ -2,10 +2,10 @@ LocationMode=path-bar ShowHidden=false ShowSizeColumn=true -GeometryX=2376 -GeometryY=194 +GeometryX=456 +GeometryY=1287 GeometryWidth=1008 GeometryHeight=690 -SortColumn=name -SortOrder=ascending +SortColumn=modified +SortOrder=descending StartupMode=recent diff --git a/.config/gtk-3.0/bookmarks b/.config/gtk-3.0/bookmarks index 5c88852..96b7e90 100644 --- a/.config/gtk-3.0/bookmarks +++ b/.config/gtk-3.0/bookmarks @@ -1 +1,2 @@ +file:///home/paramah/Projects file:///home/paramah/Nextcloud diff --git a/.config/gtk-3.0/gtk.css b/.config/gtk-3.0/gtk.css index 3ac12c0..25e053c 100644 --- a/.config/gtk-3.0/gtk.css +++ b/.config/gtk-3.0/gtk.css @@ -1,191 +1,2 @@ -/* Custom styles */ - -/* select-off -@define-color selected_bg_color #398ee7; -@define-color selected_fg_color #eeeeee; -@define-color theme_selected_bg_color @selected_bg_color; -@define-color theme_selected_fg_color @selected_fg_color; -select-off */ - -/* panel-off -@define-color panel_bg_color #cccccc; -@define-color panel_fg_color #333333; - -PanelWidget, -PanelApplet, -PanelToplevel, -PanelSeparator, -PanelApplet > GtkMenuBar.menubar, -PanelApplet > GtkMenuBar.menubar.menuitem, -PanelMenuBar.menubar, -PanelMenuBar.menubar.menuitem, -PanelAppletFrame, -UnityPanelWidget, -.gnome-panel-menu-bar, -.unity-panel { - background-image: -gtk-gradient(linear,left top,left bottom,from(shade(@panel_bg_color,1.2)),to(shade(@panel_bg_color,0.8))); - color: @panel_fg_color; -} - -.unity-panel.menuitem, -.unity-panel .menuitem { - color: @panel_fg_color; -} - -.unity-panel.menubar.menuitem:hover, -.unity-panel.menubar .menuitem *:hover { - border-color: shade(@panel_bg_color, 0.7); - border-image: none; - background-image: -gtk-gradient(linear,left top,left bottom,from(shade(@panel_bg_color, 0.97)),to(shade(@panel_bg_color, 0.82))); - color: @panel_fg_color; -} - -PanelApplet .button { - border-color: transparent; - border-image: none; - background-image: -gtk-gradient(linear,left top,left bottom,from(shade(@panel_bg_color,1.2)),to(shade(@panel_bg_color,0.8))); - color: @panel_fg_color; - box-shadow: none; - text-shadow: none; - -unico-inner-stroke-width: 0; -} - -PanelApplet .button:active { - border-color: shade(@panel_bg_color,0.8); - border-image: none; - background-image: -gtk-gradient(linear,left top,left bottom,from(shade(shade(@panel_bg_color,1.02),0.9)),to(shade(shade(@panel_bg_color,1.02),0.95))); - color: @panel_fg_color; - box-shadow: none; - text-shadow: none; - -unico-inner-stroke-width: 0; -} - -PanelApplet .button:prelight { - border-color: transparent; - border-image: none; - background-image: -gtk-gradient(linear,left top,left bottom,from(shade(@panel_bg_color,1.2)),to(shade(@panel_bg_color,1.0))); - color: @panel_fg_color; - box-shadow: none; - text-shadow: none; - -unico-inner-stroke-width: 0; -} - -PanelApplet .button:active:prelight { - border-color: shade(@panel_bg_color,0.8); - border-image: none; - background-image: -gtk-gradient(linear,left top,left bottom,from(shade(shade(@panel_bg_color,1.02),1.0)),to(shade(shade(@panel_bg_color,1.02),1.05))); - color: @panel_fg_color; - box-shadow: none; - text-shadow: none; - -unico-inner-stroke-width: 0; -} - -WnckPager, -WnckTasklist { - background-color: @panel_bg_color; -} - -panel-off */ - -/* menu-off -@define-color menu_bg_color #eeeeee; -@define-color menu_fg_color #333333; - -GtkTreeMenu.menu, -GtkMenuToolButton.menu, -GtkComboBox .menu { - background-color: @menu_bg_color; -} - -.primary-toolbar .button .menu, -.toolbar .menu, -.toolbar .primary-toolbar .menu, -.menu { - border-style: none; - background-image: none; - background-color: @menu_bg_color; - color: @menu_fg_color; - box-shadow: none; - text-shadow: none; - -unico-inner-stroke-width: 0; -} - -.menu.button:hover, -.menu.button:active, -.menu.button:active:insensitive, -.menu.button:insensitive, -.menu.button { - background-color: @menu_bg_color; - background-image: none; -} - -GtkTreeMenu .menuitem * { - color: @menu_fg_color; -} - -.menuitem, -.menu .menuitem { - background-color: transparent; -} - -.menu .menuitem:active, -.menu .menuitem:hover { - background-color: @theme_selected_bg_color; -} - -.menuitem.check, -.menuitem.radio, -.menuitem.check:hover, -.menuitem.radio:hover, -.menuitem.check:active, -.menuitem.radio:active { - background-color: transparent; -} - -.menu .menuitem:insensitive, -.menu .menuitem *:insensitive { - color: mix(@menu_fg_color,@menu_bg_color,0.5); -} - -.menuitem.arrow { - color: alpha(@menu_fg_color, 0.6); -} - -.menuitem .entry { - border-color: shade(@menu_bg_color,0.7); - border-image: none; - background-color: @menu_bg_color; - background-image: none; - color: @menu_fg_color; -} - -.menuitem .accelerator { - color: alpha(@menu_fg_color,0.6); -} - -.menuitem .accelerator:insensitive { - color: alpha(mix(@menu_fg_color,@menu_bg_color,0.5),0.6); - text-shadow: none; -} - -.menuitem.separator { - background-color: transparent; - color: shade(@menu_bg_color, 0.9); -} - -.menuitem GtkCalendar, -.menuitem GtkCalendar.button, -.menuitem GtkCalendar.header, -.menuitem GtkCalendar.view { - border-color: shade(@menu_bg_color,0.8); - border-image: none; - background-color: @menu_bg_color; - background-image: none; - color: @menu_fg_color; -} - -.menuitem GtkCalendar:inconsistent { - color: mix(@menu_fg_color,@menu_bg_color,0.5); -} - -menu-off */ +/* Remove dotted lines from GTK 3 applications */ +.undershoot.top, .undershoot.right, .undershoot.bottom, .undershoot.left { background-image: none; } diff --git a/.config/gtk-3.0/settings.ini b/.config/gtk-3.0/settings.ini index cde545b..4335641 100644 --- a/.config/gtk-3.0/settings.ini +++ b/.config/gtk-3.0/settings.ini @@ -1,11 +1,19 @@ [Settings] -gtk-application-prefer-dark-theme=1 -gtk-button-images=1 +gtk-theme-name=Adwaita +gtk-icon-theme-name=Adwaita +gtk-font-name=Cantarell 10 gtk-cursor-theme-name=Adwaita -gtk-fallback-icon-theme=Adwaita -gtk-font-name=Noto Sans Cypriot Regular 9 -gtk-icon-theme-name=Gruvbox -gtk-menu-images=0 -gtk-primary-button-warps-slider=false -gtk-theme-name=Breeze-Dark +gtk-cursor-theme-size=24 gtk-toolbar-style=GTK_TOOLBAR_ICONS +gtk-toolbar-icon-size=GTK_ICON_SIZE_SMALL_TOOLBAR +gtk-button-images=1 +gtk-menu-images=0 +gtk-enable-event-sounds=1 +gtk-enable-input-feedback-sounds=0 +gtk-xft-antialias=1 +gtk-xft-hinting=1 +gtk-xft-hintstyle=hintmedium +gtk-xft-rgba=rgb +gtk-application-prefer-dark-theme=1 +gtk-fallback-icon-theme=Adwaita +gtk-primary-button-warps-slider=false diff --git a/.config/gtk-4.0/servers b/.config/gtk-4.0/servers index 017f2d2..f83d71b 100644 --- a/.config/gtk-4.0/servers +++ b/.config/gtk-4.0/servers @@ -13,4 +13,24 @@ + + projekty na myszka + + + + + + + + + + media na myszka + + + + + + + + \ No newline at end of file diff --git a/.config/kanshi/config b/.config/kanshi/config index 086e34b..fd5589d 100644 --- a/.config/kanshi/config +++ b/.config/kanshi/config @@ -1,23 +1,13 @@ profile Home { - output eDP-1 mode 1920x1080@60Hz position 1920,0 - output DP-3 mode 1920x1080@60Hz position 3830,0 - output DP-4 mode 1920x1080@60Hz position 0,0 + output eDP-1 mode 1920x1080 position 850,1080 transform normal + output DP-3 mode 1920x1080 position 0,0 transform normal + output DP-4 mode 1920x1080 position 1920,10 transform normal } + profile HomeAS { - output eDP-1 mode 1920x1080@60Hz position 1920,0 - output DP-5 mode 1920x1080@60Hz position 3830,0 - output DP-6 mode 1920x1080@60Hz position 0,0 + output eDP-1 mode 1920x1080 position 850,1080 transform normal + output DP-5 mode 1920x1080 position 0,0 transform normal + output DP-6 mode 1920x1080 position 1920,10 transform normal } -profile StreamSage { - output eDP-1 mode 1920x1080@60Hz position 1910,0 - output DP-7 mode 1920x1080@60Hz position 3830,0 - output DP-6 mode 1920x1080@60Hz position 0,0 -} - -profile StreamSage_duzy { - output eDP-1 mode 1920x1080 position 1930,0 - output DP-4 mode 1920x1080 position 0,0 - output DP-5 mode 1920x1080 position 3870,0 -} diff --git a/.config/sway/autostart b/.config/sway/autostart new file mode 100644 index 0000000..00b386d --- /dev/null +++ b/.config/sway/autostart @@ -0,0 +1,13 @@ +exec rm /tmp/nwg-shell-check-update.lock +exec wlsunset -t 4500 -T 6500 -l -1 -L -1 -g 1.0 +exec swaync -s /home/paramah/.config/swaync/preset-0.css +exec nm-applet --indicator +exec wl-paste --type text --watch cliphist store +exec wl-paste --type image --watch cliphist store +exec_always nwg-autotiling +exec_always nwg-drawer -r -c 6 -is 64 -fscol 2 -s preset-0.css -term foot -ft -pbexit 'nwg-dialog -p exit-sway -c "swaymsg exit"' -pblock 'nwg-lock' -pbpoweroff 'nwg-dialog -p poweroff -c "systemctl -i poweroff"' -pbreboot 'nwg-dialog -p reboot -c "systemctl reboot"' -pbsleep 'nwg-dialog -p sleep -c "systemctl suspend"' -pbsize 48 +exec_always nwg-panel -c preset-0 -s preset-0.css +exec_always nwg-shell-check-updates +#exec swayidle timeout 1200 nwg-lock timeout 1800 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' +exec nwg-update-indicator +exec_always nwg-screenshot-applet diff --git a/.config/sway/config-backup-20240519-141059 b/.config/sway/config-backup-20240519-141059 new file mode 100644 index 0000000..9b02543 --- /dev/null +++ b/.config/sway/config-backup-20240519-141059 @@ -0,0 +1,46 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +set $alt Mod1 + +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +# set $term foot +set $term alacritty +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +set $menu dmenu_path | dmenu | xargs swaymsg exec -- + +font Terminus 9 +#font pango:SourceCodePro Medium 11 + +gaps inner 10 +default_border none +default_border normal 0 + +### Output configuration +# +# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) +# output * bg ~/Wallpapers/deusex.jpg fill + + +#for_window [app_id="^launcher$"] floating enable, sticky enable, resize set 30 ppt 60 ppt, border pixel 10 +#set $menu exec $term --class=launcher -e /home/paramah/bin/sway-launcher-desktop.sh +#bindsym $mod+d exec $menu + +# include @sysconfdir@/sway/config.d/* + + +include $HOME/.config/sway/sway.d/*.conf diff --git a/.config/sway/keyboard b/.config/sway/keyboard new file mode 100644 index 0000000..ead5d10 --- /dev/null +++ b/.config/sway/keyboard @@ -0,0 +1,8 @@ +input "type:keyboard" { + xkb_layout pl + repeat_delay 300 + repeat_rate 40 + xkb_capslock disabled + xkb_numlock disabled +} +bindsym --release Super_L exec $launcher diff --git a/.config/sway/idle.yml b/.config/sway/off-idle.yml similarity index 100% rename from .config/sway/idle.yml rename to .config/sway/off-idle.yml diff --git a/.config/sway/outputs b/.config/sway/outputs new file mode 100644 index 0000000..e69de29 diff --git a/.config/sway/pointer b/.config/sway/pointer new file mode 100644 index 0000000..db6e52f --- /dev/null +++ b/.config/sway/pointer @@ -0,0 +1,5 @@ +input "type:pointer" { + natural_scroll disabled + scroll_factor 1.0 + left_handed disabled +} diff --git a/.config/sway/sway.d/03-workspace.conf b/.config/sway/sway.d/03-workspace.conf index 27740b3..f799c55 100644 --- a/.config/sway/sway.d/03-workspace.conf +++ b/.config/sway/sway.d/03-workspace.conf @@ -15,7 +15,7 @@ workspace 2 output eDP-1 workspace 3 output DP-3 workspace 4 output DP-3 -workspace 5 output DP-4 +workspace 5 output DP-3 workspace 10 output eDP-1 diff --git a/.config/sway/sway.d/06-floating.conf b/.config/sway/sway.d/06-floating.conf index 12d524a..78d6681 100644 --- a/.config/sway/sway.d/06-floating.conf +++ b/.config/sway/sway.d/06-floating.conf @@ -3,6 +3,7 @@ for_window [app_id="(.*)telegram(.*)"] resize set 900 600, move scratchpad, border pixel 1 for_window [class="Mattermost"] resize set 900 600, move scratchpad, border pixel 1 for_window [title="WhatsApp"] move scratchpad, border pixel 1 +for_window [class="Element"] move scratchpad, resize set 1000 800, border pixel 1 for_window [class="discord"] move scratchpad, border pixel 1 for_window [window_role="floating"] floating enable for_window [class="QSyncthingTray"] floating enable @@ -13,6 +14,8 @@ for_window [class="Gnome-calculator"] floating enable for_window [class="zoom"] move scratchpad, floating enable for_window [class="Signal"] move scratchpad +for_window [class="Trilium Notes"] move scratchpad, resize set 1200 800, border normal 2 + for_window [class="pavucontrol"] floating enable for_window [app_id="zenity"] floating enable diff --git a/.config/sway/sway.d/07-hotkeys.conf b/.config/sway/sway.d/07-hotkeys.conf index 448ac6f..a4df1cf 100644 --- a/.config/sway/sway.d/07-hotkeys.conf +++ b/.config/sway/sway.d/07-hotkeys.conf @@ -147,12 +147,12 @@ bindsym Shift+$mod+b exec rofi-buku ## Screenshot // Screenshot active display // ## #bindsym Print exec $BIN_DIR/screenshots.sh display #bindsym --locked Print exec grim -o "$(swaymsg --type get_outputs --raw | jq -r '.[] | select(.focused) | .name')" - | swappy -f - -bindsym --locked Print exec /usr/share/sway/scripts/grimshot --notify save area - | swappy -f - +bindsym --locked Print exec grimshot --notify save area - | swappy -f - ## Screenshot // Screenshot current window // <ο…Ί> ## #bindsym $mod+Print exec $BIN_DIR/screenshots.sh window #bindsym $mod+Print exec swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.focused) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | grim -g - - | swappy -f - -bindsym $mod+Print exec /usr/share/sway/scripts/grimshot --notify save output - | swappy -f - +bindsym $mod+Print exec grimshot --notify save output - | swappy -f - ## Modify // Monitor brightness up // ## #bindsym XF86MonBrightnessUp exec light -A 5 @@ -201,6 +201,8 @@ bindsym $mod+x exec $BIN_DIR/dmenuscreenshare.sh bindsym $mod+p [class="Mattermost"] scratchpad show bindsym $mod+Shift+m [class="Thunderbird"] scratchpad show +bindsym $mod+n [class="Trilium Notes"] scratchpad show + bindsym $mod+i exec --no-startup-id /home/paramah/.config/rofi/launchers/type-4/launcher.sh -show window bindsym $mod+Shift+o exec --no-startup-id ~/.config/rofi/scripts/nmvpnmenu.sh bindsym $mod+o exec --no-startup-id ~/.config/rofi/scripts/sound.sh diff --git a/.config/sway/touchpad b/.config/sway/touchpad new file mode 100644 index 0000000..2cdb7bf --- /dev/null +++ b/.config/sway/touchpad @@ -0,0 +1,13 @@ +input "type:touchpad" { + pointer_accel 0.0 + natural_scroll disabled + scroll_factor 1.0 + scroll_method two_finger + left_handed disabled + tap enabled + tap_button_map lrm + drag enabled + drag_lock disabled + dwt enabled + middle_emulation enabled +} diff --git a/.config/sway/variables b/.config/sway/variables new file mode 100644 index 0000000..640eaa4 --- /dev/null +++ b/.config/sway/variables @@ -0,0 +1,6 @@ +set $term foot +set $browser chromium --enable-features=UseOzonePlatform --ozone-platform=wayland +set $filemanager thunar +set $editor vim +set $launcher nwg-drawer +set $exit $launcher diff --git a/.config/sway/workspaces b/.config/sway/workspaces new file mode 100644 index 0000000..e69de29 diff --git a/.config/systemd/user/crc-daemon.service b/.config/systemd/user/crc-daemon.service new file mode 100644 index 0000000..8a727cd --- /dev/null +++ b/.config/systemd/user/crc-daemon.service @@ -0,0 +1,11 @@ + +[Unit] +Description=CRC daemon +Requires=crc-http.socket +Requires=crc-vsock.socket + +[Service] +# This allows systemd to know when startup is not complete (for example, because of a preflight failure) +# daemon.SdNotify(false, daemon.SdNotifyReady) must be called before the startup is successful +Type=notify +ExecStart=/home/paramah/.crc/bin/crc daemon diff --git a/.config/systemd/user/crc-http.socket b/.config/systemd/user/crc-http.socket new file mode 100644 index 0000000..b6d7963 --- /dev/null +++ b/.config/systemd/user/crc-http.socket @@ -0,0 +1,9 @@ +[Unit] +Description=CRC HTTP socket + +[Socket] +ListenStream=%h/.crc/crc-http.sock +Service=crc-daemon.service + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/crc-vsock.socket b/.config/systemd/user/crc-vsock.socket new file mode 100644 index 0000000..cc6714c --- /dev/null +++ b/.config/systemd/user/crc-vsock.socket @@ -0,0 +1,9 @@ +[Unit] +Description=CRC vsock socket + +[Socket] +ListenStream=vsock::1024 +Service=crc-daemon.service + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/default.target.wants/crc-http.socket b/.config/systemd/user/default.target.wants/crc-http.socket new file mode 120000 index 0000000..77572bc --- /dev/null +++ b/.config/systemd/user/default.target.wants/crc-http.socket @@ -0,0 +1 @@ +/home/paramah/.config/systemd/user/crc-http.socket \ No newline at end of file diff --git a/.config/systemd/user/default.target.wants/crc-vsock.socket b/.config/systemd/user/default.target.wants/crc-vsock.socket new file mode 120000 index 0000000..92d783e --- /dev/null +++ b/.config/systemd/user/default.target.wants/crc-vsock.socket @@ -0,0 +1 @@ +/home/paramah/.config/systemd/user/crc-vsock.socket \ No newline at end of file diff --git "a/.config/systemd/user/default.target.wants/gitwatch@\\x27\\x2dr\\x20ssh:--git\\x40git.cynarski.pl:65522-myEnv-sd.git\\x27\\x20\\x7e-sd.service" "b/.config/systemd/user/default.target.wants/gitwatch@\\x27\\x2dr\\x20ssh:--git\\x40git.cynarski.pl:65522-myEnv-sd.git\\x27\\x20\\x7e-sd.service" new file mode 120000 index 0000000..4abc28a --- /dev/null +++ "b/.config/systemd/user/default.target.wants/gitwatch@\\x27\\x2dr\\x20ssh:--git\\x40git.cynarski.pl:65522-myEnv-sd.git\\x27\\x20\\x7e-sd.service" @@ -0,0 +1 @@ +/home/paramah/.config/systemd/user/gitwatch@.service \ No newline at end of file diff --git a/.config/systemd/user/gitwatch@.service b/.config/systemd/user/gitwatch@.service new file mode 100644 index 0000000..6480df7 --- /dev/null +++ b/.config/systemd/user/gitwatch@.service @@ -0,0 +1,10 @@ +[Unit] +Description=Watch file or directory and git commit all changes. run with: systemctl --user --now enable gitwatch@$(systemd-escape -- "'-r url/to/repository' /path/to/folder").service + +[Service] +Environment="SCRIPT_ARGS=%I" +ExecStart=/usr/bin/bash -c "/home/paramah/bin/gitwatch ${SCRIPT_ARGS}" +ExecStop=/bin/true + +[Install] +WantedBy=default.target diff --git a/.config/waybar/bin/lampka.sh b/.config/waybar/bin/lampka.sh new file mode 100755 index 0000000..51049b9 --- /dev/null +++ b/.config/waybar/bin/lampka.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +curl -X POST -d '' http://192.168.88.129:8123/api/webhook/-atYLUfPeumO_uApfB5X5vOst + diff --git a/.config/waybar/bin/tv_voldown.sh b/.config/waybar/bin/tv_voldown.sh index cc9b2a8..557b08a 100755 --- a/.config/waybar/bin/tv_voldown.sh +++ b/.config/waybar/bin/tv_voldown.sh @@ -1,2 +1,2 @@ #!/bin/bash -curl -X POST -d '' http://192.168.88.169:8123/api/webhook/tv_voldown +curl -X POST -d '' http://192.168.88.129:8123/api/webhook/tv_voldown diff --git a/.config/waybar/bin/tv_volup.sh b/.config/waybar/bin/tv_volup.sh index 03b9669..88c21cc 100755 --- a/.config/waybar/bin/tv_volup.sh +++ b/.config/waybar/bin/tv_volup.sh @@ -1,2 +1,2 @@ #!/bin/bash -curl -X POST -d '' http://192.168.88.169:8123/api/webhook/tv_volup +curl -X POST -d '' http://192.168.88.129:8123/api/webhook/tv_volup diff --git a/.gitconfig b/.gitconfig index f0099bd..fb66949 100644 --- a/.gitconfig +++ b/.gitconfig @@ -79,14 +79,14 @@ [includeIf "gitdir:~/Projects/CyfroweNiebo/"] path = ~/Projects/CyfroweNiebo/.gitconfig -[includeIf "gitdir:~/Projects/streamsage.io/"] - path = ~/Projects/streamsage.io/.gitconfig +#[includeIf "gitdir:~/Projects/streamsage.io/"] +# path = ~/Projects/streamsage.io/.gitconfig -[includeIf "gitdir:~/Projects/stream-sage/"] - path = ~/Projects/streamsage.io/.gitconfig +#[includeIf "gitdir:~/Projects/stream-sage/"] +# path = ~/Projects/streamsage.io/.gitconfig -[includeIf "gitdir:~/Projects/cardboard.live/"] - path = ~/Projects/streamsage.io/.gitconfig +#[includeIf "gitdir:~/Projects/cardboard.live/"] +# path = ~/Projects/streamsage.io/.gitconfig [includeIf "gitdir:~/Projects/GONG/"] path = ~/Projects/GONG/.gitconfig @@ -117,3 +117,5 @@ [safe] directory = /opt/flutter +[credential] + helper = store diff --git a/.signature b/.signature index aea5e65..0aac661 100644 --- a/.signature +++ b/.signature @@ -1,6 +1,3 @@ --- -Aleksander "paramah" Cynarski -------------------------------- -PGP/GPG: http://gpg.cynarski.pl -About: http://cynarski.pl - +π”Έπ•π•–π•œπ•€π•’π•Ÿπ••π•–π•£ β„‚π•ͺπ•Ÿπ•’π•£π•€π•œπ•š +DevOps ☣ Developer ☣ Freak +https://cynarski.pl diff --git a/.tmux.conf b/.tmux.conf index b810d7d..d4b72b4 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -80,6 +80,8 @@ set -g @plugin 'tmux-plugins/tmux-sessionist' set -g default-terminal "screen-256color" +#set -s copy-command 'wl-copy' + set-option -g status on set-option -g status-interval 2 set-option -g status-justify "centre" diff --git a/.zshrc b/.zshrc index f73e193..e1ced0d 100644 --- a/.zshrc +++ b/.zshrc @@ -43,6 +43,9 @@ export PATH="/home/paramah/bin:$PATH" export PATH="$HOME/.symfony/bin:$PATH" export PATH="/home/paramah/.linkerd2/bin:$PATH" +#dotnet +export DOTNET_ROOT=$HOME/.dotnet + # Path to your oh-my-zsh installation. export ZSH=$HOME/.oh-my-zsh #source /usr/share/zsh-theme-powerlevel9k/powerlevel9k.zsh-theme @@ -56,10 +59,10 @@ source /usr/bin/virtualenvwrapper.sh plugins=( zsh-autosuggestions - virtualenvwrapper + #virtualenvwrapper virtualenv - taskwarrior - timewarrior + #taskwarrior + #timewarrior archlinux systemd themes @@ -73,6 +76,9 @@ plugins=( terraform asdf #aterminal + poetry + #fzf-tab-completion + sd ) @@ -91,6 +97,8 @@ zplug "kazhala/dotbare" # autocomplete on steroids zstyle ':completion:*' fzf-search-display true +zstyle ':completion::*:ls::*' fzf-completion-opts --preview='eval head {1}' +zstyle ':completion::*:cat::*' fzf-completion-opts --preview='eval head {1}' # Map widgets to key bindkey '^ge' fzf-select-widget @@ -242,7 +250,6 @@ alias tfw="terraform workspace" autoload -U +X bashcompinit && bashcompinit complete -o nospace -C /usr/bin/vault vault -xset b off #wal -i ~/Wallpapers/5sense1.jpg #wal -i ~/Wallpapers/steampunk_1.jpg #wal -i ~/Wallpapers/steampunk_5.jpg @@ -390,7 +397,7 @@ mb() { export PAGER=bat -alias ls="exa" +#alias ls="exa" #cat ~/.ideas # @@ -406,8 +413,8 @@ then echo -en "\e]0;$(id --user --name)@$(hostname): ${1}\a" } fi -PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source "/home/paramah/.config/tea/autocomplete.zsh" -PROG=ledo _CLI_ZSH_AUTOCOMPLETE_HACK=1 source "/home/paramah/.config/ledo/autocomplete.zsh" +#PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source "/home/paramah/.config/tea/autocomplete.zsh" +#PROG=ledo _CLI_ZSH_AUTOCOMPLETE_HACK=1 source "/home/paramah/.config/ledo/autocomplete.zsh" PATH="/home/paramah/perl5/bin${PATH:+:${PATH}}"; export PATH; PERL5LIB="/home/paramah/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; @@ -417,7 +424,7 @@ PERL_MM_OPT="INSTALL_BASE=/home/paramah/perl5"; export PERL_MM_OPT; PATH="/home/paramah/.local/share/gem/ruby/3.0.0/bin${PATH:+${PATH}}"; export PATH; #source <(clockify-cli completion zsh) -source <(kubectl completion zsh) +#source <(kubectl completion zsh) source <(helm completion zsh) source <(kubectl completion zsh) POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true @@ -443,3 +450,22 @@ typeset -g POWERLEVEL9K_AWS_SHOW_ON_DEMAND='' #export GPG_TTY=$(tty) #gpgconf --launch gpg-agent #gpg-connect-agent updatestartuptty /bye >/dev/null + +#export NVM_DIR="$HOME/.nvm" +#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +# +autoload bashcompinit +bashcompinit +source /usr/lib/python3.12/site-packages/argcomplete/bash_completion.d/_python-argcomplete + +# pnpm +export PNPM_HOME="/home/paramah/.local/share/pnpm" +case ":$PATH:" in + *":$PNPM_HOME:"*) ;; + *) export PATH="$PNPM_HOME:$PATH" ;; +esac +# pnpm end +# + + diff --git a/nvim/coc-settings.json b/_oldies/nvim/coc-settings.json similarity index 100% rename from nvim/coc-settings.json rename to _oldies/nvim/coc-settings.json diff --git a/nvim/init.vim b/_oldies/nvim/init.vim similarity index 100% rename from nvim/init.vim rename to _oldies/nvim/init.vim diff --git a/bin/agg b/bin/agg new file mode 100755 index 0000000..87a7229 Binary files /dev/null and b/bin/agg differ diff --git a/bin/crc b/bin/crc new file mode 100755 index 0000000..32616d7 Binary files /dev/null and b/bin/crc differ diff --git a/bin/gitwatch b/bin/gitwatch new file mode 100755 index 0000000..5c90aa2 --- /dev/null +++ b/bin/gitwatch @@ -0,0 +1,413 @@ +#!/usr/bin/env bash +# +# gitwatch - watch file or directory and git commit all changes as they happen +# +# Copyright (C) 2013-2018 Patrick Lehner +# with modifications and contributions by: +# - Matthew McGowan +# - Dominik D. Geyer +# - Phil Thompson +# - Dave Musicant +# +############################################################################# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +############################################################################# +# +# Idea and original code taken from http://stackoverflow.com/a/965274 +# original work by Lester Buck +# (but heavily modified by now) +# +# Requires the command 'inotifywait' to be available, which is part of +# the inotify-tools (See https://github.com/rvoicilas/inotify-tools ), +# and (obviously) git. +# Will check the availability of both commands using the `which` command +# and will abort if either command (or `which`) is not found. +# + +REMOTE="" +PULL_BEFORE_PUSH=0 +BRANCH="" +SLEEP_TIME=2 +DATE_FMT="+%Y-%m-%d %H:%M:%S" +COMMITMSG="Scripted auto-commit on change (%d) by gitwatch.sh" +LISTCHANGES=-1 +LISTCHANGES_COLOR="--color=always" +GIT_DIR="" +SKIP_IF_MERGING=0 + +# Print a message about how to use this script +shelp() { + echo "gitwatch - watch file or directory and git commit all changes as they happen" + echo "" + echo "Usage:" + echo "${0##*/} [-s ] [-d ] [-r [-b ]]" + echo " [-m ] [-l|-L ] [-x ] [-M] " + echo "" + echo "Where is the file or folder which should be watched. The target needs" + echo "to be in a Git repository, or in the case of a folder, it may also be the top" + echo "folder of the repo." + echo "" + echo " -s After detecting a change to the watched file or directory," + echo " wait seconds until committing, to allow for more" + echo " write actions of the same batch to finish; default is 2sec" + echo " -d The format string used for the timestamp in the commit" + echo " message; see 'man date' for details; default is " + echo ' "+%Y-%m-%d %H:%M:%S"' + echo " -r If given and non-empty, a 'git push' to the given " + echo " is done after every commit; default is empty, i.e. no push" + echo " -R If given along with -r, a 'git pull --rebase ' is done before any push" + echo " -b The branch which should be pushed automatically;" + echo " - if not given, the push command used is 'git push '," + echo " thus doing a default push (see git man pages for details)" + echo " - if given and" + echo " + repo is in a detached HEAD state (at launch)" + echo " then the command used is 'git push '" + echo " + repo is NOT in a detached HEAD state (at launch)" + echo " then the command used is" + echo " 'git push :' where" + echo " is the target of HEAD (at launch)" + echo " if no remote was defined with -r, this option has no effect" + echo " -g Location of the .git directory, if stored elsewhere in" + echo " a remote location. This specifies the --git-dir parameter" + echo " -l Log the actual changes made in this commit, up to a given" + echo " number of lines, or all lines if 0 is given" + echo " -L Same as -l but without colored formatting" + echo " -m The commit message used for each commit; all occurrences of" + echo " %d in the string will be replaced by the formatted date/time" + echo " (unless the specified by -d is empty, in which case %d" + echo " is replaced by an empty string); the default message is:" + echo ' "Scripted auto-commit on change (%d) by gitwatch.sh"' + echo " -e Events passed to inotifywait to watch (defaults to " + echo " '$EVENTS')" + echo " (useful when using inotify-win, e.g. -e modify,delete,move)" + echo " (currently ignored on Mac, which only uses default values)" + echo " -M Prevent commits when there is an ongoing merge in the repo" + echo " -x Pattern to exclude from inotifywait" + echo "" + echo "As indicated, several conditions are only checked once at launch of the" + echo "script. You can make changes to the repo state and configurations even while" + echo "the script is running, but that may lead to undefined and unpredictable (even" + echo "destructive) behavior!" + echo "It is therefore recommended to terminate the script before changing the repo's" + echo "config and restarting it afterwards." + echo "" + echo 'By default, gitwatch tries to use the binaries "git", "inotifywait", and' + echo "\"readline\", expecting to find them in the PATH (it uses 'which' to check this" + echo "and will abort with an error if they cannot be found). If you want to use" + echo "binaries that are named differently and/or located outside of your PATH, you can" + echo "define replacements in the environment variables GW_GIT_BIN, GW_INW_BIN, and" + echo "GW_RL_BIN for git, inotifywait, and readline, respectively." +} + +# print all arguments to stderr +stderr() { + echo "$@" >&2 +} + +# clean up at end of program, killing the remaining sleep process if it still exists +cleanup() { + if [[ -n $SLEEP_PID ]] && kill -0 "$SLEEP_PID" &> /dev/null; then + kill "$SLEEP_PID" &> /dev/null + fi + exit 0 +} + +# Tests for the availability of a command +is_command() { + hash "$1" 2> /dev/null +} + +# Test whether or not current git directory has ongoign merge +is_merging () { + [ -f "$(git rev-parse --git-dir)"/MERGE_HEAD ] +} + +############################################################################### + +while getopts b:d:h:g:L:l:m:p:r:s:e:x:MR option; do # Process command line options + case "${option}" in + b) BRANCH=${OPTARG} ;; + d) DATE_FMT=${OPTARG} ;; + h) + shelp + exit + ;; + g) GIT_DIR=${OPTARG} ;; + l) LISTCHANGES=${OPTARG} ;; + L) + LISTCHANGES=${OPTARG} + LISTCHANGES_COLOR="" + ;; + m) COMMITMSG=${OPTARG} ;; + M) SKIP_IF_MERGING=1 ;; + p | r) REMOTE=${OPTARG} ;; + R) PULL_BEFORE_PUSH=1 ;; + s) SLEEP_TIME=${OPTARG} ;; + x) EXCLUDE_PATTERN=${OPTARG} ;; + e) EVENTS=${OPTARG} ;; + *) + stderr "Error: Option '${option}' does not exist." + shelp + exit 1 + ;; + esac +done + +shift $((OPTIND - 1)) # Shift the input arguments, so that the input file (last arg) is $1 in the code below + +if [ $# -ne 1 ]; then # If no command line arguments are left (that's bad: no target was passed) + shelp # print usage help + exit # and exit +fi + +# if custom bin names are given for git, inotifywait, or readlink, use those; otherwise fall back to "git", "inotifywait", and "readlink" +if [ -z "$GW_GIT_BIN" ]; then GIT="git"; else GIT="$GW_GIT_BIN"; fi + +if [ -z "$GW_INW_BIN" ]; then + # if Mac, use fswatch + if [ "$(uname)" != "Darwin" ]; then + INW="inotifywait" + EVENTS="${EVENTS:-close_write,move,move_self,delete,create,modify}" + else + INW="fswatch" + # default events specified via a mask, see + # https://emcrisostomo.github.io/fswatch/doc/1.14.0/fswatch.html/Invoking-fswatch.html#Numeric-Event-Flags + # default of 414 = MovedTo + MovedFrom + Renamed + Removed + Updated + Created + # = 256 + 128+ 16 + 8 + 4 + 2 + EVENTS="${EVENTS:---event=414}" + fi +else + INW="$GW_INW_BIN" +fi + +if [ -z "$GW_RL_BIN" ]; then RL="readlink"; else RL="$GW_RL_BIN"; fi + +# Check availability of selected binaries and die if not met +for cmd in "$GIT" "$INW"; do + is_command "$cmd" || { + stderr "Error: Required command '$cmd' not found." + exit 2 + } +done +unset cmd + +############################################################################### + +SLEEP_PID="" # pid of timeout subprocess + +trap "cleanup" EXIT # make sure the timeout is killed when exiting script + +# Expand the path to the target to absolute path +if [ "$(uname)" != "Darwin" ]; then + IN=$($RL -f "$1") +else + if is_command "greadlink"; then + IN=$(greadlink -f "$1") + else + IN=$($RL -f "$1") + if [ $? -eq 1 ]; then + echo "Seems like your readlink doesn't support '-f'. Running without. Please 'brew install coreutils'." + IN=$($RL "$1") + fi + fi +fi + +if [ -d "$1" ]; then # if the target is a directory + + TARGETDIR=$(sed -e "s/\/*$//" <<< "$IN") # dir to CD into before using git commands: trim trailing slash, if any + + if [ -z $EXCLUDE_PATTERN ]; then + EXCLUDE_OPTS="'(\.git/|\.git$)'" + else + EXCLUDE_OPTS="'(\.git/|\.git$|$EXCLUDE_PATTERN)'" + fi + + # construct inotifywait-commandline + if [ "$(uname)" != "Darwin" ]; then + INW_ARGS=("-qmr" "-e" "$EVENTS" "--exclude" $EXCLUDE_OPTS "\"$TARGETDIR\"") + else + # still need to fix EVENTS since it wants them listed one-by-one + INW_ARGS=("--recursive" "$EVENTS" "-E" "--exclude" $EXCLUDE_OPTS "\"$TARGETDIR\"") + fi + GIT_ADD_ARGS="--all ." # add "." (CWD) recursively to index + GIT_COMMIT_ARGS="" # add -a switch to "commit" call just to be sure + +elif [ -f "$1" ]; then # if the target is a single file + + TARGETDIR=$(dirname "$IN") # dir to CD into before using git commands: extract from file name + # construct inotifywait-commandline + if [ "$(uname)" != "Darwin" ]; then + INW_ARGS=("-qm" "-e" "$EVENTS" "$IN") + else + INW_ARGS=("$EVENTS" "$IN") + fi + + GIT_ADD_ARGS="$IN" # add only the selected file to index + GIT_COMMIT_ARGS="" # no need to add anything more to "commit" call +else + stderr "Error: The target is neither a regular file nor a directory." + exit 3 +fi + +# If $GIT_DIR is set, verify that it is a directory, and then add parameters to +# git command as need be +if [ -n "$GIT_DIR" ]; then + + if [ ! -d "$GIT_DIR" ]; then + stderr ".git location is not a directory: $GIT_DIR" + exit 4 + fi + + GIT="$GIT --no-pager --work-tree $TARGETDIR --git-dir $GIT_DIR" +fi + +# Check if commit message needs any formatting (date splicing) +if ! grep "%d" > /dev/null <<< "$COMMITMSG"; then # if commitmsg didn't contain %d, grep returns non-zero + DATE_FMT="" # empty date format (will disable splicing in the main loop) + FORMATTED_COMMITMSG="$COMMITMSG" # save (unchanging) commit message +fi + +# CD into right dir +cd "$TARGETDIR" || { + stderr "Error: Can't change directory to '${TARGETDIR}'." + exit 5 +} + +if [ -n "$REMOTE" ]; then # are we pushing to a remote? + if [ -z "$BRANCH" ]; then # Do we have a branch set to push to ? + PUSH_CMD="$GIT push $REMOTE" # Branch not set, push to remote without a branch + else + # check if we are on a detached HEAD + if HEADREF=$($GIT symbolic-ref HEAD 2> /dev/null); then # HEAD is not detached + #PUSH_CMD="$GIT push $REMOTE $(sed "s_^refs/heads/__" <<< "$HEADREF"):$BRANCH" + PUSH_CMD="$GIT push $REMOTE ${HEADREF#refs/heads/}:$BRANCH" + else # HEAD is detached + PUSH_CMD="$GIT push $REMOTE $BRANCH" + fi + fi + if [[ $PULL_BEFORE_PUSH -eq 1 ]]; then + PULL_CMD="$GIT pull --rebase $REMOTE" # Branch not set, pull to remote without a branch + fi + +else + PUSH_CMD="" # if not remote is selected, make sure push command is empty + PULL_CMD="" # if not remote is selected, make sure pull command is empty +fi + +# A function to reduce git diff output to the actual changed content, and insert file line numbers. +# Based on "https://stackoverflow.com/a/12179492/199142" by John Mellor +diff-lines() { + local path= + local line= + local previous_path= + while read -r; do + esc=$'\033' + if [[ $REPLY =~ ---\ (a/)?([^[:blank:]$esc]+).* ]]; then + previous_path=${BASH_REMATCH[2]} + continue + elif [[ $REPLY =~ \+\+\+\ (b/)?([^[:blank:]$esc]+).* ]]; then + path=${BASH_REMATCH[2]} + elif [[ $REPLY =~ @@\ -[0-9]+(,[0-9]+)?\ \+([0-9]+)(,[0-9]+)?\ @@.* ]]; then + line=${BASH_REMATCH[2]} + elif [[ $REPLY =~ ^($esc\[[0-9;]+m)*([\ +-]) ]]; then + REPLY=${REPLY:0:150} # limit the line width, so it fits in a single line in most git log outputs + if [[ $path == "/dev/null" ]]; then + echo "File $previous_path deleted or moved." + continue + else + echo "$path:$line: $REPLY" + fi + if [[ ${BASH_REMATCH[2]} != - ]]; then + ((line++)) + fi + fi + done +} + +############################################################################### + +# main program loop: wait for changes and commit them +# whenever inotifywait reports a change, we spawn a timer (sleep process) that gives the writing +# process some time (in case there are a lot of changes or w/e); if there is already a timer +# running when we receive an event, we kill it and start a new one; thus we only commit if there +# have been no changes reported during a whole timeout period +eval "$INW" "${INW_ARGS[@]}" | while read -r line; do + # is there already a timeout process running? + if [[ -n $SLEEP_PID ]] && kill -0 "$SLEEP_PID" &> /dev/null; then + # kill it and wait for completion + kill "$SLEEP_PID" &> /dev/null || true + wait "$SLEEP_PID" &> /dev/null || true + fi + + # start timeout process + ( + sleep "$SLEEP_TIME" # wait some more seconds to give apps time to write out all changes + + if [ -n "$DATE_FMT" ]; then + #FORMATTED_COMMITMSG="$(sed "s/%d/$(date "$DATE_FMT")/" <<< "$COMMITMSG")" # splice the formatted date-time into the commit message + FORMATTED_COMMITMSG="${COMMITMSG/\%d/$(date "$DATE_FMT")}" # splice the formatted date-time into the commit message + fi + + if [[ $LISTCHANGES -ge 0 ]]; then # allow listing diffs in the commit log message, unless if there are too many lines changed + DIFF_COMMITMSG="$($GIT diff -U0 "$LISTCHANGES_COLOR" | diff-lines)" + LENGTH_DIFF_COMMITMSG=0 + if [[ $LISTCHANGES -ge 1 ]]; then + LENGTH_DIFF_COMMITMSG=$(echo -n "$DIFF_COMMITMSG" | grep -c '^') + fi + if [[ $LENGTH_DIFF_COMMITMSG -le $LISTCHANGES ]]; then + # Use git diff as the commit msg, unless if files were added or deleted but not modified + if [ -n "$DIFF_COMMITMSG" ]; then + FORMATTED_COMMITMSG="$DIFF_COMMITMSG" + else + FORMATTED_COMMITMSG="New files added: $($GIT status -s)" + fi + else + #FORMATTED_COMMITMSG="Many lines were modified. $FORMATTED_COMMITMSG" + FORMATTED_COMMITMSG=$($GIT diff --stat | grep '|') + fi + fi + + # CD into right dir + cd "$TARGETDIR" || { + stderr "Error: Can't change directory to '${TARGETDIR}'." + exit 6 + } + STATUS=$($GIT status -s) + if [ -n "$STATUS" ]; then # only commit if status shows tracked changes. + # We want GIT_ADD_ARGS and GIT_COMMIT_ARGS to be word splitted + # shellcheck disable=SC2086 + + if [ "$SKIP_IF_MERGING" -eq 1 ] && is_merging; then + echo "Skipping commit - repo is merging" + exit 0 + fi + + $GIT add $GIT_ADD_ARGS # add file(s) to index + # shellcheck disable=SC2086 + $GIT commit $GIT_COMMIT_ARGS -m"$FORMATTED_COMMITMSG" # construct commit message and commit + + if [ -n "$PULL_CMD" ]; then + echo "Pull command is $PULL_CMD" + eval "$PULL_CMD" + fi + + if [ -n "$PUSH_CMD" ]; then + echo "Push command is $PUSH_CMD" + eval "$PUSH_CMD" + fi + fi + ) & # and send into background + + SLEEP_PID=$! # and remember its PID +done diff --git a/bin/sd b/bin/sd new file mode 120000 index 0000000..84cda98 --- /dev/null +++ b/bin/sd @@ -0,0 +1 @@ +/home/paramah/tools/sd/sd \ No newline at end of file diff --git a/bin/wireguard-cynarski.sh b/bin/wireguard-cynarski.sh new file mode 100755 index 0000000..f6199cc --- /dev/null +++ b/bin/wireguard-cynarski.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +IPS=( "3.71.86.69" ) +GW="10.0.200.2" + +MODE=$1 + +function r_up() { + for host in "${IPS[@]}" + do + ip r a ${host} via ${GW} + done +} + +function r_down() { + for host in "${IPS[@]}" + do + ip r d ${host} via ${GW} + done +} + + + +case ${MODE} in + up) + r_up + ;; + down) + r_down + ;; +esac + diff --git a/bin/zsh_history_fix b/bin/zsh_history_fix new file mode 100755 index 0000000..0cfcfa2 --- /dev/null +++ b/bin/zsh_history_fix @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh +# George Ornbo (shapeshed) http://shapeshed.com +# License - http://unlicense.org +# +# Fixes a corrupt .zsh_history file + +mv ~/.zsh_history ~/.zsh_history_bad +strings ~/.zsh_history_bad > ~/.zsh_history +fc -R ~/.zsh_history +rm ~/.zsh_history_bad +