Formatting

This commit is contained in:
Thomas Avé 2022-07-23 19:31:38 +02:00
parent 20b61f0f67
commit 8dcb8694e5
11 changed files with 1124 additions and 1125 deletions

View File

@ -31,30 +31,30 @@ local exit_screen = {}
local icon_size = dpi(90) local icon_size = dpi(90)
local build_button = function(icon) local build_button = function(icon)
local button = wibox.widget { local button = wibox.widget {
wibox.widget { wibox.widget {
wibox.widget {
wibox.widget { wibox.widget {
image = icon, wibox.widget {
widget = wibox.widget.imagebox image = icon,
widget = wibox.widget.imagebox
},
top = dpi(16),
bottom = dpi(16),
left = dpi(16),
right = dpi(16),
widget = wibox.container.margin
}, },
top = dpi(16), shape = gears.shape.circle,
bottom = dpi(16), forced_width = icon_size,
left = dpi(16), forced_height = icon_size,
right = dpi(16), widget = clickable_container
widget = wibox.container.margin },
}, left = dpi(24),
shape = gears.shape.circle, right = dpi(24),
forced_width = icon_size, widget = wibox.container.margin
forced_height = icon_size, }
widget = clickable_container
},
left = dpi(24),
right = dpi(24),
widget = wibox.container.margin
}
return button return button
end end
@ -66,102 +66,102 @@ end
local exit_screen_grabber local exit_screen_grabber
local function suspend_command() local function suspend_command()
exit_screen.hide() exit_screen.hide()
awful.spawn.with_shell(apps.lock .. " & systemctl suspend") awful.spawn.with_shell(apps.lock .. " & systemctl suspend")
end end
local function exit_command() local function exit_command()
awesome.quit() awesome.quit()
end end
local function lock_command() local function lock_command()
exit_screen.hide() exit_screen.hide()
awful.spawn.with_shell("sleep 1 && " .. apps.lock) awful.spawn.with_shell("sleep 1 && " .. apps.lock)
end end
local function poweroff_command() local function poweroff_command()
awful.spawn.with_shell("poweroff") awful.spawn.with_shell("poweroff")
awful.keygrabber.stop(exit_screen_grabber) awful.keygrabber.stop(exit_screen_grabber)
end end
local function reboot_command() local function reboot_command()
awful.spawn.with_shell("reboot") awful.spawn.with_shell("reboot")
awful.keygrabber.stop(exit_screen_grabber) awful.keygrabber.stop(exit_screen_grabber)
end end
local poweroff = build_button(ICON_DIR .. "power.png", "Shutdown") local poweroff = build_button(ICON_DIR .. "power.png", "Shutdown")
poweroff:connect_signal( poweroff:connect_signal(
"button::release", "button::release",
function() function()
poweroff_command() poweroff_command()
end end
) )
local reboot = build_button(ICON_DIR .. "restart.png", "Restart") local reboot = build_button(ICON_DIR .. "restart.png", "Restart")
reboot:connect_signal( reboot:connect_signal(
"button::release", "button::release",
function() function()
reboot_command() reboot_command()
end end
) )
local suspend = build_button(ICON_DIR .. "sleep.png", "Sleep") local suspend = build_button(ICON_DIR .. "sleep.png", "Sleep")
suspend:connect_signal( suspend:connect_signal(
"button::release", "button::release",
function() function()
suspend_command() suspend_command()
end end
) )
local exit = build_button(ICON_DIR .. "logout.png", "Logout") local exit = build_button(ICON_DIR .. "logout.png", "Logout")
exit:connect_signal( exit:connect_signal(
"button::release", "button::release",
function() function()
exit_command() exit_command()
end end
) )
local lock = build_button(ICON_DIR .. "lock.png", "Lock") local lock = build_button(ICON_DIR .. "lock.png", "Lock")
lock:connect_signal( lock:connect_signal(
"button::release", "button::release",
function() function()
lock_command() lock_command()
end end
) )
-- subscribe to the show_exit_screen signal -- subscribe to the show_exit_screen signal
-- show the exit screen when signal is broadcasted -- show the exit screen when signal is broadcasted
awesome.connect_signal("show_exit_screen", awesome.connect_signal("show_exit_screen",
function() function()
exit_screen_grabber = awful.keygrabber.run( exit_screen_grabber = awful.keygrabber.run(
function(_, key, event) function(_, key, event)
if event == "release" then if event == "release" then
return return
end end
if key == "s" then if key == "s" then
suspend_command() suspend_command()
elseif key == "e" then elseif key == "e" then
exit_command() exit_command()
elseif key == "l" then elseif key == "l" then
lock_command() lock_command()
elseif key == "p" then elseif key == "p" then
poweroff_command() poweroff_command()
elseif key == "r" then elseif key == "r" then
reboot_command() reboot_command()
elseif key == "Escape" or key == "q" or key == "x" then elseif key == "Escape" or key == "q" or key == "x" then
exit_screen.hide() exit_screen.hide()
end
end end
end )
) exit_screen.widget.visible = true
exit_screen.widget.visible = true end
end
) )
-- hide exit screen -- hide exit screen
function exit_screen.hide() function exit_screen.hide()
awful.keygrabber.stop(exit_screen_grabber) awful.keygrabber.stop(exit_screen_grabber)
exit_screen.widget.visible = false exit_screen.widget.visible = false
end end
@ -174,52 +174,52 @@ local screen_geometry = awful.screen.focused().geometry
-- Create the widget -- Create the widget
exit_screen.widget = wibox({ exit_screen.widget = wibox({
x = screen_geometry.x, x = screen_geometry.x,
y = screen_geometry.y, y = screen_geometry.y,
visible = false, visible = false,
ontop = true, ontop = true,
type = "splash", type = "splash",
height = screen_geometry.height, height = screen_geometry.height,
width = screen_geometry.width width = screen_geometry.width
}) })
exit_screen.widget:buttons( exit_screen.widget:buttons(
gears.table.join( gears.table.join(
-- Middle click - Hide exit_screen -- Middle click - Hide exit_screen
awful.button({}, 2, awful.button({}, 2,
function() function()
exit_screen.hide() exit_screen.hide()
end end
), ),
-- Right click - Hide exit_screen -- Right click - Hide exit_screen
awful.button({}, 3, awful.button({}, 3,
function() function()
exit_screen.hide() exit_screen.hide()
end end
) )
) )
) )
-- Item placement -- Item placement
exit_screen.widget:setup { exit_screen.widget:setup {
nil, nil,
{ {
nil, nil,
{ {
poweroff, poweroff,
reboot, reboot,
suspend, suspend,
exit, exit,
lock, lock,
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
}, },
nil, nil,
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal layout = wibox.layout.align.horizontal
}, },
nil, nil,
expand = "none", expand = "none",
layout = wibox.layout.align.vertical layout = wibox.layout.align.vertical
} }
return exit_screen return exit_screen

