Bar changes

This commit is contained in:
Daan Vanoverloop 2019-08-27 14:11:39 +02:00
parent 7ec776db74
commit ad3718e7a8
3 changed files with 111 additions and 20 deletions

View File

@ -8,6 +8,6 @@ function run {
}
. ~/.config/compton/launch.sh
run ~/.config/awesome/autohidewibox.py ~/.config/awesome/autohidewibox.conf
#run ~/.config/awesome/autohidewibox.py ~/.config/awesome/autohidewibox.conf
run ~/setbg.sh
run dunst

View File

@ -14,6 +14,7 @@ local beautiful = require("beautiful")
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
local vicious = require("vicious")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
@ -46,6 +47,7 @@ end
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init("/home/daan/.config/awesome/theme.lua")
beautiful.font = "Hack Nerd Font 9"
-- This is used later as the default terminal and editor to run.
terminal = "termite"
@ -64,7 +66,7 @@ awful.layout.layouts = {
awful.layout.suit.spiral.dwindle,
awful.layout.suit.floating,
awful.layout.suit.tile,
--awful.layout.suit.tile.left,
--awful.layout.suit.tile.left
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
@ -165,9 +167,31 @@ local function set_wallpaper(s)
end
end
volumebox = wibox.widget.textbox()
vicious.cache(vicious.widgets.volume)
vicious.register(volumebox, vicious.widgets.volume, "  $1 ", 3, {"Master", "-D", "pulse"})
batwidget = wibox.widget.textbox()
vicious.cache(vicious.widgets.bat)
vicious.register(batwidget, vicious.widgets.bat, "  $2 ", 61, "BAT1")
wifiwidget = wibox.widget.textbox()
vicious.cache(vicious.widgets.wifi)
vicious.register(wifiwidget, vicious.widgets.wifi, "  ${linp} ", 10, "wlp3s0")
cpuwidget = wibox.widget.textbox()
vicious.cache(vicious.widgets.cpu)
vicious.register(cpuwidget, vicious.widgets.cpu, "  $1 ", 1)
memwidget = wibox.widget.textbox()
vicious.cache(vicious.widgets.mem)
vicious.register(memwidget, vicious.widgets.mem, "  $2 MiB ", 1)
-- 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)
-- Wallpaper
set_wallpaper(s)
@ -200,7 +224,7 @@ awful.screen.connect_for_each_screen(function(s)
}
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
s.mywibox = awful.wibar({ position = "top", screen = s, bg = "#00000000", visible = false })
-- Add widgets to the wibox
s.mywibox:setup {
@ -212,15 +236,31 @@ awful.screen.connect_for_each_screen(function(s)
s.mypromptbox,
},
--s.mytasklist, -- Middle widget
wibox.widget { widget = wibox.widget.separator },
wibox.widget { widget = wibox.widget.separator, visible = false },
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
--mykeyboardlayout,
memwidget,
cpuwidget,
volumebox,
wifiwidget,
batwidget,
--wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
--s.mylayoutbox,
},
}
local timer = require("gears.timer")
local dock_trigger = wibox({ bg = "#00000000", opacity = 0, ontop = true, visible = true })
local dock_hide_timer = timer({ timeout = 1})
dock_trigger:geometry({ width = 10, height = 10 })
dock_hide_timer:connect_signal("timeout", function() stopgaps(s.mywibox) end )
dock_trigger:connect_signal("mouse::enter", function() startgaps(s.mywibox) end)
dock_trigger:connect_signal("mouse::enter", function() if dock_hide_timer.started then dock_hide_timer:stop() end end)
dock_trigger:connect_signal("mouse::leave", function() dock_hide_timer:again() end)
end)
-- }}}
@ -232,22 +272,52 @@ root.buttons(gears.table.join(
))
-- }}}
function startgaps ()
function togglegaps (dock)
if beautiful.useless_gap == 10 then stopgaps(dock) else startgaps(dock) end
end
function startgaps (dock)
beautiful.useless_gap = 10
dock.visible = true
end
function stopgaps ()
function stopgaps (dock)
beautiful.useless_gap = 0
dock.visible = false
end
key.connect_signal("press", function(k)
print("hello")
end)
-- {{{ Key bindings
globalkeys = gears.table.join(
awful.key({ modkey, }, "", startgaps, stopgaps),
awful.key({}, "XF86AudioRaiseVolume", function ()
awful.spawn("sh -c 'pactl set-sink-mute 0 false && pactl set-sink-volume 0 +5%'")
gears.timer.start_new(0.2, function () vicious.force({ volumebox, }) end)
end),
awful.key({}, "XF86AudioLowerVolume", function ()
awful.spawn("sh -c 'pactl set-sink-mute 0 false && pactl set-sink-volume 0 -5%'")
gears.timer.start_new(0.2, function () vicious.force({ volumebox, }) end)
end),
awful.key({}, "XF86AudioMute", function ()
awful.spawn("pactl set-sink-mute 0 toggle")
gears.timer.start_new(0.2, function () vicious.force({ volumebox, }) end)
end),
awful.key({ "Control" }, "XF86MonBrightnessUp", function ()
awful.spawn("xbacklight -inc 1")
end),
awful.key({ "Control" }, "XF86MonBrightnessDown", function ()
awful.spawn("xbacklight -dec 1")
end),
awful.key({}, "XF86MonBrightnessUp", function ()
awful.spawn("xbacklight -inc 5")
end),
awful.key({}, "XF86MonBrightnessDown", function ()
awful.spawn("xbacklight -dec 5")
end),
awful.key({ modkey }, "g", function () for s in screen do togglegaps(s.mywibox) end end),
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}),
awful.key({ modkey, }, "Left", awful.tag.viewprev,
@ -576,7 +646,4 @@ end)
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)
-- }}}

View File

@ -11,7 +11,7 @@ local themes_path = gfs.get_themes_dir()
local theme = {}
theme.font = "sans 10"
theme.font = "Hack Nerd Font 10"
theme.bg_normal = "#222222"
theme.bg_focus = "#535d6c"
@ -99,8 +99,32 @@ theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/m
theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png"
--]]
math.randomseed(os.time());
-- To guarantee unique random numbers on every platform, pop a few
for i = 1,10 do
math.random()
end
theme.wallpaper = themes_path.."default/background.png"
-- LUA implementation of PHP scan dir
-- Returns all files (except . and ..) in "directory"
function scandir(directory)
num_files, t, popen = 0, {}, io.popen
for filename in popen('ls -a "'..directory..'"'):lines() do
-- If case to disregard "." and ".."
if(not(filename == "." or filename == "..")) then
num_files = num_files + 1
t[num_files] = filename
end
end
return t
end
function theme.wallpaper ()
files = scandir("~/Pictures/wallpapers/")
count = 0
for i,v in ipairs(files) do count += 1 end
return files[math.random(1, count)]
end
-- You can use your own layout icons like this:
theme.layout_fairh = themes_path.."default/layouts/fairhw.png"
@ -127,7 +151,7 @@ theme.awesome_icon = theme_assets.awesome_icon(
-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil
--theme.icon_theme = nil
return theme