Skip to content

Instantly share code, notes, and snippets.

@lopesivan
Created May 22, 2026 07:29
Show Gist options
  • Select an option

  • Save lopesivan/e128d74c75e35ee858413a0b718acc62 to your computer and use it in GitHub Desktop.

Select an option

Save lopesivan/e128d74c75e35ee858413a0b718acc62 to your computer and use it in GitHub Desktop.
i3wm
#!/bin/sh
exec bash --rcfile /home/ivan/.bashrc.without-brew
#!/bin/sh
exec /bin/google-chrome --new-window --class="chromedd" --user-data-dir=/tmp/chromedd
# ~.config/i3/config
## Use xprop para identificar as classes dos aplicativos
for_window [class="^.*"] border pixel 3
gaps inner 10
gaps outer 10
smart_gaps on
smart_borders on
## variáveis
set $mod Mod4
set $ALT Mod1
set $exe exec --no-startup-id
set $stoprec --no-startup-id killall ffmpeg
# ############################################################################
# DEBUG: $ i3status -c i3status.conf
# ############################################################################
set $st /home/linuxbrew/.linuxbrew/bin/st
set $nvin /home/linuxbrew/.linuxbrew/bin/nvin
set $rangerdd /home/linuxbrew/.linuxbrew/bin/rangerdd
set $ddspawn /home/linuxbrew/.linuxbrew/bin/ddspawn
set $bashdd /home/linuxbrew/.linuxbrew/bin/bashdd
set $chromedd /home/linuxbrew/.linuxbrew/bin/chromedd
set $tmuxdd /home/linuxbrew/.linuxbrew/bin/tmuxdd
set $tmux /home/linuxbrew/.linuxbrew/bin/tmux
set $maple /home/linuxbrew/.linuxbrew/bin/maple
set $zathuraddr /home/linuxbrew/.linuxbrew/bin/zathuraddr
set $term1 rxvt -fn "xft:Hack Nerd Font Mono:size=15:hinting=true"
set $term2 rxvt -fn "xft:DroidSansM Nerd Font Propo:size=15:hinting=true"
set $term3 rxvt -fn "xft:SauceCodePro Nerd Font Propo:size=15:hinting=true"
set $stmd /home/linuxbrew/.linuxbrew/bin/st
set $st0 /home/linuxbrew/.linuxbrew/bin/st
set $st1 /home/linuxbrew/.linuxbrew/bin/st
set $st2 /home/linuxbrew/.linuxbrew/bin/st
set $st3 /home/linuxbrew/.linuxbrew/bin/st
set $lhowto /home/linuxbrew/.linuxbrew/bin/lhowto.sh
set $pdoc /home/linuxbrew/.linuxbrew/bin/pdoc.sh
set $ldoc /home/linuxbrew/.linuxbrew/bin/ldoc.sh
set $netrefresh --no-startup-id sudo systemctl restart NetworkManager
## variáveis de ambiente
exec --no-startup-id ~/.config/i3/env.sh
## I3 GAPS CHANGE
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym o mode "$mode_gaps_outer"
bindsym i mode "$mode_gaps_inner"
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_inner" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym Shift+0 gaps inner all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym Shift+0 gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
## terminal
bindsym $mod+u $exe $ddspawn $tmuxdd
#bindsym $mod+e $exe $term2 -e sh -c 'bash --rcfile /home/ivan/.bashrc.without-brew'
bindsym $mod+e $exe $ddspawn --term "rxvt -fn 'xft:DroidSansM Nerd Font Propo:size=15:hinting=true'" $bashdd
#bindsym $mod+e $exe $ddspawn --appc rxvt /home/linuxbrew/.linuxbrew/bin/open-terminal-here.sh
#bindsym $mod+e exec --no-startup-id /home/linuxbrew/.linuxbrew/bin/open-terminal-here.sh
## horizontal
bindsym $mod+apostrophe split horizontal ;; exec $st
## vertical
bindsym $mod+slash split vertical ;; exec $st
## botão temporário: Menu
bindsym Menu $exe $st -e sh -c 'bash --rcfile /home/ivan/.bashrc.without-brew'
## ranger
bindsym $mod+Return $exe $ddspawn --term "$st -d /workspace" $rangerdd
#bindsym $mod+Return $exe $st -n `uuidgen` -d /workspace -e sh -c ranger
#bindsym $mod+Return $exe $st -n `uuidgen` -d /workspace -e sh -c $rangerdd
#bindsym $mod+Return $exe $ddspawn rangerdd
# joga comando na janela do tmux
# bindsym XF86HomePage exec tmux send-keys -t 0 'ranger' Enter
## monitor
exec_always --no-startup-id ~/.screenlayout/monitor-hdmi-aoc.sh
#exec_always --no-startup-id ~/.screenlayout/monitor-hdmi-laptop.sh
#exec_always --no-startup-id ~/.screenlayout/monitor-clone.sh
#exec_always --no-startup-id ~/.screenlayout/monitor-clone-with2workspaces.sh
#exec_always --no-startup-id ~/.screenlayout/monitor-desktop.sh
## Wall paper
exec_always --no-startup-id ~/.config/i3/wallpaper.sh
## Compton
# exec_always --no-startup-id ~/.config/i3/compton.sh
## Unclutter: makes the mouse invisible after a brief period
$exe unclutter
## Arrastar: Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
## chrome
bindsym $mod+g $exe $ddspawn --app google-chrome /bin/google-chrome
#bindsym $mod+g $exe $ddspawn --app chromedd $chromedd
## X Maple
bindsym $mod+m $exe $ddspawn --appn "Maple 2021" /home/linuxbrew/.linuxbrew/bin/xmaple
#bindsym $mod+m $exe mapledd
## Dialog BloX Maple
#bindsym $mod+w $exe $ddspawn --appc "DialogBlocks" /home/linuxbrew/.linuxbrew/bin/dialogblocks.sh
bindsym $mod+w $exe $ddspawn --app dialogblocks /home/linuxbrew/.linuxbrew/bin/dialogblocks.sh
## kill focused window
bindsym $mod+Shift+q kill
bindsym $ALT+F4 kill
## change focus
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
## move focused window
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
## split in horizontal orientation
bindsym $mod+Shift+h split h
## split in vertical orientation
bindsym $mod+Shift+v split v
## enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
## toggle tiling / floating
bindsym $mod+Shift+space floating toggle
## Wokspace
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
#set $ws6 "6"
set $ws6 "6:gimp"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
## reload the configuration file
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
## exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
## resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the window’s width.
# Pressing right will grow the window’s width.
# Pressing up will shrink the window’s height.
# Pressing down will grow the window’s height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym ccedilla resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
# w = (w/f)*f + 2, h = (h/2f)*2f + 2
#bindsym 1 resize set 1002 1042; move position center
#bindsym 2 resize set 546 610; move position center
#bindsym 3 resize set 466 514; move position center
}
bindsym $mod+r mode "resize"
## workspaces
set $wbrowser 3
set $wjet 4
set $wmath 5
set $wgimp 6
## SYSTEMD
set $shutdown sudo shutdown -h now
set $reboot sudo reboot
set $netrefresh --no-startup-id sudo systemctl restart NetworkManager
set $hibernate sudo systemctl suspend
## MPV
# Usage:
# $ mpv /dev/video0
for_window [title="video0 - mpv"] floating enable
for_window [title="video0 - mpv"] sticky enable
for_window [ instance="gl" class="mpv" ] floating enable
for_window [ instance="gl" class="mpv" ] border 1pixel
for_window [ instance="gl" class="mpv" ] move scratchpad
bindsym $mod+v [ instance="gl" class="mpv" ] scratchpad show; [ instance="gl" class="mpv" ] move position center; fullscreen toggle
## NVIDIA-SMI
bindsym $mod+n $exe $st.5 -n wnvidia -e sh -c "watch -n 1 nvidia-smi"
for_window [instance="wnvidia"] move position center
for_window [instance="wnvidia"] floating enable border normal focus
for_window [instance="wnvidia"] fullscreen enable
## BLUETOOTH......................................................DESABILITADO
#bindsym $ALT+b exec "rfkill unblock bluetooth && blueman-manager"
## XF86 Botõoes ldoc. lhowto, pdoc
# [XF86Mail] [XF86HomePage] [XF86Messenger] [XF86Tools]
bindsym XF86Mail $exe $st -n wldoc -e sh -c $lhowto
# XF86HomePage
bindsym XF86Messenger $exe $st -n wldoc -e sh -c $pdoc
bindsym XF86Tools $exe $st -n wldoc -e sh -c $ldoc
# FIX:
#for_window [instance="wldoc"] move position top
#for_window [instance="wldoc"] floating enable border normal focus
#for_window [instance="wldoc"] fullscreen enable
# subdtituída por:
#
for_window [instance="wldoc"] \
floating enable, \
border normal, \
move position top, \
fullscreen enable
## XCLOCK
bindsym $mod+c [instance="xclock"] scratchpad show; [instance="xclock"] move position center; fullscreen toggle
for_window [class="XClock" instance="xclock"] floating enable
for_window [class="XClock" instance="xclock"] border 1pixel
for_window [class="XClock" instance="xclock"] resize set 100 100
for_window [class="XClock" instance="xclock"] move scratchpad
$exe xclock -digital -brief -fg cyan -bg black -brief -face Courier:size=450 -padding 40
## GIMP
for_window [class="Gimp"] move workspace $ws6
for_window [class="Gimp" window_role="gimp-toolbox"] floating disable, move right
for_window [class="Gimp" window_role="gimp-dock"] floating disable, move left
# gimp (class: Gimp — pega todas as janelas)
#bindsym $mod+F5 $exe $ddspawn --appc Gimp /usr/bin/gimp
bindsym $mod+F5 workspace $ws6; exec --no-startup-id /usr/bin/gimp
# blender
bindsym $mod+F6 $exe $ddspawn --appc Blender /snap/bin/blender
# qualquer outro app gráfico simples (uma janela só)
#bindsym $mod+F7 $exe $ddspawn --app inkscape /usr/bin/inkscape
## zathura (PDF)
for_window [instance="org.pwmt.zathura"] move scratchpad
bindsym $mod+z $exe $zathuraddr
## Others
bindsym $mod+Delete exec $stoprec
# Lock screen
bindsym $mod+l exec i3lock -i ~/.config/i3/scripts/lockscreen/lockscreen.png -t
focus_follows_mouse no
# X86
# Calculator and sound mixer
bindsym XF86Calculator exec gnome-calculator
## Volume control
# Volume keys
#bindsym XF86AudioRaiseVolume exec amixer -q set Master 2dB+ unmute
#bindsym XF86AudioLowerVolume exec amixer -q set Master 2dB- unmute
bindsym XF86AudioMute exec amixer -q set Master toggle
bindsym XF86AudioRaiseVolume exec "amixer -D pulse sset Master '5%+'"
bindsym XF86AudioLowerVolume exec "amixer -D pulse sset Master '5%-'"
#=bindsym XF86AudioMute exec "amixer -D pulse set Master toggle"
#https://github.com/acrisci/playerctl/
# mpd
# bindsym XF86AudioPlay exec mpc play
# bindsym XF86AudioNext exec mpc next
# bindsym XF86AudioPrev exec mpc prev
# bindsym XF86AudioStop exec mpc stop
# md_navigate_next:  :
# linea_music_end_button:  :
# linea_music_beginning_button:  :
# linea_music_stop_button:  :
# XF86AudioPlay
# XF86AudioPrev
# XF86AudioNext
# XF86AudioStop
# XF86Mail
# XF86HomePage
# XF86Messenger
# XF86Messenger
# XF86Tools
# XF86Tools
# Path to volume control, without trailing slash
#set $volumepath ~/.config/i3-volume
# Command for the status line (used with -t, requires -u)
# ie: i3blocks, i3status
set $statuscmd /bin/i3status
# Signal used to update the status line (used with -u, requires -t)
# i3blocks uses SIGRTMIN+10 by default
# i3status uses SIGUSR1 by default
set $statussig SIGUSR1
# Amount to increase/decrease volume as a percentage (used with -i, -d)
set $volumestep 5
## gtk............................................................DESABILITADO
# Regra para forçar a aplicação GTKmm a ser flutuante (floating)
#for_window [class="App"] floating enable
# Regra para forçar a aplicação a ser flutuante (floating)
for_window [class="App"] floating enable, border pixel 1 # (border pixel é opcional, mas ajuda a ver)
## WXGLADE
# --- Regras para wxGlade ---
# 1. Atribuição de Workspace (Workspace Assignment)
# Atribui a janela ao workspace $ws3 (o '3') usando a classe
# Corrigido para a ordem provável: class="Wxglade"
assign [class="Wxglade"] 3
# 2. Propriedades da Janela (Window Properties)
# Aplica as propriedades Flutuante e Borda.
# Não use o 'assign' aqui, use 'for_window'.
for_window [class="Wxglade"] floating enable, border pixel 1
#/usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec
# Restore GNOME's settings
#exec --no-startup-id /usr/lib/gnome-settings-daemon/gnome-settings-daemon-localeexec
# Fix a bug in gnome-settings-daemon: http://feeding.cloud.geek.nz/posts/creating-a-modern-tiling-desktop-environment-using-i3/
#exec --no-startup-id dconf write /org/gnome/settings-daemon/plugins/cursor/active false
## SHORTCUTS APPLICATIONS
# Gimp
workspace $wgimp gaps inner 2
workspace $wgimp gaps outer 2
assign [class="^Blender$"] $wgimp
assign [class="^Gimp$"] $wgimp
assign [class="^MyPaint$"] $wgimp
assign [class="^Adl$"] $wgimp
# for_window [window_role="gimp-toolbox"] floating disable
# for_window [window_role="gimp-dock"] floating disable
# for_window [window_role="gimp-image-window"] floating disable
#for_window [window_role="GtkFileChooserDialog"] resize shrink height 10 px
#for_window [window_role="GtkFileChooserDialog"] floating enable
#for_window [window_role="GtkFileChooserDialog"] resize set 900 600
#for_window [window_role="GtkFileChooserDialog"] move position center
for_window [window_role="GtkFileChooserDialog"] floating enable
for_window [window_role="GtkFileChooserDialog"] fullscreen enable
for_window [window_role="GtkFileChooserDialog"] move position center
# jetbrains
for_window [class="^jetbrains-.+" instance="jetbrains-.+"] border none
for_window [title="^Android Emulator -"] floating enable
# Maple
assign [class="java-lang-Thread" instance="sun-awt-X11-XFramePeer"] $ws6
for_window [class="java-lang-Thread" instance="sun-awt-X11-XFramePeer"] focus
## SHORTCUTS WORKSPACES
#set $script_path ~/developer/scripts/voidrice/meta_workspaces.py
# next/previous workspace
# #---Workspace Bindings---# #
bindsym $mod+Home workspace $ws1
bindsym $mod+Shift+Home move container to workspace $ws1
bindsym $mod+End workspace $ws10
bindsym $mod+Shift+End move container to workspace $ws10
#bindsym $mod+Prior workspace prev
#bindsym $mod+Shift+Prior move container to workspace prev
#bindsym $mod+Next workspace next
#bindsym $mod+Shift+Next move container to workspace next
#bindsym $mod+Tab workspace back_and_forth
# bindsym $mod+Tab workspace next
# bindsym $mod+Shift+Tab workspace prev
bindsym $mod+Next workspace next
bindsym $mod+Prior workspace prev
#bindsym $mod+XF86Back workspace prev
#bindsym $mod+Shift+XF86Back move container to workspace prev
#bindsym $mod+XF86Forward workspace next
#bindsym $mod+Shift+XF86Forward move container to workspace next
#bindsym $mod+semicolon workspace next
# bindsym $mod+apostrophe split horizontal ;; exec $st3
# bindsym $mod+slash split vertical ;; exec $st3
bindsym $mod+Shift+slash kill
#bindsym $mod+backslash workspace back_and_forth
## Bindings to make the webcam float and stick.
for_window [title="mpvfloat"] floating enable
for_window [title="mpvfloat"] sticky enable
for_window [title="mpvfloat"] border pixel 0
no_focus [title="mpvfloat"]
## Function Buttons Fx
bindsym $mod+F12 $exe ~/.config/rofi/powermenu/type-1/powermenu.sh
bindsym F11 fullscreen toggle
bindsym $mod+i $exe ~/.config/rofi/powermenu/type-1/system-info.sh
#bindsym F9 $exe /opt/scripts/mouseup.sh
#bindsym --release F9 exec pkill mouseup.sh
#bindsym F10 $exe /opt/scripts/mousedown.sh
#bindsym --release F10 exec pkill mousedown.sh
## Nautilus
#bindsym $mod+F1 $exe nautilus --class Files --name small --new-window /tmp
## For screenshots and recording
#bindsym Print $exe scrot -u '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f ~/Pictures/'
bindsym Print $exe scrot -u '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f /workspace/obs/'
#bindsym Print $exe scrot -u '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f /workspace/calculo'
#bindsym Print $exe scrot -u '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f ~/Pictures/'
#bindsym Print $exe scrot -u '%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f /home/ivan/work/curso/cpp'
bindsym Shift+Print --release exec "scrot -s /tmp/screenshot-$(date +%F_%T).png -e 'xclip -selection c -t image/png < $f'"
#bindsym Shift+Print exec "scrot /tmp/screenshot-$(date +%F_%T).png -e 'xclip -selection c -t image/png < $f'"
#bindsym Shift+Print $exe scrot -u
bindsym Control+Print $exe gnome-screenshot -i
## MODE_SYSTEM
bindsym $mod+Pause mode "$mode_system"
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l $exe ~/.config/i3/scripts/i3exit.sh lock, mode "default"
bindsym e $exe ~/.config/i3/scripts/i3exit.sh logout, mode "default"
bindsym s $exe ~/.config/i3/scripts/i3exit.sh suspend, mode "default"
bindsym h $exe ~/.config/i3/scripts/i3exit.sh hibernate, mode "default"
bindsym r $exe ~/.config/i3/scripts/i3exit.sh reboot, mode "default"
bindsym Shift+s $exe ~/.config/i3/scripts/i3exit.sh shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
## Theme colors
# workspace_auto_back_and_forth yes
# force_display_urgency_hint 0 ms
# focus_on_window_activation urgent
# floating_minimum_size -1 x -1
# floating_maximum_size -1 x -1
#font pango:Hack, FontAwesome 12
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 16
## COLORS
set_from_resource $darkred color1 #000000
set_from_resource $red color9 #000000
set_from_resource $darkgreen color2 #000000
set_from_resource $green color10 #000000
set_from_resource $darkyellow color3 #000000
set_from_resource $yellow color11 #000000
set_from_resource $darkblue color4 #000000
set_from_resource $blue color12 #000000
set_from_resource $darkmagenta color5 #000000
set_from_resource $magenta color13 #000000
set_from_resource $darkcyan color6 #000000
set_from_resource $cyan color14 #000000
set_from_resource $darkwhite color7 #000000
set_from_resource $white color15 #000000
# Use custom colors for black
set $black #282828
set $darkblack #1d2021
set $transparent #00000000
# BORDER BACKGROUND TEXT INDICATOR CHILD_BORDER
client.focused $black $black $darkwhite $darkblack $darkblack
client.unfocused $black $black $white $darkblack $darkblack
client.focused_inactive $black $black $white $darkblack $darkblack
client.urgent $darkred $darkred $black $darkred $darkred
client.background $black
# Ivan
bar {
#font pango: 34px
font pango:DroidSansM Nerd Font Propo 25px
status_command i3blocks
position top
mode dock
modifier None
}
## MOUSE / XDOTOOL
#==set $mouse_slow 1
#==set $mouse_mid 10
#==set $mouse_fast 50
#==
#==# Atalhos rápidos fora do modo mouse
#==bindsym $mod+s exec --no-startup-id xdotool click 1
#==bindsym $mod+Shift+s exec --no-startup-id xdotool mousedown 1
#==bindsym $mod+space exec --no-startup-id xdotool mouseup 1
#==
#==bindsym XF86Documents exec --no-startup-id xdotool click 1
#==
#==set $mode_mouse Mouse: arrows move | Shift=fast | Mod+Shift=very fast | s/d/f click | z/x scroll | Esc sair
#==
#==bindsym XF86Favorites mode "$mode_mouse"; exec --no-startup-id xdotool mousemove 50 50
#==
#==mode "$mode_mouse" {
#== # movimento fino
#== bindsym Left exec --no-startup-id xdotool mousemove_relative -- -$mouse_slow 0
#== bindsym Down exec --no-startup-id xdotool mousemove_relative 0 $mouse_slow
#== bindsym Up exec --no-startup-id xdotool mousemove_relative -- 0 -$mouse_slow
#== bindsym Right exec --no-startup-id xdotool mousemove_relative $mouse_slow 0
#==
#== # movimento médio
#== bindsym Shift+Left exec --no-startup-id xdotool mousemove_relative -- -$mouse_mid 0
#== bindsym Shift+Down exec --no-startup-id xdotool mousemove_relative 0 $mouse_mid
#== bindsym Shift+Up exec --no-startup-id xdotool mousemove_relative -- 0 -$mouse_mid
#== bindsym Shift+Right exec --no-startup-id xdotool mousemove_relative $mouse_mid 0
#==
#== # movimento rápido
#== bindsym Shift+$mod+Left exec --no-startup-id xdotool mousemove_relative -- -$mouse_fast 0
#== bindsym Shift+$mod+Down exec --no-startup-id xdotool mousemove_relative 0 $mouse_fast
#== bindsym Shift+$mod+Up exec --no-startup-id xdotool mousemove_relative -- 0 -$mouse_fast
#== bindsym Shift+$mod+Right exec --no-startup-id xdotool mousemove_relative $mouse_fast 0
#==
#== # clique esquerdo
#== bindsym s exec --no-startup-id xdotool click 1
#== bindsym Shift+s exec --no-startup-id xdotool mousedown 1
#== bindsym $mod+s exec --no-startup-id xdotool mouseup 1
#==
#== # clique do meio
#== bindsym d exec --no-startup-id xdotool click 2
#== bindsym Shift+d exec --no-startup-id xdotool mousedown 2
#== bindsym $mod+d exec --no-startup-id xdotool mouseup 2
#==
#== # clique direito
#== bindsym f exec --no-startup-id xdotool click 3
#== bindsym Shift+f exec --no-startup-id xdotool mousedown 3
#== bindsym $mod+f exec --no-startup-id xdotool mouseup 3
#==
#== # scroll
#== bindsym z exec --no-startup-id xdotool click --clearmodifiers 4
#== bindsym x exec --no-startup-id xdotool click --clearmodifiers 5
#==
#== bindsym Return mode "default"
#== bindsym Escape mode "default"
#==}
#==# estrela:
#==#bindsym XF86Favorites mode "mouse"; exec --no-startup-id xdotool mousemove 50 50
## WIFI
set $mode_wifi Wi-Fi: (u) Unite5G, (f) uff, (r) refresh NetworkManager
bindsym $mod+Shift+w mode "$mode_wifi"
mode "$mode_wifi" {
bindsym u exec --no-startup-id nmcli connection up unite5G, mode "default"
bindsym f exec --no-startup-id nmcli connection up uff, mode "default"
bindsym r exec $netrefresh, mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
## modeline:
# vim:set foldtext=getline(v\:foldstart) foldmethod=expr foldexpr=getline(v\:lnum)=~'^##'?'>1'\:'=':
#!/bin/bash
# ddspawn -- dropdown toggle para i3
# Uso:
# ddspawn SCRIPT [OPTS...]
# ddspawn --term "TERMINAL -opts" SCRIPT
# ddspawn --app INSTANCE COMANDO
# ddspawn --appc CLASS COMANDO
# ddspawn --appn "TITULO" COMANDO
TERMINAL="/home/linuxbrew/.linuxbrew/bin/st"
TERMINAL_BIN="$TERMINAL"
I3MSG="/usr/bin/i3-msg"
TERMINAL_OPTS=""
# --- parse modo ---
app_mode=0
match_by="instance"
case "$1" in
--term)
shift
TERMINAL="$1"
TERMINAL_FULL="$@" # "rxvt -fn xft:DroidSansM Nerd Font Propo:size=15:hinting=true"
shift
name="${1##*/}"
# primeiro token = binário
TERMINAL_BIN="${TERMINAL_FULL%% *}"
# último token = script
script="${TERMINAL_FULL##* }"
# meio = opções (tudo entre o primeiro e o último token)
tmp="${TERMINAL_FULL#* }" # remove o binário
TERMINAL_OPTS="${tmp% *}" # remove o script
;;
--app)
app_mode=1
match_by="instance"
shift
name="$1"
shift
app_cmd="$@"
;;
--appc)
app_mode=1
match_by="class"
shift
name="$1"
shift
app_cmd="$@"
;;
--appn)
app_mode=1
match_by="title"
shift
name="$1"
shift
app_cmd="$@"
;;
'')
echo "Uso: ${0##*/} SCRIPT"
echo " ${0##*/} --term 'TERMINAL OPTS' SCRIPT"
echo " ${0##*/} --app INSTANCE COMANDO"
echo " ${0##*/} --appc CLASS COMANDO"
echo " ${0##*/} --appn 'TITULO' COMANDO"
exit 1
;;
*)
name="${1##*/}"
script="$1"
shift
term_opts="$@"
;;
esac
_log() { logger -t ddspawn "$name: $*"; }
# --- lock: só uma instância por name ---
safe_name="${name// /_}"
LOCKFILE="/tmp/ddspawn_${safe_name}.lock"
exec 9>"$LOCKFILE" || exit 1
if ! flock -n 9; then
_log "another instance running"
exit 0
fi
_get_xid() {
case "$match_by" in
class) xdotool search --class "$name" 2>/dev/null | head -1 ;;
instance) xdotool search --classname "$name" 2>/dev/null | head -1 ;;
title) xdotool search --name "$name" 2>/dev/null | head -1 ;;
esac
}
_exists() { [ -n "$(_get_xid)" ]; }
_is_visible() {
case "$match_by" in
class) xdotool search --onlyvisible --class "$name" >/dev/null 2>&1 ;;
instance) xdotool search --onlyvisible --classname "$name" >/dev/null 2>&1 ;;
title) xdotool search --onlyvisible --name "$name" >/dev/null 2>&1 ;;
esac
}
_in_scratchpad() {
$I3MSG -t get_tree | python3 -c "
import sys, json
def matches(node):
props = node.get('window_properties', {})
if '$match_by' == 'title':
val = node.get('name', '') or ''
else:
val = props.get('$match_by', '') or ''
return '$name'.lower() in val.lower()
def find(node, in_scratch=False):
if node.get('name') == '__i3_scratch':
in_scratch = True
if matches(node):
return in_scratch
for child in node.get('nodes', []) + node.get('floating_nodes', []):
result = find(child, in_scratch)
if result is not None:
return result
return None
data = json.load(sys.stdin)
result = find(data)
sys.exit(0 if result else 1)
"
}
_i3_selector() {
case "$match_by" in
class) echo "class=\"$name\"" ;;
instance) echo "instance=\"$name\"" ;;
title) echo "title=\"$name\"" ;;
esac
}
_spawn() {
_log "spawning"
_log "NAME = $name"
_log "TERMINAL= $TERMINAL"
_log "TERMINAL_BIN = $TERMINAL_BIN"
local cmd
if [ "$app_mode" = 1 ]; then
cmd="$app_cmd"
_log "launch: $cmd"
$I3MSG "exec --no-startup-id $cmd"
else
case "$TERMINAL" in
*rxvt* | *urxvt*) name_opt="-name" ;;
*) name_opt="-n" ;;
esac
$I3MSG "exec --no-startup-id $TERMINAL_BIN $TERMINAL_OPTS $name_opt $name -e $script"
_log "$TERMINAL_BIN $TERMINAL_OPTS $name_opt $name -e $script"
fi
local i=0
while [ $i -lt 50 ]; do
[ -n "$(_get_xid)" ] && {
_log "found after $((i * 100))ms"
return 0
}
sleep 0.1
i=$((i + 1))
done
_log "ERROR: window '$name' never appeared"
exit 1
}
_animate_resize() {
local sel="$1"
local target_w="$2"
local target_h="$3"
local steps=8
local start_w=800
local start_h=500
local i w h
for ((i = 1; i <= steps; i++)); do
w=$((start_w + (target_w - start_w) * i / steps))
h=$((start_h + (target_h - start_h) * i / steps))
$I3MSG "[$sel] resize set $w $h; [$sel] move position center"
sleep 0.015
done
}
_show() {
_log "showing"
local sel="$(_i3_selector)"
local size_file="/tmp/ddspawn_${name// /}.size"
local default_size="1920x1044"
_log "size_file=$size_file"
if [ ! -f "$size_file" ]; then
_log "size file not found, creating default: $default_size"
printf '%s\n' "$default_size" >"$size_file"
fi
local w h
w=$(cut -dx -f1 "$size_file")
h=$(cut -dx -f2 "$size_file")
_log "show at ${w}x${h}"
# if resize ON, comment this line
$I3MSG "[$sel] scratchpad show; \
[$sel] fullscreen disable; \
[$sel] resize set $w $h; \
[$sel] move position center"
# Enable resize
# $I3MSG "[$sel] scratchpad show; [$sel] fullscreen disable"
# _animate_resize "$sel" "$w" "$h"
}
_hide() {
local sel="$(_i3_selector)"
_log "hide"
$I3MSG "[$sel] fullscreen disable; \
[$sel] move scratchpad"
}
_move_to_scratchpad() {
local sel="$(_i3_selector)"
$I3MSG "[$sel] move scratchpad"
}
# --- toggle ---
if ! _exists; then
_log "not found, spawning"
_spawn
sleep 0.2
_move_to_scratchpad
sleep 0.1
_show
elif _in_scratchpad; then
_log "hidden/in scratchpad, showing"
_show
else
_log "visible, hiding"
_hide
fi
#!/bin/bash
export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
RANGER=/usr/bin/ranger
LASTDIR=/tmp/rangerdd.lastdir
# restaura último diretório se existir
if [ -f "$LASTDIR" ]; then
dir=$(<"$LASTDIR")
[ -d "$dir" ] && cd "$dir"
fi
NDE_APP_CONFIG=/home/ivan/.config/nvim-pde \
NVIM_APPNAME=nvim-pde \
EDITOR=/home/linuxbrew/.linuxbrew/bin/nvim \
exec $RANGER --choosedir="$LASTDIR"
#!/bin/sh
# tmuxdd -- abre ou reconecta sessão tmux fixa
TMUX=/home/linuxbrew/.linuxbrew/bin/tmux
SESSION="work"
# reconecta se existir, cria se não existir
$TMUX has-session -t "$SESSION" 2>/dev/null &&
exec $TMUX attach-session -t "$SESSION" ||
exec $TMUX new-session -s "$SESSION"
#!/bin/sh
# toggle zathura -- não spawna, só mostra/esconde o que já existe
I3MSG="/usr/bin/i3-msg"
name="org.pwmt.zathura"
_exists() {
xdotool search --classname "$name" >/dev/null 2>&1
}
_is_visible() {
xdotool search --onlyvisible --classname "$name" >/dev/null 2>&1
}
_show() {
$I3MSG "[instance=\"$name\"] scratchpad show; \
[instance=\"$name\"] move position center; \
[instance=\"$name\"] fullscreen enable"
}
_hide() {
$I3MSG "[instance=\"$name\"] fullscreen disable; \
[instance=\"$name\"] scratchpad show"
}
# _hide() {
# $I3MSG "[instance=\"$name\"] scratchpad show"
# }
_move_to_scratchpad() {
$I3MSG "[instance=\"$name\"] move scratchpad"
}
if ! _exists; then
# zathura não está aberto, não faz nada
notify-send "zathura" "Nenhuma janela aberta" 2>/dev/null
exit 0
elif _is_visible; then
_hide
else
# garante que está no scratchpad antes de mostrar
_move_to_scratchpad 2>/dev/null
sleep 0.1
_show
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment