This commit is contained in:
2026-01-26 17:03:18 +01:00
parent cd1b7cc874
commit 1fe5d48f1b
110 changed files with 12381 additions and 224 deletions

119
local/bin/fehbg Executable file
View File

@@ -0,0 +1,119 @@
#!/bin/bash
#
# Wrapper for nitrogen, which uses feh but save config to nitrogen save file
# needed for nitrogen by feh replacement
source ~/.config/colorizer/colorizer.conf
NITROGEN_FILE="$HOME/.config/nitrogen/bg-saved.cfg"
if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
mb-wall "${2}"
exit 0
fi
set -euo pipefail
if [[ "$1" == "default" ]];then
feh --bg-fill /usr/share/backgrounds/marek-piwnicki-FgagFhxW4Sc-unsplash.jpg
sd "file=.*$" "file=/usr/share/backgrounds/marek-piwnicki-FgagFhxW4Sc-unsplash.jpg" "$NITROGEN_FILE"
else
# jeśli restore to tylo przywróć i przerwij
if [[ "${1:-}" == "--restore" ]]; then
wp="$(awk -F '=' '/file/{print $2}' "$HOME/.config/nitrogen/bg-saved.cfg"|tail -1)"
feh --bg-fill ${wp}
exit $?
fi
if [[ "$wall2themes" == "yes" ]];then
notify-send.sh -t 5000 -i ~/.config/mabox/wpicon_wide.png --replace-file=/tmp/colorize_notid "Mabox Auto theming in progress..." "\n\nPlease wait... a few seconds...\n\n"
fi
ARGS="$*"
#notify-send.sh "All ARGS" "\n\n$ARGS"
# TU translacja opcji z nitrogenowych na opcje feh
# NITROGEN | FEH |
# --set-centered | --bg-center |
#
# REPLACE ARGS
ARGS="${ARGS/ --save/}"
ARGS="${ARGS/--set-centered/--bg-center}"
ARGS="${ARGS/--set-scaled/--bg-scale}"
ARGS="${ARGS/--set-tiled/--bg-tile}"
ARGS="${ARGS/--set-zoom-fill/--bg-fill}"
wallp="${ARGS##* }"
if [[ -f "${wallp}" ]];then
feh ${ARGS}
sd "file=.*$" "file=${wallp}" "$NITROGEN_FILE"
fi
fi
readonly bg_path="$(awk -F '=' '/file/{print $2}' "$HOME/.config/nitrogen/bg-saved.cfg"|tail -1)"
dbus-send \
--print-reply \
--system \
--dest=org.freedesktop.Accounts \
/org/freedesktop/Accounts/User$(id -u) \
org.freedesktop.DBus.Properties.Set \
string:org.freedesktop.DisplayManager.AccountsService \
string:BackgroundFile \
variant:string:"$bg_path"
# for Mabox Colorizer
WALLPALDIR="$HOME/.cache/colorizer/palettes"
mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg" | tail -1| cut -d'=' -f2) # full path to wallpaper file
# GENERATE ICON 52x32
magick ${WALLPATH} -resize 104x64^ -gravity center -extent 96x56 -bordercolor '#FFFFFF' -border 3 \
-bordercolor '#222222' -border 1 ~/.config/mabox/wpicon_wide.png
# GENERATE ICON SQUARE
magick ${WALLPATH} -resize 64x64^ -gravity center -extent 58x58 -bordercolor white -border 2 \
-bordercolor grey60 -border 1 ~/.config/mabox/wpicon.png
#killall -SIGUSR1 tint2
tint2-send refresh-execp mb-t2wall
# Wallpaper history :)
echo ${WALLPATH} >> $HOME/.cache/colorizer/.wallpaper_history
## get filename for palette and thumbnails
NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
ext="${WALLPATH##*.}"
#notify-send.sh "Extension" "$ext"
if [ ! -f "$WALLPALDIR/${NAME}.clr" ]; then
if [ "$ext" == "avif" ];then
magick ${WALLPATH} -resize 25% /tmp/out.jpg
magick /tmp/out.jpg -colors 12 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
else
magick ${WALLPATH} -resize 25% -colors 12 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
fi
fi
# GENERATE THUMBNAIL
THUMBDIR="$HOME/.cache/colorizer/thumbs"
mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]]; then
magick ${WALLPATH} -resize 270x150^ -gravity center -extent 266x146 -bordercolor '#DDDDDD' -border 2 ${THUMB}
fi
if [[ "$1" != "default" ]];then
# AUTOTHEMING - generate themes after wallpaper is changed
if [[ "$wall2themes" == "yes" ]];then
w2theme colorize
fi
fi

