clean up
This commit is contained in:
9
.gitmodules
vendored
9
.gitmodules
vendored
@@ -7,6 +7,9 @@
|
||||
[submodule "awesome/src/lib/color"]
|
||||
path = awesome/src/lib/color
|
||||
url = https://github.com/andOrlando/color
|
||||
[submodule "awesome/src/lib/dbus_proxy"]
|
||||
path = awesome/src/lib/dbus_proxy
|
||||
url = https://github.com/stefano-m/lua-dbus_proxy
|
||||
[submodule "awesome/src/lib/nice"]
|
||||
path = awesome/src/lib/nice
|
||||
url = https://github.com/Crylia/awesome-wm-nice
|
||||
[submodule "awesome/src/lib/lua-dbus_proxy"]
|
||||
path = awesome/src/lib/lua-dbus_proxy
|
||||
url = https://github.com/Crylia/lua-dbus_proxy
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
################################################
|
||||
# ██████╗██████╗ ██╗ ██╗██╗ ██╗ █████╗ #
|
||||
# ██╔════╝██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗ #
|
||||
# ██║ ██████╔╝ ╚████╔╝ ██║ ██║███████║ #
|
||||
# ██║ ██╔══██╗ ╚██╔╝ ██║ ██║██╔══██║ #
|
||||
# ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ #
|
||||
# ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ #
|
||||
################################################
|
||||
|
||||
# Set the window Width and Height in console columns.
|
||||
# The window size will change if the font size changes.
|
||||
window:
|
||||
padding:
|
||||
x: 24
|
||||
y: 24
|
||||
dimensions:
|
||||
columns: 110
|
||||
lines: 30
|
||||
decorations: full
|
||||
startup_mode: Windowed
|
||||
title: "Alacritty Terminal"
|
||||
dynamic_title: true
|
||||
# Scrolling history and multiplier
|
||||
scrolling:
|
||||
history: 10000
|
||||
multiplier: 3
|
||||
# Font family and style
|
||||
font:
|
||||
normal:
|
||||
family: "JetBrains Mono Nerd Font"
|
||||
style: Regular
|
||||
bold:
|
||||
family: "JetBrains Mono Nerd Font"
|
||||
style: Bold
|
||||
italic:
|
||||
family: "JetBrains Mono Nerd Font"
|
||||
style: italic
|
||||
bold_italic:
|
||||
family: "JetBrains Mono Nerd Font"
|
||||
style: Bold Italic
|
||||
size: 14.0
|
||||
offset:
|
||||
y: 0
|
||||
glyph_offset:
|
||||
y: 0
|
||||
# Background opacity from 0.0 transparent, 1.0 Opaque
|
||||
window:
|
||||
opacity: 0.4
|
||||
# Terminal colors
|
||||
colors:
|
||||
primary:
|
||||
background: '0x131621'
|
||||
foreground: '0xa6accd'
|
||||
cursor:
|
||||
text: CellBackground
|
||||
cursor: CellForeground
|
||||
search:
|
||||
matches:
|
||||
foreground: '0x1b1e28'
|
||||
background: '0xadd7ff'
|
||||
focus_match:
|
||||
foreground: '0x1b1e28'
|
||||
background: '0xadd7ff'
|
||||
selection:
|
||||
text: CellForeground
|
||||
background: '0x303340'
|
||||
normal:
|
||||
black: '0x1b1e28'
|
||||
red: '0xd0679d'
|
||||
green: '0x5de4c7'
|
||||
yellow: '0xfffac2'
|
||||
blue: '#435c89'
|
||||
magenta: '0xfcc5e9'
|
||||
cyan: '0xadd7ff'
|
||||
white: '0xffffff'
|
||||
bright:
|
||||
black: '0xa6accd'
|
||||
red: '0xd0679d'
|
||||
green: '0x5de4c7'
|
||||
yellow: '0xfffac2'
|
||||
blue: '0xadd7ff'
|
||||
magenta: '0xfae4fc'
|
||||
cyan: '0x89ddff'
|
||||
white: '0xffffff'
|
||||
# Cursor styling
|
||||
cursor:
|
||||
style: Beam
|
||||
thickness: 0.2
|
||||
unfocused_hollow: false
|
||||
blink_interval: 750
|
||||
|
||||
################################################################################
|
||||
# ███████╗██╗ ██╗ ██████╗ ██████╗ ████████╗ ██████╗██╗ ██╗████████╗███████╗ #
|
||||
# ██╔════╝██║ ██║██╔═══██╗██╔══██╗╚══██╔══╝██╔════╝██║ ██║╚══██╔══╝██╔════╝ #
|
||||
# ███████╗███████║██║ ██║██████╔╝ ██║ ██║ ██║ ██║ ██║ ███████╗ #
|
||||
# ╚════██║██╔══██║██║ ██║██╔══██╗ ██║ ██║ ██║ ██║ ██║ ╚════██║ #
|
||||
# ███████║██║ ██║╚██████╔╝██║ ██║ ██║ ╚██████╗╚██████╔╝ ██║ ███████║ #
|
||||
# ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝ #
|
||||
################################################################################
|
||||
|
||||
# Mouse
|
||||
mouse_bindings:
|
||||
- { mouse: Right, action: Paste }
|
||||
|
||||
# Keyboard
|
||||
key_bindings:
|
||||
- { key: C, mods: Control|Shift, action: Copy }
|
||||
- { key: V, mods: Control|Shift, action: Paste }
|
||||
- { key: C, mods: Control, mode: Vi, action: ClearSelection }
|
||||
1
awesome/src/assets/icons/network/delete.svg
Normal file
1
awesome/src/assets/icons/network/delete.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,19C6,20.1 6.9,21 8,21H16C17.1,21 18,20.1 18,19V7H6V19M8,9H16V19H8V9M15.5,4L14.5,3H9.5L8.5,4H5V6H19V4H15.5Z" /></svg>
|
||||
|
After Width: | Height: | Size: 188 B |
1
awesome/src/assets/icons/network/edit.svg
Normal file
1
awesome/src/assets/icons/network/edit.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z" /></svg>
|
||||
|
After Width: | Height: | Size: 305 B |
5
awesome/src/assets/icons/network/link copy.svg
Normal file
5
awesome/src/assets/icons/network/link copy.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24">
|
||||
<path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 539 B |
5
awesome/src/assets/icons/network/link-off.svg
Normal file
5
awesome/src/assets/icons/network/link-off.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24">
|
||||
<path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 649 B |
Submodule awesome/src/lib/dbus_proxy deleted from c9253bde3f
Submodule awesome/src/lib/lgi-async-extra deleted from 45281ceaf4
1
awesome/src/lib/lua-dbus_proxy
Submodule
1
awesome/src/lib/lua-dbus_proxy
Submodule
Submodule awesome/src/lib/lua-dbus_proxy added at 011306f859
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
awesome/src/lib/nice
Submodule
1
awesome/src/lib/nice
Submodule
Submodule awesome/src/lib/nice added at 8ee083f18c
@@ -134,7 +134,7 @@ function device.new(args)
|
||||
inputbox,
|
||||
widget = wibox.container.constraint,
|
||||
strategy = "exact",
|
||||
width = dpi(400),
|
||||
width = dpi(300),
|
||||
id = "const"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
local abutton = require("awful.button")
|
||||
local aspawn = require("awful.spawn")
|
||||
local base = require("wibox.widget.base")
|
||||
local dbus_proxy = require("dbus_proxy")
|
||||
local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gcolor = require("gears").color
|
||||
local gfilesystem = require("gears").filesystem
|
||||
@@ -249,167 +249,159 @@ end
|
||||
function bluetooth.new(args)
|
||||
args = args or {}
|
||||
|
||||
local ret = base.make_widget_from_value(wibox.widget {
|
||||
-- For some reason the first widget isn't read so the first container is a duplicate
|
||||
local ret = base.make_widget_from_value({
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
image = gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
Theme_config.bluetooth_controller.connected_icon_color),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
id = "icon"
|
||||
},
|
||||
{
|
||||
{
|
||||
text = "Paired Devices",
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "connected",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
bg = Theme_config.bluetooth_controller.connected_bg,
|
||||
fg = Theme_config.bluetooth_controller.connected_fg,
|
||||
shape = Theme_config.bluetooth_controller.connected_shape,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
id = "connected_margin",
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
step = dpi(50),
|
||||
spacing = dpi(10),
|
||||
layout = require("src.lib.overflow_widget.overflow").vertical,
|
||||
scrollbar_width = 0,
|
||||
id = "connected_device_list"
|
||||
},
|
||||
id = "margin",
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
border_color = Theme_config.bluetooth_controller.con_device_border_color,
|
||||
border_width = Theme_config.bluetooth_controller.con_device_border_width,
|
||||
shape = Theme_config.bluetooth_controller.con_device_shape,
|
||||
widget = wibox.container.background,
|
||||
forced_height = 0,
|
||||
id = "connected_list",
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
image = gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
Theme_config.bluetooth_controller.discovered_icon_color),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
id = "icon",
|
||||
},
|
||||
{
|
||||
{
|
||||
text = "Nearby Devices",
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "discovered",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "discovered_bg",
|
||||
bg = Theme_config.bluetooth_controller.discovered_bg,
|
||||
fg = Theme_config.bluetooth_controller.discovered_fg,
|
||||
shape = Theme_config.bluetooth_controller.discovered_shape,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
id = "discovered_margin",
|
||||
top = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "discovered_device_list",
|
||||
spacing = dpi(10),
|
||||
step = dpi(50),
|
||||
layout = require("src.lib.overflow_widget.overflow").vertical,
|
||||
scrollbar_width = 0,
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
border_color = Theme_config.bluetooth_controller.con_device_border_color,
|
||||
border_width = Theme_config.bluetooth_controller.con_device_border_width,
|
||||
shape = Theme_config.bluetooth_controller.con_device_shape,
|
||||
widget = wibox.container.background,
|
||||
forced_height = 0,
|
||||
id = "discovered_list",
|
||||
},
|
||||
{
|
||||
{ -- action buttons
|
||||
{
|
||||
dnd_widget {
|
||||
color = Theme_config.bluetooth_controller.power_bg,
|
||||
size = dpi(40)
|
||||
},
|
||||
id = "dnd",
|
||||
widget = wibox.container.place,
|
||||
resize = false,
|
||||
image = gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
Theme_config.bluetooth_controller.connected_icon_color),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center"
|
||||
halign = "center",
|
||||
id = "connected_icon"
|
||||
},
|
||||
nil,
|
||||
{ -- refresh
|
||||
{
|
||||
{
|
||||
{
|
||||
image = gcolor.recolor_image(icondir .. "refresh.svg",
|
||||
Theme_config.bluetooth_controller.refresh_icon_color),
|
||||
resize = false,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = dpi(5),
|
||||
text = "Paired Devices",
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
shape = Theme_config.bluetooth_controller.refresh_shape,
|
||||
bg = Theme_config.bluetooth_controller.refresh_bg,
|
||||
id = "scan",
|
||||
widget = wibox.container.background
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
top = dpi(10),
|
||||
bg = Theme_config.bluetooth_controller.connected_bg,
|
||||
fg = Theme_config.bluetooth_controller.connected_fg,
|
||||
shape = Theme_config.bluetooth_controller.connected_shape,
|
||||
widget = wibox.container.background,
|
||||
id = "connected_bg"
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
id = "connected_margin",
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
margins = dpi(15),
|
||||
widget = wibox.container.margin
|
||||
{
|
||||
{
|
||||
{
|
||||
step = dpi(50),
|
||||
spacing = dpi(10),
|
||||
layout = require("src.lib.overflow_widget.overflow").vertical,
|
||||
scrollbar_width = 0,
|
||||
id = "connected_device_list"
|
||||
},
|
||||
id = "margin",
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
border_color = Theme_config.bluetooth_controller.con_device_border_color,
|
||||
border_width = Theme_config.bluetooth_controller.con_device_border_width,
|
||||
shape = Theme_config.bluetooth_controller.con_device_shape,
|
||||
widget = wibox.container.background,
|
||||
forced_height = 0,
|
||||
id = "connected_list",
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
image = gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
Theme_config.bluetooth_controller.discovered_icon_color),
|
||||
widget = wibox.widget.imagebox,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
id = "discovered_icon",
|
||||
},
|
||||
{
|
||||
{
|
||||
text = "Nearby Devices",
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "discovered_bg",
|
||||
bg = Theme_config.bluetooth_controller.discovered_bg,
|
||||
fg = Theme_config.bluetooth_controller.discovered_fg,
|
||||
shape = Theme_config.bluetooth_controller.discovered_shape,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
id = "discovered_margin",
|
||||
top = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "discovered_device_list",
|
||||
spacing = dpi(10),
|
||||
step = dpi(50),
|
||||
layout = require("src.lib.overflow_widget.overflow").vertical,
|
||||
scrollbar_width = 0,
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
border_color = Theme_config.bluetooth_controller.con_device_border_color,
|
||||
border_width = Theme_config.bluetooth_controller.con_device_border_width,
|
||||
shape = Theme_config.bluetooth_controller.con_device_shape,
|
||||
widget = wibox.container.background,
|
||||
forced_height = 0,
|
||||
id = "discovered_list",
|
||||
},
|
||||
{
|
||||
{ -- action buttons
|
||||
{
|
||||
dnd_widget {
|
||||
color = Theme_config.bluetooth_controller.power_bg,
|
||||
size = dpi(40)
|
||||
},
|
||||
id = "dnd",
|
||||
widget = wibox.container.place,
|
||||
valign = "center",
|
||||
halign = "center"
|
||||
},
|
||||
nil,
|
||||
{ -- refresh
|
||||
{
|
||||
{
|
||||
image = gcolor.recolor_image(icondir .. "refresh.svg",
|
||||
Theme_config.bluetooth_controller.refresh_icon_color),
|
||||
resize = false,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.widget.imagebox,
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = dpi(5),
|
||||
},
|
||||
shape = Theme_config.bluetooth_controller.refresh_shape,
|
||||
bg = Theme_config.bluetooth_controller.refresh_bg,
|
||||
id = "scan",
|
||||
widget = wibox.container.background
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
top = dpi(10),
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
shape = Theme_config.bluetooth_controller.shape,
|
||||
border_color = Theme_config.bluetooth_controller.container_border_color,
|
||||
border_width = Theme_config.bluetooth_controller.container_border_width,
|
||||
bg = Theme_config.bluetooth_controller.container_bg,
|
||||
widget = wibox.container.background
|
||||
margins = dpi(15),
|
||||
widget = wibox.container.margin,
|
||||
},
|
||||
width = dpi(400),
|
||||
strategy = "exact",
|
||||
widget = wibox.container.constraint
|
||||
margins = dpi(15),
|
||||
widget = wibox.container.margin,
|
||||
})
|
||||
|
||||
-- Get a reference to the dnd button
|
||||
@@ -489,7 +481,7 @@ function bluetooth.new(args)
|
||||
--#region Dropdown logic
|
||||
local connected_margin = ret:get_children_by_id("connected_margin")[1]
|
||||
local connected_list = ret:get_children_by_id("connected_list")[1]
|
||||
local connected = ret:get_children_by_id("connected")[1].center
|
||||
local connected_icon = ret:get_children_by_id("connected_icon")[1]
|
||||
|
||||
connected_margin:connect_signal(
|
||||
"button::press",
|
||||
@@ -503,21 +495,23 @@ function bluetooth.new(args)
|
||||
end
|
||||
}
|
||||
if connected_list.forced_height == 0 then
|
||||
local size = (#ret:get_paired_devices() * 60) + 1
|
||||
local size = (#ret:get_paired_devices() * 60)
|
||||
if size < 210 then
|
||||
rubato_timer.target = dpi(size)
|
||||
end
|
||||
connected_margin.connected_bg.shape = function(cr, width, height)
|
||||
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
||||
if size > 0 then
|
||||
connected_margin.connected_bg.shape = function(cr, width, height)
|
||||
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
||||
end
|
||||
connected_icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg",
|
||||
Theme_config.bluetooth_controller.connected_icon_color))
|
||||
end
|
||||
connected.icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg",
|
||||
Theme_config.bluetooth_controller.connected_icon_color))
|
||||
else
|
||||
rubato_timer.target = 0
|
||||
connected_margin.connected_bg.shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
connected.icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
connected_icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
Theme_config.bluetooth_controller.connected_icon_color))
|
||||
end
|
||||
end
|
||||
@@ -526,7 +520,7 @@ function bluetooth.new(args)
|
||||
local discovered_margin = ret:get_children_by_id("discovered_margin")[1]
|
||||
local discovered_list = ret:get_children_by_id("discovered_list")[1]
|
||||
local discovered_bg = ret:get_children_by_id("discovered_bg")[1]
|
||||
local discovered = ret:get_children_by_id("discovered")[1].center
|
||||
local discovered_icon = ret:get_children_by_id("discovered_icon")[1]
|
||||
|
||||
discovered_margin:connect_signal(
|
||||
"button::press",
|
||||
@@ -541,22 +535,24 @@ function bluetooth.new(args)
|
||||
}
|
||||
|
||||
if discovered_list.forced_height == 0 then
|
||||
local size = (#ret:get_discovered_devices() * 60) + 1
|
||||
local size = (#ret:get_discovered_devices() * 60)
|
||||
if size > 210 then
|
||||
size = 210
|
||||
end
|
||||
rubato_timer.target = dpi(size)
|
||||
discovered_margin.discovered_bg.shape = function(cr, width, height)
|
||||
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
||||
if size > 0 then
|
||||
rubato_timer.target = dpi(size)
|
||||
discovered_margin.discovered_bg.shape = function(cr, width, height)
|
||||
gshape.partially_rounded_rect(cr, width, height, true, true, false, false, dpi(4))
|
||||
end
|
||||
discovered_icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg",
|
||||
Theme_config.bluetooth_controller.discovered_icon_color))
|
||||
end
|
||||
discovered.icon:set_image(gcolor.recolor_image(icondir .. "menu-up.svg",
|
||||
Theme_config.bluetooth_controller.discovered_icon_color))
|
||||
else
|
||||
rubato_timer.target = 0
|
||||
discovered_bg.shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
discovered.icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
discovered_icon:set_image(gcolor.recolor_image(icondir .. "menu-down.svg",
|
||||
Theme_config.bluetooth_controller.discovered_icon_color))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ return function(s)
|
||||
elseif widget == "Battery" then
|
||||
table.insert(widget_table, require("src.widgets.battery")(User_config.battery_kind))
|
||||
elseif widget == "Bluetooth" then
|
||||
table.insert(widget_table, require("src.widgets.bluetooth")())
|
||||
table.insert(widget_table, require("src.widgets.bluetooth")(s))
|
||||
elseif widget == "Clock" then
|
||||
table.insert(widget_table, require("src.widgets.clock")())
|
||||
elseif widget == "Cpu Frequency" then
|
||||
|
||||
@@ -16,7 +16,8 @@ local cm = require("src.modules.context_menu.init")
|
||||
|
||||
local capi = {
|
||||
mouse = mouse,
|
||||
awesome = awesome
|
||||
awesome = awesome,
|
||||
screen = screen,
|
||||
}
|
||||
|
||||
local icondir = gfilesystem.get_configuration_dir() .. "src/assets/icons/desktop/"
|
||||
@@ -46,7 +47,7 @@ function desktop:save_layout()
|
||||
}
|
||||
end
|
||||
|
||||
local dir = gfilesystem.get_configuration_dir() .. "src/config"
|
||||
dir = gfilesystem.get_configuration_dir() .. "src/config"
|
||||
gfilesystem.make_directories(dir)
|
||||
if not gfilesystem.file_readable(dir .. "/desktop.json") then
|
||||
os.execute("touch " .. dir .. "/desktop.json")
|
||||
@@ -214,6 +215,9 @@ function desktop:add_element(args, pos)
|
||||
cm_popup.visible = false
|
||||
end)
|
||||
|
||||
local cols = math.floor(self.args.screen.geometry.width / (args.icon_size * 1.75 * (4 / 3)))
|
||||
local rows = math.floor((self.args.screen.geometry.height - 75 + 95) / (args.icon_size * 1.75))
|
||||
print(cols, rows)
|
||||
-- While the mouse is down, remove the element from the grid and add it to manual then move it
|
||||
-- until the mouse is released and then add it back to the grid.
|
||||
e:connect_signal("button::press", function(_, _, _, b)
|
||||
@@ -221,8 +225,8 @@ function desktop:add_element(args, pos)
|
||||
|
||||
if not mousegrabber.isrunning() then
|
||||
|
||||
local width = args.icon_size * 1.75 * (4 / 3)
|
||||
local height = args.icon_size * 1.75
|
||||
local width = (self.args.screen.geometry.width - 20 - ((cols - 1) * 10)) / cols
|
||||
local height = (self.args.screen.geometry.height - 170 - 20) / rows
|
||||
|
||||
local dnd_widget = element {
|
||||
icon = args.icon,
|
||||
@@ -291,33 +295,39 @@ function desktop:add_element(args, pos)
|
||||
end
|
||||
|
||||
function desktop:draw_selector()
|
||||
local start_pos = mouse.coords()
|
||||
local start_pos = capi.mouse.coords()
|
||||
if not mousegrabber.isrunning() then
|
||||
local selector = wibox.widget {
|
||||
widget = wibox.container.background,
|
||||
bg = gcolor("#0ffff088"),
|
||||
border_color = gcolor("#0ffff0"),
|
||||
border_width = dpi(2),
|
||||
width = 100,
|
||||
height = 100,
|
||||
forced_width = 0,
|
||||
forced_height = 0,
|
||||
x = start_pos.x,
|
||||
y = start_pos.y,
|
||||
visible = true,
|
||||
shape = function(cr, w, h)
|
||||
gshape.rounded_rect(cr, w, h, dpi(10))
|
||||
end
|
||||
}
|
||||
|
||||
local coords = capi.mouse.coords()
|
||||
selector.point = { x = coords.x, y = coords.y }
|
||||
selector.point = { x = start_pos.x, y = start_pos.y }
|
||||
self.widget.manual:add(selector)
|
||||
mousegrabber.run(function(m)
|
||||
if m.buttons[1] then
|
||||
selector.visible = true
|
||||
end
|
||||
if not m.buttons[1] then
|
||||
print("stop")
|
||||
mousegrabber.stop()
|
||||
selector.visible = false
|
||||
self.widget.manual:reset()
|
||||
end
|
||||
selector.forced_width = selector.forced_width + ((start_pos.x - m.x) * -1)
|
||||
selector.forced_height = selector.forced_width + ((start_pos.y - m.y) * -1)
|
||||
|
||||
print(selector.forced_width, selector.forced_height)
|
||||
return m.buttons[1]
|
||||
end, "left_ptr")
|
||||
end
|
||||
end
|
||||
@@ -341,18 +351,10 @@ end
|
||||
function desktop.new(args)
|
||||
args = args or {}
|
||||
|
||||
args.screen = args.screen or awful.screen.focused()
|
||||
|
||||
local icon_size = args.icon_size or dpi(96)
|
||||
|
||||
-- calculate the row and column count based on the screen size and icon size and aspect ratio of 16:9
|
||||
local screen_width = awful.screen.focused().geometry.width
|
||||
local screen_height = awful.screen.focused().geometry.height
|
||||
local aspect_ratio = 4 / 3
|
||||
|
||||
local cols = math.floor(screen_width / (icon_size * 1.75 * aspect_ratio))
|
||||
local rows = math.floor((screen_height - (dpi(75 + 95))) / (icon_size * 1.75))
|
||||
|
||||
local cols = math.floor(args.screen.geometry.width / (icon_size * 1.75 * (4 / 3)))
|
||||
local rows = math.floor((args.screen.geometry.height - 75 + 95) / (icon_size * 1.75))
|
||||
--[[
|
||||
The wibox has a stacked layout with a manual layout over a grid.
|
||||
|
||||
@@ -371,15 +373,15 @@ function desktop.new(args)
|
||||
x = 0,
|
||||
y = 0,
|
||||
bg = gcolor.transparent,
|
||||
width = 1920,
|
||||
height = 1080,
|
||||
width = args.screen.geometry.width,
|
||||
height = args.screen.geometry.height,
|
||||
screen = args.screen,
|
||||
widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
layout = grid,
|
||||
homogeneous = true,
|
||||
spacing = dpi(10),
|
||||
spacing = 10,
|
||||
expand = true,
|
||||
orientation = "horizontal",
|
||||
forced_num_cols = cols,
|
||||
@@ -401,6 +403,8 @@ function desktop.new(args)
|
||||
}
|
||||
}
|
||||
|
||||
w.args = args
|
||||
|
||||
local cm_popup = cm {
|
||||
widget_template = wibox.widget {
|
||||
{
|
||||
@@ -563,29 +567,19 @@ function desktop.new(args)
|
||||
}
|
||||
}
|
||||
|
||||
w.widget.manual:buttons(
|
||||
gtable.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function()
|
||||
cm_popup.visible = false
|
||||
if capi.mouse.current_widgets[4] == w.widget.manual then
|
||||
--w:draw_selector()
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
if capi.mouse.current_widgets[4] == w.widget.manual then
|
||||
cm_popup:toggle()
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
)
|
||||
w.widget.manual:buttons(gtable.join(
|
||||
awful.button({}, 1, function()
|
||||
cm_popup.visible = false
|
||||
if capi.mouse.current_widgets[4] == w.widget.manual then
|
||||
w:draw_selector()
|
||||
end
|
||||
end),
|
||||
awful.button({}, 3, function()
|
||||
if capi.mouse.current_widgets[4] == w.widget.manual then
|
||||
cm_popup:toggle()
|
||||
end
|
||||
end)
|
||||
))
|
||||
|
||||
gtable.crush(w, desktop, true)
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ function element:on_hover()
|
||||
self.border_color = "#0ffff099"
|
||||
end)
|
||||
|
||||
self:connect_signal("mouse::leave", function()
|
||||
--[[ self:connect_signal("mouse::leave", function()
|
||||
self.bg = gcolor.transparent
|
||||
self.border_color = gcolor.transparent
|
||||
end)
|
||||
end) ]]
|
||||
|
||||
self:connect_signal("button::press", function()
|
||||
self.bg = "#0ffff088"
|
||||
|
||||
@@ -4,31 +4,22 @@
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
|
||||
awful.screen.connect_for_each_screen(
|
||||
-- For each screen this function is called once
|
||||
-- If you want to change the modules per screen use the indices
|
||||
-- e.g. 1 would be the primary screen and 2 the secondary screen.
|
||||
function(s)
|
||||
-- Create 9 tags
|
||||
awful.layout.append_default_layouts(User_config.layouts)
|
||||
awful.tag(
|
||||
{ "1", "2", "3", "4", "5", "6", "7", "8", "9" },
|
||||
s,
|
||||
User_config.layouts[1]
|
||||
)
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
-- Create 9 tags
|
||||
awful.layout.append_default_layouts(User_config.layouts)
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, User_config.layouts[1])
|
||||
|
||||
require("src.modules.desktop.desktop") { screen = s }
|
||||
require("src.modules.powermenu.powermenu")(s)
|
||||
require("src.modules.audio.volume_osd") { screen = s }
|
||||
--require("src.modules.audio.volume_controller") { screen = s }
|
||||
require("src.modules.brightness.brightness_osd")(s)
|
||||
require("src.modules.titlebar.titlebar")
|
||||
require("src.modules.crylia_bar.init")(s)
|
||||
--require("src.modules.crylia_wibox.init")(s)
|
||||
require("src.modules.notification-center.init")(s)
|
||||
require("src.modules.window_switcher.init")(s)
|
||||
require("src.modules.application_launcher.init") { screen = s }
|
||||
--require("src.modules.calendar.init") { screen = s }
|
||||
require("src.modules.network_controller.init") { screen = s }
|
||||
end
|
||||
)
|
||||
require("src.modules.desktop.desktop") { screen = s }
|
||||
require("src.modules.powermenu.powermenu")(s)
|
||||
require("src.modules.audio.volume_osd") { screen = s }
|
||||
--require("src.modules.audio.volume_controller") { screen = s }
|
||||
require("src.modules.brightness.brightness_osd") { screen = s }
|
||||
require("src.lib.nice") { titlebar_font = User_config.font.bold,
|
||||
titlebar_items = { left = { "icon" }, right = { "minimize", "maximize", "close" } } }
|
||||
require("src.modules.crylia_bar.init")(s)
|
||||
--require("src.modules.crylia_wibox.init")(s)
|
||||
require("src.modules.notification-center.init")(s)
|
||||
require("src.modules.window_switcher.init")(s)
|
||||
require("src.modules.application_launcher.init") { screen = s }
|
||||
require("src.modules.network_controller.init") { screen = s }
|
||||
end)
|
||||
|
||||
@@ -3,22 +3,152 @@
|
||||
------------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local abutton = require("awful.button")
|
||||
local awidget = require("awful.widget")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gtable = require("gears").table
|
||||
local gfilesystem = require("gears").filesystem
|
||||
local gobject = require("gears").object
|
||||
local gcolor = require("gears").color
|
||||
local lgi = require("lgi")
|
||||
local wibox = require("wibox")
|
||||
local base = require("wibox.widget.base")
|
||||
local NM = require("lgi").NM
|
||||
local NM = lgi.NM
|
||||
|
||||
-- Third party libs
|
||||
local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy")
|
||||
|
||||
-- Own libs
|
||||
local ap_form = require("src.modules.network_controller.ap_form")
|
||||
local cm = require("src.modules.context_menu.init")
|
||||
|
||||
local icondir = gfilesystem.get_configuration_dir() .. "src/assets/icons/network/"
|
||||
|
||||
local access_point = { mt = {} }
|
||||
|
||||
local function flags_to_security(flags, wpa_flags, rsn_flags)
|
||||
local str = ""
|
||||
if flags == 1 and wpa_flags == 0 and rsn_flags == 0 then
|
||||
str = str .. " WEP"
|
||||
end
|
||||
if wpa_flags ~= 0 then
|
||||
str = str .. " WPA1"
|
||||
end
|
||||
if not rsn_flags ~= 0 then
|
||||
str = str .. " WPA2"
|
||||
end
|
||||
if wpa_flags == 512 or rsn_flags == 512 then
|
||||
str = str .. " 802.1X"
|
||||
end
|
||||
|
||||
return (str:gsub("^%s", ""))
|
||||
end
|
||||
|
||||
function access_point:get_access_point_connections(ssid)
|
||||
local cn = {}
|
||||
|
||||
local connections = self.NetworkManagerSettings:ListConnections()
|
||||
for _, connection_path in ipairs(connections) do
|
||||
local NetworkManagerSettingsConnection = dbus_proxy.Proxy:new {
|
||||
bus = dbus_proxy.Bus.SYSTEM,
|
||||
name = "org.freedesktop.NetworkManager",
|
||||
interface = "org.freedesktop.NetworkManager.Settings.Connection",
|
||||
path = connection_path
|
||||
}
|
||||
|
||||
if NetworkManagerSettingsConnection.Filename:find(ssid) then
|
||||
table.insert(cn, NetworkManagerSettingsConnection)
|
||||
end
|
||||
end
|
||||
|
||||
return cn
|
||||
end
|
||||
|
||||
function access_point:create_profile(ap, password, auto_connect)
|
||||
local s_wsec = {}
|
||||
local security = flags_to_security(ap.Flags, ap.WpaFlags, ap.RsnFlags)
|
||||
if security ~= "" then
|
||||
if security:match("WPA") then
|
||||
s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "wpa-psk")
|
||||
s_wsec["auth-alg"] = lgi.GLib.Variant("s", "open")
|
||||
s_wsec["psk"] = lgi.GLib.Variant("s", password)
|
||||
else
|
||||
s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "None")
|
||||
s_wsec["wep-key-type"] = lgi.GLib.Variant("s", NM.WepKeyType.PASSPHRASE)
|
||||
s_wsec["wep-key0"] = lgi.GLib.Variant("s", password)
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
["connection"] = {
|
||||
-- ["interface-name"] = lgi.GLib.Variant("s", ap.device_interface),
|
||||
["uuid"] = lgi.GLib.Variant("s", string.gsub('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx', '[xy]', function(c)
|
||||
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format('%x', v)
|
||||
end)),
|
||||
["id"] = lgi.GLib.Variant("s", NM.utils_ssid_to_utf8(ap.Ssid)),
|
||||
["type"] = lgi.GLib.Variant("s", "802-11-wireless"),
|
||||
["autoconnect"] = lgi.GLib.Variant("b", auto_connect),
|
||||
},
|
||||
["ipv4"] = {
|
||||
["method"] = lgi.GLib.Variant("s", "auto")
|
||||
},
|
||||
["ipv6"] = {
|
||||
["method"] = lgi.GLib.Variant("s", "auto"),
|
||||
},
|
||||
["802-11-wireless"] = {
|
||||
["mode"] = lgi.GLib.Variant("s", "infrastructure"),
|
||||
},
|
||||
["802-11-wireless-security"] = s_wsec
|
||||
}
|
||||
end
|
||||
|
||||
function access_point:disconnect_ap()
|
||||
self.NetworkManager:DeactivateConnection(self.NetworkManagerDevice.ActiveConnection)
|
||||
end
|
||||
|
||||
function access_point:connect(ap, password, auto_connect)
|
||||
local connections = self:get_access_point_connections(NM.utils_ssid_to_utf8(ap.Ssid))
|
||||
local profile = self:create_profile(self.NetworkManagerAccessPoint, password, auto_connect)
|
||||
|
||||
if #connections == 0 then
|
||||
self.NetworkManager:AddAndActivateConnectionAsync(function(proxy, context, success, fail)
|
||||
if fail ~= nil then
|
||||
print("Error: " .. tostring(fail), tostring(fail.code))
|
||||
self:emit_signal("NetworkManager::failed", tostring(fail), tostring(fail.code))
|
||||
return
|
||||
end
|
||||
|
||||
self:emit_signal("NetworkManager::connected", success)
|
||||
end, { call_id = "my-id" }, profile, self.NetworkManagerDevice.object_path,
|
||||
self.NetworkManagerAccessPoint.object_path)
|
||||
--88ALYLNxo9Kk*RwRxMfN
|
||||
else
|
||||
connections[1]:Update(profile)
|
||||
self.NetworkManager:ActivateConnectionAsync(function(proxy, context, success, failure)
|
||||
if failure then
|
||||
self:emit_signal("NM::AccessPointFailed", tostring(failure))
|
||||
return
|
||||
end
|
||||
|
||||
self:emit_signal("NM::AccessPointConnected", NM.utils_ssid_to_utf8(ap.Ssid))
|
||||
end,
|
||||
{ call_id = "my-id" }, connections[1].object_path, self.NetworkManagerDevice.object_path,
|
||||
self.NetworkManagerAccessPoint.object_path)
|
||||
end
|
||||
end
|
||||
|
||||
function access_point:toggle_access_point(ap, password, auto_connect)
|
||||
if self:is_ap_active(ap) then
|
||||
self:disconnect_ap()
|
||||
else
|
||||
self:connect_ap(ap, password, auto_connect)
|
||||
end
|
||||
end
|
||||
|
||||
function access_point:is_ap_active(ap)
|
||||
return ap.path == self.NetworkManagerDeviceWireless.ActiveAccessPoint
|
||||
end
|
||||
|
||||
function access_point.new(args)
|
||||
args = args or {}
|
||||
|
||||
@@ -32,6 +162,13 @@ function access_point.new(args)
|
||||
Theme_config.network_manager.access_point.icon_color2
|
||||
end ]]
|
||||
|
||||
local ssid_text = awidget.inputbox {
|
||||
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid) or
|
||||
args.NetworkManagerAccessPoint.hw_address or "Unknown",
|
||||
halign = "left",
|
||||
valign = "center",
|
||||
}
|
||||
|
||||
local ret = base.make_widget_from_value(wibox.widget {
|
||||
{
|
||||
{
|
||||
@@ -57,21 +194,11 @@ function access_point.new(args)
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid) or
|
||||
args.NetworkManagerAccessPoint.hw_address or "Unknown",
|
||||
id = "alias",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
{
|
||||
text = "Connecting...",
|
||||
id = "connecting",
|
||||
visible = false,
|
||||
font = User_config.font.specify .. ", regular 10",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "alias_container",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
ssid_text,
|
||||
widget = wibox.container.constraint,
|
||||
strategy = "exact",
|
||||
width = dpi(300),
|
||||
id = "alias"
|
||||
},
|
||||
width = dpi(260),
|
||||
height = dpi(40),
|
||||
@@ -130,21 +257,92 @@ function access_point.new(args)
|
||||
gtable.crush(ret, access_point, true)
|
||||
|
||||
ret.NetworkManagerAccessPoint = args.NetworkManagerAccessPoint
|
||||
ret.NetworkManagerSettings = args.NetworkManagerSettings
|
||||
ret.NetworkManagerDeviceWireless = args.NetworkManagerDeviceWireless
|
||||
ret.NetworkManagerDevice = args.NetworkManagerDevice
|
||||
ret.NetworkManager = args.NetworkManager
|
||||
|
||||
ret.ap_form = ap_form { screen = args.screen, ssid = NM.utils_ssid_to_utf8(ret.NetworkManagerAccessPoint.Ssid) }
|
||||
ret.ap_form = ap_form {
|
||||
screen = args.screen,
|
||||
NetworkManagerAccessPoint = args.NetworkManagerAccessPoint,
|
||||
ap = ret
|
||||
}
|
||||
|
||||
ret:buttons(
|
||||
gtable.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
nil,
|
||||
function()
|
||||
ret.ap_form:popup_toggle()
|
||||
ret.cm = cm {
|
||||
widget_template = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = true,
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
id = "icon_role",
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
stragety = "exact",
|
||||
width = dpi(24),
|
||||
height = dpi(24),
|
||||
id = "const"
|
||||
},
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
valign = "center",
|
||||
halign = "left",
|
||||
id = "text_role"
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
}, spacing = dpi(10),
|
||||
entries = {
|
||||
{ -- Connect/Disconnect a device
|
||||
name = "ret.device.Connected" and "Disconnect" or "Connect",
|
||||
icon = gcolor.recolor_image("ret.device.Connected" and icondir .. "link-off.svg" or
|
||||
icondir .. "link.svg",
|
||||
Theme_config.network_manager.access_point.icon_color),
|
||||
callback = function()
|
||||
ret:toggle_access_point()
|
||||
end,
|
||||
id = "connected"
|
||||
},
|
||||
{ -- Rename a device
|
||||
name = "Rename",
|
||||
icon = gcolor.recolor_image(icondir .. "edit.svg", Theme_config.network_manager.icon_color),
|
||||
callback = function()
|
||||
ssid_text:focus()
|
||||
ssid_text:connect_signal("submit", function(text)
|
||||
text = text:get_text()
|
||||
ssid_text.markup = ret:rename(text)
|
||||
end)
|
||||
end
|
||||
)
|
||||
},
|
||||
{ -- Remove a device
|
||||
name = "Remove",
|
||||
icon = gcolor.recolor_image(icondir .. "delete.svg", Theme_config.network_manager.icon_color),
|
||||
callback = function()
|
||||
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret:buttons(gtable.join(
|
||||
abutton({}, 1, nil,
|
||||
function()
|
||||
--TODO:Check if there are any connection details, else open the popup
|
||||
ret.ap_form:popup_toggle()
|
||||
end
|
||||
),
|
||||
abutton({}, 3, nil,
|
||||
function()
|
||||
ret.cm:toggle()
|
||||
end
|
||||
)
|
||||
)
|
||||
))
|
||||
|
||||
ret:get_children_by_id("con")[1].image = gcolor.recolor_image(
|
||||
icondir .. "link.svg", icon_color)
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
local awful = require("awful")
|
||||
local abutton = require("awful.button")
|
||||
local aplacement = require("awful.placement")
|
||||
local apopup = require("awful.popup")
|
||||
local awidget = require("awful.widget")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gtable = require("gears.table")
|
||||
local gobject = require("gears.object")
|
||||
local gcolor = require("gears.color")
|
||||
local gshape = require("gears.shape")
|
||||
local gfilesystem = require("gears.filesystem")
|
||||
local NM = require("lgi").NM
|
||||
local wibox = require("wibox")
|
||||
|
||||
local icondir = gfilesystem.get_configuration_dir() .. "src/assets/icons/network/"
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse,
|
||||
mousegrabber = mousegrabber
|
||||
}
|
||||
|
||||
@@ -22,47 +26,11 @@ end
|
||||
|
||||
function ap_form.new(args)
|
||||
args = args or {}
|
||||
args.screen = args.screen or awful.screen.preferred()
|
||||
args.screen = args.screen
|
||||
|
||||
local settigns_form = {
|
||||
password = awful.widget.inputbox {
|
||||
widget_template = wibox.template {
|
||||
widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
halign = "left",
|
||||
valign = "center",
|
||||
id = "text_role",
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
margins = 5,
|
||||
id = "marg"
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = "exact",
|
||||
width = 400,
|
||||
height = 50,
|
||||
id = "const"
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
bg = "#212121",
|
||||
fg = "#F0F0F0",
|
||||
border_color = "#414141",
|
||||
border_width = 2,
|
||||
shape = gshape.rounded_rect,
|
||||
forced_width = 300,
|
||||
forced_height = 50,
|
||||
},
|
||||
update_callback = function(template_widget, args)
|
||||
template_widget.widget.const.marg.text_role.markup = args.text
|
||||
end
|
||||
}
|
||||
},
|
||||
}
|
||||
local password = awidget.inputbox { hint_text = "Password..." }
|
||||
|
||||
local ret = awful.popup {
|
||||
local ret = apopup {
|
||||
widget = {
|
||||
{
|
||||
{ -- Header
|
||||
@@ -71,7 +39,7 @@ function ap_form.new(args)
|
||||
{
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
text = args.ssid,
|
||||
text = NM.utils_ssid_to_utf8(args.NetworkManagerAccessPoint.Ssid),
|
||||
font = User_config.font.specify .. ",extra bold 16",
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
@@ -115,7 +83,30 @@ function ap_form.new(args)
|
||||
right = dpi(20),
|
||||
},
|
||||
-- Change to inputtextbox container
|
||||
settigns_form.password,
|
||||
{
|
||||
{
|
||||
{
|
||||
password,
|
||||
widget = wibox.container.margin,
|
||||
margins = 5,
|
||||
id = "marg"
|
||||
},
|
||||
widget = wibox.container.constraint,
|
||||
strategy = "exact",
|
||||
width = 400,
|
||||
height = 50,
|
||||
id = "const"
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
bg = "#212121",
|
||||
fg = "#F0F0F0",
|
||||
border_color = "#414141",
|
||||
border_width = 2,
|
||||
shape = gshape.rounded_rect,
|
||||
forced_width = 300,
|
||||
forced_height = 50,
|
||||
id = "password_container"
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{ -- Actions
|
||||
@@ -181,7 +172,7 @@ function ap_form.new(args)
|
||||
widget = wibox.container.margin,
|
||||
margins = dpi(10)
|
||||
},
|
||||
placement = awful.placement.centered,
|
||||
placement = aplacement.centered,
|
||||
ontop = true,
|
||||
visible = false,
|
||||
width = dpi(600),
|
||||
@@ -195,6 +186,30 @@ function ap_form.new(args)
|
||||
screen = args.screen,
|
||||
}
|
||||
|
||||
local password_container = ret.widget:get_children_by_id("password_container")[1]
|
||||
|
||||
-- Focus the searchbar when its left clicked
|
||||
password_container:buttons(gtable.join {
|
||||
abutton({}, 1, function()
|
||||
password:focus()
|
||||
end)
|
||||
})
|
||||
|
||||
--#region Hover signals to change the cursor to a text cursor
|
||||
local old_cursor, old_wibox
|
||||
password_container:connect_signal("mouse::enter", function()
|
||||
local wid = capi.mouse.current_wibox
|
||||
if wid then
|
||||
old_cursor, old_wibox = wid.cursor, wid
|
||||
wid.cursor = "xterm"
|
||||
end
|
||||
end)
|
||||
password_container:connect_signal("mouse::leave", function()
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end)
|
||||
--#endregion
|
||||
|
||||
gtable.crush(ret, ap_form, true)
|
||||
|
||||
local checkbox = ret.widget:get_children_by_id("checkbox")[1]
|
||||
@@ -210,13 +225,10 @@ function ap_form.new(args)
|
||||
|
||||
local connect_button = ret.widget:get_children_by_id("connect_button")[1]
|
||||
connect_button:connect_signal("button::press", function()
|
||||
ret:emit_signal("ap_form::connect", {
|
||||
ssid = args.ssid,
|
||||
password = settigns_form.password:get_text(),
|
||||
auto_connect = ret.widget:get_children_by_id("checkbox")[1].checked
|
||||
})
|
||||
print("Connect to " .. args.ssid:get_text(), "\nPassword: " .. settigns_form.password:get_text(),
|
||||
"\nAuto connect: " .. tostring(ret.widget:get_children_by_id("checkbox")[1].checked))
|
||||
password:stop()
|
||||
args.ap:connect(args.NetworkManagerAccessPoint, password:get_text(),
|
||||
ret.widget:get_children_by_id("checkbox")[1].checked)
|
||||
ret:popup_toggle()
|
||||
end)
|
||||
Hover_signal(connect_button)
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local dbus_proxy = require("dbus_proxy")
|
||||
local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gtable = require("gears").table
|
||||
local gtimer = require("gears").timer
|
||||
local gshape = require("gears").shape
|
||||
local gobject = require("gears").object
|
||||
local gcolor = require("gears").color
|
||||
local gears = require("gears")
|
||||
local lgi = require("lgi")
|
||||
@@ -24,11 +23,6 @@ local dnd_widget = require("awful.widget.toggle_widget")
|
||||
|
||||
local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/network/"
|
||||
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
}
|
||||
|
||||
local network = { mt = {} }
|
||||
|
||||
network.NMState = {
|
||||
@@ -63,31 +57,6 @@ network.DeviceState = {
|
||||
FAILED = 120
|
||||
}
|
||||
|
||||
local function flags_to_security(flags, wpa_flags, rsn_flags)
|
||||
local str = ""
|
||||
if flags == 1 and wpa_flags == 0 and rsn_flags == 0 then
|
||||
str = str .. " WEP"
|
||||
end
|
||||
if wpa_flags ~= 0 then
|
||||
str = str .. " WPA1"
|
||||
end
|
||||
if not rsn_flags ~= 0 then
|
||||
str = str .. " WPA2"
|
||||
end
|
||||
if wpa_flags == 512 or rsn_flags == 512 then
|
||||
str = str .. " 802.1X"
|
||||
end
|
||||
|
||||
return (str:gsub("^%s", ""))
|
||||
end
|
||||
|
||||
local function generate_uuid()
|
||||
return string.gsub('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx', '[xy]', function(c)
|
||||
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format('%x', v)
|
||||
end)
|
||||
end
|
||||
|
||||
function network:get_wifi_proxy()
|
||||
local devices = self._private.NetworkManager:GetDevices()
|
||||
for _, path in ipairs(devices) do
|
||||
@@ -146,74 +115,16 @@ function network.device_state_to_string(state)
|
||||
return device_state_to_string[state]
|
||||
end
|
||||
|
||||
function network:get_access_point_connections(ssid)
|
||||
local cn = {}
|
||||
|
||||
local connections = self._private.NetworkManagerSettings:ListConnections()
|
||||
for _, connection_path in ipairs(connections) do
|
||||
local NetworkManagerSettingsConnection = dbus_proxy.Proxy:new {
|
||||
bus = dbus_proxy.Bus.SYSTEM,
|
||||
name = "org.freedesktop.NetworkManager",
|
||||
interface = "org.freedesktop.NetworkManager.Settings.Connection",
|
||||
path = connection_path
|
||||
}
|
||||
|
||||
if NetworkManagerSettingsConnection.Filename:find(ssid) then
|
||||
table.insert(cn, NetworkManagerSettingsConnection)
|
||||
end
|
||||
end
|
||||
|
||||
return cn
|
||||
end
|
||||
|
||||
function network:create_profile(ap, password, auto_connect)
|
||||
local s_wsec = {}
|
||||
if ap.security ~= "" then
|
||||
if ap.security:match("WPA") then
|
||||
s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "wpa-psk")
|
||||
s_wsec["auth-alg"] = lgi.GLib.Variant("s", "open")
|
||||
--s_wsec["psk"] = lgi.GLib.Variant("s", helpers.string.trim(password))
|
||||
else
|
||||
s_wsec["key-mgmt"] = lgi.GLib.Variant("s", "None")
|
||||
s_wsec["wep-key-type"] = lgi.GLib.Variant("s", NM.WepKeyType.PASSPHRASE)
|
||||
--s_wsec["wep-key0"] = lgi.GLib.Variant("s", helpers.string.trim(password))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
["connection"] = {
|
||||
-- ["interface-name"] = lgi.GLib.Variant("s", ap.device_interface),
|
||||
["uuid"] = lgi.GLib.Variant("s", generate_uuid()),
|
||||
["id"] = lgi.GLib.Variant("s", ap.ssid),
|
||||
["type"] = lgi.GLib.Variant("s", "802-11-wireless"),
|
||||
["autoconnect"] = lgi.GLib.Variant("b", auto_connect),
|
||||
},
|
||||
["ipv4"] = {
|
||||
["method"] = lgi.GLib.Variant("s", "auto")
|
||||
},
|
||||
["ipv6"] = {
|
||||
["method"] = lgi.GLib.Variant("s", "auto"),
|
||||
},
|
||||
["802-11-wireless"] = {
|
||||
["mode"] = lgi.GLib.Variant("s", "infrastructure"),
|
||||
},
|
||||
["802-11-wireless-security"] = s_wsec
|
||||
}
|
||||
end
|
||||
|
||||
---Scan for access points and create a widget for each one.
|
||||
function network:scan_access_points()
|
||||
local ap_list = self:get_children_by_id("wifi_ap_list")[1]
|
||||
|
||||
ap_list:reset()
|
||||
self._private.NetworkManagerDeviceWireless:RequestScanAsync(function(proxy, context, success, failure)
|
||||
if failure then
|
||||
-- Send an error notification
|
||||
print("AP Scan failed: ", failure)
|
||||
return
|
||||
end
|
||||
|
||||
-- Get every access point even those who hide their ssid
|
||||
print(#self._private.NetworkManagerDeviceWireless:GetAllAccessPoints())
|
||||
for _, ap in ipairs(self._private.NetworkManagerDeviceWireless:GetAllAccessPoints()) do
|
||||
|
||||
-- Create a new proxy for every ap
|
||||
@@ -223,69 +134,27 @@ function network:scan_access_points()
|
||||
interface = "org.freedesktop.NetworkManager.AccessPoint",
|
||||
path = ap
|
||||
}
|
||||
--[[ for _, ap2 in ipairs(ap_list.children) do
|
||||
if ap2.NetworkManagerAccessPoint.HwAddress:match(ap.HwAddress or "") then
|
||||
goto continue
|
||||
end
|
||||
end ]]
|
||||
|
||||
print("AP Found: ", NetworkManagerAccessPoint.HwAddress, NM.utils_ssid_to_utf8(NetworkManagerAccessPoint.Ssid),
|
||||
NetworkManagerAccessPoint.Strength)
|
||||
|
||||
|
||||
-- We are only interested in those with a ssid
|
||||
if NetworkManagerAccessPoint.Ssid then
|
||||
ap_list:add(access_point { NetworkManagerAccessPoint = NetworkManagerAccessPoint })
|
||||
ap_list:add(access_point {
|
||||
NetworkManagerAccessPoint = NetworkManagerAccessPoint,
|
||||
NetworkManagerDevice = self._private.NetworkManagerDevice,
|
||||
NetworkManagerSettings = self._private.NetworkManagerSettings,
|
||||
NetworkManager = self._private.NetworkManager,
|
||||
NetworkManagerDeviceWireless = self._private.NetworkManagerDeviceWireless
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(ap_list, function(a, b)
|
||||
return a.NetworkManagerAccessPoint.Strength > b.NetworkManagerAccessPoint.Strength
|
||||
end)
|
||||
print("AP_Anzahl: ", #ap_list.children)
|
||||
end, { call_id = "my-id" }, {})
|
||||
end
|
||||
|
||||
function network:is_ap_active(ap)
|
||||
return ap.path == self._private.wifi_proxy.ActiveAccessPoint
|
||||
end
|
||||
|
||||
function network:disconnect_ap()
|
||||
self._private.NetworkManager:DeactivateConnection(self._private.NetworkManagerDevice.ActiveConnection)
|
||||
end
|
||||
|
||||
function network:connect_ap(ap, pw, auto_connect)
|
||||
local connections = self:get_access_point_connections(ap.ssid)
|
||||
local profile = self:create_profile(ap, pw, auto_connect)
|
||||
|
||||
if #connections == 0 then
|
||||
self._private.NetworkManager:AddAndActivateConnectionAsync(function(proxy, context, success, failure)
|
||||
if failure then
|
||||
self:emit_signal("NM::AccessPointFailed", tostring(failure))
|
||||
return
|
||||
end
|
||||
|
||||
self:emit_signal("NM::AccessPointConnected", ap.ssid)
|
||||
end, { call_id = "my-id", profile, ap.device_proxy_path, ap.path })
|
||||
else
|
||||
connections[1]:Update(profile)
|
||||
self._private.NetworkManager:ActivateConnectionAsync(function(proxy, context, success, failure)
|
||||
if failure then
|
||||
self:emit_signal("NM::AccessPointFailed", tostring(failure))
|
||||
return
|
||||
end
|
||||
|
||||
self:emit_signal("NM::AccessPointConnected", ap.ssid)
|
||||
end, { call_id = "my-id", connections[1].object_path, ap.device_proxy_path, ap.path })
|
||||
end
|
||||
end
|
||||
|
||||
function network:toggle_access_point(ap, password, auto_connect)
|
||||
if self:is_ap_active(ap) then
|
||||
self:disconnect_ap()
|
||||
else
|
||||
self:connect_ap(ap, password, auto_connect)
|
||||
end
|
||||
return ap.path == self._private.NetworkManagerDeviceWireless.ActiveAccessPoint
|
||||
end
|
||||
|
||||
---Toggles networking on or off
|
||||
|
||||
@@ -1,447 +0,0 @@
|
||||
-----------------------------------
|
||||
-- This is the titlebar module --
|
||||
-----------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
client = client
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/titlebar/"
|
||||
|
||||
awful.titlebar.enable_tooltip = true
|
||||
awful.titlebar.fallback_name = 'Client'
|
||||
|
||||
-- Normal AND Focus(active/inactive) have to be set or errors will appear in stdout
|
||||
Theme.titlebar_close_button_normal = icondir .. "close.svg"
|
||||
Theme.titlebar_close_button_focus = icondir .. "close.svg"
|
||||
Theme.titlebar_minimize_button_normal = icondir .. "minimize.svg"
|
||||
Theme.titlebar_minimize_button_focus = icondir .. "minimize.svg"
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
|
||||
local create_buttons = function(c)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function()
|
||||
c:activate { context = 'titlebar', action = 'mouse_move' }
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
c:activate { context = 'titlebar', action = 'mouse_resize' }
|
||||
end
|
||||
)
|
||||
)
|
||||
return buttons
|
||||
end
|
||||
|
||||
local create_titlebar = function(c, size, position)
|
||||
local close_button = awful.titlebar.widget.closebutton(c)
|
||||
local minimize_button = awful.titlebar.widget.minimizebutton(c)
|
||||
local maximize_button = awful.titlebar.widget.maximizedbutton(c)
|
||||
|
||||
local tb
|
||||
|
||||
if position == "left" then
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = Theme_config.titlebar.bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
tb = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
close_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.close_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
{
|
||||
maximize_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.maximize_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "maximizebutton"
|
||||
},
|
||||
{
|
||||
minimize_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.minimize_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_buttons(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
|
||||
titlebar:setup { tb, layout = wibox.layout.fixed.horizontal }
|
||||
|
||||
elseif position == "top" then
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "top",
|
||||
bg = Theme_config.titlebar.bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
tb = wibox.widget {
|
||||
{
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.titlewidget(c),
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
layout = wibox.container.place,
|
||||
},
|
||||
buttons = create_buttons(c),
|
||||
fill_space = true,
|
||||
layout = wibox.layout.stack
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
minimize_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.minimize_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
{
|
||||
maximize_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.maximize_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "maximizebutton"
|
||||
},
|
||||
{
|
||||
close_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.close_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
layout = wibox.layout.align.horizontal,
|
||||
id = "main"
|
||||
}
|
||||
|
||||
titlebar:setup { tb, layout = wibox.layout.fixed.vertical }
|
||||
end
|
||||
|
||||
if not tb then return end
|
||||
|
||||
close_button:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
c.border_color = Theme_config.titlebar.close_button.hover_border
|
||||
local cb = tb:get_children_by_id("closebutton")[1]
|
||||
cb.border_color = Theme_config.titlebar.close_button.hover_border
|
||||
cb.bg = Theme_config.titlebar.close_button.hover_bg
|
||||
end
|
||||
)
|
||||
|
||||
close_button:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
c.border_color = Theme_config.window.border_normal
|
||||
local cb = tb:get_children_by_id("closebutton")[1]
|
||||
cb.border_color = Theme_config.titlebar.close_button.border_color
|
||||
cb.bg = Theme_config.titlebar.close_button.bg
|
||||
end
|
||||
)
|
||||
|
||||
minimize_button:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
c.border_color = Theme_config.titlebar.minimize_button.hover_border
|
||||
local mb = tb:get_children_by_id("minimizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.minimize_button.hover_border
|
||||
mb.bg = Theme_config.titlebar.minimize_button.hover_bg
|
||||
end
|
||||
)
|
||||
|
||||
minimize_button:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
c.border_color = Theme_config.window.border_normal
|
||||
local mb = tb:get_children_by_id("minimizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.minimize_button.border_color
|
||||
mb.bg = Theme_config.titlebar.minimize_button.bg
|
||||
end
|
||||
)
|
||||
|
||||
maximize_button:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
c.border_color = Theme_config.titlebar.maximize_button.hover_border
|
||||
local mb = tb:get_children_by_id("maximizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.maximize_button.hover_border
|
||||
mb.bg = Theme_config.titlebar.maximize_button.hover_bg
|
||||
end
|
||||
)
|
||||
|
||||
maximize_button:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
c.border_color = Theme_config.window.border_normal
|
||||
local mb = tb:get_children_by_id("maximizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.maximize_button.border_color
|
||||
mb.bg = Theme_config.titlebar.maximize_button.bg
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local create_titlebar_dialog_modal = function(c, size, position)
|
||||
local close_button = awful.titlebar.widget.closebutton(c)
|
||||
local minimize_button = awful.titlebar.widget.minimizebutton(c)
|
||||
local maximize_button = awful.titlebar.widget.maximizedbutton(c)
|
||||
|
||||
local tb
|
||||
|
||||
if position == "left" then
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = Theme_config.titlebar.bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
tb = wibox.widget {
|
||||
{
|
||||
{
|
||||
close_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.close_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_buttons(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
|
||||
titlebar:setup { tb, layout = wibox.layout.fixed.horizontal }
|
||||
|
||||
elseif position == "top" then
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "top",
|
||||
bg = Theme_config.titlebar.bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
tb = wibox.widget {
|
||||
{
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.titlewidget(c),
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
layout = wibox.container.place,
|
||||
},
|
||||
buttons = create_buttons(c),
|
||||
fill_space = true,
|
||||
layout = wibox.layout.stack
|
||||
},
|
||||
{
|
||||
{
|
||||
close_button,
|
||||
widget = wibox.container.background,
|
||||
border_color = Theme_config.titlebar.close_button.border_color,
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
layout = wibox.layout.align.horizontal,
|
||||
id = "main"
|
||||
}
|
||||
|
||||
titlebar:setup { tb, layout = wibox.layout.fixed.vertical }
|
||||
end
|
||||
|
||||
if not tb then return end
|
||||
|
||||
close_button:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
c.border_color = Theme_config.titlebar.close_button.hover_border
|
||||
local cb = tb:get_children_by_id("closebutton")[1]
|
||||
cb.border_color = Theme_config.titlebar.close_button.hover_border
|
||||
cb.bg = Theme_config.titlebar.close_button.hover_bg
|
||||
end
|
||||
)
|
||||
|
||||
close_button:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
c.border_color = Theme_config.window.border_normal
|
||||
local cb = tb:get_children_by_id("closebutton")[1]
|
||||
cb.border_color = Theme_config.titlebar.close_button.border_color
|
||||
cb.bg = Theme_config.titlebar.close_button.bg
|
||||
end
|
||||
)
|
||||
|
||||
minimize_button:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
c.border_color = Theme_config.titlebar.minimize_button.hover_border
|
||||
local mb = tb:get_children_by_id("minimizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.minimize_button.hover_border
|
||||
mb.bg = Theme_config.titlebar.minimize_button.hover_bg
|
||||
end
|
||||
)
|
||||
|
||||
minimize_button:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
c.border_color = Theme_config.window.border_normal
|
||||
local mb = tb:get_children_by_id("minimizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.minimize_button.border_color
|
||||
mb.bg = Theme_config.titlebar.minimize_button.bg
|
||||
end
|
||||
)
|
||||
|
||||
maximize_button:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
c.border_color = Theme_config.titlebar.maximize_button.hover_border
|
||||
local mb = tb:get_children_by_id("maximizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.maximize_button.hover_border
|
||||
mb.bg = Theme_config.titlebar.maximize_button.hover_bg
|
||||
end
|
||||
)
|
||||
|
||||
maximize_button:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
c.border_color = Theme_config.window.border_normal
|
||||
local mb = tb:get_children_by_id("maximizebutton")[1]
|
||||
mb.border_color = Theme_config.titlebar.maximize_button.border_color
|
||||
mb.bg = Theme_config.titlebar.maximize_button.bg
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
capi.client.connect_signal(
|
||||
"request::titlebars",
|
||||
function(c)
|
||||
if c.type == "dialog" then
|
||||
create_titlebar_dialog_modal(c, dpi(35), User_config.titlebar_position)
|
||||
elseif c.type == "modal" then
|
||||
create_titlebar_dialog_modal(c, dpi(35), User_config.titlebar_position)
|
||||
else
|
||||
create_titlebar(c, dpi(35), User_config.titlebar_position)
|
||||
end
|
||||
|
||||
if not c.floating or c.maximized or c.fullscreen then
|
||||
if User_config.titlebar_position == "left" then
|
||||
awful.titlebar.hide(c, "left")
|
||||
elseif User_config.titlebar_position == "top" then
|
||||
awful.titlebar.hide(c, "top")
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
capi.client.connect_signal(
|
||||
"property::floating",
|
||||
function(c)
|
||||
if c.floating and not (c.maximized or c.fullscreen) then
|
||||
if User_config.titlebar_position == "left" then
|
||||
awful.titlebar.show(c, "left")
|
||||
elseif User_config.titlebar_position == "top" then
|
||||
awful.titlebar.show(c, "top")
|
||||
end
|
||||
else
|
||||
if User_config.titlebar_position == "left" then
|
||||
awful.titlebar.hide(c, "left")
|
||||
elseif User_config.titlebar_position == "top" then
|
||||
awful.titlebar.hide(c, "top")
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
case $1 in
|
||||
"get")
|
||||
echo $(xfpm-power-backlight-helper --get-brightness)
|
||||
;;
|
||||
"set")
|
||||
echo $(pkexec xfpm-power-backlight-helper --set-brightness $2)
|
||||
;;
|
||||
esac
|
||||
@@ -515,8 +515,13 @@ Theme_config.right_bar = {
|
||||
|
||||
Theme_config.titlebar = {
|
||||
bg = "#121212AA",
|
||||
size = dpi(38),
|
||||
close_button = {
|
||||
border_color = "#00000000",
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
bg = "#00000000",
|
||||
fg = color["Grey100"],
|
||||
hover_border = color["Red800"],
|
||||
@@ -525,6 +530,10 @@ Theme_config.titlebar = {
|
||||
},
|
||||
minimize_button = {
|
||||
border_color = "#00000000",
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
fg = color["Grey100"],
|
||||
bg = "#00000000",
|
||||
hover_border = color["Orange800"],
|
||||
@@ -533,6 +542,10 @@ Theme_config.titlebar = {
|
||||
},
|
||||
maximize_button = {
|
||||
border_color = "#00000000",
|
||||
border_width = dpi(2),
|
||||
shape = function(cr, width, height)
|
||||
gshape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
fg = color["Grey100"],
|
||||
bg = "#00000000",
|
||||
hover_border = color["Green800"],
|
||||
|
||||
@@ -55,6 +55,14 @@ User_config = {
|
||||
]] --
|
||||
battery_path = nil,
|
||||
|
||||
--[[
|
||||
The brightness increase/decrease step in percent.
|
||||
Example:
|
||||
brightness_step = 5
|
||||
Will increase the brightness by 5% at a time
|
||||
]]
|
||||
brightness_step = 2,
|
||||
|
||||
--[[
|
||||
DnD or 'Do not Disturb' will prevent notifications from poping up.
|
||||
This is just a default value, you can toggle it in the notification-center, but it won't be saved.
|
||||
@@ -213,7 +221,7 @@ User_config = {
|
||||
--[[
|
||||
This is the default terminal, Alacritty is the default.
|
||||
]] --
|
||||
terminal = "alacritty",
|
||||
terminal = "kitty",
|
||||
|
||||
text_editor = "code",
|
||||
|
||||
|
||||
87
awesome/src/tools/color_helper.lua
Normal file
87
awesome/src/tools/color_helper.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
local cairo = require("lgi").cairo
|
||||
local gcolor = require("gears.color")
|
||||
local gdk = require("lgi").Gdk
|
||||
local gsurface = require("gears.surface")
|
||||
local gtable = require("gears.table")
|
||||
|
||||
local color_helper = { mt = {} }
|
||||
color_helper.color_rules = {}
|
||||
|
||||
function color_helper.set_color_rule(c, color)
|
||||
color_helper.color_rules[c.instance] = color
|
||||
end
|
||||
|
||||
function color_helper.get_color_rule(c)
|
||||
return color_helper.color_rules[c.instance]
|
||||
end
|
||||
|
||||
function color_helper.lighten(color, amount)
|
||||
local r, g, b
|
||||
r, g, b = gcolor.parse_color(color)
|
||||
r = 255 * r
|
||||
g = 255 * g
|
||||
b = 255 * b
|
||||
r = r + math.floor(2.55 * amount)
|
||||
g = g + math.floor(2.55 * amount)
|
||||
b = b + math.floor(2.55 * amount)
|
||||
r = r > 255 and 255 or r
|
||||
g = g > 255 and 255 or g
|
||||
b = b > 255 and 255 or b
|
||||
return ("#%02x%02x%02x"):format(r, g, b)
|
||||
end
|
||||
|
||||
function color_helper.duotone_gradient_vertical(color_1, color_2, height, offset_1, offset_2)
|
||||
local fill_pattern = cairo.Pattern.create_linear(0, 0, 0, height)
|
||||
local r, g, b, a
|
||||
r, g, b, a = gcolor.parse_color(color_1)
|
||||
fill_pattern:add_color_stop_rgba(offset_1 or 0, r, g, b, a)
|
||||
r, g, b, a = gcolor.parse_color(color_2)
|
||||
fill_pattern:add_color_stop_rgba(offset_2 or 1, r, g, b, a)
|
||||
return fill_pattern
|
||||
end
|
||||
|
||||
function color_helper.get_dominant_color(client)
|
||||
local color, pb, bytes
|
||||
local tally, content, cgeo = {}, gsurface(client.content), client:geometry()
|
||||
local x_offset, y_offset, x_lim = 2, 2, math.floor(cgeo.width / 2)
|
||||
|
||||
for x_pos = 0, x_lim, 2 do
|
||||
for y_pos = 0, 8, 1 do
|
||||
pb = gdk.pixbuf_get_from_surface(content, x_offset + x_pos, y_offset + y_pos, 1, 1)
|
||||
bytes = pb:get_pixels()
|
||||
color = "#" .. bytes:gsub(".", function(c)
|
||||
return ("%02x"):format(c:byte())
|
||||
end)
|
||||
if not tally[color] then
|
||||
tally[color] = 1
|
||||
else
|
||||
tally[color] = tally[color] + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
local mode
|
||||
local mode_c = 0
|
||||
for k, v in pairs(tally) do
|
||||
if v > mode_c then
|
||||
mode_c = v
|
||||
mode = k
|
||||
end
|
||||
end
|
||||
color = mode
|
||||
color_helper.set_color_rule(client, color)
|
||||
return color
|
||||
end
|
||||
|
||||
function color_helper.new(args)
|
||||
local ret = {}
|
||||
|
||||
gtable.crush(ret, color_helper, true)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function color_helper.mt:__call(...)
|
||||
return color_helper.new(...)
|
||||
end
|
||||
|
||||
return setmetatable(color_helper, color_helper.mt)
|
||||
@@ -1,6 +1,6 @@
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local dbus_proxy = require("dbus_proxy")
|
||||
local dbus_proxy = require("src.lib.lua-dbus_proxy.src.dbus_proxy")
|
||||
local lgi = require("lgi")
|
||||
|
||||
local capi = {
|
||||
|
||||
@@ -2,14 +2,18 @@
|
||||
-- This is the bluetooth widget --
|
||||
----------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
-- Awesome libs
|
||||
local awful = require("awful")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
-- Own libs
|
||||
local bt_module = require("src.modules.bluetooth.init")
|
||||
|
||||
local capi = {
|
||||
awesome = awesome,
|
||||
mouse = mouse
|
||||
}
|
||||
|
||||
-- Icon directory path
|
||||
@@ -18,21 +22,9 @@ local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/bl
|
||||
-- Returns the bluetooth widget
|
||||
return function(s)
|
||||
|
||||
local bt_widget = require("src.modules.bluetooth.init") { screen = s }
|
||||
|
||||
local bluetooth_container = awful.popup {
|
||||
widget = bt_widget:get_widget(),
|
||||
ontop = true,
|
||||
bg = Theme_config.bluetooth_controller.container_bg,
|
||||
stretch = false,
|
||||
visible = false,
|
||||
forced_width = dpi(400),
|
||||
screen = s,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(12))
|
||||
end
|
||||
}
|
||||
|
||||
-- Get the bluetooth module
|
||||
local bt_widget = bt_module { screen = s }
|
||||
-- Create the bluetooth widget
|
||||
local bluetooth_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
@@ -60,6 +52,25 @@ return function(s)
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
-- If bt_widget is nil then there is no bluetooth adapter and there shouldn't be done
|
||||
-- anything besides returning the widget without any logic behind
|
||||
if not bt_widget then
|
||||
return bluetooth_widget
|
||||
end
|
||||
|
||||
-- Create the awful.popup container for the module
|
||||
local bluetooth_container = awful.popup {
|
||||
widget = bt_widget,
|
||||
ontop = true,
|
||||
stretch = false,
|
||||
visible = false,
|
||||
screen = s,
|
||||
border_color = Theme_config.bluetooth_controller.container_border_color,
|
||||
border_width = Theme_config.bluetooth_controller.container_border_width,
|
||||
bg = Theme_config.bluetooth_controller.container_bg
|
||||
}
|
||||
|
||||
-- When the status changes update the icon
|
||||
bt_widget:connect_signal("bluetooth::status", function(status)
|
||||
bluetooth_widget:get_children_by_id("icon")[1].image = gears.color.recolor_image(status._private.Adapter1.Powered and
|
||||
icondir .. "bluetooth-on.svg" or icondir .. "bluetooth-off.svg", Theme_config.bluetooth.fg)
|
||||
@@ -68,19 +79,17 @@ return function(s)
|
||||
-- Hover signal to change color when mouse is over
|
||||
Hover_signal(bluetooth_widget)
|
||||
|
||||
bluetooth_widget:connect_signal(
|
||||
"button::press",
|
||||
function(_, _, _, key)
|
||||
if key == 1 then
|
||||
local geo = mouse.current_wibox:geometry()
|
||||
bluetooth_container.x = geo.x
|
||||
bluetooth_container.y = geo.y + dpi(55)
|
||||
bluetooth_container.visible = not bluetooth_container.visible
|
||||
else
|
||||
capi.awesome.emit_signal("toggle_bluetooth")
|
||||
end
|
||||
-- On left click toggle the bluetooth container else toggle the bluetooth on/off
|
||||
bluetooth_widget:connect_signal("button::press", function(_, _, _, key)
|
||||
if key == 1 then
|
||||
local geo = capi.mouse.current_wibox:geometry()
|
||||
bluetooth_container.x = geo.x
|
||||
bluetooth_container.y = geo.y + dpi(55)
|
||||
bluetooth_container.visible = not bluetooth_container.visible
|
||||
else
|
||||
capi.awesome.emit_signal("toggle_bluetooth")
|
||||
end
|
||||
)
|
||||
end)
|
||||
|
||||
return bluetooth_widget
|
||||
end
|
||||
|
||||
@@ -16,6 +16,14 @@
|
||||
- Algorithm to select the best search match
|
||||
- Keep track of most launched applications and serve them over others
|
||||
|
||||
### Backlight [100% Done]
|
||||
|
||||
#### Features
|
||||
|
||||
- Change backlight with your backlight keys
|
||||
- See the change on a OSD that pops up
|
||||
- Works with all devices by writing into /usr/class/backlight/`device`
|
||||
|
||||
### Bluetooth [95% Done]
|
||||
|
||||
#### Features
|
||||
@@ -37,4 +45,42 @@
|
||||
- Getting and asking for a passcode
|
||||
- "Greying out" non avaiable options in the dropdown
|
||||
|
||||
### Calendar [60% Done]
|
||||
|
||||
#### Features
|
||||
|
||||
- Read .ical files and put them into the calendar
|
||||
- Create tasks for every day
|
||||
- Month/Year switcher
|
||||
- Saved accross restarts
|
||||
- Popup with the task informations
|
||||
|
||||
#### TODO
|
||||
|
||||
- Create a new task for a calendar
|
||||
- Create an alert that notifies the user
|
||||
- Week numbers
|
||||
- Remove a calendar
|
||||
- Remove a task
|
||||
|
||||
### Desktop [40% Done]
|
||||
|
||||
- Create desktop icons, folders or files
|
||||
- Drag and drop desktop icons
|
||||
- Context menu
|
||||
- Saves accross restart
|
||||
- Desktop context menu
|
||||
|
||||
TODO
|
||||
|
||||
- Actions for the context menu
|
||||
- Open width in context menu
|
||||
- Drag across multiple screens
|
||||
- Proper size calculation for desktop icons and desktop
|
||||
- Multiscreen support in general
|
||||
- MIME types for files
|
||||
- xdg folder types
|
||||
- Drag-select
|
||||
- Cross-DE support (e.g. use the same desktop icons as used in KDE or Mate ...)
|
||||
|
||||
## Widgets
|
||||
|
||||
142
i3/config
142
i3/config
@@ -1,142 +0,0 @@
|
||||
#################################################################
|
||||
# ██╗██████╗ ██████╗██████╗ ██╗ ██╗██╗ ██╗ █████╗ #
|
||||
# ██║╚════██╗ ██╔════╝██╔══██╗╚██╗ ██╔╝██║ ██║██╔══██╗ #
|
||||
# ██║ █████╔╝█████╗██║ ██████╔╝ ╚████╔╝ ██║ ██║███████║ #
|
||||
# ██║ ╚═══██╗╚════╝██║ ██╔══██╗ ╚██╔╝ ██║ ██║██╔══██║ #
|
||||
# ██║██████╔╝ ╚██████╗██║ ██║ ██║ ███████╗██║██║ ██║ #
|
||||
# ╚═╝╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝ #
|
||||
#################################################################
|
||||
|
||||
# Modifier
|
||||
set $mod Mod4
|
||||
floating_modifier $mod
|
||||
|
||||
# Client theme
|
||||
client.focused #a6bcfa #a6bcfa #a6bcfa #a6bcfa
|
||||
client.unfocused #585f75 #585f75 #585f75 #585f75
|
||||
client.focused_inactive #585f75 #585f75 #585f75 #585f75
|
||||
client.urgent #fbdf91 #fbdf91 #fbdf91 #fbdf91
|
||||
font pango:JetBrainsNerd Font Mono 10
|
||||
for_window [class="^.*"] border pixel 2
|
||||
gaps inner 10
|
||||
hide_edge_borders smart
|
||||
|
||||
# Window modes
|
||||
bindsym $mod+f fullscreen toggle
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# Set screen
|
||||
set $primary_screen DP-0
|
||||
set $second_screen HDMI-0
|
||||
|
||||
# Set workspaces
|
||||
set $ws1 "1"
|
||||
set $ws2 "2"
|
||||
set $ws3 "3"
|
||||
set $ws4 "4"
|
||||
set $ws5 "5"
|
||||
set $ws6 "6"
|
||||
set $ws7 "7"
|
||||
set $ws8 "8"
|
||||
set $ws9 "9"
|
||||
set $ws10 "SecondScreen"
|
||||
|
||||
# Assign workspace to screen
|
||||
workspace $ws10 output $second_screen
|
||||
|
||||
# Globalkeys
|
||||
bindsym Print exec flameshot gui
|
||||
bindsym $mod+e exec nautilus
|
||||
bindsym $mod+Return exec alacritty
|
||||
bindsym $mod+d exec --no-startup-id rofi -show drun -theme ~/.config/rofi/appmenu/rofi.rasi
|
||||
bindsym $mod+Control+c reload
|
||||
bindsym $mod+Control+r restart
|
||||
bindsym $mod+Shift+e exec --no-startup-id "rofi -show power-menu -modi 'power-menu:~/.config/rofi/rofi-power-menu --choices=shutdown/reboot/logout/lockscreen' -theme ~/.config/rofi/powermenu/powermenu.rasi"
|
||||
|
||||
# Clientkeys
|
||||
bindsym $mod+q kill
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
bindsym $mod+h split h
|
||||
bindsym $mod+v split v
|
||||
bindsym $mod+a focus parent
|
||||
# Switch to workspace
|
||||
bindsym $mod+1 workspace number $ws1
|
||||
bindsym $mod+2 workspace number $ws2
|
||||
bindsym $mod+3 workspace number $ws3
|
||||
bindsym $mod+4 workspace number $ws4
|
||||
bindsym $mod+5 workspace number $ws5
|
||||
bindsym $mod+6 workspace number $ws6
|
||||
bindsym $mod+7 workspace number $ws7
|
||||
bindsym $mod+8 workspace number $ws8
|
||||
bindsym $mod+9 workspace number $ws9
|
||||
bindsym $mod+0 workspace number $ws10
|
||||
# Move window to workspace x
|
||||
bindsym $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws10
|
||||
# Function Keys
|
||||
bindsym XF86AudioPlay exec playerctl play-pause
|
||||
bindsym XF86AudioStop exec playerctl stop
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl -- set-sink-volume @DEFAULT_SINK@ +5% #increase sound volume
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl -- set-sink-volume @DEFAULT_SINK@ -5% #decrease sound volume
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl -- set-sink-mute @DEFAULT_SINK@ toggle # mute sound
|
||||
bindsym XF86MonBrightnessUp exec xbacklight -inc 10 # increase screen brightness
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -dec 10 # decrease screen brightnessR
|
||||
|
||||
# Modes
|
||||
mode "resize" {
|
||||
bindsym Left resize shrink width 10 px or 10 ppt
|
||||
bindsym Down resize grow height 10 px or 10 ppt
|
||||
bindsym Up resize shrink height 10 px or 10 ppt
|
||||
bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
bindsym $mod+r mode "default"
|
||||
}
|
||||
|
||||
# Modekeys
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
# Floating exceptions
|
||||
for_window [title="Lautstärkeregler"] floating enable
|
||||
for_window [class="Arandr"] floating enable
|
||||
for_window [class="Grub-customizer"] floating enable
|
||||
for_window [class="Gnome-control-center"] floating enable
|
||||
for_window [class="Xfce4-power-manager-settings"] floating enable
|
||||
for_window [class="Lutris" id=63012046 instance="lutris" title="Läufer verwalten"] floating enable
|
||||
for_window [class="zoom" title="Chat"] floating enable
|
||||
|
||||
# Autostart
|
||||
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
|
||||
exec --no-startup-id picom --experimental-backends
|
||||
exec --no-startup-id setxkbmap -layout us
|
||||
exec_always --no-startup-id $HOME/.config/polybar/scripts/launch.sh
|
||||
exec_always --no-startup-id picom --experimental-backends
|
||||
exec_always --no-startup-id nitrogen --restore
|
||||
exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
|
||||
exec --no-startup-id power-manager-plugins
|
||||
exec --no-startup-id ~/.screenlayout/i3.sh
|
||||
exec --no-startup-id /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd
|
||||
exec discord
|
||||
exec spotify
|
||||
|
||||
# Automove window to workspace
|
||||
for_window [class="Spotify"] move container to workspace $ws10
|
||||
for_window [class="discord"] move container to workspace $ws10
|
||||
@@ -1,63 +0,0 @@
|
||||
;============================================================;
|
||||
; ;
|
||||
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ ;
|
||||
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ ;
|
||||
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ ;
|
||||
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ ;
|
||||
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ ;
|
||||
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ;
|
||||
; ;
|
||||
;=============================================================;
|
||||
|
||||
[colors]
|
||||
background = #212121
|
||||
foreground = #ffffff
|
||||
primay-900 = #0D47A1
|
||||
primay-800 = #1565C0
|
||||
primay-700 = #1976D2
|
||||
primay-600 = #1E88E5
|
||||
primay-500 = #2196F3
|
||||
primay-400 = #42A5F5
|
||||
primay-300 = #64B5F6
|
||||
primay-200 = #90CAF9
|
||||
primay-100 = #BBDEFB
|
||||
primay-50 = #E3F2FD
|
||||
|
||||
[global/wm]
|
||||
margin-top = 5
|
||||
margin-bottom = 5
|
||||
include-file = ~/.config/polybar/modules/modules.ini
|
||||
|
||||
[bar/crylia]
|
||||
monitor = ${env:MONITOR:}
|
||||
width = 100%
|
||||
height = 25
|
||||
fixed-center = true
|
||||
line-size = 2
|
||||
background = ${colors.background}
|
||||
foreground = ${colors.foreground}
|
||||
padding-left = 0
|
||||
padding-right = 0
|
||||
|
||||
;Default Font
|
||||
font-0 = "JetBrainsMono Nerd Font Mono:size=18:antialias=true;4"
|
||||
font-1 = "JetBrainsMono Nerd Font Mono:size=12:antialias=true;3"
|
||||
; Separator Font
|
||||
font-2 = "Ubuntu Nerd Font:size=25:antialias=true;2"
|
||||
; Bluetooth Icon Font
|
||||
font-3 = "JetBrainsMonoExtraBold Nerd Font Mono:size=12:antialias=true;3"
|
||||
|
||||
modules-left = i3 xwindow
|
||||
modules-center = date
|
||||
modules-right = separator6 sound separator5 memory separator4 gpu-nvidia separator3 cpu separator2 eth separator1 powermenu
|
||||
|
||||
scroll-up = i3wm-wsnext
|
||||
scroll-down = i3wm-wsprev
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
;compositing-background = xor
|
||||
;compositing-background = screen
|
||||
;compositing-foreground = source
|
||||
;compositing-border = over
|
||||
;pseudo-transparency = true
|
||||
@@ -1,6 +0,0 @@
|
||||
[module/battery]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/scripts/battery.sh
|
||||
format-font = 1
|
||||
interval = 10
|
||||
click-right = xfce4-power-manager-settings
|
||||
@@ -1,9 +0,0 @@
|
||||
[module/bluetooth]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/scripts/bluetooth.sh
|
||||
format-font = 4
|
||||
format-background = ${colors.background}
|
||||
format-foreground = ${colors.cyan}
|
||||
format-padding = 1
|
||||
click-left = $HOME/.config/polybar/scripts/bluetooth_toogle.sh
|
||||
click-right = blueman-manager
|
||||
@@ -1,10 +0,0 @@
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 2
|
||||
format = <label>
|
||||
label = " %{F#40C4FF}CPU %percentage%%"
|
||||
label-foreground = ${colors.bluegreen}
|
||||
label-background = ${colors.background}
|
||||
label-font = 2
|
||||
label-padding-left = 0
|
||||
label-padding-right = 1
|
||||
@@ -1,11 +0,0 @@
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 1
|
||||
|
||||
date = "%{F#FFE082}%{T1} %{T2}%a, %b %d"
|
||||
|
||||
time = "%{T1} %{T2}%H:%M"
|
||||
|
||||
label = %date% - %time%
|
||||
label-foreground = ${colors.green}
|
||||
label-font = 2
|
||||
@@ -1,11 +0,0 @@
|
||||
[module/gpu-nvidia]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/scripts/gpu-nvidia.sh
|
||||
interval = 2
|
||||
format-font = 2
|
||||
format-foreground = #69F0AE
|
||||
|
||||
[module/gpu-intel]
|
||||
type = custom/script
|
||||
#exec = $HOME/.config/polybar/scripts/gpu-intel.sh
|
||||
interval = 2
|
||||
@@ -1,24 +0,0 @@
|
||||
[module/i3]
|
||||
type = internal/i3
|
||||
format = <label-state>
|
||||
index-sort = true
|
||||
wrapping-scroll = false
|
||||
pin-workspaces = true
|
||||
|
||||
label-focused-font = 4
|
||||
label-unfocused-font = 4
|
||||
label-visible-font = 4
|
||||
label-urgent-font = 4
|
||||
|
||||
label-focused = "%{T1}%{F#00fff9}%{B#212121}%{T4}%{F#212121}%{B#00fff9} %name% %{T1}%{F#00fff9}%{B#212121}"
|
||||
|
||||
label-unfocused = "%{T1}%{F#9600ff}%{B#212121}%{T4}%{F#212121}%{B#9600ff} %name% %{T1}%{F#9600ff}%{B#212121}"
|
||||
label-unfocused-foreground = #00ACC1
|
||||
|
||||
; visible = Active workspace on unfocused monitor
|
||||
label-visible = "%{T1}%{F#00b8ff}%{B#212121}%{T4}%{F#212121}%{B#00b8ff} %name% %{T1}%{F#00b8ff}%{B#212121}"
|
||||
label-visible-foreground = #00E5FF
|
||||
|
||||
; urgent = Workspace with urgency hint set
|
||||
label-urgent = "%{T1}%{F#ff00c1}%{B#212121}%{T4}%{F#212121}%{B#ff00c1} %name% %{T1}%{F#ff00c1}%{B#212121}"
|
||||
label-urgent-foreground = #FF5252
|
||||
@@ -1,8 +0,0 @@
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
interval = 3
|
||||
format = <label>
|
||||
label = " %{F#FFFF00} %{T2}RAM %gb_used% | %gb_total% "
|
||||
label-font = 1
|
||||
label-padding-left = 0
|
||||
label-padding-right = 0
|
||||
@@ -1,15 +0,0 @@
|
||||
[global/wm]
|
||||
include-file = ~/.config/polybar/modules/i3.ini
|
||||
include-file = ~/.config/polybar/modules/separators.ini
|
||||
include-file = ~/.config/polybar/modules/network.ini
|
||||
include-file = ~/.config/polybar/modules/xwindow.ini
|
||||
include-file = ~/.config/polybar/modules/date.ini
|
||||
include-file = ~/.config/polybar/modules/sound.ini
|
||||
include-file = ~/.config/polybar/modules/battery.ini
|
||||
include-file = ~/.config/polybar/modules/bluetooth.ini
|
||||
include-file = ~/.config/polybar/modules/cpu.ini
|
||||
include-file = ~/.config/polybar/modules/memory.ini
|
||||
include-file = ~/.config/polybar/modules/powermenu.ini
|
||||
include-file = ~/.config/polybar/modules/player-mpris-tail.ini
|
||||
include-file = ~/.config/polybar/modules/gpu.ini
|
||||
include-file = ~/.config/polybar/modules/screen.ini
|
||||
@@ -1,35 +0,0 @@
|
||||
[module/wlan]
|
||||
type = custom/script
|
||||
exec=$HOME/.config/polybar/scripts/wifi.sh
|
||||
format-foreground = ${colors.background}
|
||||
format-background = ${colors.yellow}
|
||||
format-font = 2
|
||||
format-padding = 2
|
||||
interval = 5
|
||||
|
||||
[module/wlanstrength]
|
||||
type = custom/script
|
||||
exec=$HOME/.config/polybar/scripts/wifistrength.sh
|
||||
format-foreground = ${colors.green}
|
||||
format-background = ${colors.background}
|
||||
format-font = 2
|
||||
click-left = $HOME/.config/polybar/scripts/wifi_toggle.sh
|
||||
click-right = gnome-control-center wifi
|
||||
|
||||
[module/networkactivity]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/scripts/network_speed.sh
|
||||
format-foreground = ${colors.yellow}
|
||||
|
||||
[module/eth]
|
||||
type = internal/network
|
||||
interface = eno1
|
||||
interval = 3.0
|
||||
format-connected = <label-connected>
|
||||
label-connected = "%{F#FFAB40} %{T2}%ifname%: %local_ip% "
|
||||
format-connected-font = 1
|
||||
|
||||
format-disconnected = <label-disconnected>
|
||||
format-disconnected-underline = ${self.format-connected-underline}
|
||||
label-disconnected = "%{F#FFAB40} %{T2}%ifname%: disconnected "
|
||||
format-disconnected-font = 1
|
||||
@@ -1,6 +0,0 @@
|
||||
[module/player-mpris-tail]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/scripts/player-mpris-tail.py -f ' {:title:t30:{title}:} - {:artist:t30:{artist}:} %{A1:$HOME/.config/polybar/scripts/player-mpris-tail.py previous:}玲%{A}%{A1:$HOME/.config/polybar/scripts/player-mpris-tail.py play-pause:} 懶 {icon-reversed}%{A}%{A1:$HOME/.config/polybar/scripts/player-mpris-tail.py next:}怜%{A}'
|
||||
tail = true
|
||||
format-foreground = ${colors.pink}
|
||||
interval = 5
|
||||
@@ -1,4 +0,0 @@
|
||||
[module/powermenu]
|
||||
type = custom/script
|
||||
exec = echo "%{F#FF5252} "
|
||||
click-left = "rofi -show power-menu -modi power-menu:~/.config/rofi/rofi-power-menu -theme ~/.config/rofi/powermenu/powermenu.rasi"
|
||||
@@ -1,6 +0,0 @@
|
||||
[module/toggle_screen]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/scripts/check_screen.sh
|
||||
format-font = 4
|
||||
format-foreground = ${colors.pink}
|
||||
click-left = $HOME/.config/polybar/scripts/toggle_screen.sh
|
||||
@@ -1,35 +0,0 @@
|
||||
[module/separator1]
|
||||
type = custom/text
|
||||
content = %{T6}/%{T-}
|
||||
content-font = 3
|
||||
content-foreground = #FF5252
|
||||
|
||||
[module/separator2]
|
||||
type = custom/text
|
||||
content = %{T6}/%{T-}
|
||||
content-font = 3
|
||||
content-foreground = #FFAB40
|
||||
|
||||
[module/separator3]
|
||||
type = custom/text
|
||||
content = %{T6}/%{T-}
|
||||
content-font = 3
|
||||
content-foreground = #40C4FF
|
||||
|
||||
[module/separator4]
|
||||
type = custom/text
|
||||
content = %{T6}/%{T-}
|
||||
content-font = 3
|
||||
content-foreground = #69F0AE
|
||||
|
||||
[module/separator5]
|
||||
type = custom/text
|
||||
content = %{T6}/%{T-}
|
||||
content-font = 3
|
||||
content-foreground = #FFFF00
|
||||
|
||||
[module/separator6]
|
||||
type = custom/text
|
||||
content = %{T6}/%{T-}
|
||||
content-font = 3
|
||||
content-foreground = #18FFFF
|
||||
@@ -1,21 +0,0 @@
|
||||
[module/sound]
|
||||
type = internal/pulseaudio
|
||||
|
||||
format-volume = <ramp-volume><label-volume>
|
||||
label-volume = "%{F#18FFFF}%percentage%% "
|
||||
label-volume-padding-right = 0
|
||||
label-volume-padding-left = 1
|
||||
label-volume-font = 2
|
||||
|
||||
format-mutes = <label-muted>
|
||||
label-muted-padding-right = 0
|
||||
label-muted-font = 1
|
||||
label-muted = "%{F#18FFFF} ﱝ %{T2}0% "
|
||||
|
||||
ramp-volume-0 = "%{F#18FFFF} "
|
||||
ramp-volume-1 = "%{F#18FFFF} 墳"
|
||||
ramp-volume-2 = "%{F#18FFFF} "
|
||||
ramp-volume-font = 1
|
||||
use-ui-max = true
|
||||
|
||||
click-right = pavucontrol
|
||||
@@ -1,4 +0,0 @@
|
||||
[module/xwindow]
|
||||
type = internal/xwindow
|
||||
label = " %{T2}%{F#64FFDA}%title%"
|
||||
label-maxlen = 48
|
||||
@@ -1,98 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# This script uses upower to get all the battery informations
|
||||
# https://upower.freedesktop.org/docs/Device.html
|
||||
|
||||
CHARGE=$(upower -i $(upower -e | grep '/battery') | grep --color=never -E percentage|xargs|cut -d' ' -f2|sed s/%//)
|
||||
ICON=""
|
||||
BAT_STATE=$(upower -i `upower -e | grep 'battery'` | grep -E 'state')
|
||||
COLOR=""
|
||||
|
||||
#More Icons
|
||||
#
|
||||
|
||||
# Charging
|
||||
if [[ $BAT_STATE == *'discharging'* ]]; then
|
||||
if [ $CHARGE -eq 0 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#fc8894}"
|
||||
elif [ $CHARGE -gt 0 ] && [ $CHARGE -le 10 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#fc8894}"
|
||||
elif [ $CHARGE -gt 10 ] && [ $CHARGE -le 20 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#fc8894}"
|
||||
#notify-send -u critical "Battery Warning" "20% charge remaining!"
|
||||
elif [ $CHARGE -gt 20 ] && [ $CHARGE -le 30 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 30 ] && [ $CHARGE -le 40 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 40 ] && [ $CHARGE -le 50 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 50 ] && [ $CHARGE -le 60 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 60 ] && [ $CHARGE -le 70 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 70 ] && [ $CHARGE -le 80 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
elif [ $CHARGE -gt 80 ] && [ $CHARGE -le 90 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
elif [ $CHARGE -gt 90 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
fi
|
||||
# Discharging
|
||||
elif [[ $BAT_STATE == *'charging'* ]]; then
|
||||
if [ $CHARGE -eq 0 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#fc8894}"
|
||||
elif [ $CHARGE -gt 0 ] && [ $CHARGE -le 10 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#fc8894}"
|
||||
elif [ $CHARGE -gt 10 ] && [ $CHARGE -le 20 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#fc8894}"
|
||||
elif [ $CHARGE -gt 20 ] && [ $CHARGE -le 30 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 30 ] && [ $CHARGE -le 40 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 40 ] && [ $CHARGE -le 50 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 50 ] && [ $CHARGE -le 60 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 60 ] && [ $CHARGE -le 70 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#e3e3e3}"
|
||||
elif [ $CHARGE -gt 70 ] && [ $CHARGE -le 80 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
elif [ $CHARGE -gt 80 ] && [ $CHARGE -le 90 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
elif [ $CHARGE -gt 90 ]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
fi
|
||||
elif [[ $BAT_STATE == *'fully-charged'* ]]; then
|
||||
ICON=""
|
||||
COLOR="%{F#8be09c}"
|
||||
#notify-send -u low "Battery Info" "Your battery is fully charged"
|
||||
elif [[ $BAT_STATE == *'unknown'* ]]; then
|
||||
ICON=""
|
||||
fi
|
||||
|
||||
STRING="$COLOR$ICON $CHARGE%"
|
||||
|
||||
# Final formatted output.
|
||||
echo $STRING
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
STATE=$(bluetoothctl show | grep Powered)
|
||||
DEVICE_NAME=$(bluetoothctl info | grep Name: | awk '{ first = $1; $1 = ""; print $0 }')
|
||||
POWERED=""
|
||||
COLOR=""
|
||||
STRING=""
|
||||
|
||||
if [[ $STATE == *'yes'* ]]
|
||||
then
|
||||
POWERED=" ON"
|
||||
COLOR=""
|
||||
else
|
||||
POWERED=" OFF"
|
||||
COLOR=""
|
||||
fi
|
||||
|
||||
if [[ $DEVICE_NAME ]]
|
||||
then
|
||||
POWERED=" "
|
||||
fi
|
||||
|
||||
echo $POWERED$CONNECTED$DEVICE_NAME
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
STATE=$(bluetoothctl show | grep Powered)
|
||||
|
||||
if [[ $STATE == *"yes" ]]
|
||||
then
|
||||
echo $(bluetoothctl power off)
|
||||
else
|
||||
echo $(bluetoothctl power on)
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
SECOND_SCREEN_ON=$(xrandr | grep -sw 'HDMI-1 connected 2160x1080')
|
||||
|
||||
if [[ $SECOND_SCREEN_ON == 'HDMI-1 connected 2160x1080'* ]]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#gpu=$(timeout 1s sudo intel_gpu_top -o - | awk 'NR>=3{printf "\t%11s%14s%12s%\n" $8,$11,$14,$17}')
|
||||
timeout 1s sudo intel_gpu_top -l | awk 'NR>=3{printf "\t%11s%14s%12s%\n" $8,$11,$14,$17}'
|
||||
echo "iGPU $gpu"
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk '{ print " GPU " $1 "% "}'
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
killall -q polybar
|
||||
|
||||
if type "xrandr"; then
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR=$m polybar --reload crylia -c $HOME/.config/polybar/config.ini &
|
||||
done
|
||||
else
|
||||
polybar crylia -c $HOME/.config/polybar/config.ini &
|
||||
fi
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
NETWORK=$(awk '{if(l1){print $2-l1,$10-l2} else{l1=$2; l2=$10;}}' <(grep wlo1 /proc/net/dev) <(sleep 1; grep wlo1 /proc/net/dev))
|
||||
UP=$(echo $NETWORK | awk '{ print $2 }')
|
||||
DOWN=$(echo $NETWORK | awk '{ print $1 }')
|
||||
UP=$(echo "scale=2 ; $UP / 1048576" | bc)
|
||||
DOWN=$(echo "scale=2 ; $DOWN / 1048576" | bc)
|
||||
|
||||
echo " $DOWN MB/s $UP MB/s"
|
||||
@@ -1,548 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import dbus
|
||||
import os
|
||||
from operator import itemgetter
|
||||
import argparse
|
||||
import re
|
||||
from urllib.parse import unquote
|
||||
import time
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
from gi.repository import GLib
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
||||
|
||||
FORMAT_STRING = '{icon} {artist} - {title}'
|
||||
FORMAT_REGEX = re.compile(r'(\{:(?P<tag>.*?)(:(?P<format>[wt])(?P<formatlen>\d+))?:(?P<text>.*?):\})', re.I)
|
||||
FORMAT_TAG_REGEX = re.compile(r'(?P<format>[wt])(?P<formatlen>\d+)')
|
||||
SAFE_TAG_REGEX = re.compile(r'[{}]')
|
||||
|
||||
class PlayerManager:
|
||||
def __init__(self, filter_list, block_mode = True, connect = True):
|
||||
self.filter_list = filter_list
|
||||
self.block_mode = block_mode
|
||||
self._connect = connect
|
||||
self._session_bus = dbus.SessionBus()
|
||||
self.players = {}
|
||||
|
||||
self.print_queue = []
|
||||
self.connected = False
|
||||
self.player_states = {}
|
||||
|
||||
self.refreshPlayerList()
|
||||
|
||||
if self._connect:
|
||||
self.connect()
|
||||
loop = GLib.MainLoop()
|
||||
try:
|
||||
loop.run()
|
||||
except KeyboardInterrupt:
|
||||
print("interrupt received, stopping…")
|
||||
|
||||
def connect(self):
|
||||
self._session_bus.add_signal_receiver(self.onOwnerChangedName, 'NameOwnerChanged')
|
||||
self._session_bus.add_signal_receiver(self.onChangedProperties, 'PropertiesChanged',
|
||||
path = '/org/mpris/MediaPlayer2',
|
||||
sender_keyword='sender')
|
||||
|
||||
def onChangedProperties(self, interface, properties, signature, sender = None):
|
||||
if sender in self.players:
|
||||
player = self.players[sender]
|
||||
# If we know this player, but haven't been able to set up a signal handler
|
||||
if 'properties_changed' not in player._signals:
|
||||
# Then trigger the signal handler manually
|
||||
player.onPropertiesChanged(interface, properties, signature)
|
||||
else:
|
||||
# If we don't know this player, get its name and add it
|
||||
bus_name = self.getBusNameFromOwner(sender)
|
||||
if bus_name is None:
|
||||
return
|
||||
self.addPlayer(bus_name, sender)
|
||||
player = self.players[sender]
|
||||
player.onPropertiesChanged(interface, properties, signature)
|
||||
|
||||
def onOwnerChangedName(self, bus_name, old_owner, new_owner):
|
||||
if self.busNameIsAPlayer(bus_name):
|
||||
if new_owner and not old_owner:
|
||||
self.addPlayer(bus_name, new_owner)
|
||||
elif old_owner and not new_owner:
|
||||
self.removePlayer(old_owner)
|
||||
else:
|
||||
self.changePlayerOwner(bus_name, old_owner, new_owner)
|
||||
|
||||
def getBusNameFromOwner(self, owner):
|
||||
player_bus_names = [ bus_name for bus_name in self._session_bus.list_names() if self.busNameIsAPlayer(bus_name) ]
|
||||
for player_bus_name in player_bus_names:
|
||||
player_bus_owner = self._session_bus.get_name_owner(player_bus_name)
|
||||
if owner == player_bus_owner:
|
||||
return player_bus_name
|
||||
|
||||
def busNameIsAPlayer(self, bus_name):
|
||||
if bus_name.startswith('org.mpris.MediaPlayer2') is False:
|
||||
return False
|
||||
name = bus_name.split('.')[3]
|
||||
if self.block_mode is True:
|
||||
return name not in self.filter_list
|
||||
return name in self.filter_list
|
||||
|
||||
def refreshPlayerList(self):
|
||||
player_bus_names = [ bus_name for bus_name in self._session_bus.list_names() if self.busNameIsAPlayer(bus_name) ]
|
||||
for player_bus_name in player_bus_names:
|
||||
self.addPlayer(player_bus_name)
|
||||
if self.connected != True:
|
||||
self.connected = True
|
||||
self.printQueue()
|
||||
|
||||
def addPlayer(self, bus_name, owner = None):
|
||||
player = Player(self._session_bus, bus_name, owner = owner, connect = self._connect, _print = self.print)
|
||||
self.players[player.owner] = player
|
||||
|
||||
def removePlayer(self, owner):
|
||||
if owner in self.players:
|
||||
self.players[owner].disconnect()
|
||||
del self.players[owner]
|
||||
# If there are no more players, clear the output
|
||||
if len(self.players) == 0:
|
||||
_printFlush(ICON_NONE)
|
||||
# Else, print the output of the next active player
|
||||
else:
|
||||
players = self.getSortedPlayerOwnerList()
|
||||
if len(players) > 0:
|
||||
self.players[players[0]].printStatus()
|
||||
|
||||
def changePlayerOwner(self, bus_name, old_owner, new_owner):
|
||||
player = Player(self._session_bus, bus_name, owner = new_owner, connect = self._connect, _print = self.print)
|
||||
self.players[new_owner] = player
|
||||
del self.players[old_owner]
|
||||
|
||||
# Get a list of player owners sorted by current status and age
|
||||
def getSortedPlayerOwnerList(self):
|
||||
players = [
|
||||
{
|
||||
'number': int(owner.split('.')[-1]),
|
||||
'status': 2 if player.status == 'playing' else 1 if player.status == 'paused' else 0,
|
||||
'owner': owner
|
||||
}
|
||||
for owner, player in self.players.items()
|
||||
]
|
||||
return [ info['owner'] for info in reversed(sorted(players, key=itemgetter('status', 'number'))) ]
|
||||
|
||||
# Get latest player that's currently playing
|
||||
def getCurrentPlayer(self):
|
||||
playing_players = [
|
||||
player_owner for player_owner in self.getSortedPlayerOwnerList()
|
||||
if
|
||||
self.players[player_owner].status == 'playing' or
|
||||
self.players[player_owner].status == 'paused'
|
||||
]
|
||||
return self.players[playing_players[0]] if playing_players else None
|
||||
|
||||
def print(self, status, player):
|
||||
self.player_states[player.bus_name] = status
|
||||
|
||||
if self.connected:
|
||||
current_player = self.getCurrentPlayer()
|
||||
if current_player != None:
|
||||
_printFlush(self.player_states[current_player.bus_name])
|
||||
else:
|
||||
_printFlush(ICON_STOPPED)
|
||||
else:
|
||||
self.print_queue.append([status, player])
|
||||
|
||||
def printQueue(self):
|
||||
for args in self.print_queue:
|
||||
self.print(args[0], args[1])
|
||||
self.print_queue.clear()
|
||||
|
||||
|
||||
class Player:
|
||||
def __init__(self, session_bus, bus_name, owner = None, connect = True, _print = None):
|
||||
self._session_bus = session_bus
|
||||
self.bus_name = bus_name
|
||||
self._disconnecting = False
|
||||
self.__print = _print
|
||||
|
||||
self.metadata = {
|
||||
'artist' : '',
|
||||
'album' : '',
|
||||
'title' : '',
|
||||
'track' : 0
|
||||
}
|
||||
|
||||
self._rate = 1.
|
||||
self._positionAtLastUpdate = 0.
|
||||
self._timeAtLastUpdate = time.time()
|
||||
self._positionTimerRunning = False
|
||||
|
||||
self._metadata = None
|
||||
self.status = 'stopped'
|
||||
self.icon = ICON_NONE
|
||||
self.icon_reversed = ICON_PLAYING
|
||||
if owner is not None:
|
||||
self.owner = owner
|
||||
else:
|
||||
self.owner = self._session_bus.get_name_owner(bus_name)
|
||||
self._obj = self._session_bus.get_object(self.bus_name, '/org/mpris/MediaPlayer2')
|
||||
self._properties_interface = dbus.Interface(self._obj, dbus_interface='org.freedesktop.DBus.Properties')
|
||||
self._introspect_interface = dbus.Interface(self._obj, dbus_interface='org.freedesktop.DBus.Introspectable')
|
||||
self._media_interface = dbus.Interface(self._obj, dbus_interface='org.mpris.MediaPlayer2')
|
||||
self._player_interface = dbus.Interface(self._obj, dbus_interface='org.mpris.MediaPlayer2.Player')
|
||||
self._introspect = self._introspect_interface.get_dbus_method('Introspect', dbus_interface=None)
|
||||
self._getProperty = self._properties_interface.get_dbus_method('Get', dbus_interface=None)
|
||||
self._playerPlay = self._player_interface.get_dbus_method('Play', dbus_interface=None)
|
||||
self._playerPause = self._player_interface.get_dbus_method('Pause', dbus_interface=None)
|
||||
self._playerPlayPause = self._player_interface.get_dbus_method('PlayPause', dbus_interface=None)
|
||||
self._playerStop = self._player_interface.get_dbus_method('Stop', dbus_interface=None)
|
||||
self._playerPrevious = self._player_interface.get_dbus_method('Previous', dbus_interface=None)
|
||||
self._playerNext = self._player_interface.get_dbus_method('Next', dbus_interface=None)
|
||||
self._playerRaise = self._media_interface.get_dbus_method('Raise', dbus_interface=None)
|
||||
self._signals = {}
|
||||
|
||||
self.refreshPosition()
|
||||
self.refreshStatus()
|
||||
self.refreshMetadata()
|
||||
|
||||
if connect:
|
||||
self.printStatus()
|
||||
self.connect()
|
||||
|
||||
def play(self):
|
||||
self._playerPlay()
|
||||
def pause(self):
|
||||
self._playerPause()
|
||||
def playpause(self):
|
||||
self._playerPlayPause()
|
||||
def stop(self):
|
||||
self._playerStop()
|
||||
def previous(self):
|
||||
self._playerPrevious()
|
||||
def next(self):
|
||||
self._playerNext()
|
||||
def raisePlayer(self):
|
||||
self._playerRaise()
|
||||
|
||||
def connect(self):
|
||||
if self._disconnecting is not True:
|
||||
introspect_xml = self._introspect(self.bus_name, '/')
|
||||
if 'TrackMetadataChanged' in introspect_xml:
|
||||
self._signals['track_metadata_changed'] = self._session_bus.add_signal_receiver(self.onMetadataChanged, 'TrackMetadataChanged', self.bus_name)
|
||||
self._signals['seeked'] = self._player_interface.connect_to_signal('Seeked', self.onSeeked)
|
||||
self._signals['properties_changed'] = self._properties_interface.connect_to_signal('PropertiesChanged', self.onPropertiesChanged)
|
||||
|
||||
def disconnect(self):
|
||||
self._disconnecting = True
|
||||
for signal_name, signal_handler in list(self._signals.items()):
|
||||
signal_handler.remove()
|
||||
del self._signals[signal_name]
|
||||
|
||||
def refreshStatus(self):
|
||||
# Some clients (VLC) will momentarily create a new player before removing it again
|
||||
# so we can't be sure the interface still exists
|
||||
try:
|
||||
self.status = str(self._getProperty('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')).lower()
|
||||
self.updateIcon()
|
||||
self.checkPositionTimer()
|
||||
except dbus.exceptions.DBusException:
|
||||
self.disconnect()
|
||||
|
||||
def refreshMetadata(self):
|
||||
# Some clients (VLC) will momentarily create a new player before removing it again
|
||||
# so we can't be sure the interface still exists
|
||||
try:
|
||||
self._metadata = self._getProperty('org.mpris.MediaPlayer2.Player', 'Metadata')
|
||||
self._parseMetadata()
|
||||
except dbus.exceptions.DBusException:
|
||||
self.disconnect()
|
||||
|
||||
def updateIcon(self):
|
||||
self.icon = (
|
||||
ICON_PLAYING if self.status == 'playing' else
|
||||
ICON_PAUSED if self.status == 'paused' else
|
||||
ICON_STOPPED if self.status == 'stopped' else
|
||||
ICON_NONE
|
||||
)
|
||||
self.icon_reversed = (
|
||||
ICON_PAUSED if self.status == 'playing' else
|
||||
ICON_PLAYING
|
||||
)
|
||||
|
||||
def _print(self, status):
|
||||
self.__print(status, self)
|
||||
|
||||
def _parseMetadata(self):
|
||||
if self._metadata != None:
|
||||
# Obtain properties from _metadata
|
||||
_artist = _getProperty(self._metadata, 'xesam:artist', [''])
|
||||
_album = _getProperty(self._metadata, 'xesam:album', '')
|
||||
_title = _getProperty(self._metadata, 'xesam:title', '')
|
||||
_track = _getProperty(self._metadata, 'xesam:trackNumber', '')
|
||||
_genre = _getProperty(self._metadata, 'xesam:genre', [''])
|
||||
_disc = _getProperty(self._metadata, 'xesam:discNumber', '')
|
||||
_length = _getProperty(self._metadata, 'xesam:length', 0) or _getProperty(self._metadata, 'mpris:length', 0)
|
||||
_length_int = _length if type(_length) is int else int(float(_length))
|
||||
_date = _getProperty(self._metadata, 'xesam:contentCreated', '')
|
||||
_year = _date[0:4] if len(_date) else ''
|
||||
_url = _getProperty(self._metadata, 'xesam:url', '')
|
||||
_cover = _getProperty(self._metadata, 'xesam:artUrl', '') or _getProperty(self._metadata, 'mpris:artUrl', '')
|
||||
_duration = _getDuration(_length_int)
|
||||
# Update metadata
|
||||
self.metadata['artist'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_artist))
|
||||
self.metadata['album'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_album))
|
||||
self.metadata['title'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_title))
|
||||
self.metadata['track'] = _track
|
||||
self.metadata['genre'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_genre))
|
||||
self.metadata['disc'] = _disc
|
||||
self.metadata['date'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _date)
|
||||
self.metadata['year'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _year)
|
||||
self.metadata['url'] = _url
|
||||
self.metadata['filename'] = os.path.basename(_url)
|
||||
self.metadata['length'] = _length_int
|
||||
self.metadata['cover'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _metadataGetFirstItem(_cover))
|
||||
self.metadata['duration'] = _duration
|
||||
|
||||
def onMetadataChanged(self, track_id, metadata):
|
||||
self.refreshMetadata()
|
||||
self.printStatus()
|
||||
|
||||
def onPropertiesChanged(self, interface, properties, signature):
|
||||
updated = False
|
||||
if dbus.String('Metadata') in properties:
|
||||
_metadata = properties[dbus.String('Metadata')]
|
||||
if _metadata != self._metadata:
|
||||
self._metadata = _metadata
|
||||
self._parseMetadata()
|
||||
updated = True
|
||||
if dbus.String('PlaybackStatus') in properties:
|
||||
status = str(properties[dbus.String('PlaybackStatus')]).lower()
|
||||
if status != self.status:
|
||||
self.status = status
|
||||
self.checkPositionTimer()
|
||||
self.updateIcon()
|
||||
updated = True
|
||||
if dbus.String('Rate') in properties and dbus.String('PlaybackStatus') not in properties:
|
||||
self.refreshStatus()
|
||||
if NEEDS_POSITION and dbus.String('Rate') in properties:
|
||||
rate = properties[dbus.String('Rate')]
|
||||
if rate != self._rate:
|
||||
self._rate = rate
|
||||
self.refreshPosition()
|
||||
|
||||
if updated:
|
||||
self.refreshPosition()
|
||||
self.printStatus()
|
||||
|
||||
def checkPositionTimer(self):
|
||||
if NEEDS_POSITION and self.status == 'playing' and not self._positionTimerRunning:
|
||||
self._positionTimerRunning = True
|
||||
GLib.timeout_add_seconds(1, self._positionTimer)
|
||||
|
||||
def onSeeked(self, position):
|
||||
self.refreshPosition()
|
||||
self.printStatus()
|
||||
|
||||
def _positionTimer(self):
|
||||
self.printStatus()
|
||||
self._positionTimerRunning = self.status == 'playing'
|
||||
return self._positionTimerRunning
|
||||
|
||||
def refreshPosition(self):
|
||||
try:
|
||||
time_us = self._getProperty('org.mpris.MediaPlayer2.Player', 'Position')
|
||||
except dbus.exceptions.DBusException:
|
||||
time_us = 0
|
||||
|
||||
self._timeAtLastUpdate = time.time()
|
||||
self._positionAtLastUpdate = time_us / 1000000
|
||||
|
||||
def _getPosition(self):
|
||||
if self.status == 'playing':
|
||||
return self._positionAtLastUpdate + self._rate * (time.time() - self._timeAtLastUpdate)
|
||||
else:
|
||||
return self._positionAtLastUpdate
|
||||
|
||||
def _statusReplace(self, match, metadata):
|
||||
tag = match.group('tag')
|
||||
format = match.group('format')
|
||||
formatlen = match.group('formatlen')
|
||||
text = match.group('text')
|
||||
tag_found = False
|
||||
reversed_tag = False
|
||||
|
||||
if tag.startswith('-'):
|
||||
tag = tag[1:]
|
||||
reversed_tag = True
|
||||
|
||||
if format is None:
|
||||
tag_is_format_match = re.match(FORMAT_TAG_REGEX, tag)
|
||||
if tag_is_format_match:
|
||||
format = tag_is_format_match.group('format')
|
||||
formatlen = tag_is_format_match.group('formatlen')
|
||||
tag_found = True
|
||||
if format is not None:
|
||||
text = text.format_map(CleanSafeDict(**metadata))
|
||||
if format == 'w':
|
||||
formatlen = int(formatlen)
|
||||
text = text[:formatlen]
|
||||
elif format == 't':
|
||||
formatlen = int(formatlen)
|
||||
if len(text) > formatlen:
|
||||
text = text[:max(formatlen - len(TRUNCATE_STRING), 0)] + TRUNCATE_STRING
|
||||
if tag_found is False and tag in metadata and len(metadata[tag]):
|
||||
tag_found = True
|
||||
|
||||
if reversed_tag:
|
||||
tag_found = not tag_found
|
||||
|
||||
if tag_found:
|
||||
return text
|
||||
else:
|
||||
return ''
|
||||
|
||||
def printStatus(self):
|
||||
if self.status in [ 'playing', 'paused' ]:
|
||||
metadata = { **self.metadata, 'icon': self.icon, 'icon-reversed': self.icon_reversed }
|
||||
if NEEDS_POSITION:
|
||||
metadata['position'] = time.strftime("%M:%S", time.gmtime(self._getPosition()))
|
||||
# replace metadata tags in text
|
||||
text = re.sub(FORMAT_REGEX, lambda match: self._statusReplace(match, metadata), FORMAT_STRING)
|
||||
# restore polybar tag formatting and replace any remaining metadata tags after that
|
||||
try:
|
||||
text = re.sub(r'p(.*?)p(.*?)p(.*?)p', r'%{\1}\2%{\3}', text.format_map(CleanSafeDict(**metadata)))
|
||||
except:
|
||||
print("Invalid format string")
|
||||
self._print(text)
|
||||
else:
|
||||
self._print(ICON_STOPPED)
|
||||
|
||||
|
||||
def _dbusValueToPython(value):
|
||||
if isinstance(value, dbus.Dictionary):
|
||||
return {_dbusValueToPython(key): _dbusValueToPython(value) for key, value in value.items()}
|
||||
elif isinstance(value, dbus.Array):
|
||||
return [ _dbusValueToPython(item) for item in value ]
|
||||
elif isinstance(value, dbus.Boolean):
|
||||
return int(value) == 1
|
||||
elif (
|
||||
isinstance(value, dbus.Byte) or
|
||||
isinstance(value, dbus.Int16) or
|
||||
isinstance(value, dbus.UInt16) or
|
||||
isinstance(value, dbus.Int32) or
|
||||
isinstance(value, dbus.UInt32) or
|
||||
isinstance(value, dbus.Int64) or
|
||||
isinstance(value, dbus.UInt64)
|
||||
):
|
||||
return int(value)
|
||||
elif isinstance(value, dbus.Double):
|
||||
return float(value)
|
||||
elif (
|
||||
isinstance(value, dbus.ObjectPath) or
|
||||
isinstance(value, dbus.Signature) or
|
||||
isinstance(value, dbus.String)
|
||||
):
|
||||
return unquote(str(value))
|
||||
|
||||
def _getProperty(properties, property, default = None):
|
||||
value = default
|
||||
if not isinstance(property, dbus.String):
|
||||
property = dbus.String(property)
|
||||
if property in properties:
|
||||
value = properties[property]
|
||||
return _dbusValueToPython(value)
|
||||
else:
|
||||
return value
|
||||
|
||||
def _getDuration(t: int):
|
||||
seconds = t / 1000000
|
||||
return time.strftime("%M:%S", time.gmtime(seconds))
|
||||
|
||||
def _metadataGetFirstItem(_value):
|
||||
if type(_value) is list:
|
||||
# Returns the string representation of the first item on _value if it has at least one item.
|
||||
# Returns an empty string if _value is empty.
|
||||
return str(_value[0]) if len(_value) else ''
|
||||
else:
|
||||
# If _value isn't a list just return the string representation of _value.
|
||||
return str(_value)
|
||||
|
||||
class CleanSafeDict(dict):
|
||||
def __missing__(self, key):
|
||||
return '{{{}}}'.format(key)
|
||||
|
||||
|
||||
"""
|
||||
Seems to assure print() actually prints when no terminal is connected
|
||||
"""
|
||||
|
||||
_last_status = ''
|
||||
def _printFlush(status, **kwargs):
|
||||
global _last_status
|
||||
if status != _last_status:
|
||||
print(status, **kwargs)
|
||||
sys.stdout.flush()
|
||||
_last_status = status
|
||||
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('command', help="send the given command to the active player",
|
||||
choices=[ 'play', 'pause', 'play-pause', 'stop', 'previous', 'next', 'status', 'list', 'current', 'metadata', 'raise' ],
|
||||
default=None,
|
||||
nargs='?')
|
||||
parser.add_argument('-b', '--blacklist', help="ignore a player by it's bus name. Can be given multiple times (e.g. -b vlc -b audacious)",
|
||||
action='append',
|
||||
metavar="BUS_NAME",
|
||||
default=[])
|
||||
parser.add_argument('-w', '--whitelist', help="permit a player by it's bus name like --blacklist. will block --blacklist if given",
|
||||
action='append',
|
||||
metavar="BUS_NAME",
|
||||
default=[])
|
||||
parser.add_argument('-f', '--format', default='{icon} {:artist:{artist} - :}{:title:{title}:}{:-title:{filename}:}')
|
||||
parser.add_argument('--truncate-text', default='…')
|
||||
parser.add_argument('--icon-playing', default='⏵')
|
||||
parser.add_argument('--icon-paused', default='⏸')
|
||||
parser.add_argument('--icon-stopped', default='⏹')
|
||||
parser.add_argument('--icon-none', default='')
|
||||
args = parser.parse_args()
|
||||
|
||||
FORMAT_STRING = re.sub(r'%\{(.*?)\}(.*?)%\{(.*?)\}', r'p\1p\2p\3p', args.format)
|
||||
NEEDS_POSITION = "{position}" in FORMAT_STRING
|
||||
|
||||
TRUNCATE_STRING = args.truncate_text
|
||||
ICON_PLAYING = args.icon_playing
|
||||
ICON_PAUSED = args.icon_paused
|
||||
ICON_STOPPED = args.icon_stopped
|
||||
ICON_NONE = args.icon_none
|
||||
|
||||
block_mode = len(args.whitelist) == 0
|
||||
filter_list = args.blacklist if block_mode else args.whitelist
|
||||
|
||||
if args.command is None:
|
||||
PlayerManager(filter_list = filter_list, block_mode = block_mode)
|
||||
else:
|
||||
player_manager = PlayerManager(filter_list = filter_list, block_mode = block_mode, connect = False)
|
||||
current_player = player_manager.getCurrentPlayer()
|
||||
if args.command == 'play' and current_player:
|
||||
current_player.play()
|
||||
elif args.command == 'pause' and current_player:
|
||||
current_player.pause()
|
||||
elif args.command == 'play-pause' and current_player:
|
||||
current_player.playpause()
|
||||
elif args.command == 'stop' and current_player:
|
||||
current_player.stop()
|
||||
elif args.command == 'previous' and current_player:
|
||||
current_player.previous()
|
||||
elif args.command == 'next' and current_player:
|
||||
current_player.next()
|
||||
elif args.command == 'status' and current_player:
|
||||
current_player.printStatus()
|
||||
elif args.command == 'list':
|
||||
print("\n".join(sorted([
|
||||
"{} : {}".format(player.bus_name.split('.')[3], player.status)
|
||||
for player in player_manager.players.values() ])))
|
||||
elif args.command == 'current' and current_player:
|
||||
print("{} : {}".format(current_player.bus_name.split('.')[3], current_player.status))
|
||||
elif args.command == 'metadata' and current_player:
|
||||
print(_dbusValueToPython(current_player._metadata))
|
||||
elif args.command == 'raise' and current_player:
|
||||
current_player.raisePlayer()
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
SECOND_SCREEN_ON=$(xrandr | grep 'HDMI-1 connected 2160x1080')
|
||||
|
||||
if [[ $SECOND_SCREEN_ON == 'HDMI-1 connected 2160x1080'* ]]; then
|
||||
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-1 --off --output HDMI-2 --off
|
||||
sleep 1
|
||||
nitrogen --restore
|
||||
sleep 1
|
||||
pkill -f bashtop
|
||||
else
|
||||
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 120x0 --rotate normal --output HDMI-1 --mode 1080x2160 --pos 0x1080 --rotate right --output HDMI-2 --off
|
||||
sleep 1
|
||||
nitrogen --restore
|
||||
alacritty -o font.size=5 -t TrackpadBashtop -e bashtop
|
||||
fi
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SSID=$(iwgetid -r)
|
||||
SSIG=$(grep "$(iwgetid -m | awk '{ printf "%s", $1 }')" /proc/net/wireless | awk '{ printf "%i\n", int($3 * 100 / 70) }')
|
||||
IP=$(ip route get 8.8.8.8 | grep -oP 'src \K[^ ]+')
|
||||
SIG=$(echo "$SSIG" | rev | cut -c 2- | rev)
|
||||
|
||||
NETWORK_UP=$(echo "scale=2 ; $(cat /proc/net/dev | awk '/wlo1:/ { print $2 }') / 1024" | bc)
|
||||
NETWORK_DOWN=$(echo "scale=2 ; $(cat /proc/net/dev | awk '/wlo1:/ { print $10 }') / 1024" | bc)
|
||||
|
||||
#wifi off
|
||||
|
||||
if [[ $SSID ]]; then
|
||||
echo "$IP $NETWORK_UP MB/s $NETWORK_DOWN MB/s"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
WIFI_STATUS=$(nmcli radio wifi)
|
||||
|
||||
if [[ $WIFI_STATUS == 'enabled' ]]
|
||||
then
|
||||
echo $(nmcli radio wifi off)
|
||||
elif [[ $WIFI_STATUS == 'disabled' ]]
|
||||
then
|
||||
echo $(nmcli radio wifi on)
|
||||
fi
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SSID=$(iwgetid -r)
|
||||
SSIG=$(grep "$(iwgetid -m | awk '{ printf "%s", $1 }')" /proc/net/wireless | awk '{ printf "%i\n", int($3 * 100 / 70) }')
|
||||
|
||||
if [[ $SSID ]]; then
|
||||
echo " $SSIG%"
|
||||
else
|
||||
echo "睊 0%"
|
||||
fi
|
||||
Reference in New Issue
Block a user