summaryrefslogtreecommitdiffstats
path: root/programs/dotfiles/awesome/scratch.lua
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2023-09-29 14:22:24 -0400
committerJon Santmyer <jon@jonsantmyer.com>2023-09-29 14:22:24 -0400
commitf819e30b03dffcf9e74af4b8552e4a8ab8f54c58 (patch)
treec05f4f1db738d6cd9d2824b5000c6afc3b1d61d1 /programs/dotfiles/awesome/scratch.lua
parentd3bb6cbb4724bc8f18f72fa3fea3e65f73ae8d09 (diff)
downloadnix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.tar.gz
nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.tar.bz2
nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.zip
major reorganizing to seperate modules
Diffstat (limited to 'programs/dotfiles/awesome/scratch.lua')
-rw-r--r--programs/dotfiles/awesome/scratch.lua54
1 files changed, 0 insertions, 54 deletions
diff --git a/programs/dotfiles/awesome/scratch.lua b/programs/dotfiles/awesome/scratch.lua
deleted file mode 100644
index aa1fd1e..0000000
--- a/programs/dotfiles/awesome/scratch.lua
+++ /dev/null
@@ -1,54 +0,0 @@
-local client = client
-
-local awful = require("awful")
-local util = require("awful.util")
-
-local scratch = {}
-
-local function activate(c)
- local ctag = awful.tag.selected(c.screen)
- ctags = {ctag}
- for k,tag in pairs(c:tags()) do
- if tag ~= ctag then table.insert(ctags, tag) end
- end
- c:tags(ctags)
- c:raise()
- client.focus = c
-end
-
-local function deactivate(c)
- local ctag = awful.tag.selected(c.screen)
- ctags = {}
- for k,tag in pairs(c:tags()) do
- if tag ~= ctag then table.insert(ctags, tag) end
- end
- c:tags(ctags)
-end
-
-function scratch.raise(cmd, rule)
- local rule = rule or { instance = "scratch" }
- local function match(c) return awful.rules.match(c, rule) end
-
- local clients = client.get()
- local findex = util.table.hasitem(clients, client.focus) or 1
- local start = util.cycle(#clients, findex + 1)
-
- for c in awful.client.iterate(match, start) do
- activate(c)
- return
- end
-
- util.spawn(cmd)
-end
-
-function scratch.toggle(cmd, rule)
- local rule = rule or { instance = "scratch" }
-
- if client.focus and awful.rules.match(client.focus, rule) then
- deactivate(client.focus)
- else
- scratch.raise(cmd)
- end
-end
-
-return scratch