39
local/bin/lxappearance Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
GTK2_RC="$HOME/.gtkrc-2.0"
GTK3_RC="$HOME/.config/gtk-3.0/settings.ini"
ICON_DEF="$HOME/.icons/default/index.theme"
XRES="$HOME/.Xresources"
/usr/bin/lxappearance
sleep .5
#READ Cursor theme name from GTK2_RC
read CURTHEME <<< "$(grep gtk-cursor-theme-name ${GTK2_RC} | cut -d'"' -f2)"
# WRITE to GTK3
if grep "^gtk-cursor-theme-name=${CURTHEME}" ${GTK3_RC};then
#found nic nie robimy
:
else
sd "^gtk-cursor-theme-name.*$" "gtk-cursor-theme-name=${CURTHEME}" ${GTK3_RC}
fi
# WRITE to ICON_DEF
if grep "^Inherits=${CURTHEME}" ${ICON_DEF};then
:
else
sd "^Inherits=.*$" "Inherits=${CURTHEME}" ${ICON_DEF}
fi
# WRITE to .Xresources
if grep "^Xcursor.theme: ${CURTHEME}" ${XRES};then
:
else
if grep Xcursor.theme ${XRES};then
sd "^Xcursor.theme:.*$" "Xcursor.theme: ${CURTHEME}" ${XRES}
else
echo "Xcursor.theme: ${CURTHEME}" >> ${XRES}
fi
xrdb "$HOME/.Xresources"
fi
reload-gtk

119
local/bin/nitrogen Executable file
View File

@@ -0,0 +1,119 @@
#!/bin/bash
#
# Wrapper for nitrogen, which uses feh but save config to nitrogen save file
# needed for nitrogen by feh replacement
source ~/.config/colorizer/colorizer.conf
NITROGEN_FILE="$HOME/.config/nitrogen/bg-saved.cfg"
if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
mb-wall "${2}"
exit 0
fi
set -euo pipefail
if [[ "$1" == "default" ]];then
feh --bg-fill /usr/share/backgrounds/marek-piwnicki-FgagFhxW4Sc-unsplash.jpg
sd "file=.*$" "file=/usr/share/backgrounds/marek-piwnicki-FgagFhxW4Sc-unsplash.jpg" "$NITROGEN_FILE"
else
# jeśli restore to tylo przywróć i przerwij
if [[ "${1:-}" == "--restore" ]]; then
wp="$(awk -F '=' '/file/{print $2}' "$HOME/.config/nitrogen/bg-saved.cfg"|tail -1)"
feh --bg-fill ${wp}
exit $?
fi
if [[ "$wall2themes" == "yes" ]];then
notify-send.sh -t 5000 -i ~/.config/mabox/wpicon_wide.png --replace-file=/tmp/colorize_notid "Mabox Auto theming in progress..." "\n\nPlease wait... a few seconds...\n\n"
fi
ARGS="$*"
#notify-send.sh "All ARGS" "\n\n$ARGS"
# TU translacja opcji z nitrogenowych na opcje feh
# NITROGEN | FEH |
# --set-centered | --bg-center |
#
# REPLACE ARGS
ARGS="${ARGS/ --save/}"
ARGS="${ARGS/--set-centered/--bg-center}"
ARGS="${ARGS/--set-scaled/--bg-scale}"
ARGS="${ARGS/--set-tiled/--bg-tile}"
ARGS="${ARGS/--set-zoom-fill/--bg-fill}"
wallp="${ARGS##* }"
if [[ -f "${wallp}" ]];then
feh ${ARGS}
sd "file=.*$" "file=${wallp}" "$NITROGEN_FILE"
fi
fi
readonly bg_path="$(awk -F '=' '/file/{print $2}' "$HOME/.config/nitrogen/bg-saved.cfg"|tail -1)"
dbus-send \
--print-reply \
--system \
--dest=org.freedesktop.Accounts \
/org/freedesktop/Accounts/User$(id -u) \
org.freedesktop.DBus.Properties.Set \
string:org.freedesktop.DisplayManager.AccountsService \
string:BackgroundFile \
variant:string:"$bg_path"
# for Mabox Colorizer
WALLPALDIR="$HOME/.cache/colorizer/palettes"
mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg" | tail -1| cut -d'=' -f2) # full path to wallpaper file
# GENERATE ICON 52x32
magick ${WALLPATH} -resize 104x64^ -gravity center -extent 96x56 -bordercolor '#FFFFFF' -border 3 \
-bordercolor '#222222' -border 1 ~/.config/mabox/wpicon_wide.png
# GENERATE ICON SQUARE
magick ${WALLPATH} -resize 64x64^ -gravity center -extent 58x58 -bordercolor white -border 2 \
-bordercolor grey60 -border 1 ~/.config/mabox/wpicon.png
#killall -SIGUSR1 tint2
tint2-send refresh-execp mb-t2wall
# Wallpaper history :)
echo ${WALLPATH} >> $HOME/.cache/colorizer/.wallpaper_history
## get filename for palette and thumbnails
NAME=${WALLPATH////_}
if [[ "${NAME}" =~ ^_home_.* ]]; then
n=${#HOME}
((n++))
NAME=${NAME:${n}}
fi
ext="${WALLPATH##*.}"
#notify-send.sh "Extension" "$ext"
if [ ! -f "$WALLPALDIR/${NAME}.clr" ]; then
if [ "$ext" == "avif" ];then
magick ${WALLPATH} -resize 25% /tmp/out.jpg
magick /tmp/out.jpg -colors 12 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
else
magick ${WALLPATH} -resize 25% -colors 12 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr"
fi
fi
# GENERATE THUMBNAIL
THUMBDIR="$HOME/.cache/colorizer/thumbs"
mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]]; then
magick ${WALLPATH} -resize 270x150^ -gravity center -extent 266x146 -bordercolor '#DDDDDD' -border 2 ${THUMB}
fi
if [[ "$1" != "default" ]];then
# AUTOTHEMING - generate themes after wallpaper is changed
if [[ "$wall2themes" == "yes" ]];then
w2theme colorize
fi
fi

20
local/bin/noblank Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
case "$LANG" in
pl*)
DISABLED="Wygaszanie monitora jest WYŁĄCZONE"
ENABLED="Wygaszanie monitora jest WŁĄCZONE"
;;
*)
DISABLED="Monitor blanking is DISABLED"
ENABLED="Monitor blanking is ENABLED"
;;
esac
if (xset q|grep --quiet "DPMS is Enabled");
then
xset s off -dpms
notify-send -i monitor -t 5000 "DPMS" "$DISABLED"
else
xset s on +dpms
notify-send -i monitor -t 5000 "DPMS" "$ENABLED"
fi

57
local/bin/skippy-xd-fix Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
#
# skippy-wrapper - B. Murphy
#
# a work around for the bug in skippy-xd that prevents minimized
# windows being included in the selection screen.
#
# dependency: xdotool
#
#
# prelim -- check not already running
# 0. get desktop
# 1. get list of all windows
# 2. get list of visible windows
# 3 generate list of hidden windows
# 4. raise hidden windows
# 5. run skippy-xd
# 6. get active window = SkippySelected
# 7. minimize hidden windows unless selected
#
#prelim
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then exit; fi
#0.
dtop=`xdotool get_desktop`
#1.
any=`xdotool search --desktop $dtop "" 2> /dev/null`
#2.
visible=`xdotool search --desktop $dtop --onlyvisible "" 2> /dev/null`
#3.
hidden=$any
for item in $visible; do
hidden=`echo ${hidden/$item/''}`
done
#4.
for item in $hidden; do
xdotool windowmap $item
done
#5.
skippy-xd &> /dev/null
#6.
SkippySelected=`xdotool getactivewindow`
#7.
hidden=`echo ${hidden/$SkippySelected/''}`
for item in $hidden; do
xdotool windowminimize $item
done

