Browse Source

update

main
Kristof Vandam 5 years ago
parent
commit
d793b1ad23
  1. BIN
      modules/.sidepanel.lua.swp
  2. 41
      modules/dock.lua
  3. 100
      modules/dockbox.lua
  4. 141
      modules/init.lua
  5. 233
      modules/sidepanel.lua
  6. 1
      rc.lua
  7. 3437
      themes/pixelos/assets/mockup.svg
  8. 20
      themes/pixelos/init.lua

BIN
modules/.sidepanel.lua.swp

Binary file not shown.

41
modules/dock.lua

@ -0,0 +1,41 @@
local wibox = require("wibox")
local beautiful = require("beautiful")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local apps = require("config.apps")
local box = require("modules.dock.dockbox")
--local browser = box(beautiful.yellow, beautiful.yellow_light, "", apps.browser)
--local fileexplorer = box(beautiful.blue, beautiful.blue_light, "", apps.fileexplorer)
--local terminal = box(beautiful.fg_normal, beautiful.fg_focus, "", apps.terminal)
--local intellij = box(beautiful.red, beautiful.red_light, "", "intellij-idea-ultimate-edition")
--local gimp = box(beautiful.cyan, beautiful.cyan_light, "", "gimp")
--local spotify = box(beautiful.green, beautiful.green_light, "", "spotify")
return wibox.widget {
{
nil,
{
nil,
{
browser,
fileexplorer,
terminal,
intellij,
gimp,
spotify,
spacing = dpi(8),
layout = wibox.layout.fixed.vertical
},
nil,
expand = "none",
layout = wibox.layout.align.vertical
},
nil,
expand = "none",
layout = wibox.layout.align.horizontal
},
widget = wibox.container.background,
}

100
modules/dockbox.lua

@ -0,0 +1,100 @@
local wibox = require("wibox")
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local naughty = require("naughty")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local dockbox = require("lib.dockbox")
local countIndicator = function()
return wibox.widget {
bg = beautiful.fg_normal,
shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, true, true, false, dpi(50))
end,
forced_height = dpi(6),
widget = wibox.container.background
}
end
return function(fg, fg_hover, text, app)
local count = 0
local countWidget = wibox.layout.fixed.vertical()
countWidget.forced_width = dpi(5)
countWidget.spacing = dpi(2)
local clientIsApp = function(c)
-- returns if the client c is the same as the sidebarbox-app (e.g. firefox, kitty, ...)
-- some fiddling needed, is kinda hacky
if app == "intellij-idea-ultimate-edition" and c.class == "jetbrains-idea" then
-- hmm
return true
elseif c.class ~= nil then
return string.lower(c.class) == string.lower(app)
elseif c.instance ~= nil then
return string.lower(c.instance) == string.lower(app)
elseif c.name ~= nil then
return string.lower(c.name) == string.lower(app)
else
return false
end
end
client.connect_signal("manage", function(c)
if clientIsApp(c) then
count = count + 1
-- don't add unlimited indicators
if count < 6 then
countWidget:insert(1, countIndicator())
end
end
end)
client.connect_signal("unmanage", function(c)
if clientIsApp(c) then
count = count - 1
if count < 5 then
countWidget:remove(1)
end
end
end)
local findApp = function()
-- open client if at already exists
-- spawn new client otherwise
if count > 0 then
for _, tag in pairs(root.tags()) do
for _, c in pairs(tag:clients()) do
if clientIsApp(c) then
c:jump_to(false)
return
end
end
end
else
awful.spawn(app)
end
end
return wibox.widget {
{
nil,
countWidget,
nil,
expand = "none",
widget = wibox.layout.align.vertical
},
dockbox(fg, fg_hover, text, function()
findApp()
awesome.emit_signal("dashboard::close")
end),
spacing = dpi(2),
layout = wibox.layout.fixed.horizontal
}
end

141
modules/init.lua

