diff options
| author | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-28 22:47:28 -0500 | 
|---|---|---|
| committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-28 22:47:28 -0500 | 
| commit | 9d7c46cb29293c5f553f1204c25d9afa7506f8c2 (patch) | |
| tree | 34f95a3eae0c0adacd3d766c4478195f0c8d32d3 | |
| parent | ad8a5145c3db84ae34d2f475eff35427640ba64b (diff) | |
| parent | d1f9ee5eced0c273de6c598f88ddb0f7b4e54230 (diff) | |
| download | dotconfig-9d7c46cb29293c5f553f1204c25d9afa7506f8c2.tar.xz dotconfig-9d7c46cb29293c5f553f1204c25d9afa7506f8c2.zip  | |
Merge branch 'master' of localgit:dotconfig
| -rw-r--r-- | awesome/bar.lua | 16 | ||||
| -rw-r--r-- | awesome/keybindings.lua | 9 | ||||
| -rw-r--r-- | awesome/layouts.lua | 1 | ||||
| -rw-r--r-- | awesome/manage.lua | 15 | ||||
| -rw-r--r-- | awesome/noborders.lua | 20 | ||||
| -rw-r--r-- | awesome/rc.lua | 8 | ||||
| -rw-r--r-- | awesome/rules.lua | 13 | ||||
| -rw-r--r-- | awesome/screen.lua | 4 | ||||
| -rw-r--r-- | awesome/signals.lua | 66 | ||||
| -rw-r--r-- | awesome/sloppyfocus.lua | 7 | ||||
| -rw-r--r-- | awesome/theme.lua | 14 | ||||
| -rw-r--r-- | awesome/todo | 18 | ||||
| -rw-r--r-- | awesome/util/seasonalwallpaper.lua | 17 | ||||
| -rw-r--r-- | awesome/warpcursor.lua | 22 | ||||
| -rw-r--r-- | awesome/widgets/classiclayoutbox.lua | 92 | 
15 files changed, 174 insertions, 148 deletions
diff --git a/awesome/bar.lua b/awesome/bar.lua index e9465d3..285ffe6 100644 --- a/awesome/bar.lua +++ b/awesome/bar.lua @@ -67,22 +67,6 @@ local tasklist_buttons = gears.table.join(  ) - ---local function set_wallpaper(s) ---	-- Wallpaper ---	if beautiful.wallpaper then ---		local wallpaper = beautiful.wallpaper ---		-- If wallpaper is a function, call it with the screen ---		if type(wallpaper) == "function" then ---			wallpaper = wallpaper(s) ---		end ---		gears.wallpaper.maximized(wallpaper, s, true) ---	end ---end - --- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) ---screen.connect_signal("property::geometry", set_wallpaper) -  awful.screen.connect_for_each_screen(function (s)  	awful.tag({"1", "2", "3", "4", "5", "6", "7", "8", "9"}, s, awful.layout.layouts[1])  	s.mypromptbox = awful.widget.prompt() diff --git a/awesome/keybindings.lua b/awesome/keybindings.lua index ec5475a..7908281 100644 --- a/awesome/keybindings.lua +++ b/awesome/keybindings.lua @@ -6,6 +6,7 @@ local menubar = require("menubar")  -- when client with a matching name is opened:  -- require("awful.hotkeys_popup.keys") +-- Shortcuts for readable keybinds  local super = "Mod4"  local alt   = "Mod1"  local shift = "Shift" @@ -57,8 +58,8 @@ globalkeys = gears.table.join(  	key(w , "h",      function () awful.tag.incmwfact(-0.05)               end, { group = "layout"  , description = "decrease master width factor" }),  	key(ws, "h",      function () awful.tag.incnmaster( 1, nil, true)      end, { group = "layout"  , description = "increase the number of master clients" }),  	key(ws, "l",      function () awful.tag.incnmaster(-1, nil, true)      end, { group = "layout"  , description = "decrease the number of master clients" }), -	key(wc, "h",      function () awful.tag.incncol( 1, nil, true)         end, { group = "layout"  , description = "increase the number of columns" }), -	key(wc, "l",      function () awful.tag.incncol(-1, nil, true)         end, { group = "layout"  , description = "decrease the number of columns" }), +	--key(wc, "h",      function () awful.tag.incncol( 1, nil, true)         end, { group = "layout"  , description = "increase the number of columns" }), +	--key(wc, "l",      function () awful.tag.incncol(-1, nil, true)         end, { group = "layout"  , description = "decrease the number of columns" }),  	key(w , "m",      function () awful.layout.set(awful.layout.suit.max)  end, { group = "layout"  , description = "change to max layout" }),  	key(w , "t",      function () awful.layout.set(awful.layout.suit.tile) end, { group = "layout"  , description = "change to tile layout" }),  	key(w , "r",      function () awful.screen.focused().mypromptbox:run() end, { group = "launcher", description = "run prompt" }), @@ -95,11 +96,11 @@ globalkeys = gears.table.join(  local beautiful = require("beautiful")  local function protectClient(c)  	c.prevent_kill = true -	c.border_width = beautiful.border_width * 3 +	c.screen:emit_signal("arrange")  end  local function unProtectClient(c)  	c.prevent_kill = false -	c.border_width = beautiful.border_width +	c.screen:emit_signal("arrange")  end  local function killClient(c)  	if c.prevent_kill == nil or not c.prevent_kill then diff --git a/awesome/layouts.lua b/awesome/layouts.lua index 0e65017..6143c2c 100644 --- a/awesome/layouts.lua +++ b/awesome/layouts.lua @@ -3,7 +3,6 @@ local awful = require("awful")  -- Table of layouts to cover with awful.layout.inc, order matters.  awful.layout.layouts = { -	-- awful.layout.suit.tile.right,  	awful.layout.suit.tile,  	awful.layout.suit.max,  	awful.layout.suit.floating, diff --git a/awesome/manage.lua b/awesome/manage.lua new file mode 100644 index 0000000..5b1bd40 --- /dev/null +++ b/awesome/manage.lua @@ -0,0 +1,15 @@ +local awful = require("awful") + +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c) +	-- Set the windows at the slave, +	-- i.e. put it at the end of others instead of setting it master. +	if not awesome.startup then +		awful.client.setslave(c) +	end + +	if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then +		-- Prevent clients from being unreachable after screen count changes. +		awful.placement.no_offscreen(c) +	end +end) diff --git a/awesome/noborders.lua b/awesome/noborders.lua new file mode 100644 index 0000000..fe67024 --- /dev/null +++ b/awesome/noborders.lua @@ -0,0 +1,20 @@ +local beautiful = require("beautiful") + +-- TODO this function will call arrange multiple times. once per each change of c.border_width +local function update_borders(s) +	local max = s.selected_tag.layout.name == "max" +	local only_one = #s.tiled_clients == 1 -- use tiled_clients so that other floating windows don't affect the count + +	-- but iterate over clients instead of tiled_clients as tiled_clients doesn't include maximized windows +	for _, c in pairs(s.clients) do +		if c.prevent_kill then +			c.border_width = beautiful.border_width * 3 +		elseif (max or only_one or c.maximized) and not c.floating then +			c.border_width = 0 +		else +			c.border_width = beautiful.border_width +		end +	end +end + +screen.connect_signal("arrange", update_borders) -- NOTE this signal may eventually be deprecated. see issue #2581 and the v5 milestone on github diff --git a/awesome/rc.lua b/awesome/rc.lua index 849ecb2..1bcbaa8 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -7,10 +7,14 @@ require("errors")  require("layouts")  require("theme")  -- Load before bar  require("bar") +require("screen")  require("mouse")  require("keybindings")  require("rules") -require("signals") -require("tagnames") +require("manage") +require("noborders") +require("warpcursor") +require("sloppyfocus") +--require("tagnames")  --require("widgets.audio") diff --git a/awesome/rules.lua b/awesome/rules.lua index 16ac074..3f57080 100644 --- a/awesome/rules.lua +++ b/awesome/rules.lua @@ -14,9 +14,20 @@ awful.rules.rules = {  			buttons = clientbuttons,  			screen = awful.screen.preferred,  			placement = awful.placement.no_overlap+awful.placement.no_offscreen, -			prevent_kill = false +			prevent_kill = false,  		}  	}, +	-- warp cursor +	{ rule_any = { class = { +		"Chromium-browser", +		"Firefox", +		"Firefox-esr", +		"Gimp", +		"KeePassXC", +		"Pcmanfm", +		}}, +		properties = { warp_cursor = true, } +	},  	{ rule = { class = "KeePassXC" },  		-- except = { name = "Unlock Database - KeePassXC" },  -- Not needed  		properties = { diff --git a/awesome/screen.lua b/awesome/screen.lua new file mode 100644 index 0000000..dc01e2c --- /dev/null +++ b/awesome/screen.lua @@ -0,0 +1,4 @@ +local awful = require("awful") + +-- change wallpaper when screen geometry changes +screen.connect_signal("property::geometry", function () awful.spawn("seasonalwallpaper") end) diff --git a/awesome/signals.lua b/awesome/signals.lua deleted file mode 100644 index f0d0149..0000000 --- a/awesome/signals.lua +++ /dev/null @@ -1,66 +0,0 @@ -local awful = require("awful") -local beautiful = require("beautiful") - --- {{{ Signals --- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c) -    -- Set the windows at the slave, -    -- i.e. put it at the end of others instead of setting it master. -    if not awesome.startup then awful.client.setslave(c) end - -    if awesome.startup -      and not c.size_hints.user_position -      and not c.size_hints.program_position then -        -- Prevent clients from being unreachable after screen count changes. -        awful.placement.no_offscreen(c) -    end -end) - ----- Add a titlebar if titlebars_enabled is set to true in the rules. ---client.connect_signal("request::titlebars", function(c) ---    -- buttons for the titlebar ---    local buttons = gears.table.join( ---        awful.button({ }, 1, function() ---            c:emit_signal("request::activate", "titlebar", {raise = true}) ---            awful.mouse.client.move(c) ---        end), ---        awful.button({ }, 3, function() ---            c:emit_signal("request::activate", "titlebar", {raise = true}) ---            awful.mouse.client.resize(c) ---        end) ---    ) --- ---    awful.titlebar(c) : setup { ---        { -- Left ---            awful.titlebar.widget.iconwidget(c), ---            buttons = buttons, ---            layout  = wibox.layout.fixed.horizontal ---        }, ---        { -- Middle ---            { -- Title ---                align  = "center", ---                widget = awful.titlebar.widget.titlewidget(c) ---            }, ---            buttons = buttons, ---            layout  = wibox.layout.flex.horizontal ---        }, ---        { -- Right ---            awful.titlebar.widget.floatingbutton (c), ---            awful.titlebar.widget.maximizedbutton(c), ---            awful.titlebar.widget.stickybutton   (c), ---            awful.titlebar.widget.ontopbutton    (c), ---            awful.titlebar.widget.closebutton    (c), ---            layout = wibox.layout.fixed.horizontal() ---        }, ---        layout = wibox.layout.align.horizontal ---    } ---end) - --- Enable sloppy focus, so that focus follows mouse. -client.connect_signal("mouse::enter", function(c) -    c:emit_signal("request::activate", "mouse_enter", {raise = false}) -end) - -client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) --- }}} diff --git a/awesome/sloppyfocus.lua b/awesome/sloppyfocus.lua new file mode 100644 index 0000000..e6b7e4e --- /dev/null +++ b/awesome/sloppyfocus.lua @@ -0,0 +1,7 @@ +local beautiful = require("beautiful") + +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) +	c:emit_signal("request::activate", "mouse_enter", { raise = false }) +end) + diff --git a/awesome/theme.lua b/awesome/theme.lua index cdf6f2e..e48c1ce 100644 --- a/awesome/theme.lua +++ b/awesome/theme.lua @@ -3,13 +3,17 @@ local beautiful = require("beautiful")  local gears = require("gears")  -- Themes define colours, icons, font and wallpapers. --- beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")  beautiful.init(gears.filesystem.get_themes_dir() .. "gtk/theme.lua")  beautiful.useless_gap = 0 +beautiful.gap_single_client = false  --beautiful.layoutlist_font = "Monospace 8" -beautiful.font = "Tamzen 10" -beautiful.taglist_font = "Tamzen 10" -beautiful.tasklist_font = "Tamzen 10" -beautiful.tasklist_font_focus = "Tamzen 10" +--beautiful.font = "Tamzen 10" +--beautiful.taglist_font = "Tamzen 10" +--beautiful.tasklist_font = beautiful.font +beautiful.tasklist_font_focus = beautiful.font -- prevent bold  beautiful.tasklist_align = "center"  -- does nothing?  beautiful.wibar_height = "18" + +-- Set border on clients +client.connect_signal("focus",   function(c) c.border_color = beautiful.border_focus  end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) diff --git a/awesome/todo b/awesome/todo index f20b248..70b1646 100644 --- a/awesome/todo +++ b/awesome/todo @@ -1,17 +1,23 @@ -seasonalwallpaper -mouse warping window rule -singular borders / no border on screen edges -gaps -layout shown in bar -mouse ctrl layout sizes +gaps keybinds  client mfact/fact  hostname configs  volume widget & dropdown menu  battery widget  bar styling / powerline for certain confs  net widget +classiclayout widget minify +widget icons +bar title tabs in monocle mode +better tagnames +volume/cpu graph/etc in middle right bar when hovering over stats +new windows should open on the tags activated when spawn was ran + +# BUGS +warp cursor is bugged  #general  other layouts +floating support +tabbing support  cleanup diff --git a/awesome/util/seasonalwallpaper.lua b/awesome/util/seasonalwallpaper.lua index 230986a..4ec3bb3 100644 --- a/awesome/util/seasonalwallpaper.lua +++ b/awesome/util/seasonalwallpaper.lua @@ -1,4 +1,5 @@  local gears = require("gears") +local beautiful = require("beautiful")  local wallpapers_directory = gears.get_xdg_data_home() .. "wallpaper"  local spring = wallpapers_directory .. "/spring" @@ -7,3 +8,19 @@ local fall   = wallpapers_directory .. "/fall"  local winter = wallpapers_directory .. "/winter" + +--local function set_wallpaper(s) +--	-- Wallpaper +--	if beautiful.wallpaper then +--		local wallpaper = beautiful.wallpaper +--		-- If wallpaper is a function, call it with the screen +--		if type(wallpaper) == "function" then +--			wallpaper = wallpaper(s) +--		end +--		gears.wallpaper.maximized(wallpaper, s, true) +--	end +--end + +function set_wallpaper() +	gt +end diff --git a/awesome/warpcursor.lua b/awesome/warpcursor.lua new file mode 100644 index 0000000..f1a46bd --- /dev/null +++ b/awesome/warpcursor.lua @@ -0,0 +1,22 @@ +function warp_cursor(c) +--	if c ~= client.focus or not c.warp_cursor then +	if not c.warp_cursor then +		return +	end + +	-- dont allow moving mouse unless it is over another client or over nothing +	local canmovemouse = mouse.current_client or (mouse.current_wibox or mouse.current_widget) == nil + +	if canmovemouse and mouse.current_client ~= c then +		mouse.coords { +			x = c.x + (c.width  / 2), +			y = c.y + (c.height / 2), +		} +	end +end + +client.connect_signal("focus", warp_cursor) +--client.connect_signal("property::size", warp_cursor) +--client.connect_signal("property::position", warp_cursor) + +return warp_cursor diff --git a/awesome/widgets/classiclayoutbox.lua b/awesome/widgets/classiclayoutbox.lua index ac08671..818dc0f 100644 --- a/awesome/widgets/classiclayoutbox.lua +++ b/awesome/widgets/classiclayoutbox.lua @@ -33,7 +33,7 @@ local layout_icons = {  }  local function get_screen(s) -return s and capi.screen[s] +	return s and capi.screen[s]  end  local layoutbox = { mt = {} } @@ -41,24 +41,25 @@ local layoutbox = { mt = {} }  local boxes = nil  local function update(w, screen) -screen = get_screen(screen) -local name = layout.getname(layout.get(screen)) -w._layoutbox_tooltip:set_text(name or "[no name]") +	screen = get_screen(screen) +	local name = layout.getname(layout.get(screen)) +	w._layoutbox_tooltip:set_text(name or "[no name]")  	if name == "max" and #screen.clients > 0 then -		w.textbox.text = "[" .. #screen.clients .. "]" +		w.textbox.text = " [" .. #screen.clients .. "] " -- TODO manage / unmanage signal  		return  	end -   	w.textbox.text = layout_icons[name] +	w.textbox.text = layout_icons[name] +	w.textbox.text = " " .. w.textbox.text .. " "  end  local function update_from_tag(t) -local screen = get_screen(t.screen) -local w = boxes[screen] -if w then -	update(w, screen) -end +	local screen = get_screen(t.screen) +	local w = boxes[screen] +	if w then +		update(w, screen) +	end  end  --- Create a layoutbox widget. It draws a picture with the current layout @@ -66,48 +67,45 @@ end  -- @param screen The screen number that the layout will be represented for.  -- @return An imagebox widget configured as a layoutbox.  function layoutbox.new(screen) -screen = get_screen(screen or 1) - --- Do we already have the update callbacks registered? -if boxes == nil then -	boxes = setmetatable({}, { __mode = "kv" }) -	capi.tag.connect_signal("property::selected", update_from_tag) -	capi.tag.connect_signal("property::layout", update_from_tag) -	capi.tag.connect_signal("property::screen", function() -		for s, w in pairs(boxes) do -			if s.valid then -				update(w, s) +	screen = get_screen(screen or 1) + +	-- Do we already have the update callbacks registered? +	if boxes == nil then +		boxes = setmetatable({}, { __mode = "kv" }) +		capi.tag.connect_signal("property::selected", update_from_tag) +		capi.tag.connect_signal("property::layout", update_from_tag) +		capi.tag.connect_signal("property::screen", function() +			for s, w in pairs(boxes) do +				if s.valid then +					update(w, s) +				end  			end -		end -	end) -	layoutbox.boxes = boxes -end +		end) +		layoutbox.boxes = boxes +	end --- Do we already have a layoutbox for this screen? -local w = boxes[screen] -if not w then -	w = wibox.widget { -		{ -			id     = "textbox", -			widget = wibox.widget.textbox -		}, -		layout = wibox.layout.fixed.horizontal -	} - -	w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1} - -	update(w, screen) -	boxes[screen] = w -end +	-- Do we already have a layoutbox for this screen? +	local w = boxes[screen] +	if not w then +		w = wibox.widget { +			{ +				id     = "textbox", +				widget = wibox.widget.textbox +			}, +			layout = wibox.layout.fixed.horizontal +		} + +		w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1} + +		update(w, screen) +		boxes[screen] = w +	end -return w +	return w  end  function layoutbox.mt:__call(...) -return layoutbox.new(...) +	return layoutbox.new(...)  end  return setmetatable(layoutbox, layoutbox.mt) - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -  | 