View File

@ -32,14 +32,14 @@ naughty.config.defaults.margin = dpi(16)
naughty.config.defaults.border_width = 0 naughty.config.defaults.border_width = 0
naughty.config.defaults.position = "top_right" naughty.config.defaults.position = "top_right"
naughty.config.defaults.shape = function(cr, w, h) naughty.config.defaults.shape = function(cr, w, h)
gears.shape.rounded_rect(cr, w, h, dpi(6)) gears.shape.rounded_rect(cr, w, h, dpi(6))
end end
naughty.config.padding = dpi(7) naughty.config.padding = dpi(7)
naughty.config.spacing = dpi(7) naughty.config.spacing = dpi(7)
naughty.config.icon_dirs = { naughty.config.icon_dirs = {
"/usr/share/icons/Tela-dark", "/usr/share/icons/Tela-dark",
"/usr/share/pixmaps/" "/usr/share/pixmaps/"
} }
naughty.config.icon_formats = {"png", "svg"} naughty.config.icon_formats = {"png", "svg"}
@ -48,25 +48,25 @@ naughty.config.presets.low.timeout = 3
naughty.config.presets.critical.timeout = 0 naughty.config.presets.critical.timeout = 0
naughty.config.presets.normal = { naughty.config.presets.normal = {
font = beautiful.title_font, font = beautiful.title_font,
fg = beautiful.fg_normal, fg = beautiful.fg_normal,
bg = beautiful.bg_normal, bg = beautiful.bg_normal,
position = "top_right" position = "top_right"
} }
naughty.config.presets.low = { naughty.config.presets.low = {
font = beautiful.title_font, font = beautiful.title_font,
fg = beautiful.fg_normal, fg = beautiful.fg_normal,
bg = beautiful.bg_normal, bg = beautiful.bg_normal,
position = "top_right" position = "top_right"
} }
naughty.config.presets.critical = { naughty.config.presets.critical = {
font = "SF Display Bold 10", font = "SF Display Bold 10",
fg = "#ffffff", fg = "#ffffff",
bg = "#ff0000", bg = "#ff0000",
position = "top_right", position = "top_right",
timeout = 0 timeout = 0
} }
naughty.config.presets.ok = naughty.config.presets.normal naughty.config.presets.ok = naughty.config.presets.normal
@ -80,29 +80,29 @@ naughty.config.presets.warn = naughty.config.presets.critical
if awesome.startup_errors then if awesome.startup_errors then
naughty.notify({ naughty.notify({
preset = naughty.config.presets.critical, preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!", title = "Oops, there were errors during startup!",
text = awesome.startup_errors text = awesome.startup_errors
}) })
end end
do do
local in_error = false local in_error = false
awesome.connect_signal( awesome.connect_signal(
"debug::error", "debug::error",
function(err) function(err)
if in_error then if in_error then
return return
end end
in_error = true in_error = true
naughty.notify({ naughty.notify({
preset = naughty.config.presets.critical, preset = naughty.config.presets.critical,
title = "Oops, an error happened!", title = "Oops, an error happened!",
text = tostring(err) text = tostring(err)
}) })
in_error = false in_error = false
end end
) )
end end

