Continue restructure
|  | @ -1,6 +1,6 @@ | |||
| local awful = require("awful") | ||||
| local lain = require("lain") | ||||
| local grid = require("layout.grid") | ||||
| local grid = require("components.layout.grid") | ||||
| local quake = lain.util.quake({app="alacritty", followtag=true, argname = '--class %s', extra="--option=window.opacity=1.0 --option=\"colors.primary.background='#000d2b'\" -e tmux", height=0.3}) | ||||
| 
 | ||||
| -- Import panels | ||||
|  |  | |||
|  | @ -8,14 +8,14 @@ local beautiful = require("beautiful") | |||
| local wibox = require("wibox") | ||||
| local theme = require("theme") | ||||
| local lain = require("lain") | ||||
| local tag_list = require("widgets.tag-list") | ||||
| local layout_box = require("widgets.layout-box") | ||||
| local battery_widget = require("widgets.battery-widget.battery") | ||||
| local volume_widget = require("widgets.volume-widget.volume") | ||||
| local tag_list = require("components.widgets.tag-list") | ||||
| local layout_box = require("components.widgets.layout-box") | ||||
| local battery_widget = require("components.widgets.battery-widget.battery") | ||||
| local volume_widget = require("components.widgets.volume-widget.volume") | ||||
| local pl = require("utils.powerline") | ||||
| 
 | ||||
| -- import widgets | ||||
| local task_list = require("widgets.task-list") | ||||
| local task_list = require("components.widgets.task-list") | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Custom Widgets | ||||
|  |  | |||
| Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 700 B | 
| Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB | 
| Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB | 
| Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB | 
| Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB | 
|  | @ -18,7 +18,7 @@ local theme = require("theme") | |||
| 
 | ||||
| local dpi = require('beautiful').xresources.apply_dpi | ||||
| local capi = {button = button} | ||||
| local ICON_DIR = gears.filesystem.get_configuration_dir() .. "/icons/" | ||||
| local ICON_DIR = gears.filesystem.get_configuration_dir() .. "/images/" | ||||
| 
 | ||||
| -- define module table | ||||
| local task_list = {} | ||||
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB | 
| Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB | 
| Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB | 
| Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B | 
|  | @ -13,7 +13,7 @@ local spawn = require("awful.spawn") | |||
| local gears = require("gears") | ||||
| local beautiful = require("beautiful") | ||||
| local watch = require("awful.widget.watch") | ||||
| local utils = require("widgets.volume-widget.utils") | ||||
| local utils = require("components.widgets.volume-widget.utils") | ||||
| 
 | ||||
| 
 | ||||
| local LIST_DEVICES_CMD = [[sh -c "pacmd list-sinks; pacmd list-sources"]] | ||||
|  | @ -24,11 +24,11 @@ local function TOG_VOLUME_CMD(device) return 'amixer -D ' .. device .. ' sset Ma | |||
| 
 | ||||
| 
 | ||||
| local widget_types = { | ||||
|     icon_and_text = require("widgets.volume-widget.widgets.icon-and-text-widget"), | ||||
|     icon = require("widgets.volume-widget.widgets.icon-widget"), | ||||
|     arc = require("widgets.volume-widget.widgets.arc-widget"), | ||||
|     horizontal_bar = require("widgets.volume-widget.widgets.horizontal-bar-widget"), | ||||
|     vertical_bar = require("widgets.volume-widget.widgets.vertical-bar-widget") | ||||
|     icon_and_text = require("components.widgets.volume-widget.widgets.icon-and-text-widget"), | ||||
|     icon = require("components.widgets.volume-widget.widgets.icon-widget"), | ||||
|     arc = require("components.widgets.volume-widget.widgets.arc-widget"), | ||||
|     horizontal_bar = require("components.widgets.volume-widget.widgets.horizontal-bar-widget"), | ||||
|     vertical_bar = require("components.widgets.volume-widget.widgets.vertical-bar-widget") | ||||
| } | ||||
| local volume = {} | ||||
| 
 | ||||
|  | @ -1,7 +1,7 @@ | |||
| local wibox = require("wibox") | ||||
| local beautiful = require('beautiful') | ||||
| 
 | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/widgets/volume-widget/icons/' | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/components/widgets/volume-widget/icons/' | ||||
| 
 | ||||
| local widget = {} | ||||
| 
 | ||||
