about summary refs log tree commit diff
path: root/awesome
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-06-12 21:26:56 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-06-12 21:26:56 +0700
commit88051c9ccfa9b863b41f0ae86dbb1caaeb739743 (patch)
treeb013742178c012abcb11d72e888be4b62105fc40 /awesome
parentc6b2aca48fc3aa2a0039a99aad8fdb13b926fa94 (diff)
downloaddotfiles-88051c9ccfa9b863b41f0ae86dbb1caaeb739743.tar.gz
Overhaul configurations
Diffstat (limited to 'awesome')
-rw-r--r--awesome/.config/awesome/rc.lua52
1 files changed, 36 insertions, 16 deletions
diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua
index 11140c7..a204762 100644
--- a/awesome/.config/awesome/rc.lua
+++ b/awesome/.config/awesome/rc.lua
@@ -1,17 +1,18 @@
--- Standard awesome library
-local gears = require"gears"
+-- Awesome library
 local awful = require"awful"
-require"awful.autofocus"
--- Widget and layout library
+local beautiful = require"beautiful"
+local gears = require"gears"
+local menubar = require"menubar"
+local naughty = require"naughty"
 local wibox = require"wibox"
+
+-- Awful submodules
+require"awful.autofocus"
+local show_help = require"awful.hotkeys_popup".widget.show_help
+
 -- Menu library
 local freedesktop = require"freedesktop"
--- Theme handling library
-local beautiful = require"beautiful"
--- Notification library
-local naughty = require"naughty"
-local menubar = require"menubar"
-local hotkeys_popup = require"awful.hotkeys_popup".widget
+
 -- System data library
 local vicious = require"vicious"
 
@@ -64,8 +65,9 @@ local play_pause = "playerctl play-pause"
 local rewind = "playerctl previous"
 local forward = "playerctl next"
 
-local scrot = "scrot /home/cnx/Desktop/%FT%T.png"
-local scrot_select = "scrot --border --select /home/cnx/Desktop/%FT%T.png"
+local home = os.getenv("HOME")
+local scrot = "scrot " .. home .. "/Desktop/%FT%T.png"
+local scrot_select = "scrot --border --select " .. home .. "/Desktop/%FT%T.png"
 
 -- Default modkey.
 -- Usually, Mod4 is the key with a logo between Control and Alt.
@@ -122,7 +124,7 @@ end
 -- {{{ Menu
 -- Create a launcher widget and a main menu
 local myawesomemenu = {
-  {"hotkeys", function () return false, hotkeys_popup.show_help end},
+  {"hotkeys", function () return false, show_help end},
   {"manual", terminal .. " -e man awesome"},
   {"edit config", editor .. " " .. awesome.conffile},
   {"restart", awesome.restart},
@@ -134,6 +136,24 @@ local mymainmenu = freedesktop.menu.build{
   after = {{"Open terminal", terminal}}
 }
 
+local function showclipboard()
+  local base = home .. "/.cache/threa/"
+  local command = "threac %s && xdotool key shift+Insert"
+  local f = io.open(base .. "order")
+  local order = f:read("*a")
+  f:close()
+
+  local items = {}
+  for c in order:gmatch(".") do
+    local f = io.open(base .. c)
+    table.insert(items, {f:read("*a"):gsub("\n", " "), function ()
+      awful.spawn.with_shell(command:format(c))
+    end})
+    f:close()
+  end
+  awful.menu{items = items, theme = {width = 911}}:show()
+end
+
 -- mylauncher = awful.widget.launcher{image = beautiful.awesome_icon,
 --                                    menu = mymainmenu}
 
@@ -420,7 +440,7 @@ end
 local globalkeys = awful.util.table.join(
   awful.key({modkey, "Control"}, "x", lua_prompt,
             {description = "execute prompt", group = "awesome"}),
-  awful.key({modkey, "Control"}, "s", hotkeys_popup.show_help,
+  awful.key({modkey, "Control"}, "s", show_help,
             {description="show help", group="awesome"}),
   awful.key({modkey}, "Left", awful.tag.viewprev,
             {description = "view previous", group = "tag"}),
@@ -435,6 +455,8 @@ local globalkeys = awful.util.table.join(
             {description = "focus previous by index", group = "client"}),
   awful.key({modkey}, "w", function () mymainmenu:show() end,
             {description = "show main menu", group = "awesome"}),
+  awful.key({modkey}, "d", showclipboard,
+            {description = "show clipboard", group = "awesome"}),
 
   -- Layout manipulation
   awful.key({modkey, "Shift"}, "j", function () awful.client.swap.byidx(1) end,
@@ -494,8 +516,6 @@ local globalkeys = awful.util.table.join(
             {description = "open Clojure interpreter", group = "launcher"}),
   awful.key({modkey}, "g", spawner(guile),
             {description = "open Guile interpreter", group = "launcher"}),
-  awful.key({modkey}, "d", spawner"diodon",
-            {description = "open clipboard manager", group = "launcher"}),
   awful.key({modkey}, "s", spawner"slock",
             {description = "lock screen", group = "launcher"}),
   awful.key({modkey, "Shift"}, "s", spawner(slock_suspend),