View File

@ -82,55 +82,55 @@ local cpu_widget = wibox.widget{
-- =================================================================== -- ===================================================================
top_panel.create = function(s) top_panel.create = function(s)
local panel = awful.wibar({ local panel = awful.wibar({
screen = s, screen = s,
position = "top", position = "top",
ontop = true, ontop = true,
height = beautiful.top_panel_height, height = beautiful.top_panel_height,
width = s.geometry.width, width = s.geometry.width,
bg = theme.bg_normal .. "99" bg = theme.bg_normal .. "99"
}) })
panel:setup { panel:setup {
expand = "none", expand = "none",
layout = wibox.layout.align.horizontal, layout = wibox.layout.align.horizontal,
task_list.create(s), task_list.create(s),
nil, nil,
{ {
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline), pl(wibox.widget{}, theme.bg_normal .. "00", theme.top_panel_powerline),
pl(wibox.container.margin(wibox.widget.systray(), 0, 0, 5, 5), theme.top_panel_powerline, theme.bg_normal), pl(wibox.container.margin(wibox.widget.systray(), 0, 0, 5, 5), theme.top_panel_powerline, theme.bg_normal),
pl(volume_widget({widget_type='icon_and_text'}), theme.bg_normal, theme.top_panel_powerline), pl(volume_widget({widget_type='icon_and_text'}), theme.bg_normal, theme.top_panel_powerline),
pl(awful.widget.watch('bash -c "sensors | grep Tctl | cut -f 10 -d \' \' | cut -c 2-"', 5), theme.top_panel_powerline, theme.bg_normal), pl(awful.widget.watch('bash -c "sensors | grep Tctl | cut -f 10 -d \' \' | cut -c 2-"', 5), theme.top_panel_powerline, theme.bg_normal),
pl(memory_widget, theme.bg_normal, theme.top_panel_powerline), pl(memory_widget, theme.bg_normal, theme.top_panel_powerline),
pl(cpu_widget, theme.top_panel_powerline, theme.bg_normal), pl(cpu_widget, theme.top_panel_powerline, theme.bg_normal),
pl(frequency_widget, theme.bg_normal, theme.top_panel_powerline), pl(frequency_widget, theme.bg_normal, theme.top_panel_powerline),
pl(updates_indicator, theme.top_panel_powerline, theme.bg_normal), pl(updates_indicator, theme.top_panel_powerline, theme.bg_normal),
pl(require("widgets.layout-box"), theme.bg_normal, theme.top_panel_powerline), pl(require("widgets.layout-box"), theme.bg_normal, theme.top_panel_powerline),
pl(wibox.widget.textclock('%a %b %d, %H:%M:%S', 1), theme.top_panel_powerline, theme.top_panel_powerline), pl(wibox.widget.textclock('%a %b %d, %H:%M:%S', 1), theme.top_panel_powerline, theme.top_panel_powerline),
} }
} }
-- =================================================================== -- ===================================================================
-- Functionality -- Functionality
-- =================================================================== -- ===================================================================
-- hide panel when client is fullscreen -- hide panel when client is fullscreen
local function change_panel_visibility(client) local function change_panel_visibility(client)
if client.screen == s then if client.screen == s then
panel.ontop = not client.fullscreen panel.ontop = not client.fullscreen
end end
end end
-- connect panel visibility function to relevant signals -- connect panel visibility function to relevant signals
client.connect_signal("property::fullscreen", change_panel_visibility) client.connect_signal("property::fullscreen", change_panel_visibility)
client.connect_signal("focus", change_panel_visibility) client.connect_signal("focus", change_panel_visibility)
updates_indicator:connect_signal("button::press", function(c, _, _, button) updates_indicator:connect_signal("button::press", function(c, _, _, button)
awful.spawn('bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c \"yay ; echo \'\\nDone, press any key to exit...\' ; read\""') awful.spawn('bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty -e bash -c \"yay ; echo \'\\nDone, press any key to exit...\' ; read\""')
end) end)
end end

File diff suppressed because it is too large Load Diff

View File

@ -24,33 +24,33 @@ local pastel = {}
pastel.initialize = function() pastel.initialize = function()
-- Import components -- Import components
require("components.pastel.wallpaper") require("components.pastel.wallpaper")
require("components.exit-screen") require("components.exit-screen")
-- Import panels -- Import panels
local top_panel = require("components.pastel.top-panel") local top_panel = require("components.pastel.top-panel")
-- Set up each screen (add tags & panels) -- Set up each screen (add tags & panels)
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
for i = 1, 9, 1 for i = 1, 9, 1
do do
awful.tag.add(i, { awful.tag.add(i, {
icon_only = true, icon_only = true,
layout = awful.layout.suit.tile, layout = awful.layout.suit.tile,
screen = s, screen = s,
selected = i == 1 selected = i == 1
}) })
end end
s.quake = quake s.quake = quake
-- Only add the top panel on the primary screen -- Only add the top panel on the primary screen
if s.index == 1 then if s.index == 1 then
top_panel.create(s) top_panel.create(s)
end end
end) end)
end end
return pastel return pastel

