Compare commits

...

2 commits

Author SHA1 Message Date
Alexis Jhon Gaspar 8f871f1ef2 Fix keybinds 2023-10-24 23:52:19 +08:00
Alexis Jhon Gaspar a08ccf9925 Initial version of tabb uploaded 2023-10-24 23:49:19 +08:00
3 changed files with 61 additions and 2 deletions

View file

@ -502,7 +502,7 @@ static const Rule rules[] = {
*/
RULE(.class = "st", .isterminal = 1)
RULE(.class = "St", .isterminal = 1)
RULE(.class = "tabbed", .isfloating = 0)
RULE(.class = "tabbed", .isfloating = 0, .noswallow = 1)
RULE(.wintype = WTYPE "DESKTOP", .unmanaged = 2)
RULE(.wintype = WTYPE "DOCK", .unmanaged = 1)
RULE(.wintype = WTYPE "DIALOG", .isfloating = 1, .noswallow = 1)
@ -949,6 +949,8 @@ static const Key keys[] = {
{ Mod4Mask, XK_l, spawn, SHCMD("slock") },
/* suckless-utils keymaps */
{ Mod4Mask, XK_t, spawn, SHCMD("tabbed -c -r 2 st -w ''") },
{ Mod4Mask, XK_y, spawn, SHCMD("tabb") },
{ Mod4Mask|ShiftMask, XK_y, spawn, SHCMD("tabb --disable") },
{ Mod4Mask, XK_i, spawn, SHCMD("firefox") },
{ Mod4Mask, XK_e, spawn, SHCMD("st -T broot broot") },
{ Mod4Mask|ShiftMask, XK_e, spawn, SHCMD("st -T sfm sfm") },

57
scripts/tabb Executable file
View file

@ -0,0 +1,57 @@
#!/bin/bash
# tabb for tabbed by Alexis.
tabbed_id=$(tabbed -d -c)
main() {
while true; do
if [[ ! $(pgrep -x "tabbed") ]]; then
echo "No Tabbed process found. Exiting..."
exit 1
fi
deskid=$(xdotool get_desktop)
window=$(wmctrl -x -l | grep -E " $deskid " | grep -v $(printf '0x0%x' "$tabbed_id") | cut -d ' ' -f 1,4)
if [[ $(pgrep -x "tabbed" | wc -l) -gt 1 ]]; then
automode=false
tabbed_id=$(xdotool search --class "tabbed" | tail -n 1)
fi
IFS=':'
for win in $(printf '%s' "$window" | tr '\n' ':'); do
unset IFS
wid=$(printf '%s' "$win" | cut -d ' ' -f 1)
wname=$(printf '%s' "$win" | cut -d ' ' -f 2)
if [ "$wname" = "(has no name)" ]; then
cwid=$(xwininfo -children -id "$wid" | grep '^ 0x' | sed -e 's@^ *\\(0x[0-9a-f]*\\) "\\([^"]*\\)".*@\\1@')
for id in $(printf '%s' "$cwid"); do
xdotool windowreparent "$id" "$tabbed_id"
done
else
xdotool windowreparent "$wid" "$tabbed_id"
fi
done
if [ "$automode" = false ]; then
exit 0
fi
done
}
while getopts ":e:d" flag; do
case $flag in
-e )
automode=true
main
;;
-d )
automode=false
main
;;
esac
done
if [ $OPTIND -eq 1 ]; then
automode=true
main
fi
shift $((OPTIND-1))

View file

@ -287,7 +287,7 @@ static const Key keys[] = {
{ 0, XK_F11, fullscreen, { 0 } },
/* Unique functionality */
{ MODKEY|ShiftMask, XK_m, spawn, OPENTERMSOFT("_TABBED_SELECT_TERMAPP") },
{ MODKEY|ShiftMask, XK_y, spawn, OPENTERM("_TABBED_TERM") },
{ MODKEY|ShiftMask, XK_u, spawn, OPENTERM("_TABBED_TERM") },
{ MODKEY|ShiftMask, XK_a, spawn, ATTACHWIN("_TABBED_ATTACH_WIN") },
{ MODKEY|ShiftMask, XK_f, spawn, ATTACHSELECTWIN("_TABBED_ATTACH_WIN") },
{ MODKEY|ShiftMask, XK_g, spawn, ATTACHALL("_TABBED_ATTACH_ALL") },