@ -0,0 +1,141 @@
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful")
local dpi = require("beautiful.xresources").apply_dpi
local dock = require("widgets.dock.dock")
local width = 68
local openerWidth = 8
local height = 376
local dock_container = wibox({
visible = true,
ontop = true,
type = "dock",
screen = screen.primary,
x = 0,
y = beautiful.bar_height + (awful.screen.focused().geometry.height - height - beautiful.bar_height) / 2,
width = dpi(width + openerWidth),
height = dpi(height),
bg = "#00000000"
})
local dock_opener = wibox.widget {
bg = beautiful.bg_normal,
forced_width = dpi(openerWidth),
input_passthrough = true,
bg = "#00000000",
widget = wibox.container.background
}
local mouse_in_dock = false
local get_fullscreen = function()
tag = awful.screen.focused().selected_tag
for _, client in pairs(tag:clients()) do
if client.fullscreen then
return true
end
end
return false
end
local get_auto_hide = function(tag)
if tag == nil then tag = awful.screen.focused().selected_tag end
-- auto hiding if any client on the current tag overlaps the dock
for _, client in pairs(tag:clients()) do
if client.x < width then
return true
end
end
return false
end
local show_cb = function()
if not mouse_in_dock and get_auto_hide() then return false end
local delta = 2
if dock_container.x < 0 then
dock_container.x = dock_container.x + delta
return true
else
return false
end
end
local hide_cb = function()
if mouse_in_dock or not get_auto_hide() then return false end
local delta = 2
if dock_container.x > -width then
dock_container.x = dock_container.x - delta
return true
else
return false
end
end
local show = function()
gears.timer.start_new(0.002, show_cb)
end
local hide = function()
gears.timer.start_new(0.002, hide_cb)
end
dock_opener:connect_signal("mouse::enter", function()
if get_fullscreen() then return end
mouse_in_dock = true
show()
end)
dock_opener:connect_signal("mouse::leave", function()
mouse_in_dock = false
hide()
end)
dock:connect_signal("mouse::leave", function()
mouse_in_dock = false
hide()
end)
dock:connect_signal("mouse::enter", function()
mouse_in_dock = true
show()
end)
local update = function(tag)
if tag == nil then
tag = awful.screen.focused().selected_tag
end
if get_auto_hide(tag) and not mouse_in_dock then
hide()
else
show()
end
end
client.connect_signal("manage", function() update() end)
client.connect_signal("unmanage", function() update() end)
client.connect_signal("property::size", function() update() end)
client.connect_signal("property::position", function() update() end)
client.connect_signal("tagged", function() update() end)
tag.connect_signal("property::layout", function(t) update(t) end)
tag.connect_signal("property::selected", function(t) update(t) end)
dock_container:setup {
dock,
dock_opener,
layout = wibox.layout.fixed.horizontal
}
update()

233
modules/sidepanel.lua

@ -9,85 +9,184 @@ local thumbnail = require('modules.thumbnail')
screen.connect_signal("request::desktop_decoration", function(s)
local entries = {
{
name = "firefox",
command = "firefox"
},
{
name = "terminal",
command = "alacritty"
},
{
name = "slack",
command = "slack"
},
{
name = "inkscape",
command = "inkscape"
}
}
local dock = wibox({
position = "left",
ontop = true,
stretch = false,
width = dpi(64),
height = s.workarea.height,
visible = true,
visible = false,
y = 48
})
--[[ client.connect_signal("manage", function(c)
local completed_entries = {}
for entry in pairs(entries) do
if c.name:lower():match(entry.name:lower()) then
completed_entries[entry] = {}
completed_entries[entry].count = completed_entries[entry].count + 1
else
entry[count] = 1
table.insert(completed_entries, entry)
end
end
end) ]]--
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.allscreen,
buttons = {
awful.button({ }, 1, function (c)
c:activate { context = "tasklist", action = "toggle_minimization" }
local t = c.first_tag
t:view_only()
end),
awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
awful.button({ }, 4, function() awful.client.focus.byidx( 1) end),
awful.button({ }, 5, function() awful.client.focus.byidx(-1) end),
},
layout = {
layout = wibox.layout.fixed.vertical
},
widget_template = {
{
wibox.widget.base.make_widget(),
forced_height = 5,
id = 'background_role',
widget = wibox.container.background,
},
{
{
id = 'clienticon',
widget = awful.widget.clienticon,
},
margins = 10,
widget = wibox.container.margin
},
nil,
create_callback = function(self, c, index, objects)
self:get_children_by_id('clienticon')[1].client = c
local tooltip = awful.tooltip({
objects = { self },
timer_function = function()
return c.name
screen = s,
filter = function() return true end, -- Filtering is already done in source
source = function()
-- Get all clients
local cls = client.get()
-- Filter by an existing filter function and allowing only one client per class
local result = {}
local class_seen = {}
for _, c in pairs(cls) do
if awful.widget.tasklist.filter.allscreen(c, s) then
if not class_seen[c.class] then
class_seen[c.class] = true
table.insert(result, c)
end
end
end
return result
end,
--screen = s,
--filter = awful.widget.tasklist.filter.allscreen,
buttons = {
awful.button({ }, 1, function (c)
if cl_menu then
cl_menu:hide()
cl_menu=nil
else
client_num=0
client_list={}
for i, cl in pairs(client.get()) do
if cl.class == c.class then
client_num = client_num + 1
client_list[i]=
{cl.name,
function()
client.focus = cl
awful.tag.viewonly(cl:tags()[1])
cl:raise()
end,
})
-- Then you can set tooltip props if required (should work as is)
tooltip.align = "left"
tooltip.mode = "outside"
tooltip.preferred_positions = {"left"}
tooltip.preferred_alignments = {"middle"}
end,
layout = wibox.layout.align.vertical,
},
}
cl.icon
}
end
end
dock:setup {
expand = "none",
layout = wibox.layout.align.vertical,
s.mytasklist,
}
local dock_trigger = awful.wibox({
position = "left",
width = 1,
bg = "#00000000",
opacity = 0,
ontop = true,
visible = true
if client_num > 1 then
cl_menu=awful.menu({items = client_list, theme = {width=900}})
cl_menu.align = "left"
cl_menu.mode = "outside"
cl_menu.preferred_positions = {"left"}
cl_menu.preferred_alignments = {"middle"}
cl_menu:show()
else
client.focus = c
awful.tag.viewonly(c:tags()[1])
c:raise()
end
end
end),
--awful.button({ }, 1, function (c)
--c:activate { context = "tasklist", action = "toggle_minimization" }
--local t = c.first_tag
--t:view_only()
--end),
awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end),
awful.button({ }, 4, function() awful.client.focus.byidx( 1) end),
awful.button({ }, 5, function() awful.client.focus.byidx(-1) end),
},
layout = {
layout = wibox.layout.fixed.vertical
},
widget_template = {
{
wibox.widget.base.make_widget(),
forced_height = 5,
id = 'background_role',
widget = wibox.container.background,
},
{
{
id = 'clienticon',
widget = awful.widget.clienticon,
},
margins = 10,
widget = wibox.container.margin
},
nil,
create_callback = function(self, c, index, objects)
self:get_children_by_id('clienticon')[1].client = c
local tooltip = awful.tooltip({
objects = { self },
timer_function = function()
return c.name
end,
})
local dock_hide_timer = timer({ timeout = 1})
-- Then you can set tooltip props if required (should work as is)
tooltip.align = "left"
tooltip.mode = "outside"
tooltip.preferred_positions = {"left"}
tooltip.preferred_alignments = {"middle"}
end,
layout = wibox.layout.align.vertical,
},
}
dock:setup {
expand = "none",
layout = wibox.layout.align.vertical,
{
s.mytasklist,
awful.widget.launcher({
image = beautiful.apps_slack,
command = "slack"
}),
layout = wibox.layout.align.vertical
}
}
local dock_trigger = awful.wibox({
position = "left",
width = 1,
bg = "#00000000",
opacity = 0,
ontop = true,
visible = true
})
local dock_hide_timer = timer({ timeout = 1})
dock_trigger:geometry({ width = 5, height = s.workarea.height })
dock_hide_timer:connect_signal("timeout", function() dock.visible = false; dock_hide_timer:stop() end )
dock_trigger:connect_signal("mouse::enter", function() dock.visible = true end)
dock:connect_signal("mouse::enter", function() if dock_hide_timer.started then dock_hide_timer:stop() end end)
dock:connect_signal("mouse::leave", function() dock_hide_timer:again() end)
dock_trigger:geometry({ width = 5, height = s.workarea.height })
dock_hide_timer:connect_signal("timeout", function() dock.visible = false; dock_hide_timer:stop() end )
dock_trigger:connect_signal("mouse::enter", function() dock.visible = true end)
dock:connect_signal("mouse::enter", function() if dock_hide_timer.started then dock_hide_timer:stop() end end)
dock:connect_signal("mouse::leave", function() dock_hide_timer:again() end)
end)