View File

@ -20,27 +20,27 @@ local theme_config_dir = gears.filesystem.get_configuration_dir() .. "/configura
-- define default apps (global variable so other components can access it) -- define default apps (global variable so other components can access it)
apps = { apps = {
network_manager = "nm-connection-editor", -- recommended: nm-connection-editor network_manager = "nm-connection-editor", -- recommended: nm-connection-editor
power_manager = "", -- recommended: xfce4-power-manager power_manager = "", -- recommended: xfce4-power-manager
terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"', terminal = 'bash -c "WINIT_X11_SCALE_FACTOR=1 alacritty"',
launcher = "/home/user/.toggle_rofi.sh", launcher = "/home/user/.toggle_rofi.sh",
lock = "i3lock", lock = "i3lock",
screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'", screenshot = "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'",
filebrowser = "nautilus" filebrowser = "nautilus"
} }
-- define wireless and ethernet interface names for the network widget -- define wireless and ethernet interface names for the network widget
-- use `ip link` command to determine these -- use `ip link` command to determine these
network_interfaces = { network_interfaces = {
lan = 'enp4s0' lan = 'enp4s0'
} }
-- List of apps to run on start-up -- List of apps to run on start-up
local run_on_start_up = { local run_on_start_up = {
"numlockx on", "numlockx on",
"bluetoothctl power on", "bluetoothctl power on",
"nm-applet", "nm-applet",
"blueman-applet" "blueman-applet"
} }
-- =================================================================== -- ===================================================================
@ -53,13 +53,13 @@ require("components.notifications")
-- Run all the apps listed in run_on_start_up -- Run all the apps listed in run_on_start_up
for _, app in ipairs(run_on_start_up) do for _, app in ipairs(run_on_start_up) do
local findme = app local findme = app
local firstspace = app:find(" ") local firstspace = app:find(" ")
if firstspace then if firstspace then
findme = app:sub(0, firstspace - 1) findme = app:sub(0, firstspace - 1)
end end
-- pipe commands to bash to allow command to be shell agnostic -- pipe commands to bash to allow command to be shell agnostic
awful.spawn.with_shell(string.format("echo 'pgrep -u $USER -x %s > /dev/null || (%s)' | bash -", findme, app), false) awful.spawn.with_shell(string.format("echo 'pgrep -u $USER -x %s > /dev/null || (%s)' | bash -", findme, app), false)
end end
-- Import theme -- Import theme
@ -81,36 +81,36 @@ awful.rules.rules = create_rules(keys.clientkeys, keys.clientbuttons)
-- Define layouts -- Define layouts
awful.layout.layouts = { awful.layout.layouts = {
awful.layout.suit.floating, awful.layout.suit.floating,
awful.layout.suit.tile, awful.layout.suit.tile,
awful.layout.suit.tile.left, awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom, awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top, awful.layout.suit.tile.top,
awful.layout.suit.fair, awful.layout.suit.fair,
awful.layout.suit.fair.horizontal, awful.layout.suit.fair.horizontal,
} }
-- remove gaps if layout is set to max -- remove gaps if layout is set to max
tag.connect_signal('property::layout', function(t) tag.connect_signal('property::layout', function(t)
local current_layout = awful.tag.getproperty(t, 'layout') local current_layout = awful.tag.getproperty(t, 'layout')
if (current_layout == awful.layout.suit.max) then if (current_layout == awful.layout.suit.max) then
t.gap = 0 t.gap = 0
else else
t.gap = beautiful.useless_gap t.gap = beautiful.useless_gap
end end
end) end)
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c) 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) -- Set the window as a slave (put it at the end of others instead of setting it as master)
if not awesome.startup then if not awesome.startup then
awful.client.setslave(c) awful.client.setslave(c)
end end
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then 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. -- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end
end) end)
@ -124,7 +124,7 @@ require("awful.autofocus")
-- Focus clients under mouse -- Focus clients under mouse
client.connect_signal("mouse::enter", function(c) client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})
end) end)
@ -146,24 +146,24 @@ collectgarbage("setpause", 110)
collectgarbage("setstepmul", 1000) collectgarbage("setstepmul", 1000)
require("awesomewm-vim-tmux-navigator") { require("awesomewm-vim-tmux-navigator") {
up = {"Up", "k"}, up = {"Up", "k"},
down = {"Down", "j"}, down = {"Down", "j"},
left = {"Left", "h"}, left = {"Left", "h"},
right = {"Right", "l"}, right = {"Right", "l"},
mod = "Mod4", mod = "Mod4",
mod_keysym = "Super_L", mod_keysym = "Super_L",
-- experimental = true -- experimental = true
} }
local handle_single_win = function(focused) local handle_single_win = function(focused)
local hide = focused.maximized or focused.fullscreen local hide = focused.maximized or focused.fullscreen
for i, c in ipairs(client.get()) do for i, c in ipairs(client.get()) do
if not c.floating and c.screen == focused.screen then if not c.floating and c.screen == focused.screen then
c.minimized = hide c.minimized = hide
end end
end end
focused.minimized = false focused.minimized = false
end end
-- --
-- client.connect_signal("property::fullscreen", handle_single_win) -- client.connect_signal("property::fullscreen", handle_single_win)

View File

@ -28,97 +28,97 @@ local rules = {}
-- return a table of client rules including provided keys / buttons -- return a table of client rules including provided keys / buttons
function rules.create(clientkeys, clientbuttons) function rules.create(clientkeys, clientbuttons)
return { return {
-- All clients will match this rule. -- All clients will match this rule.
{ {
rule = {}, rule = {},
properties = { properties = {
titlebars_enabled = beautiful.titlebars_enabled, titlebars_enabled = beautiful.titlebars_enabled,
border_width = beautiful.border_width, border_width = beautiful.border_width,
border_color = beautiful.border_normal, border_color = beautiful.border_normal,
focus = awful.client.focus.filter, focus = awful.client.focus.filter,
raise = true, raise = true,
keys = clientkeys, keys = clientkeys,
buttons = clientbuttons, buttons = clientbuttons,
screen = awful.screen.preferred, screen = awful.screen.preferred,
placement = awful.placement.centered placement = awful.placement.centered
},
},
-- Floating clients.
{
rule_any = {
instance = {
"DTA",
"copyq",
}, },
class = { },
"Nm-connection-editor" -- Floating clients.
}, {
name = { rule_any = {
"Event Tester", instance = {
"Steam Guard - Computer Authorization Required" "DTA",
}, "copyq",
role = { },
"pop-up", class = {
"GtkFileChooserDialog" "Nm-connection-editor"
}, },
type = { name = {
"dialog" "Event Tester",
} "Steam Guard - Computer Authorization Required"
}, properties = {floating = true} },
}, role = {
"pop-up",
"GtkFileChooserDialog"
},
type = {
"dialog"
}
}, properties = {floating = true}
},
-- Fullscreen clients -- Fullscreen clients
{ {
rule_any = { rule_any = {
class = { class = {
"Terraria.bin.x86", "Terraria.bin.x86",
},
}, properties = {fullscreen = true}
},
-- "Switch to tag"
-- These clients make you switch to their tag when they appear
{
rule_any = {
class = {
"Firefox"
},
}, properties = {switchtotag = true}
},
-- Visualizer
{
rule_any = {name = {"cava"}},
properties = {
floating = true,
maximized_horizontal = true,
sticky = true,
ontop = false,
skip_taskbar = true,
below = true,
focusable = false,
height = screen_height * 0.40,
opacity = 0.6
}, },
}, properties = {fullscreen = true} callback = function (c)
}, decorations.hide(c)
awful.placement.bottom(c)
end
},
-- "Switch to tag" -- File chooser dialog
-- These clients make you switch to their tag when they appear {
{ rule_any = {role = {"GtkFileChooserDialog"}},
rule_any = { properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.65}
class = { },
"Firefox"
},
}, properties = {switchtotag = true}
},
-- Visualizer -- Pavucontrol & Bluetooth Devices
{ {
rule_any = {name = {"cava"}}, rule_any = {class = {"Pavucontrol"}, name = {"Bluetooth Devices"}},
properties = { properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.45}
floating = true, },
maximized_horizontal = true, }
sticky = true,
ontop = false,
skip_taskbar = true,
below = true,
focusable = false,
height = screen_height * 0.40,
opacity = 0.6
},
callback = function (c)
decorations.hide(c)
awful.placement.bottom(c)
end
},
-- File chooser dialog
{
rule_any = {role = {"GtkFileChooserDialog"}},
properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.65}
},
-- Pavucontrol & Bluetooth Devices
{
rule_any = {class = {"Pavucontrol"}, name = {"Bluetooth Devices"}},
properties = {floating = true, width = screen_width * 0.55, height = screen_height * 0.45}
},
}
end end
-- return module table -- return module table

View File

