diff options
-rw-r--r-- | scroll/config | 39 | ||||
-rw-r--r-- | scroll/scripts/scratchpad.lua | 35 |
2 files changed, 53 insertions, 21 deletions
diff --git a/scroll/config b/scroll/config index 2b18e24..34eaaee 100644 --- a/scroll/config +++ b/scroll/config @@ -25,6 +25,9 @@ set $dmenu dmenu_run -l 15 # Your preferred file manager set $filemanager kitty -e lf +# The scripts directory +set $scripts $home/.config/scroll/scripts + exec waybar exec hypridle exec hyprpaper @@ -114,10 +117,10 @@ animations { bindsym $mod+Ctrl+Backspace kill all # Start your launcher - bindsym $mod+r exec $rmenu + bindsym $mod+e exec $rmenu bindsym $mod+d exec $dmenu - bindsym $mod+e exec $filemanager + bindsym $mod+Alt+f exec $filemanager # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. @@ -233,8 +236,8 @@ animations { # # Make the current focus fullscreen bindsym $mod+f fullscreen - bindsym $mod+Shift+f fullscreen global - bindsym $mod+Alt+f fullscreen_application toggle + #bindsym $mod+Shift+f fullscreen global + bindsym $mod+Shift+f fullscreen_application toggle bindsym $mod+Ctrl+Alt+f fullscreen_application reset # Toggle the current focus between tiling and floating mode @@ -497,39 +500,45 @@ bindgesture swipe:4:left workspace prev bindgesture swipe:4:up scale_workspace overview # Enable window swallowing (of mpv specifically) -lua $home/.config/scroll/scripts/swallow.lua +lua $scripts/swallow.lua # Scratchpads for_window [app_id="sphtop"] move scratchpad for_window [app_id="sphtop"] scratchpad show -bindsym $mod+Ctrl+z lua $home/.config/scroll/scripts/scratchpad.lua sphtop htop +bindsym $mod+Ctrl+z lua $scripts/scratchpad.lua sphtop kitty htop for_window [app_id="spterm"] move scratchpad for_window [app_id="spterm"] scratchpad show -bindsym $mod+Ctrl+x lua $home/.config/scroll/scripts/scratchpad.lua spterm +bindsym $mod+Ctrl+x lua $scripts/scratchpad.lua spterm kitty for_window [app_id="sppmxr"] move scratchpad for_window [app_id="sppmxr"] scratchpad show -bindsym $mod+Ctrl+c lua $home/.config/scroll/scripts/scratchpad.lua sppmxr pulsemixer +bindsym $mod+Ctrl+c lua $scripts/scratchpad.lua sppmxr kitty pulsemixer for_window [app_id="spblue"] move scratchpad for_window [app_id="spblue"] scratchpad show -bindsym $mod+Ctrl+v lua $home/.config/scroll/scripts/scratchpad.lua spblue bluetoothctl +bindsym $mod+Ctrl+v lua $scripts/scratchpad.lua spblue kitty bluetoothctl for_window [app_id="spncmp"] move scratchpad for_window [app_id="spncmp"] scratchpad show -bindsym $mod+Ctrl+b lua $home/.config/scroll/scripts/scratchpad.lua spncmp ncmpcpp +bindsym $mod+Ctrl+b lua $scripts/scratchpad.lua spncmp kitty ncmpcpp for_window [app_id="spmutt"] move scratchpad for_window [app_id="spmutt"] scratchpad show -bindsym $mod+Ctrl+a lua $home/.config/scroll/scripts/scratchpad.lua spmutt neomutt +bindsym $mod+Ctrl+a lua $scripts/scratchpad.lua spmutt kitty neomutt for_window [app_id="spprof"] move scratchpad for_window [app_id="spprof"] scratchpad show -bindsym $mod+Ctrl+s lua $home/.config/scroll/scripts/scratchpad.lua spprof profanity +bindsym $mod+Ctrl+s lua $scripts/scratchpad.lua spprof kitty profanity for_window [app_id="spirss"] move scratchpad for_window [app_id="spirss"] scratchpad show -bindsym $mod+Ctrl+d lua $home/.config/scroll/scripts/scratchpad.lua spirss irssi +bindsym $mod+Ctrl+d lua $scripts/scratchpad.lua spirss kitty irssi for_window [app_id="sptodo"] move scratchpad for_window [app_id="sptodo"] scratchpad show -bindsym $mod+Ctrl+f lua $home/.config/scroll/scripts/scratchpad.lua sptodo todo +bindsym $mod+Ctrl+f lua $scripts/scratchpad.lua sptodo kitty todo for_window [app_id="sptrmc"] move scratchpad for_window [app_id="sptrmc"] scratchpad show -bindsym $mod+Ctrl+g lua $home/.config/scroll/scripts/scratchpad.lua sptrmc tremc +bindsym $mod+Ctrl+g lua $scripts/scratchpad.lua sptrmc kitty tremc +for_window [app_id="org.pipewire.Helvum"] move scratchpad +for_window [app_id="org.pipewire.Helvum"] scratchpad show +bindsym $mod+Ctrl+q lua $scripts/scratchpad.lua org.pipewire.Helvum helvum +for_window [app_id="com.github.wwmm.easyeffects"] move scratchpad +for_window [app_id="com.github.wwmm.easyeffects"] scratchpad show +bindsym $mod+Ctrl+e lua $scripts/scratchpad.lua com.github.wwmm.easyeffects easyeffects # # Workspace rules: diff --git a/scroll/scripts/scratchpad.lua b/scroll/scripts/scratchpad.lua index 7e078d6..6972843 100644 --- a/scroll/scripts/scratchpad.lua +++ b/scroll/scripts/scratchpad.lua @@ -1,15 +1,26 @@ local args, _ = ... local id = "" -local spawn = "" +local terminal = false +local command = nil for i, arg in ipairs(args) do if i <= 1 then - id = arg - else - spawn = spawn .. " " .. arg + id = arg + elseif i == 2 then + if (arg == "kitty") then + terminal = true + else + command = arg + --terminal = true + end + elseif (terminal == true) then + command = arg + break end end +--scroll.command(nil, "exec notify-send \"Spawn command\" \"" .. command .. "\"") + local function exists(id) local is_in_array = false local cons = scroll.scratchpad_get_containers() @@ -31,11 +42,23 @@ local function is_focused(id) return app_id == id end +local function spawn(term, comm) + if (term) then + if (comm) then + scroll.command(nil, "exec kitty --class " .. id .. " -e " .. comm) + else + scroll.command(nil, "exec kitty --class " .. id) + end + else + scroll.command(nil, "exec " .. comm) + end +end + if (not exists(id)) then - scroll.command(nil, "exec kitty --class " .. id .. spawn) + spawn(terminal, command) end if (is_focused(id)) then - scroll.command(nill, "scratchpad show") + scroll.command(nil, "scratchpad show") else scroll.command(nil, "[app_id=\"" .. id .. "\"] scratchpad show") end |