diff --git a/bin/mabox-obstart b/bin/mabox-obstart index b873ad0..6c9d0c7 100755 --- a/bin/mabox-obstart +++ b/bin/mabox-obstart @@ -91,6 +91,11 @@ checkautostart [ ! -f "$HOME/.config/mabox/.mwelcome" ] && mwelcome & # [ -f "$HOME/.config/wpg/.mabox-init" ] && wpg-mabox-init & +# rename old wrappers, they now in /usr/local/bin +wrappers=(nitrogen i3lock xrandr lxappearance skippy-xd-fix) +for wrapper in "${wrappers[@]}" +[[ -f "$HOME/.local/bin/${wr}" ]] && mv "$HOME/.local/bin/${wr}" "$HOME/.local/bin/${wr}.old" +do . $HOME/.config/mabox/mabox.conf #Set config variables if not set or empty; ":" means do nothing diff --git a/local/bin/lxappearance b/local/bin/lxappearance new file mode 100755 index 0000000..fd02b3f --- /dev/null +++ b/local/bin/lxappearance @@ -0,0 +1,38 @@ +#!/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 + + diff --git a/local/bin/nitrogen b/local/bin/nitrogen new file mode 100755 index 0000000..b6761e5 --- /dev/null +++ b/local/bin/nitrogen @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# +# Wrapper for nitrogen, so LightDM wallpaper is synced. +# +# Copyright (C) 2021 Rafael Cavalcanti - rafaelc.org +# Licensed under GPLv3 + +set -euo pipefail + +/usr/bin/nitrogen "$@" +if [[ "${1:-}" == "--restore" ]]; then + exit $? +fi + +readonly bg_path="$(awk -F '=' '/file/{print $2}' "$HOME/.config/nitrogen/bg-saved.cfg")" + +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" + +# Mabox Colorizer +# Generate wallpaper color palette +WALLPALDIR="$HOME/.config/colormenu/palettes/wallp" +mkdir -p "$WALLPALDIR" +read WALLPATH<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg" | cut -d'=' -f2) +WALLPAPER=${WALLPATH##*/} +if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then + convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr" +fi + +# GENERATE THUMBNAIL +THUMBDIR="$HOME/.config/mabox/wallthumbs" +mkdir -p ${THUMBDIR} +THUMB="${THUMBDIR}/${WALLPAPER}.png" +if [[ ! -f "$THUMB" ]]; then +convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} +fi + +# auto generate themes +if command -v w2theme &> /dev/null +then +source ~/.config/colorizer/colorizer.conf + if [[ "$wall2themes" == "yes" ]];then + w2theme colorize + fi +fi diff --git a/bin/noblank b/local/bin/noblank similarity index 100% rename from bin/noblank rename to local/bin/noblank diff --git a/bin/skippy-xd-fix b/local/bin/skippy-xd-fix similarity index 100% rename from bin/skippy-xd-fix rename to local/bin/skippy-xd-fix diff --git a/local/bin/xrandr b/local/bin/xrandr new file mode 100755 index 0000000..11fd785 --- /dev/null +++ b/local/bin/xrandr @@ -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