1
rc.lua

@ -15,6 +15,7 @@ require('modules.client')
require('modules.titlebar')
require('modules.panel')
require('modules.sidepanel')
--require('modules.dock')
-- require('modules.appdrawer')
require('bindings.keys')

3437
themes/pixelos/assets/mockup.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 235 KiB

20
themes/pixelos/init.lua

@ -25,7 +25,7 @@ theme.useless_gap = 10
-- Colors
theme.color_transparent = '#00000000'
theme.background = '#1a1a1a'
theme.background = '#1F242588'
theme.fg_normal = '#ffffffff'
theme.fg_focus = '#e4e4e4'
@ -35,6 +35,22 @@ theme.bg_normal = theme.background
theme.bg_focus = '#5a5a5a'
theme.bg_urgent = '#3F3F3F'
-- Tooltip
theme.tooltip_bg = theme.background
theme.tooltip_border_width = 0
theme.tooltip_shape = gears.shape.rounded_rect
-- Notifications
theme.notification_bg = theme.background
theme.notification_border_width = 0
theme.notification_border_color = "#FFFFFFFF"
theme.notification_shape = gears.shape.rounded_rect
-- Menu
theme.menu_height = 40
theme.menu_bg_focus = theme.background
theme.menu_bg_normal = theme.background
-- Taglist
theme.taglist_bg_empty = theme.background .. '00'
theme.taglist_bg_occupied = '#2a2a2a' .. 'ff'
@ -42,6 +58,8 @@ theme.taglist_bg_urgent = '#E91E63' .. '99'
theme.taglist_bg_focus = '#3a3a3a'
theme.taglist_spacing = dpi(0)
theme.apps_slack = assets .. 'titlebar/buttons/button_red.png'
-- Tasklist
theme.tasklist_bg_normal = theme.background .. '99'
theme.tasklist_bg_focus = theme.background

Loading…
Cancel
Save