full refactoring re mothership to endos
This commit is contained in:
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# usage: import-gsettings
|
||||
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
|
||||
if [ ! -f "$config" ]; then exit 1; fi
|
||||
|
||||
gnome_schema="org.gnome.desktop.interface"
|
||||
gtk_theme="$(grep 'gtk-theme-name' "$config" | cut -d'=' -f2)"
|
||||
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | cut -d'=' -f2)"
|
||||
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | cut -d'=' -f2)"
|
||||
font_name="$(grep 'gtk-font-name' "$config" | cut -d'=' -f2)"
|
||||
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
|
||||
gsettings set "$gnome_schema" icon-theme "$icon_theme"
|
||||
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
|
||||
gsettings set "$gnome_schema" font-name "$font_name"
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
SELECTION="$(printf " Lock\n Suspend\n Log out\n Reboot\n Reboot to UEFI\n Shutdown" | fuzzel --dmenu -a top-right -l 6 -w 18 -p "Select an option: ")"
|
||||
|
||||
confirm_action() {
|
||||
local action="$1"
|
||||
CONFIRMATION="$(printf "No\nYes" | fuzzel --dmenu -a top-right -l 2 -w 18 -p "$action?")"
|
||||
[[ "$CONFIRMATION" == *"Yes"* ]]
|
||||
}
|
||||
|
||||
case $SELECTION in
|
||||
*" Lock"*)
|
||||
gtklock;;
|
||||
*" Suspend"*)
|
||||
if confirm_action "Suspend"; then
|
||||
systemctl suspend
|
||||
fi;;
|
||||
*" Log out"*)
|
||||
if confirm_action "Log out"; then
|
||||
swaymsg exit
|
||||
fi;;
|
||||
*" Reboot"*)
|
||||
if confirm_action "Reboot"; then
|
||||
systemctl reboot
|
||||
fi;;
|
||||
*" Reboot to UEFI"*)
|
||||
if confirm_action "Reboot to UEFI"; then
|
||||
systemctl reboot --firmware-setup
|
||||
fi;;
|
||||
*" Shutdown"*)
|
||||
if confirm_action "Shutdown"; then
|
||||
systemctl poweroff
|
||||
fi;;
|
||||
esac
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the lengths for each column
|
||||
ws_length=2
|
||||
app_id_length=14
|
||||
name_length=50
|
||||
|
||||
# Fetch the data from swaymsg and format it
|
||||
formatted_output=$(swaymsg -t get_tree | jq -r --arg ws_length "$ws_length" --arg app_id_length "$app_id_length" --arg name_length "$name_length" '
|
||||
def lpad($len; $char):
|
||||
if (.|length) > $len then $char * ($len - (.|length)) +.[:$len-1] + "\u2026" else $char * ($len - (.|length)) +. end;
|
||||
def rpad($len; $char):
|
||||
if (.|length) > $len then.[:$len-1] + "\u2026" else. + $char * ($len - (.|length)) end;
|
||||
..
|
||||
| objects
|
||||
| select(.type == "workspace") as $ws
|
||||
|..
|
||||
| objects
|
||||
| select(has("app_id"))
|
||||
| (if.focused then "*" else " " end) as $asterisk
|
||||
| "\($asterisk)[\($ws.name | lpad($ws_length | tonumber; " "))]\((.app_id // "xwayland") | lpad($app_id_length | tonumber; " ")): \(.name | rpad($name_length | tonumber; " ")) (\(.id))"
|
||||
')
|
||||
|
||||
# Launch fuzzel with the formatted output
|
||||
row=$(echo "$formatted_output" | fuzzel --dmenu --width=80 --lines=12)
|
||||
|
||||
# Get the container ID from the selection and focus the container
|
||||
if [ -n "$row" ]; then
|
||||
winid="${row##*(}"
|
||||
winid="${winid%%)*}"
|
||||
swaymsg "[con_id=$winid] focus"
|
||||
fi
|
||||
Reference in New Issue
Block a user