From: danix Date: Tue, 12 Nov 2024 08:55:44 +0000 (+0100) Subject: modified betterlockscreen and added a few config modifications. X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=719089de4f984924ae81fda4a3f388b49058b311;p=my-dotfiles.git modified betterlockscreen and added a few config modifications. --- diff --git a/bashrc b/bashrc index 11e5aa9..6b517eb 100644 --- a/bashrc +++ b/bashrc @@ -95,6 +95,7 @@ export QT_QPA_PLATFORMTHEME="qt5ct" #export QT_STYLE_OVERRIDE="kvantum" export XDG_DATA_DIRS="/usr/local/share/:/usr/share/" export CM_LAUNCHER=rofi +export $(dbus-launch) # Tailoring LESS # If any syntax highlighters are available, use them. @@ -149,3 +150,4 @@ mount-fs () { mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}' ) | column -t } + diff --git a/home-bin/betterlockscreen b/home-bin/betterlockscreen old mode 100644 new mode 100755 index 0b92ad9..6b2c6de --- a/home-bin/betterlockscreen +++ b/home-bin/betterlockscreen @@ -62,9 +62,11 @@ init_config () { # read user config USER_CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}" USER_CONF="$USER_CONF_DIR/betterlockscreenrc" + USER_THEME="$USER_CONF_DIR/betterlockscreen.theme" SYS_CONF="/etc/betterlockscreenrc" XDG_USER_CONF_DIR="$USER_CONF_DIR/betterlockscreen" XDG_USER_CONF="$XDG_USER_CONF_DIR/betterlockscreenrc" + XDG_USER_THEME="$XDG_USER_CONF_DIR/betterlockscreen.theme" if [ -e "$SYS_CONF" ]; then # shellcheck source=/dev/null @@ -77,11 +79,13 @@ init_config () { # shellcheck source=/dev/null source "$USER_CONF" + source "$USER_THEME" fi if [ -e "$XDG_USER_CONF" ]; then # shellcheck source=/dev/null source "$XDG_USER_CONF" + source "$XDG_USER_THEME" fi if ! cmd_exists "$i3lockcolor_bin"; then diff --git a/home-bin/get_spotify_status.sh b/home-bin/get_spotify_status.sh new file mode 100755 index 0000000..fde841f --- /dev/null +++ b/home-bin/get_spotify_status.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# The name of polybar bar which houses the main spotify module and the control modules. +PARENT_BAR="bottom" +PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) + +# Set the source audio player here. +# Players supporting the MPRIS spec are supported. +# Examples: spotify, vlc, chrome, mpv and others. +# Use `playerctld` to always detect the latest player. +# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control +PLAYER="spotify" + +# Format of the information displayed +# Eg. {{ artist }} - {{ album }} - {{ title }} +# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata +FORMAT="{{ title }} - {{ artist }}" + +# Sends $2 as message to all polybar PIDs that are part of $1 +update_hooks() { + while IFS= read -r id + do + polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1 + done < <(echo "$1") +} + +PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) +EXIT_CODE=$? + +if [ $EXIT_CODE -eq 0 ]; then + STATUS=$PLAYERCTL_STATUS +else + STATUS="No player is running" +fi + +if [ "$1" == "--status" ]; then + echo "$STATUS" +else + if [ "$STATUS" = "Stopped" ]; then + echo "No music is playing" + elif [ "$STATUS" = "Paused" ]; then + update_hooks "$PARENT_BAR_PID" 2 + playerctl --player=$PLAYER metadata --format "$FORMAT" + elif [ "$STATUS" = "No player is running" ]; then + echo "$STATUS" + else + update_hooks "$PARENT_BAR_PID" 1 + playerctl --player=$PLAYER metadata --format "$FORMAT" + fi +fi + diff --git a/home-bin/i3lock-fancy b/home-bin/i3lock-fancy old mode 100644 new mode 100755 diff --git a/home-bin/wallpaper.sh b/home-bin/wallpaper.sh deleted file mode 100644 index e3d293a..0000000 --- a/home-bin/wallpaper.sh +++ /dev/null @@ -1,127 +0,0 @@ -#! /bin/bash - -# uncomment for debug -# set -x - -PID=$$ -PIDFILE=${PIDFILE:-/tmp/wallpaper.pid} -WAIT_CYCLE="5m" -INPUT=$1 - -trap "rm -f $PIDFILE" SIGTERM - -WP_SETTER="/usr/bin/feh" -QARMA="/usr/bin/qarma" - -function set_wp() { - NEW_WP=$1 - $WP_SETTER --bg-fill $NEW_WP -} - -# set background function (requires input) -function wpapers() { - if [[ -f $1 ]]; then - # We have a single file as input - set_wp $1 - exit 0 - elif [[ -d $1 ]]; then - # directory as input - while true; do - BGIMG=$(find $1 -type f -print | shuf -n1) - set_wp ${BGIMG} - sleep $WAIT_CYCLE - done - fi -} - -function file_or_dir() { - if [[ -f /tmp/choice ]]; then - rm /tmp/choice - fi - - FOD=$($QARMA --list --text="single image or directory?" --hide-header "file" "directory" > /tmp/choice) - case $? in - 0 ) - file_chooser $(cat /tmp/choice) - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - ;; - esac -} - -function file_chooser() { - case $1 in - "file" ) - FILE="$($QARMA --file-selection --title='Choose your Wallpaper')" - case $? in - 0 ) - wpapers $FILE - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - esac - ;; - "directory" ) - FILE="$($QARMA --file-selection --directory --title='Choose your Wallpaper directory')" - case $? in - 0 ) - wpapers $FILE - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - esac - ;; - * ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - ;; - esac -} - -function run() { - if [[ $(basename $0) == "wallpaper.sh" ]]; then - # we were called as wallpaper.sh, so simple wallpaper setter without qarma interaction - wpapers "$1" - elif [[ $(basename $0) == "change_wallpaper.sh" ]]; then - # we use qarma to set the wallpaper - $QARMA --question --title="Change Wallpaper" --text="Do you want to change the wallpaper?" - case $? in - 0 ) - file_or_dir - ;; - 1 ) - $QARMA --info --title="Exiting!" --text="No wallpaper was changed." - ;; - -1 ) - $QARMA --error --title="Ooops!!" --text="Something unexpected happened." - esac - fi -} - -if [[ -r $PIDFILE ]]; then - # PIDFILE exists, so I guess there's already an instance running - # let's kill it and run again - kill -s 15 $(cat $PIDFILE) > /dev/null 2>&1 - # should already be deleted by trap, but just to be sure - rm /tmp/choice || true - rm $PIDFILE -fi - -# create PIDFILE -echo $PID > $PIDFILE - -if [[ ! -z $1 ]]; then - run $1 -else - run -fi - diff --git a/home-config/betterlockscreen/betterlockscreenrc b/home-config/betterlockscreen/betterlockscreenrc new file mode 100644 index 0000000..9815cd5 --- /dev/null +++ b/home-config/betterlockscreen/betterlockscreenrc @@ -0,0 +1,28 @@ +# ~/.config/betterlockscreenrc + +# default options +display_on=0 +span_image=false +lock_timeout=300 +#fx_list=(dim blur dimblur pixel dimpixel color) +fx_list=(blur) +dim_level=40 +blur_level=1 +pixel_scale=10,1000 +solid_color=333333 +wallpaper_cmd="feh --bg-fill" +quiet=false + +# default theme moved to betterlockscreen.theme +# inside this same directory + +# +# expert options (change at own risk!) +# + +# i3lockcolor_bin="i3lock-color" # Manually set command for i3lock-color +# suspend_command="systemctl suspend" # Manually change action e.g. hibernate/suspend-command + +# i3lock-color - custom arguments +# lockargs=() # overwriting default "(-n)" +# lockargs+=(--ignore-empty-password) # appending new argument diff --git a/home-config/i3/config b/home-config/i3/config index be93a6d..7640d17 100644 --- a/home-config/i3/config +++ b/home-config/i3/config @@ -12,7 +12,7 @@ # Alt+Return Alt+h Ctrl+Win+r Alt+w # # # # # -# Ctrl+F1 Ctrl+F1 Ctrl+F1 Ctrl+F1 # +# Ctrl+F1 Ctrl+F2 Ctrl+F3 Ctrl+F4 # # # # # # # @@ -78,18 +78,55 @@ font pango:"Droid Sans 10" floating_modifier $win # start a terminal -# macropad 5 -bindsym $alt+Return exec --no-startup-id kitty -# macropad Shift+5 -bindsym Shift+$alt+Return exec --no-startup-id blackpearl-sshmenu.sh -# custom binding -# macropad 4 +#### MACROPAD top encoder +# multimedia binding +bindsym XF86AudioMute exec --no-startup-id dunst_vol_brig.sh mute +bindsym XF86AudioLowerVolume exec --no-startup-id dunst_vol_brig.sh vol_d +bindsym XF86AudioRaiseVolume exec --no-startup-id dunst_vol_brig.sh vol_u +# MACROPAD bottom encoder +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioPrev exec --no-startup-id playerctl previous +bindsym XF86AudioNext exec --no-startup-id playerctl next + +# brightness bindings +# MACROPAD Alt + top encoder +bindsym $alt+XF86AudioLowerVolume exec --no-startup-id dunst_vol_brig.sh brig_d +bindsym $alt+XF86AudioRaiseVolume exec --no-startup-id dunst_vol_brig.sh brig_u + +#### MACROPAD 1 +bindsym $win+w exec $browser +#### MACROPAD Shift+1 +bindsym $win+Shift+w exec $incognito-browser +#### MACROPAD 2 +bindsym $win+r exec $prog-editor +#### MACROPAD Shift+2 +bindsym $win+Shift+r exec Typora +#### MACROPAD 3 +bindsym $win+g exec gimp +#### MACROPAD 4 bindsym Shift+$ctrl+l exec --no-startup-id clipmenu -no-lazy-grab -show run -theme darknix/notes -# macropad Shift+4 +#### MACROPAD Shift+4 bindsym $alt+Shift+$ctrl+l exec --no-startup-id xclip -o | qrencode -o - | feh -Z - +#### MACROPAD 5 +bindsym $alt+Return exec --no-startup-id kitty +#### MACROPAD Shift+5 +bindsym Shift+$alt+Return exec --no-startup-id blackpearl-sshmenu.sh +#### MACROPAD 6 +# split in horizontal orientation +bindsym $alt+h exec notify-send 'splitting windows horizontally';split h +# split in vertical orientation +bindsym Shift+$alt+h exec notify-send 'splitting windows vertically';split v +#### MACROPAD 7 +bindsym $win+Ctrl+r exec notify-send 'Resize Mode';mode "resize" +#### MACROPAD 8 +# change container layout (stacked, tabbed, toggle split) +bindsym $alt+w exec notify-send 'layout tabbed';layout tabbed +bindsym Shift+$alt+w exec notify-send 'layout stacking';layout stacking +bindsym Ctrl+$alt+w exec notify-send 'layout split';layout toggle split +#### custom bindings bindsym Shift+$win+s exec --no-startup-id blackpearl-scrotmenu.sh bindsym $alt+Menu exec --no-startup-id qwalwal.sh bindsym $win+period exec --no-startup-id blackpearl-emoji.sh @@ -97,27 +134,13 @@ bindsym Shift+$win+period exec --no-startup-id blackpearl-symbols.sh bindsym XF86Search exec --no-startup-id blackpearl-appsmenu.sh bindsym $alt+Escape --release exec xkill bindsym $win+e exec pcmanfm-qt - -# macropad 3 -bindsym $win+g exec gimp - -bindsym $win+l exec --no-startup-id betterlockscreen -l - -# macropad 1 -bindsym $win+w exec $browser -# macropad Shift+1 -bindsym $win+Shift+w exec $incognito-browser - -bindsym XF86Calculator exec kcalc -bindsym XF86Sleep exec i3suspend -# macropad 2 -bindsym $win+r exec $prog-editor -# macropad Shift+2 -bindsym $win+Shift+r exec Typora - -bindsym XF86HomePage exec --no-startup-id blackpearl-appsmenu.sh -#bindsym $win+p exec uxterm -T "spt" -geometry 90x30+800+30 -e spt +bindsym $win+l exec --no-startup-id betterlockscreen -l blur bindsym $win+m exec Telegram +bindsym XF86Calculator exec kcalc +# start rofi in dmenu mode (a program launcher) +bindsym $alt+F2 exec --no-startup-id blackpearl-runner.sh +# Set shut down, restart and locking features +bindsym $win+x exec --no-startup-id blackpearl-powermenu.sh # notes bindings bindsym $ctrl+F5 exec --no-startup-id blackpearl-notes.sh -a @@ -130,31 +153,15 @@ bindsym $alt+Tab exec --no-startup-id "blackpearl-window.sh all" #bindsym $alt+Tab exec --no-startup-id "killall -s SIGUSR1 i3expod" #bindsym $alt+Ctrl+Tab exec --no-startup-id "blackpearl-window.sh all" -# multimedia binding -# macropad top encoder -bindsym XF86AudioMute exec --no-startup-id dunst_vol_brig.sh mute -bindsym XF86AudioLowerVolume exec --no-startup-id dunst_vol_brig.sh vol_d -bindsym XF86AudioRaiseVolume exec --no-startup-id dunst_vol_brig.sh vol_u -# macropad bottom encoder -bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause -bindsym XF86AudioPrev exec --no-startup-id playerctl previous -bindsym XF86AudioNext exec --no-startup-id playerctl next - -# brightness bindings -# macropad Alt + top encoder -bindsym $alt+XF86AudioLowerVolume exec --no-startup-id dunst_vol_brig.sh brig_d -bindsym $alt+XF86AudioRaiseVolume exec --no-startup-id dunst_vol_brig.sh brig_u # kill focused window #bindsym $ctrl+Shift+q kill -bindsym --whole-window $alt+button2 kill +bindsym --whole-window $alt+button3 kill # restart polybar -# macropad Alt + bottom encoder -bindsym $alt+XF86AudioPlay exec --no-startup-id polybar-msg cmd restart +# MACROPAD Alt + bottom encoder +bindsym $alt+XF86AudioPlay exec --no-startup-id run-polybar.sh -# start rofi in dmenu mode (a program launcher) -bindsym $alt+F2 exec --no-startup-id blackpearl-runner.sh # change focus bindsym $alt+j focus left @@ -180,19 +187,9 @@ bindsym $alt+Shift+Down move down bindsym $alt+Shift+Up move up bindsym $alt+Shift+Right move right -# split in horizontal orientation -bindsym $alt+h exec notify-send 'splitting windows horizontally';split h -# split in vertical orientation -bindsym Shift+$alt+h exec notify-send 'splitting windows vertically';split v - # enter fullscreen mode for the focused container bindsym $alt+f fullscreen toggle -# change container layout (stacked, tabbed, toggle split) -bindsym $alt+w exec notify-send 'layout tabbed';layout tabbed -bindsym Shift+$alt+w exec notify-send 'layout stacking';layout stacking -bindsym Ctrl+$alt+w exec notify-send 'layout split';layout toggle split - # toggle tiling / floating bindsym $alt+Shift+space floating toggle @@ -286,8 +283,6 @@ workspace $ws1 gaps inner 0 workspace $ws2 gaps inner 0 workspace $ws5 gaps inner 0 -# Set shut down, restart and locking features -bindsym $win+x exec --no-startup-id blackpearl-powermenu.sh # resize window (you can also use the mouse for that) mode "resize" { @@ -309,8 +304,6 @@ mode "resize" { bindsym Escape exec notify-send 'Resize Mode OFF';mode "default" } -bindsym $win+Ctrl+r exec notify-send 'Resize Mode';mode "resize" - set $wine_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) set $wine_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) bindsym $win+Shift+g mode "$wine_gaps" @@ -350,3 +343,6 @@ mode "$wine_gaps_inner" { # start both polybar exec_always --no-startup-id $HOME/bin/run-polybar.sh + +exec_always --no-startup-id playerctld daemon + diff --git a/home-config/polybar/config b/home-config/polybar/config index e5706d8..b5af431 100644 --- a/home-config/polybar/config +++ b/home-config/polybar/config @@ -42,8 +42,8 @@ foreground = ${colors.foreground} separator-foreground = ${colors.secondary} font-0 = "Inconsolata Nerd Font:weight=regular;2" padding = 1px -modules-left = duckstation dunst-snooze -modules-center = windowlist +modules-left = duckstation dunst-snooze windowlist +modules-center = spotify spotify-prev spotify-play-pause spotify-next modules-right = date dpi = 96 enable-ipc = true @@ -116,3 +116,5 @@ include-file = /home/danix/.config/polybar/modules/keyboard.ini # windowlist include-file = /home/danix/.config/polybar/modules/windowlist.ini +# spotify +include-file = /home/danix/.config/polybar/modules/spotify.ini diff --git a/home-config/polybar/modules/spotify.ini b/home-config/polybar/modules/spotify.ini new file mode 100644 index 0000000..81272fd --- /dev/null +++ b/home-config/polybar/modules/spotify.ini @@ -0,0 +1,26 @@ +[module/spotify] +type = custom/script +tail = true +interval = 1 +format-prefix = " 󰝚 " +format =