|  | @ -2,7 +2,7 @@ local wibox = require("wibox") | |||
| local beautiful = require('beautiful') | ||||
| local gears = require("gears") | ||||
| 
 | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/widgets/volume-widget/icons/' | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/components/widgets/volume-widget/icons/' | ||||
| 
 | ||||
| local widget = {} | ||||
| 
 | ||||
|  | @ -3,7 +3,7 @@ local beautiful = require('beautiful') | |||
| 
 | ||||
| local widget = {} | ||||
| 
 | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/widgets/volume-widget/icons/' | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/components/widgets/volume-widget/icons/' | ||||
| 
 | ||||
| function widget.get_widget(widgets_args) | ||||
|     local args = widgets_args or {} | ||||
|  | @ -2,7 +2,7 @@ local wibox = require("wibox") | |||
| 
 | ||||
| local widget = {} | ||||
| 
 | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/widgets/volume-widget/icons/' | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/components/widgets/volume-widget/icons/' | ||||
| 
 | ||||
| function widget.get_widget(widgets_args) | ||||
|     local args = widgets_args or {} | ||||
|  | @ -2,7 +2,7 @@ local wibox = require("wibox") | |||
| local beautiful = require('beautiful') | ||||
| local gears = require("gears") | ||||
| 
 | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/widgets/volume-widget/icons/' | ||||
| local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/components/widgets/volume-widget/icons/' | ||||
| 
 | ||||
| local widget = {} | ||||
| 
 | ||||
| Before Width: | Height: | Size: 894 B After Width: | Height: | Size: 894 B | 
| Before Width: | Height: | Size: 961 KiB After Width: | Height: | Size: 961 KiB | 
|  | @ -1,21 +1,8 @@ | |||
| --        ██╗  ██╗███████╗██╗    ██╗███████╗ | ||||
| --        ██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝ | ||||
| --        █████╔╝ █████╗    ╚████╔╝ ███████╗ | ||||
| --        ██╔═██╗ ██╔══╝     ╚██╔╝  ╚════██║ | ||||
| --        ██║  ██╗███████╗    ██║   ███████║ | ||||
| --        ╚═╝  ╚═╝╚══════╝    ╚═╝   ╚══════╝ | ||||
| 
 | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Initialization | ||||
| -- =================================================================== | ||||
| 
 | ||||
| 
 | ||||
| local awful = require("awful") | ||||
| local gears = require("gears") | ||||
| local naughty = require("naughty") | ||||
| local beautiful = require("beautiful") | ||||
| local volume_widget = require("widgets.volume-widget.volume") | ||||
| local volume_widget = require("components.widgets.volume-widget.volume") | ||||
| local dpi = beautiful.xresources.apply_dpi | ||||
| 
 | ||||
