From db7e78dc9cf52e5ab12921b63e7b629cbf0d22a2 Mon Sep 17 00:00:00 2001 From: Digital Studium Date: Sat, 16 Mar 2024 18:34:40 +0300 Subject: [PATCH] Initial commit --- VERSION | 1 + a | 15 +++++++++++++++ create_deb_package.sh | 23 +++++++++++++++++++++++ g | 25 +++++++++++++++++++++++++ r | 3 +++ s | 14 ++++++++++++++ 6 files changed, 81 insertions(+) create mode 100644 VERSION create mode 100755 a create mode 100755 create_deb_package.sh create mode 100755 g create mode 100755 r create mode 100755 s diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..9459d4b --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.1 diff --git a/a b/a new file mode 100755 index 0000000..7be0f47 --- /dev/null +++ b/a @@ -0,0 +1,15 @@ +#!/bin/bash +set -e +cat > /tmp/.dialogrc << EOL +# Item color +tag_color = (BLACK,WHITE,ON) +EOL +action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for apt" 10 40 0 "Update" 1 "Upgrade" 2 "Install" 3 "Remove" 4) + + +if [[ $action == "Install" || $action == "Remove" ]]; then + package=$(apt list 2>/dev/null | awk -F'/' 'NR>1{print $1}' | fzf) + sudo apt ${action,,} $package -y +elif [[ $action == "Update" || $action == "Upgrade" ]]; then + sudo apt ${action,,} -y +fi diff --git a/create_deb_package.sh b/create_deb_package.sh new file mode 100755 index 0000000..92f9df0 --- /dev/null +++ b/create_deb_package.sh @@ -0,0 +1,23 @@ +mkdir -p gui-scripts_$(cat VERSION)-1/usr/local/bin +mkdir -p gui-scripts_$(cat VERSION)-1/DEBIAN + +cat > gui-scripts_$(cat VERSION)-1/DEBIAN/control << EOL +Package: gui-scripts +Version: $(cat VERSION)-1 +Section: base +Priority: optional +Architecture: amd64 +Depends: fzf, dialog (>= 1.3), xdotool, x11-xkb-utils +Maintainer: Konstantin Shutkin +Description: GUI scripts + GUI scripts for popular cli tools, based on dialog and fzf +EOL + + +for script in a s g r; do + cp $script gui-scripts_$(cat VERSION)-1/usr/local/bin +done + +dpkg-deb --build gui-scripts_$(cat VERSION)-1 + + diff --git a/g b/g new file mode 100755 index 0000000..740f159 --- /dev/null +++ b/g @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +cat > /tmp/.dialogrc << EOL +# Item color +tag_color = (BLACK,WHITE,ON) +EOL +set +ex +action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for git" 10 40 0 'Add all && Commit && Push' 1 "Add all" 2 "Commit" 3 "Push" 4) + +#echo $action +#exit + +if [[ $action == "Add all && Commit && Push" ]]; then + git add . + commit_message=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --title "$action" --inputbox "Enter the commit message:" 8 40) + git commit -"m $commit_message" + git push +elif [[ $action == "Add all" ]]; then + git add . +elif [[ $action == "Commit" ]]; then + commit_message=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --title "$action" --inputbox "Enter the commit message:" 8 40) + git commit -"m $commit_message" +elif [[ $action == "Push" ]]; then + git push +fi diff --git a/r b/r new file mode 100755 index 0000000..d083e11 --- /dev/null +++ b/r @@ -0,0 +1,3 @@ +#!/bin/bash +setxkbmap +cat ~/.aliases.txt | fzf | cut -d : -f 2- | xargs -I _ xdotool type _ diff --git a/s b/s new file mode 100755 index 0000000..5cf5b8a --- /dev/null +++ b/s @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +cat > /tmp/.dialogrc << EOL +# Item color +tag_color = (BLACK,WHITE,ON) +EOL +service=$(systemctl list-units --type service --all --plain --quiet | awk '{ print $1 }' | fzf) +set +ex +action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for $service" 10 40 0 "Status" 1 "Start" 2 "Stop" 3 "Disable" 4 "Enable" 5) + + +if [ ! -z $action ]; then + sudo systemctl ${action,,} $service +fi