forked from ashpie/simple-awesome
Compare commits
14 Commits
ashpie-edi
...
develop
Author | SHA1 | Date | |
---|---|---|---|
|
16772da504 | ||
|
7ed0fc7522 | ||
662a816dd0 | |||
957452c55b | |||
6e94e368ed | |||
fbc13ab63f | |||
5961d734b5 | |||
93a3caf5a4 | |||
4b93a05fa5 | |||
c8409703e1 | |||
3908cb4058 | |||
f3b9ffcaf9 | |||
37a94eb5ed | |||
e3cbb2f987 |
58
config.lua
58
config.lua
@ -1,61 +1,3 @@
|
||||
local config = require("default_config")
|
||||
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
|
||||
config.awesome.tiling.layouts = {
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.floating,
|
||||
awful.layout.suit.tile.left,
|
||||
awful.layout.suit.tile.bottom,
|
||||
awful.layout.suit.tile.top,
|
||||
-- awful.layout.suit.fair,
|
||||
-- awful.layout.suit.fair.horizontal,
|
||||
-- awful.layout.suit.spiral,
|
||||
-- awful.layout.suit.spiral.dwindle,
|
||||
-- awful.layout.suit.max,
|
||||
-- awful.layout.suit.max.fullscreen,
|
||||
-- awful.layout.suit.magnifier,
|
||||
-- awful.layout.suit.corner.nw,
|
||||
-- awful.layout.suit.corner.ne,
|
||||
-- awful.layout.suit.corner.sw,
|
||||
-- awful.layout.suit.corner.se,
|
||||
}
|
||||
|
||||
config.autostart = gears.table.join(config.autostart,
|
||||
{
|
||||
"nextcloud",
|
||||
"discord-canary",
|
||||
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1",
|
||||
"tabs-app",
|
||||
"/usr/lib/kdeconnectd",
|
||||
"kdeconnect-indicator",
|
||||
}
|
||||
)
|
||||
|
||||
config.widgets.system_resources.bars.screens = { 1, 2, 3 }
|
||||
|
||||
config.keys.custom_keys = {
|
||||
{
|
||||
hotkey = {
|
||||
{ config.keys.modkey, },
|
||||
"e"
|
||||
},
|
||||
action = function()
|
||||
awful.spawn('pcmanfm')
|
||||
end,
|
||||
identity = { description = "pcmanfm", group = "utilities" }
|
||||
},
|
||||
{
|
||||
hotkey = {
|
||||
{ config.keys.modkey, },
|
||||
'Print'
|
||||
},
|
||||
action = function()
|
||||
awful.spawn('sh -c ~/scripts/flameshot_upload.sh')
|
||||
end,
|
||||
identity = { description = "Upload screeshot", group = "utilities" }
|
||||
}
|
||||
};
|
||||
|
||||
return config
|
||||
|
139
simple/init.lua
139
simple/init.lua
@ -132,9 +132,6 @@ if config.widgets.keyboard_layout.enabled then
|
||||
end
|
||||
hotkey.registerKeys(keyboard_layout.getKeys(config.keys.global_keys.keyboard_layout))
|
||||
|
||||
-- Force set default keyboard layout
|
||||
awful.spawn(config.widgets.keyboard_layout.layout_switch_command .. ' ' .. config.widgets.keyboard_layout.layouts[1])
|
||||
|
||||
|
||||
--
|
||||
-- Auto start
|
||||
@ -200,24 +197,23 @@ os_menu = awful.widget.launcher({
|
||||
|
||||
-- {{{ Wibar
|
||||
-- Create a textclock widget
|
||||
main_clock = wibox.widget.textclock(" %F · %R ")
|
||||
utc_clock = wibox.widget.textclock(" %T UTC ¤ ", 1, "Z")
|
||||
mytextclock = wibox.widget.textclock()
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
-- local taglist_buttons = gears.table.join(awful.button({}, 1, function(t) t:view_only() end),
|
||||
-- awful.button({ config.keys.modkey }, 1, function(t)
|
||||
-- if client.focus then
|
||||
-- client.focus:move_to_tag(t)
|
||||
-- end
|
||||
-- end),
|
||||
-- awful.button({}, 3, awful.tag.viewtoggle),
|
||||
-- awful.button({ config.keys.modkey }, 3, function(t)
|
||||
-- if client.focus then
|
||||
-- client.focus:toggle_tag(t)
|
||||
-- end
|
||||
-- end),
|
||||
-- awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end),
|
||||
-- awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end))
|
||||
local taglist_buttons = gears.table.join(awful.button({}, 1, function(t) t:view_only() end),
|
||||
awful.button({ config.keys.modkey }, 1, function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({}, 3, awful.tag.viewtoggle),
|
||||
awful.button({ config.keys.modkey }, 3, function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end),
|
||||
awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end))
|
||||
|
||||
local tasklist_buttons = gears.table.join(awful.button({}, 1, function(c)
|
||||
if c == client.focus then
|
||||
@ -270,11 +266,11 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
awful.button({}, 4, function() awful.layout.inc(1) end),
|
||||
awful.button({}, 5, function() awful.layout.inc(-1) end)))
|
||||
-- Create a taglist widget
|
||||
-- s.mytaglist = awful.widget.taglist {
|
||||
-- screen = s,
|
||||
-- filter = awful.widget.taglist.filter.all,
|
||||
-- buttons = taglist_buttons
|
||||
-- }
|
||||
s.mytaglist = awful.widget.taglist {
|
||||
screen = s,
|
||||
filter = awful.widget.taglist.filter.all,
|
||||
buttons = taglist_buttons
|
||||
}
|
||||
|
||||
-- Create a tasklist widget
|
||||
s.mytasklist = awful.widget.tasklist {
|
||||
@ -334,7 +330,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
-- Left widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
launcher,
|
||||
-- s.mytaglist,
|
||||
s.mytaglist,
|
||||
s.mypromptbox,
|
||||
},
|
||||
s.mytasklist, -- Middle widget
|
||||
@ -345,8 +341,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
matchesScreen(config.widgets.system_resources.battery.screens) and system_resources_widget.battery or nil,
|
||||
keyboard_layout_widget,
|
||||
wibox.widget.systray(),
|
||||
utc_clock,
|
||||
main_clock,
|
||||
mytextclock,
|
||||
s.mylayoutbox,
|
||||
os_menu,
|
||||
},
|
||||
@ -551,50 +546,50 @@ clientkeys = gears.table.join(-- tiling
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
-- for i = 1, 9 do
|
||||
-- hotkey.registerKeys(-- View tag only.
|
||||
-- awful.key({ config.keys.modkey }, "#" .. i + 9,
|
||||
-- function()
|
||||
-- local screen = awful.screen.focused()
|
||||
-- local tag = screen.tags[i]
|
||||
-- if tag then
|
||||
-- tag:view_only()
|
||||
-- end
|
||||
-- end,
|
||||
-- { description = "view tag #" .. i, group = "tag" }),
|
||||
-- -- Toggle tag display.
|
||||
-- awful.key({ config.keys.modkey, "Control" }, "#" .. i + 9,
|
||||
-- function()
|
||||
-- local screen = awful.screen.focused()
|
||||
-- local tag = screen.tags[i]
|
||||
-- if tag then
|
||||
-- awful.tag.viewtoggle(tag)
|
||||
-- end
|
||||
-- end,
|
||||
-- { description = "toggle tag #" .. i, group = "tag" }),
|
||||
-- -- Move client to tag.
|
||||
-- awful.key({ config.keys.modkey, "Shift" }, "#" .. i + 9,
|
||||
-- function()
|
||||
-- if client.focus then
|
||||
-- local tag = client.focus.screen.tags[i]
|
||||
-- if tag then
|
||||
-- client.focus:move_to_tag(tag)
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- { description = "move focused client to tag #" .. i, group = "tag" }),
|
||||
-- -- Toggle tag on focused client.
|
||||
-- awful.key({ config.keys.modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
-- function()
|
||||
-- if client.focus then
|
||||
-- local tag = client.focus.screen.tags[i]
|
||||
-- if tag then
|
||||
-- client.focus:toggle_tag(tag)
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- { description = "toggle focused client on tag #" .. i, group = "tag" }))
|
||||
-- end
|
||||
for i = 1, 9 do
|
||||
hotkey.registerKeys(-- View tag only.
|
||||
awful.key({ config.keys.modkey }, "#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
end,
|
||||
{ description = "view tag #" .. i, group = "tag" }),
|
||||
-- Toggle tag display.
|
||||
awful.key({ config.keys.modkey, "Control" }, "#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
{ description = "toggle tag #" .. i, group = "tag" }),
|
||||
-- Move client to tag.
|
||||
awful.key({ config.keys.modkey, "Shift" }, "#" .. i + 9,
|
||||
function()
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
client.focus:move_to_tag(tag)
|
||||
end
|
||||
end
|
||||
end,
|
||||
{ description = "move focused client to tag #" .. i, group = "tag" }),
|
||||
-- Toggle tag on focused client.
|
||||
awful.key({ config.keys.modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
function()
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
client.focus:toggle_tag(tag)
|
||||
end
|
||||
end
|
||||
end,
|
||||
{ description = "toggle focused client on tag #" .. i, group = "tag" }))
|
||||
end
|
||||
|
||||
clientbuttons = gears.table.join(awful.button({}, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
@ -674,7 +669,7 @@ awful.rules.rules = {
|
||||
rule_any = {
|
||||
type = { "normal", "dialog" }
|
||||
},
|
||||
properties = { titlebars_enabled = false }
|
||||
properties = { titlebars_enabled = true }
|
||||
},
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
|
@ -34,6 +34,15 @@ local bars = wibox.widget {
|
||||
layout = wibox.layout.flex.horizontal
|
||||
}
|
||||
|
||||
function fileExists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function readCommand(command)
|
||||
local handle = io.popen(command, "r")
|
||||
local r = handle:read("*a")
|
||||
@ -151,8 +160,13 @@ function getBatteryCapacity()
|
||||
local capacity = 0
|
||||
for b in getBatteries() do
|
||||
if b:sub(1,3) ~= 'hid' and readCommand("cat /sys/class/power_supply/" .. b .. "/type"):match("Battery") then
|
||||
charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now")
|
||||
capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full")
|
||||
if fileExists("/sys/class/power_supply/" .. b .. "/energy_now") then
|
||||
charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now")
|
||||
capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full")
|
||||
else
|
||||
charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_now")
|
||||
capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_full")
|
||||
end
|
||||
end
|
||||
end
|
||||
return charge / capacity
|
||||
|
Loading…
Reference in New Issue
Block a user