From 313d50e5562be04fff980b90ab35f70bab89289c Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Sun, 2 Jan 2022 13:13:29 +0100 Subject: [PATCH] fixed custom scripts --- .config/i3/config | 9 + .../polybar/modules.ini##class.arch_laptop | 2 +- .../custom_shell_functions/git_auto_save.sh | 154 ------------------ .../custom_shell_functions/update_clock.sh | 3 - 4 files changed, 10 insertions(+), 158 deletions(-) delete mode 100644 .scripts/custom_shell_functions/git_auto_save.sh delete mode 100755 .scripts/custom_shell_functions/update_clock.sh diff --git a/.config/i3/config b/.config/i3/config index 0f20649..d879c86 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -150,6 +150,14 @@ bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right +# move focus to different monitors +bindsym $mod+Shift+Ctrl+l focus output right +bindsym $mod+Shift+Ctrl+h focus output left + +# move container to different monitors +bindsym $mod+Shift+greater move container to output right; focus output right +bindsym $mod+Shift+less move container to output left; focus output left + # workspace back and forth (with/without active container) workspace_auto_back_and_forth yes bindsym $mod+b workspace back_and_forth @@ -339,6 +347,7 @@ exec --no-startup-id nextcloud exec --no-startup-id mullvad-vpn exec_always --no-startup-id fix_xcursor exec --no-startup-id redshift ~/.config/redshift/redshift.conf +exec --no-startup-id blueman-applet # Color palette used for the terminal ( ~/.Xresources file ) diff --git a/.config/polybar/modules.ini##class.arch_laptop b/.config/polybar/modules.ini##class.arch_laptop index 475958a..be08954 100644 --- a/.config/polybar/modules.ini##class.arch_laptop +++ b/.config/polybar/modules.ini##class.arch_laptop @@ -836,7 +836,7 @@ format-packetloss = ; %downspeed% [wireless+wired] ; %linkspeed% [wired] ; Default: %ifname% %local_ip% -label-connected = "%essid% %downspeed:8% %upspeed:8% %signal%%" +label-connected = "%essid% %signal%% %downspeed:8% %upspeed:8%" ;;label-connected-foreground = #eefafafa ; Available tokens: diff --git a/.scripts/custom_shell_functions/git_auto_save.sh b/.scripts/custom_shell_functions/git_auto_save.sh deleted file mode 100644 index 4c64dcf..0000000 --- a/.scripts/custom_shell_functions/git_auto_save.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash - -function is_git { - - # check if current folder is git repository - git_check_command=$(git -C $1 rev-parse > /dev/null 2>&1) - if [[ $? != 0 ]]; then - return 0 - fi - - return 1 -} - -function get_current_branch { - echo $(git branch | grep "*" | awk '{print $NF}') -} - -function get_auto_save_branches { - - auto_save_branches_raw=`git branch | grep "git_auto_save" | tail -1 | awk '{print $FN}'` - auto_save_branches=() - for i in "${$auto_save_branches_raw[@]}" - do - echo ${git_auto_save_branches_raw[i]} - #auto_save_branches+=${git_auto_save[i]} - done - - echo $auto_save_branches - -} - -function git_auto_save { - - if [[ $(is_git ".") -ne 0 ]]; then - echo "Current dir is not a git repository." - return 1 - fi - - current_branch_name=$(get_current_branch) - - timestamp=`date +%Y_%m_%d_%H_%M_%S` - new_branch_name="git_auto_save/$HOST/$timestamp" - - # check if there is unsaved work - changes=`git status --ignore-submodules=dirty | grep -E 'modified|deleted|new'` - if [[ ! $changes ]]; then - echo "No changes found." - return - fi - - # stash changes - echo "Stashing changes..." - git stash > /dev/null 2>&1 - - # create new branch - echo "Creating new branch $new_branch_name..." - git checkout -b $new_branch_name > /dev/null 2>&1 - git push origin $new_branch_name > /dev/null 2>&1 - - # apply stashed changes - echo "Applying stash to new branch..." - git stash apply > /dev/null 2>&1 - - # add changed files - echo "Adding new/changed files..." - git add -u > /dev/null 2>&1 - - # commit changes - echo "Commiting changes..." - git commit -m "git autosave from $timestamp" > /dev/null 2>&1 - - # push changes - echo "Pushing changes..." - git push --set-upstream origin $new_branch_name > /dev/null 2>&1 - - # move back to initial branch - echo "Moving back to previous branch..." - git checkout $current_branch_name > /dev/null 2>&1 - - echo "Done." -} - -function remove_auto_save { - - if [[ $(is_git ".") -ne 0 ]]; then - echo "Current dir is not a git repository." - return 1 - fi - - echo "Looking for auto-save branches..." - - if [[ $1 ]]; then - auto_save_branch=$1 - else - auto_save_branch=`git branch | grep "git_auto_save" | head -1 | awk '{print $FN}'` - fi - - - if [[ ! $auto_save_branch ]]; then - echo "No auto-save branch found." - return 1 - fi - - auto_save_branch=${auto_save_branch:2} - echo "Auto-save branch found: $auto_save_branch" - - current_branch=$(get_current_branch) - - # if on autosave branch, move to master - if [[ $current_branch == $auto_save_branch ]]; then - echo "Currently on autosave path, moving to Master" - git checkout master - fi - - # remove local branch - echo "Deleting local branch..." - git branch -d $auto_save_branch > /dev/null 2>&1 - - # remove remote branch - echo "Deleting remote branch..." - git push origin --delete $auto_save_branch > /dev/null 2>&1 - - return 0 - -} - -function remove_all_auto_saves { - - if [[ $(is_git ".") -ne 0 ]]; then - echo "Current dir is not a git repository." - return 1 - fi - - if [[ $1 != "y" ]]; then - echo "Please confirm with 'y'" - return - fi - - # remove all auto save branches - while [[ 1 ]]; do - if ! remove_auto_save; then - break - fi - echo "Auto-Save removed." - done - - echo "All auto-saves removed." - -} - -function load_last_auto_save { - auto_save_branches=$(get_auto_save_branches) - echo $auto_save_branches -} diff --git a/.scripts/custom_shell_functions/update_clock.sh b/.scripts/custom_shell_functions/update_clock.sh deleted file mode 100755 index d5559d1..0000000 --- a/.scripts/custom_shell_functions/update_clock.sh +++ /dev/null @@ -1,3 +0,0 @@ -function update_time { - timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)" -}