| local modkey = "Mod4" | ||||
|  | @ -185,7 +172,7 @@ keys.globalkeys = gears.table.join( | |||
|             if c and c.class == "Alacritty" then | ||||
|                 awful.spawn(string.format(os.getenv("XDG_CONFIG_HOME") .. "/awesome/scripts/launch_alacritty.sh %d", c.pid)) | ||||
|             else | ||||
|                 awful.spawn(apps.terminal) | ||||
|                 awful.spawn('bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"') | ||||
|             end | ||||
|         end, | ||||
|         {description = "open a terminal", group = "launcher"} | ||||
|  | @ -334,7 +321,7 @@ keys.globalkeys = gears.table.join( | |||
|     -- Screenshot on prtscn using scrot | ||||
|     awful.key({}, "Print", | ||||
|         function() | ||||
|             awful.spawn(apps.screenshot, false) | ||||
|             awful.spawn("scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'", false) | ||||
|         end | ||||
|     ), | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										121
									
								
								awesome/rc.lua
								
								
								
								
							
							
						
						|  | @ -1,29 +1,19 @@ | |||
| --       █████╗ ██╗    ██╗███████╗███████╗ ██████╗ ███╗   ███╗███████╗ | ||||
| --      ██╔══██╗██║    ██║██╔════╝██╔════╝██╔═══██╗████╗ ████║██╔════╝ | ||||
| --      ███████║██║ █╗ ██║█████╗  ███████╗██║   ██║██╔████╔██║█████╗ | ||||
| --      ██╔══██║██║███╗██║██╔══╝  ╚════██║██║   ██║██║╚██╔╝██║██╔══╝ | ||||
| --      ██║  ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗ | ||||
| --      ╚═╝  ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝ | ||||
| 
 | ||||
| 
 | ||||
| -- Standard awesome libraries | ||||
| local gears = require("gears") | ||||
| local awful = require("awful") | ||||
| local grid = require("layout.grid") | ||||
| local mouse_utils = require("utils.mouse") | ||||
| 
 | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- User Configuration | ||||
| -- =================================================================== | ||||
| -- Local imports | ||||
| local grid = require("components.layout.grid") | ||||
| 
 | ||||
| -- Load components | ||||
| require("components.notifications") | ||||
| require("components.screen") | ||||
| require("utils.signals") | ||||
| 
 | ||||
| -- Autofocus a new client when previously focused one is closed | ||||
| require("awful.autofocus") | ||||
| 
 | ||||
| -- define default apps (global variable so other components can access it) | ||||
| apps = { | ||||
|     terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"', | ||||
|     launcher = "/home/user/.toggle_rofi.sh", | ||||
|     screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'", | ||||
| } | ||||
| 
 | ||||
| -- List of apps to run on start-up | ||||
| local run_on_start_up = { | ||||
|  | @ -32,15 +22,10 @@ local run_on_start_up = { | |||
|      "xcape -e \"Super_L=Super_L|XF86Launch5\" -t 5000", | ||||
|      "xmodmap /home/user/.Xmodmap", | ||||
|      os.getenv("XDG_CONFIG_HOME") .. "/awesome/scripts/setup_display.sh", | ||||
|      "feh --no-fehbg --bg-fill " .. gears.filesystem.get_configuration_dir() .. "/wallpaper/wallpaper.png", | ||||
|      -- "/opt/power/powersave.sh", | ||||
|      -- os.getenv("XDG_CONFIG_HOME") .. "/awesome/scripts/setup_display.sh" | ||||
| } | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Initialization | ||||
| -- =================================================================== | ||||
| 
 | ||||
| -- Define layouts | ||||
| awful.layout.layouts = { | ||||
|      grid, | ||||
|  | @ -54,9 +39,6 @@ awful.layout.layouts = { | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| -- Import notification appearance | ||||
| require("components.notifications") | ||||
| require("components.screen") | ||||
| 
 | ||||
| -- Run all the apps listed in run_on_start_up | ||||
| for _, app in ipairs(run_on_start_up) do | ||||
|  | @ -65,7 +47,7 @@ for _, app in ipairs(run_on_start_up) do | |||
|     if firstspace then | ||||
|         findme = app:sub(0, firstspace - 1) | ||||
|     end | ||||
|     -- pipe commands to bash to allow command to be shell agnostic | ||||
|     -- Run commands only if it's not already running. | ||||
|     awful.spawn.with_shell(string.format("echo 'pgrep -u $USER -x %s > /dev/null || (%s)' | bash -", findme, app), false) | ||||
| end | ||||
| 
 | ||||
|  | @ -81,86 +63,3 @@ root.buttons(keys.desktopbuttons) | |||
| -- Import rules | ||||
| local create_rules = require("rules").create | ||||
| awful.rules.rules = create_rules(keys.clientkeys, keys.clientbuttons) | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Client Focusing | ||||
| -- =================================================================== | ||||
| 
 | ||||
| 
 | ||||
| -- Autofocus a new client when previously focused one is closed | ||||
| require("awful.autofocus") | ||||
| 
 | ||||
| -- Focus clients under mouse | ||||
| client.connect_signal("mouse::enter", function(c) | ||||
|     c:emit_signal("request::activate", "mouse_enter", {raise = false}) | ||||
| end) | ||||
| 
 | ||||
| 
 | ||||
| -- Signal function to execute when a new client appears. | ||||
| client.connect_signal("manage", function (c) | ||||
|     -- Set the window as a slave (put it at the end of others instead of setting it as 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 | ||||
| 
 | ||||
|     gears.timer.delayed_call(function() | ||||
|         local geometry = c:geometry() | ||||
|         local x = geometry.x + geometry.width/2 | ||||
|         local y = geometry.y + geometry.height/2 | ||||
|         mouse.coords({x = x, y = y}, true) | ||||
|     end) | ||||
| end) | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Screen Change Functions (ie multi monitor) | ||||
| -- =================================================================== | ||||
| 
 | ||||
| 
 | ||||
| -- Reload config when screen geometry changes | ||||
| screen.connect_signal("property::geometry", awesome.restart) | ||||
| 
 | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Garbage collection (allows for lower memory consumption) | ||||
| -- =================================================================== | ||||
| 
 | ||||
| 
 | ||||
| collectgarbage("setpause", 110) | ||||
| collectgarbage("setstepmul", 1000) | ||||
| 
 | ||||
| client.connect_signal("property::maximized", function(focused) | ||||
|      local hide = focused.maximized or focused.fullscreen | ||||
|      for i, c in ipairs(client.get()) do | ||||
|          if not c.floating and c.screen == focused.screen and c.first_tag == focused.first_tag then | ||||
|              c.minimized = hide | ||||
|          end | ||||
|      end | ||||
| 
 | ||||
|      focused.minimized = false | ||||
| end) | ||||
| 
 | ||||
| client.connect_signal("unmanage", function(unmanaged) | ||||
|     if unmanaged.maximized then | ||||
|         for i, c in ipairs(client.get()) do | ||||
|             if not c.floating and c.screen == unmanaged.screen then | ||||
|                 c.minimized = false | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end) | ||||
| 
 | ||||
| client.connect_signal("focus", function(c) | ||||
|     if #c.screen.clients > 1 then | ||||
|           c.border_color = beautiful.border_focus | ||||
|     end | ||||
|     gears.timer.delayed_call(mouse_utils.move_mouse_onto_focused_client) | ||||
| end) | ||||
| 
 | ||||
| client.connect_signal("unfocus", function(c) | ||||
|   c.border_color = beautiful.border_normal | ||||
| end) | ||||
|  |  | |||
|  | @ -0,0 +1,72 @@ | |||
| local awful = require("awful") | ||||
| local beautiful = require("beautiful") | ||||
| local gears = require("gears") | ||||
| local mouse_utils = require("utils.mouse") | ||||
| 
 | ||||
| -- Focus clients under mouse | ||||
| client.connect_signal("mouse::enter", function(c) | ||||
|     c:emit_signal("request::activate", "mouse_enter", {raise = false}) | ||||
| end) | ||||
| 
 | ||||
| 
 | ||||
| client.connect_signal("manage", function (c) | ||||
|     -- Set the window as a slave (put it at the end of others instead of setting it as 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 | ||||
| 
 | ||||
|     gears.timer.delayed_call(function() | ||||
|         local geometry = c:geometry() | ||||
|         local x = geometry.x + geometry.width/2 | ||||
|         local y = geometry.y + geometry.height/2 | ||||
|         mouse.coords({x = x, y = y}, true) | ||||
|     end) | ||||
| end) | ||||
| 
 | ||||
| -- Reload config when screen geometry changes | ||||
| screen.connect_signal("property::geometry", awesome.restart) | ||||
| 
 | ||||
| 
 | ||||
| -- =================================================================== | ||||
| -- Garbage collection (allows for lower memory consumption) | ||||
| -- =================================================================== | ||||
| 
 | ||||
| collectgarbage("setpause", 110) | ||||
| collectgarbage("setstepmul", 1000) | ||||
| 
 | ||||
| client.connect_signal("property::maximized", function(focused) | ||||
|      local hide = focused.maximized or focused.fullscreen | ||||
|      for i, c in ipairs(client.get()) do | ||||
|          if not c.floating and c.screen == focused.screen and c.first_tag == focused.first_tag then | ||||
|              c.minimized = hide | ||||
|          end | ||||
|      end | ||||
| 
 | ||||
|      focused.minimized = false | ||||
| end) | ||||
| 
 | ||||
| client.connect_signal("unmanage", function(unmanaged) | ||||
|     if unmanaged.maximized then | ||||
|         for i, c in ipairs(client.get()) do | ||||
|             if not c.floating and c.screen == unmanaged.screen then | ||||
|                 c.minimized = false | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end) | ||||
| 
 | ||||
| client.connect_signal("focus", function(c) | ||||
|     if #c.screen.clients > 1 then | ||||
|           c.border_color = beautiful.border_focus | ||||
|     end | ||||
|     gears.timer.delayed_call(mouse_utils.move_mouse_onto_focused_client) | ||||
| end) | ||||
| 
 | ||||
| client.connect_signal("unfocus", function(c) | ||||
|   c.border_color = beautiful.border_normal | ||||
| end) | ||||