@ -27,47 +27,47 @@ local wibox = require('wibox')
function build(widget) function build(widget)
local container = local container =
wibox.widget { wibox.widget {
widget, widget,
widget = wibox.container.background widget = wibox.container.background
} }
local old_cursor, old_wibox local old_cursor, old_wibox
container:connect_signal( container:connect_signal(
'mouse::enter', 'mouse::enter',
function() function()
container.bg = '#ffffff11' container.bg = '#ffffff11'
local w = _G.mouse.current_wibox local w = _G.mouse.current_wibox
if w then if w then
old_cursor, old_wibox = w.cursor, w old_cursor, old_wibox = w.cursor, w
w.cursor = 'hand1' w.cursor = 'hand1'
end end
end end
) )
container:connect_signal( container:connect_signal(
'mouse::leave', 'mouse::leave',
function() function()
container.bg = '#ffffff00' container.bg = '#ffffff00'
if old_wibox then if old_wibox then
old_wibox.cursor = old_cursor old_wibox.cursor = old_cursor
old_wibox = nil old_wibox = nil
end end
end end
) )
container:connect_signal( container:connect_signal(
'button::press', 'button::press',
function() function()
container.bg = '#ffffff22' container.bg = '#ffffff22'
end end
) )
container:connect_signal( container:connect_signal(
'button::release', 'button::release',
function() function()
container.bg = '#ffffff11' container.bg = '#ffffff11'
end end
) )
return container return container

View File