106
local/bin/t2-cortile Executable file
View File

@@ -0,0 +1,106 @@
#!/bin/bash
# t2-cortile - tint2 executor to assist with cortile tiling manager
# quick and dirty currently for demo purposes only
CORTILE_CFG="$HOME/.config/cortile/config.toml"
IMG_DIR="$HOME/.config/cortile/tint2-cortile"
sendkey(){
read KEYS<<< $(grep "^${1}.*=.*$" $CORTILE_CFG | cut -d'"' -f2)
XDOTOOL_KEYS=${KEYS//-/+}
XDOTOOL_KEYS=${XDOTOOL_KEYS/Control/ctrl}
XDOTOOL_KEYS=${XDOTOOL_KEYS/Super_L/super}
XDOTOOL_KEYS=${XDOTOOL_KEYS/Space/space}
XDOTOOL_KEYS=${XDOTOOL_KEYS/KP_4/KP_Left}
XDOTOOL_KEYS=${XDOTOOL_KEYS/KP_6/KP_Right}
XDOTOOL_KEYS=${XDOTOOL_KEYS/KP_8/KP_Up}
XDOTOOL_KEYS=${XDOTOOL_KEYS/KP_2/KP_Down}
#notify-send.sh "$1" "$KEYS \n$XDOTOOL_KEYS"
xdotool key ${XDOTOOL_KEYS}
}
is_tiled(){
grep workspace-$(xdotool get_desktop) /tmp/cortile.log |tail -n 1 |grep Tile >/dev/null
}
is_fullscreen(){
grep workspace-$(xdotool get_desktop) /tmp/cortile.log |tail -n 1 |grep fullscreen >/dev/null
}
get_current_layout(){
layout=$(grep workspace-$(xdotool get_desktop) /tmp/cortile.log |tail -n 1| cut -d' ' -f6)
case "$layout" in
vertical-right) echo ${IMG_DIR}/vertical-right.png;;
vertical-left) echo ${IMG_DIR}/vertical-left.png;;
horizontal-top) echo ${IMG_DIR}/horizontal-top.png;;
horizontal-bottom) echo ${IMG_DIR}/horizontal-bottom.png;;
fullscreen) echo ${IMG_DIR}/fullscreen.png;;
esac
}
main(){
if pgrep -x cortile >/dev/null ;then
if is_tiled ;then
get_current_layout
else
echo "${IMG_DIR}/untiled.png"
fi
fi
}
left(){
if is_tiled ;then
if is_fullscreen ;then
sendkey untile
else
sendkey layout_cycle
fi
else
sendkey tile
sendkey layout_vertical_left
fi
}
middle(){
if is_tiled ;then
sendkey untile
else
sendkey tile
fi
}
right(){
if is_tiled ;then
sendkey untile
else
sendkey tile
fi
}
up(){
if is_tiled; then
if is_fullscreen ;then
sendkey window_previous
else
sendkey proportion_increase
fi
else
xdotool set_desktop --relative 1
fi
}
down(){
if is_tiled; then
if is_fullscreen ;then
sendkey window_next
else
sendkey proportion_decrease
fi
else
xdotool set_desktop --relative -- -1
fi
}
case "$1" in
left)left;;
right)right;;
middle)middle;;
up)up;;
down)down;;
*)main;;
esac

16
local/bin/xrandr Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# Wrapper for xrandr, so wallpaper and Conky are reloaded on resolution change.
#
# Copyright (C) 2022 Daniel Napora - maboxlinux.org
# Licensed under GPLv3
set -euo pipefail
/usr/bin/xrandr "$@"
if [[ "$@" == *"--output"* ]];then
nitrogen --restore
if pgrep conky;then
killall -SIGUSR1 conky 2> /dev/null
fi
fi