diff --git a/.config/nwg-wrapper/conky_sway.sh b/.config/nwg-wrapper/conky_sway.sh index a222b47..2697381 100755 --- a/.config/nwg-wrapper/conky_sway.sh +++ b/.config/nwg-wrapper/conky_sway.sh @@ -31,7 +31,7 @@ echo ' echo ' Super + p = Wofi (Run Mode)' echo ' Super + o = Wofi (Drun Mode)' echo ' Super + q = Rofi (Window Mode)' -echo ' Super + d = Dmenu' +echo ' Super + d = Wofi (Filebrowser)' echo ' Super + b = Mozilla Firefox' echo ' Super + n = PCManFM' echo ' Super + t = Wl-Screenshooter' diff --git a/.config/sway/config b/.config/sway/config index 03270a1..1952265 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -73,25 +73,20 @@ bindsym $mod+Return exec kitty # kill focused window bindsym $mod+Shift+q kill -# start dmenu (a program launcher) -bindsym $mod+d exec --no-startup-id dmenu_run -# A more modern dmenu replacement is rofi: -# bindcode $mod+40 exec "rofi -modi drun,run -show drun" -# There also is i3-dmenu-desktop which only displays applications shipping a -# .desktop file. It is a wrapper around dmenu, so you need that installed. -# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop +# start filebrowser (a program launcher) +bindsym $mod+d exec --no-startup-id ~/.config/sway/wofi/wofi_fbrun # NetworkManager #bindsym $mod+c exec --no-startup-id connman-gtk --no-icon bindsym $mod+c exec --no-startup-id nm-connection-editor # Run applications -bindsym $mod+o exec --no-startup-id wofi --show drun -bindsym $mod+q exec --no-startup-id rofi -show window +bindsym $mod+o exec --no-startup-id ~/.config/sway/wofi/wofi_drun +bindsym $mod+q exec --no-startup-id ~/.config/sway/wofi/wofi_wrun bindsym $mod+x exec --no-startup-id wdisplays bindsym $mod+b exec --no-startup-id firefox bindsym $mod+n exec --no-startup-id pcmanfm -bindsym $mod+p exec --no-startup-id wofi --show run +bindsym $mod+p exec --no-startup-id ~/.config/sway/wofi/wofi_run bindsym $mod+g exec --no-startup-id geany bindsym $mod+m exec --no-startup-id telegram bindsym $mod+z exec --no-startup-id kitty -e wf-recorder @@ -175,8 +170,8 @@ bindsym $mod+a focus parent #bindsym $mod+d focus child # sway gaps config -gaps inner 3 -gaps outer 2 +gaps inner 2 +gaps outer 1 # Disable borders #default_border none @@ -313,7 +308,7 @@ exec_always { bar { position top status_command ~/.config/sway/scripts/status_bar.sh - swaybar_command waybar + #swaybar_command waybar workspace_buttons yes #tray_output DP-0 colors { diff --git a/.config/sway/wofi/wofi_drun b/.config/sway/wofi/wofi_drun new file mode 100755 index 0000000..91f9bb8 --- /dev/null +++ b/.config/sway/wofi/wofi_drun @@ -0,0 +1,98 @@ +#!/bin/bash + +################################################################## +# wofi_drun - wofi-dmenu script that simulates 'rofi -show drun' # +# # +# Author: q3aql # +# Last update: 04-01-2023 # +################################################################## + +# Configuration variables +load_theme_path="${HOME}/.wofi" +load_desktop_files="${HOME}/.wofi/desktop" +desktop_files="/usr/share/applications" +desktop_files_home="${HOME}/.local/share/applications" + +function generate_spaces() { + num_spaces=${1} + count_spaces=1 + while [ ${count_spaces} -le ${num_spaces} ] ; do + echo -n " " + count_spaces=$(expr ${count_spaces} + 1) + done +} + +function list_desktop_files() { + if [ -d "${desktop_files}" ] ; then + ls -1 "${desktop_files}/" | grep ".desktop" + fi + if [ -d "${desktop_files_home}" ] ; then + ls -1 "${desktop_files_home}/" | grep ".desktop" + fi +} + +function list_desktop_icons() { + echo " Scan New Desktop Files" + ls -1 "${load_desktop_files}/" | while read current_desktop ; do + echo " ${current_desktop}" + done + generate_spaces 75 +} + +rundesk () { + if [ -z ${1} ] ; then + echo "No file entry" + else + if [ -f "${1}" ] ; then + eval "$(awk -F= '$1=="Exec"{$1=""; print}' "$1" | head -1)" + else + echo "File does not exist" + fi + fi +} + +function create_list_files() { + mkdir -p ${load_desktop_files} + if [ ! -f ${HOME}/.dmenu/read_list ] ; then + echo "0" > ${HOME}/.dmenu/read_list + fi + exec_list=$(cat ${HOME}/.dmenu/read_list) + if [ ${exec_list} -eq 0 ] ; then + rm -rf ${load_desktop_files}/* + list_desktop_files | while read current_file ; do + if [ -f "${desktop_files}/${current_file}" ] ; then + name_show=$(cat "${desktop_files}/${current_file}" | grep "Name=" | head -1 | cut -d "=" -f 2 | sed 's/\//|/g') + if [ ! -z "${name_show}" ] ; then + echo "${desktop_files}/${current_file}" > "${load_desktop_files}/${name_show}" + fi + fi + if [ -f "${desktop_files_home}/${current_file}" ] ; then + name_show=$(cat "${desktop_files_home}/${current_file}" | grep "Name=" | head -1 | cut -d "=" -f 2 | sed 's/\//|/g') + if [ ! -z "${name_show}" ] ; then + echo "${desktop_files_home}/${current_file}" > "${load_desktop_files}/${name_show}" + fi + fi + done + echo "1" > ${HOME}/.dmenu/read_list + fi +} + +if [ -f /usr/bin/dex ] ; then + runDesktop="dex" +else + runDesktop="rundesk" +fi + +create_list_files +list_output=$(list_desktop_icons | wofi --dmenu -i -p " drun") +run_output=$(echo ${list_output} | cut -c 5-999) +if [ ! -z "${run_output}" ] ; then + if [ "${run_output}" == "Scan New Desktop Files" ] ; then + echo "0" > ${HOME}/.dmenu/read_list + create_list_files + $0 + else + run_desktop_file=$(cat "${load_desktop_files}/${run_output}") + ${runDesktop} "${run_desktop_file}" + fi +fi diff --git a/.config/sway/wofi/wofi_fbrun b/.config/sway/wofi/wofi_fbrun new file mode 100755 index 0000000..3549e99 --- /dev/null +++ b/.config/sway/wofi/wofi_fbrun @@ -0,0 +1,74 @@ +#!/bin/bash + +########################################################################## +# wofi_fbrun - wofi-dmenu script that simulates 'rofi -show filebrowser' # +# # +# Author: q3aql # +# Last update: 04-01-2023 # +########################################################################## + +# Configuration variables +load_theme_path="${HOME}/.wofi" + +function generate_spaces() { + num_spaces=${1} + count_spaces=1 + while [ ${count_spaces} -le ${num_spaces} ] ; do + echo -n " " + count_spaces=$(expr ${count_spaces} + 1) + done +} + +function show_icon_tree() { + ls -1 | while read current ; do + if [ -f "${current}" ] ; then + echo " ${current}" + elif [ -d "${current}" ] ; then + echo " ${current}" + else + echo " ${current}" + fi + done + generate_spaces 75 +} + +function remove_icon() { + entry="${@}" + remove_icon_space=0 + read_entry=$(echo "${entry}" | grep " ") + if ! [ -z "${read_entry}" ] ; then + remove_icon_space=1 + fi + read_entry=$(echo "${entry}" | grep " ") + if ! [ -z "${read_entry}" ] ; then + remove_icon_space=1 + fi + read_entry=$(echo "${entry}" | grep " ") + if ! [ -z "${read_entry}" ] ; then + remove_icon_space=1 + fi + if [ ${remove_icon_space} -eq 1 ] ; then + show_output=$(echo "${entry}" | cut -c4-999 | tr -s " " | cut -c2-999) + echo "${show_output}" + else + echo "${entry}" + fi +} + +file=1 +while [ "${file}" ]; do + file_icon=$(show_icon_tree | wofi --dmenu -i -p " filebrowser: $(basename $(pwd))") + file=$(remove_icon "${file_icon}") + echo "# ${file} #" + if [ -e "${file}" ]; then + owd=$(pwd) + if [ -d "${file}" ]; then + cd "${file}" + else [ -f "${file}" ] + if which xdg-open &> /dev/null; then + exec xdg-open "${owd}/${file}" & + unset file + fi + fi + fi +done diff --git a/.config/sway/wofi/wofi_run b/.config/sway/wofi/wofi_run new file mode 100755 index 0000000..cfd4216 --- /dev/null +++ b/.config/sway/wofi/wofi_run @@ -0,0 +1,52 @@ +#!/bin/bash + +################################################################ +# wofi_run - wofi-dmenu script that simulates 'rofi -show run' # +# # +# Author: q3aql # +# Last update: 04-01-2023 # +################################################################ + +# Configuration variables +load_theme_path="${HOME}/.wofi" + +function generate_spaces() { + num_spaces=${1} + count_spaces=1 + while [ ${count_spaces} -le ${num_spaces} ] ; do + echo -n " " + count_spaces=$(expr ${count_spaces} + 1) + done +} + +function list_binaries() { + binaries=0 + path_binaries=${PATH} + count_path=1 + while [ ${binaries} -eq 0 ] ; do + current_path=$(echo ${path_binaries} | cut -d ":" -f ${count_path}) + if [ -z "${current_path}" ] ; then + binaries=1 + else + # Extra code / When /bin is the same that /usr/bin/ + bin_same=$(ls -la ${current_path} | grep "> usr/bin") + if [ -z "${bin_same}" ] ; then + ls -1 ${current_path}/ + count_path=$(expr ${count_path} + 1) + else + count_path=$(expr ${count_path} + 1) + fi + fi + done +} + +function list_binaries_icons() { + list_binaries | while read current_binary ; do + echo " ${current_binary}" + done + generate_spaces 75 +} + +list_output=$(list_binaries_icons | wofi --dmenu -i -p " run") +run_output=$(echo "${list_output}" | cut -c4-999) +${run_output} diff --git a/.config/sway/wofi/wofi_wrun b/.config/sway/wofi/wofi_wrun new file mode 100755 index 0000000..20e22e7 --- /dev/null +++ b/.config/sway/wofi/wofi_wrun @@ -0,0 +1,47 @@ +#!/bin/bash + +#################################################################### +# wofi_wrun - wofi-dmenu script that simulates 'rofi -show window' # +# # +# Author: q3aql # +# Last update: 04-01-2023 # +#################################################################### + +# Configuration variables +load_theme_path="${HOME}/.wofi" + +function generate_spaces() { + num_spaces=${1} + count_spaces=1 + while [ ${count_spaces} -le ${num_spaces} ] ; do + echo -n " " + count_spaces=$(expr ${count_spaces} + 1) + done +} + +function check_wmctrl() { + wmctrl -h &> /dev/null + error=$? + if [ ${error} -ne 0 ] ; then + echo " Error: You need install 'wmctrl'" | wofi --dmenu -p " window" + exit + fi +} + +function list_applications_icons() { + wmctrl -l | while read current_app ; do + echo " ${current_app}" + done + generate_spaces 75 +} + +check_wmctrl +list_output=$(list_applications_icons | wofi --dmenu -i -p " window") +run_output=$(echo ${list_output} | cut -c 5-999) +echo "# Selected: ${run_output}" +run_output=$(echo "${run_output}" | cut -d " " -f 1) +if [ -z "${run_output}" ] ; then + echo "# Selection window canceled" +else + wmctrl -ia "${run_output}" &> /dev/null +fi