@ -30,14 +30,14 @@ local folder = {}
-- split a string into a list based on a deliminator -- split a string into a list based on a deliminator
local function split_string(inputstr, delim) local function split_string(inputstr, delim)
if delim == nil then if delim == nil then
delim = "%s" delim = "%s"
end end
local t={} local t={}
for str in string.gmatch(inputstr, "([^"..delim.."]+)") do for str in string.gmatch(inputstr, "([^"..delim.."]+)") do
table.insert(t, str) table.insert(t, str)
end end
return t return t
end end
@ -47,50 +47,50 @@ end
function folder.create(directory) function folder.create(directory)
local docu_widget = wibox.widget { local docu_widget = wibox.widget {
{ {
id = "icon", id = "icon",
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
resize = true resize = true
}, },
layout = wibox.layout.align.horizontal layout = wibox.layout.align.horizontal
} }
local docu_button = clickable_container(wibox.container.margin(docu_widget, dpi(8), dpi(8), dpi(8), dpi(8))) local docu_button = clickable_container(wibox.container.margin(docu_widget, dpi(8), dpi(8), dpi(8), dpi(8)))
docu_button:buttons( docu_button:buttons(
gears.table.join( gears.table.join(
awful.button({}, 1, nil, awful.button({}, 1, nil,
function() function()
awful.spawn.easy_async_with_shell(apps.filebrowser .. " " .. directory, function(stderr) end, 1) awful.spawn.easy_async_with_shell(apps.filebrowser .. " " .. directory, function(stderr) end, 1)
end end
) )
) )
) )
-- determine hover name & icon to use -- determine hover name & icon to use
-- icon name must correspond with name of folder -- icon name must correspond with name of folder
local folder_name = "" local folder_name = ""
if directory == HOME_DIR then if directory == HOME_DIR then
folder_name = "Home" folder_name = "Home"
elseif directory == "trash://" then elseif directory == "trash://" then
folder_name = "Trash" folder_name = "Trash"
else else
local dir_list = split_string(directory, "/") local dir_list = split_string(directory, "/")
folder_name = dir_list[#dir_list] folder_name = dir_list[#dir_list]
end end
awful.tooltip({ awful.tooltip({
objects = {docu_button}, objects = {docu_button},
mode = "outside", mode = "outside",
align = "right", align = "right",
timer_function = function() timer_function = function()
return folder_name return folder_name
end, end,
preferred_positions = {"right", "left", "top", "bottom"} preferred_positions = {"right", "left", "top", "bottom"}
}) })
docu_widget.icon:set_image(PATH_TO_ICONS .. folder_name:lower() .. ".png") docu_widget.icon:set_image(PATH_TO_ICONS .. folder_name:lower() .. ".png")
return docu_button return docu_button
end end
return folder return folder

View File

@ -10,7 +10,6 @@
-- =================================================================== -- ===================================================================
local clickable_container = require('widgets.clickable-container')
local awful = require('awful') local awful = require('awful')
@ -21,31 +20,31 @@ local awful = require('awful')
-- Create an imagebox widget which will contains an icon indicating which layout we're using. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen. -- We need one layoutbox per screen.
local layout_box = clickable_container(awful.widget.layoutbox(s)) local layout_box = awful.widget.layoutbox(s)
layout_box:buttons( layout_box:buttons(
awful.util.table.join( awful.util.table.join(
awful.button({}, 1, awful.button({}, 1,
function() function()
awful.layout.inc(1) awful.layout.inc(1)
end end
), ),
awful.button({}, 3, awful.button({}, 3,
function() function()
awful.layout.inc(-1) awful.layout.inc(-1)
end end
), ),
awful.button({}, 4, awful.button({}, 4,
function() function()
awful.layout.inc(1) awful.layout.inc(1)
end end
), ),
awful.button({}, 5, awful.button({}, 5,
function() function()
awful.layout.inc(-1) awful.layout.inc(-1)
end end
) )
) )
) )
return layout_box return layout_box

View File

@ -1,9 +1,9 @@
-- ████████╗ █████╗ ███████╗██╗ ██╗ ██╗ ██╗███████╗████████╗ -- ████████╗ █████╗ ███████╗██╗ ██╗ ██╗ ██╗███████╗████████╗
-- ╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ██║ ██║██╔════╝╚══██╔══╝ -- ╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝ ██║ ██║██╔════╝╚══██╔══╝
-- ██║ ███████║███████╗█████╔╝ ██║ ██║███████╗ ██║ -- ██║ ███████║███████╗█████╔╝ ██║ ██║███████╗ ██║
-- ██║ ██╔══██║╚════██║██╔═██╗ ██║ ██║╚════██║ ██║ -- ██║ ██╔══██║╚════██║██╔═██╗ ██║ ██║╚════██║ ██║
-- ██║ ██║ ██║███████║██║ ██╗ ███████╗██║███████║ ██║ -- ██║ ██║ ██║███████║██║ ██╗ ███████╗██║███████║ ██║
-- ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝╚══════╝ ╚═╝ -- ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝╚══════╝ ╚═╝
-- =================================================================== -- ===================================================================
-- Initialization -- Initialization
@ -31,118 +31,118 @@ local task_list = {}
local function create_buttons(buttons, object) local function create_buttons(buttons, object)
if buttons then if buttons then
local btns = {} local btns = {}
for _, b in ipairs(buttons) do for _, b in ipairs(buttons) do
-- Create a proxy button object: it will receive the real -- Create a proxy button object: it will receive the real
-- press and release events, and will propagate them to the -- press and release events, and will propagate them to the
-- button object the user provided, but with the object as -- button object the user provided, but with the object as
-- argument. -- argument.
local btn = capi.button {modifiers = b.modifiers, button = b.button} local btn = capi.button {modifiers = b.modifiers, button = b.button}
btn:connect_signal('press', btn:connect_signal('press',
function() function()
object.minimized = not object.minimized object.minimized = not object.minimized
end end
) )
btns[#btns + 1] = btn btns[#btns + 1] = btn
end end
return btns return btns
end end
end end
local function list_update(w, buttons, label, data, objects) local function list_update(w, buttons, label, data, objects)
-- update the widgets, creating them if needed -- update the widgets, creating them if needed
w:reset() w:reset()
local index = 0 local index = 0
local count = 0 local count = 0
for _ in pairs(objects) do for _ in pairs(objects) do
count = count + 1 count = count + 1
end end
for i, o in ipairs(objects) do for i, o in ipairs(objects) do
index = index + 1 index = index + 1
local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll local ib, cb, tb, cbm, bgb, tbm, ibm, tt, l, ll
ib = wibox.widget.imagebox() ib = wibox.widget.imagebox()
tb = wibox.widget.textbox() tb = wibox.widget.textbox()
cb = wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9)) cb = wibox.container.margin(wibox.widget.imagebox(ICON_DIR .. "close.svg"), dpi(9), dpi(9), dpi(9), dpi(9))
cb.shape = gears.shape.circle cb.shape = gears.shape.circle
cbm = wibox.container.margin(cb, dpi(0), dpi(0), dpi(0), dpi(0)) -- 4, 8 ,12 ,12 -- close button cbm = wibox.container.margin(cb, dpi(0), dpi(0), dpi(0), dpi(0)) -- 4, 8 ,12 ,12 -- close button
cbm:buttons(gears.table.join(awful.button({}, 1, nil, cbm:buttons(gears.table.join(awful.button({}, 1, nil,
function() function()
o.kill(o) o.kill(o)
end end
))) )))
bgb = wibox.container.background() bgb = wibox.container.background()
tbm = wibox.container.margin(tb, dpi(4), dpi(4)) tbm = wibox.container.margin(tb, dpi(4), dpi(4))
ibm = wibox.container.margin(ib, dpi(5), dpi(5), dpi(5), dpi(5)) -- 12 is default top and bottom margin --app icon ibm = wibox.container.margin(ib, dpi(5), dpi(5), dpi(5), dpi(5)) -- 12 is default top and bottom margin --app icon
l = wibox.layout.fixed.horizontal() l = wibox.layout.fixed.horizontal()
ll = wibox.layout.fixed.horizontal() ll = wibox.layout.fixed.horizontal()
-- All of this is added in a fixed widget -- All of this is added in a fixed widget
l:fill_space(true) l:fill_space(true)
l:add(ibm) l:add(ibm)
l:add(tbm) l:add(tbm)
ll:add(l) ll:add(l)
ll:add(cbm) ll:add(cbm)
if (index % 2 == 0) then if (index % 2 == 0) then
local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.top_panel_powerline local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.top_panel_powerline
local main_color = o.minimized and "#12151c" or theme.bg_normal local main_color = o.minimized and "#12151c" or theme.bg_normal
bgb:set_widget(pl(ll, main_color, end_color, true)) bgb:set_widget(pl(ll, main_color, end_color, true))
else else
local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.bg_normal local end_color = (count == index or objects[index+1].minimized) and "#12151c" or theme.bg_normal
local main_color = o.minimized and "#12151c" or theme.top_panel_powerline local main_color = o.minimized and "#12151c" or theme.top_panel_powerline
bgb:set_widget(pl(ll, main_color, end_color, true)) bgb:set_widget(pl(ll, main_color, end_color, true))
end end
l:buttons(create_buttons(buttons, o)) l:buttons(create_buttons(buttons, o))
-- Tooltip to display whole title, if it was truncated -- Tooltip to display whole title, if it was truncated
tt = awful.tooltip({ tt = awful.tooltip({
objects = {tb}, objects = {tb},
mode = 'outside', mode = 'outside',
align = 'bottom', align = 'bottom',
delay_show = 1, delay_show = 1,
}) })
local text, bg, bg_image, icon, args = label(o, tb) local text, bg, bg_image, icon, args = label(o, tb)
args = args or {} args = args or {}
-- The text might be invalid, so use pcall. -- The text might be invalid, so use pcall.
if text == nil or text == '' then if text == nil or text == '' then
tbm:set_margins(0) tbm:set_margins(0)
else else
-- truncate when title is too long -- truncate when title is too long
local text_only = text:match('>(.*)<') local text_only = text:match('>(.*)<')
if (text_only:len() > 25) then if (text_only:len() > 25) then
text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, 25)) .. '...<') text = text:gsub('>(.*)<', '>' .. utf8.char(utf8.codepoint(text_only, 1, 25)) .. '...<')
tt:set_text(text) tt:set_text(text)
tt:add_to_object(tb) tt:add_to_object(tb)
else else
tt:remove_from_object(tb) tt:remove_from_object(tb)
end end
if not tb:set_markup_silently(text) then if not tb:set_markup_silently(text) then
tb:set_markup('<i>&lt;Invalid text&gt;</i>') tb:set_markup('<i>&lt;Invalid text&gt;</i>')
end end
end end
-- bgb:set_bg(bg) -- bgb:set_bg(bg)
if type(bg_image) == 'function' then if type(bg_image) == 'function' then
-- TODO: Why does this pass nil as an argument? -- TODO: Why does this pass nil as an argument?
bg_image = bg_image(tb, o, nil, objects, i) bg_image = bg_image(tb, o, nil, objects, i)
end end
-- bgb:set_bgimage(bg_image) -- bgb:set_bgimage(bg_image)
if icon then if icon then
ib.image = icon ib.image = icon
else else
ibm:set_margins(0) ibm:set_margins(0)
end end
bgb.shape = args.shape bgb.shape = args.shape
bgb.shape_border_width = args.shape_border_width bgb.shape_border_width = args.shape_border_width
bgb.shape_border_color = args.shape_border_color bgb.shape_border_color = args.shape_border_color
w:add(bgb) w:add(bgb)
end end
end end
@ -152,67 +152,67 @@ end
local tasklist_buttons = awful.util.table.join( local tasklist_buttons = awful.util.table.join(
awful.button({}, 1, awful.button({}, 1,
function(c) function(c)
if c == client.focus then if c == client.focus then
c.minimized = true c.minimized = true
else else
-- Without this, the following -- Without this, the following
-- :isvisible() makes no sense -- :isvisible() makes no sense
c.minimized = false c.minimized = false
if not c:isvisible() and c.first_tag then if not c:isvisible() and c.first_tag then
c.first_tag:view_only() c.first_tag:view_only()
end end
-- This will also un-minimize -- This will also un-minimize
-- the client, if needed -- the client, if needed
client.focus = c client.focus = c
c:raise() c:raise()
end end
end end
), ),
awful.button({}, 2, awful.button({}, 2,
function(c) function(c)
c.kill(c) c.kill(c)
end end
), ),
awful.button({}, 4, awful.button({}, 4,
function() function()
awful.client.focus.byidx(1) awful.client.focus.byidx(1)
end end
), ),
awful.button({}, 5, awful.button({}, 5,
function() function()
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
end end
) )
) )
local filter = function(c, _) local filter = function(c, _)
local tags = c.screen.tags local tags = c.screen.tags
for _, t in ipairs(tags) do for _, t in ipairs(tags) do
if t.selected then if t.selected then
local ctags = c:tags() local ctags = c:tags()
for _, v in ipairs(ctags) do for _, v in ipairs(ctags) do
if v == t then if v == t then
return true return true
end
end end
end end
end end
end return false
return false
end end
task_list.create = function(s) task_list.create = function(s)
return awful.widget.tasklist( return awful.widget.tasklist(
s, s,
filter, filter,
tasklist_buttons, tasklist_buttons,
{}, {},
list_update, list_update,
wibox.layout.fixed.horizontal() wibox.layout.fixed.horizontal()
) )
end end
return task_list return task_list