Added battery, small fixes, idk
This commit is contained in:
parent
b4675cc0b3
commit
45ec972f2b
5
Makefile
5
Makefile
@ -6,10 +6,7 @@ test: build
|
||||
|
||||
.PHONY: deploy
|
||||
deploy: build
|
||||
@echo Backing old config up
|
||||
rm -f backup.tar
|
||||
tar -cvf backup.tar -C ~/.config awesome
|
||||
rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --exclude '*' ./ ~/.config/awesome/
|
||||
rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' --exclude '*' ./ ~/.config/awesome/
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
|
@ -20,6 +20,11 @@
|
||||
],
|
||||
"Lua.workspace.library": [
|
||||
"/usr/share/awesome/lib"
|
||||
],
|
||||
"makefile.configureOnOpen": true,
|
||||
"Lua.workspace.ignoreDir": [
|
||||
".vscode",
|
||||
"/home/mutzi/.config/awesome"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#define SOL_ALL_SAFETIES_ON 1
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
@ -21,21 +22,25 @@ static std::tuple<guint, bool> get_volume(gpointer api, guint32 id) {
|
||||
GVariant *variant = nullptr;
|
||||
g_signal_emit(api, get_volume_sig, 0, id, &variant);
|
||||
|
||||
gdouble volumed;
|
||||
gboolean mute;
|
||||
gdouble volumed = 0.5;
|
||||
gboolean mute = false;
|
||||
if (variant) {
|
||||
g_variant_lookup(variant, "volume", "d", &volumed);
|
||||
g_variant_lookup(variant, "mute", "b", &mute);
|
||||
if (variant) g_variant_unref(variant);
|
||||
g_variant_unref(variant);
|
||||
}
|
||||
|
||||
return std::tuple<guint, bool>(std::round(volumed * 100.0), mute == 1);
|
||||
}
|
||||
|
||||
static void set_volume(gpointer api, guint32 id, guint voli, bool mute) {
|
||||
static void set_volume(gpointer api, guint32 id, int vol, bool mute) {
|
||||
if (set_volume_sig == 0)
|
||||
set_volume_sig = g_signal_lookup("set-volume", G_TYPE_FROM_INSTANCE(api));
|
||||
|
||||
vol = std::clamp(vol, 0, 150);
|
||||
|
||||
g_auto(GVariantBuilder) b = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE_VARDICT);
|
||||
g_variant_builder_add(&b, "{sv}", "volume", g_variant_new_double(((gdouble)voli)/100));
|
||||
g_variant_builder_add(&b, "{sv}", "volume", g_variant_new_double(((gdouble)vol)/100));
|
||||
g_variant_builder_add(&b, "{sv}", "mute", g_variant_new_boolean(mute ? TRUE : FALSE));
|
||||
|
||||
GVariant *variant = g_variant_builder_end(&b);
|
||||
|
1
rc.lua
1
rc.lua
@ -47,3 +47,4 @@ end)
|
||||
|
||||
local on_screen_connect = require('src.theme.wibar')
|
||||
require('awful').screen.connect_for_each_screen(function(s) on_screen_connect(s) end)
|
||||
require('awful').spawn.with_shell('xset s 0 0; xset dpms 0 0 0')
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
current_wid=$(xdo id)
|
||||
selection=$(rofi -i -dmenu -theme-str 'listview{columns: 6; lines: 11;}' -theme-str 'window {fullscreen: true;}' $@ < $(dirname $0)/kaomoji.txt)
|
||||
selection=$(rofi -i -dmenu -theme-str 'listview{columns: 6; lines: 11;}' -theme-str 'window {fullscreen: true;}' $@ < $(dirname $0)/kaomoji_data.sh)
|
||||
kaomoji=$(echo $selection | sed "s|$(echo -e "\ufeff").*||")
|
||||
echo -n "$kaomoji" | xclip -selection clipboard
|
||||
|
@ -4,6 +4,7 @@
|
||||
power="Power menu"
|
||||
ssh="SSH Connect"
|
||||
window="Window switcher"
|
||||
drun_actions="DRun with actions"
|
||||
kaomoji="Kaomoji"
|
||||
|
||||
# Rofi CMD
|
||||
@ -17,7 +18,7 @@ rofi_cmd() {
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$power\n$ssh\n$window\n$kaomoji" | rofi_cmd
|
||||
echo -e "$power\n$ssh\n$window\n$drun_actions\n$kaomoji" | rofi_cmd
|
||||
}
|
||||
|
||||
# Actions
|
||||
@ -37,6 +38,12 @@ case ${chosen} in
|
||||
-theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \
|
||||
-theme-str 'listview {columns: 1; lines: 10;}'
|
||||
;;
|
||||
$drun_actions)
|
||||
rofi \
|
||||
-show drun \
|
||||
-theme $HOME/.config/awesome/rofi/launcher.rasi \
|
||||
-drun-show-actions
|
||||
;;
|
||||
$kaomoji)
|
||||
$HOME/.config/awesome/rofi/kaomoji.sh \
|
||||
-theme $HOME/.config/awesome/rofi/launcher_launcher.rasi
|
||||
|
@ -1,6 +1,6 @@
|
||||
return {
|
||||
wallpaper = 'wall2.png',
|
||||
systray_screen = 1,
|
||||
|
||||
--show_battery = false,
|
||||
--show_volume = true
|
||||
show_battery = false
|
||||
}
|
||||
|
@ -23,7 +23,8 @@ local keys = gears.table.join(
|
||||
local buttons = gears.table.join(
|
||||
awful.button({}, 1, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) end),
|
||||
awful.button({ modkey }, 1, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) awful.mouse.client.move(c) end),
|
||||
awful.button({ modkey }, 3, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) awful.mouse.client.resize(c) end)
|
||||
awful.button({ modkey }, 3, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) awful.mouse.client.resize(c) end),
|
||||
awful.button({ modkey }, 2, function(c) c:kill() end)
|
||||
)
|
||||
|
||||
|
||||
|
@ -49,3 +49,9 @@ end)
|
||||
client.connect_signal('mouse::enter', function(c) c:emit_signal('request::activate', 'mouse_enter', { raise = false }) end)
|
||||
client.connect_signal('focus', function(c) c.border_color = beautiful.border_focus end)
|
||||
client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end)
|
||||
|
||||
client.connect_signal("property::minimized", function(c)
|
||||
if c.no_minimize then
|
||||
c.minimized = false
|
||||
end
|
||||
end)
|
||||
|
@ -18,8 +18,10 @@ rules.append_rules({
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
||||
size_hints_honor = false,
|
||||
no_border = false,
|
||||
titlebars_enabled = false
|
||||
}
|
||||
titlebars_enabled = false,
|
||||
no_minimize = false,
|
||||
},
|
||||
--callback = function(c) print('name ', c.name, ' class ', c.class) end
|
||||
}, {
|
||||
rule_any = {
|
||||
class = { 'Tor Browser' },
|
||||
@ -32,10 +34,10 @@ rules.append_rules({
|
||||
},
|
||||
properties = { floating = true }
|
||||
}, {
|
||||
rule_any = { class = { 'firefox', 'factorio', 'Blender' } },
|
||||
rule_any = { class = { 'firefox', 'factorio', 'Blender', 'Godot' } },
|
||||
properties = { opacity = 1, maximized = false, floating = false },
|
||||
}, {
|
||||
rule = { class = 'mpv' },
|
||||
rule_any = { class = { 'mpv', 'jellyfinmediaplayer' } },
|
||||
properties = { fullscreen = true },
|
||||
}, {
|
||||
rule = { class = 'supcom-fa' },
|
||||
@ -47,5 +49,7 @@ rules.append_rules({
|
||||
no_border = true,
|
||||
}
|
||||
},
|
||||
{ rule = { class = { 'krusader' } }, properties = { ontop = true } },
|
||||
{ rule_any = { type = { 'normal', 'dialog' } }, properties = { titlebars_enabled = true } },
|
||||
--{ rule_any = { name = { 'Counter-Strike 2' }, class = { 'cs2' } }, properties = { no_minimize = true } },
|
||||
})
|
||||
|
@ -15,7 +15,7 @@ local quake = lain.util.quake({
|
||||
followtag = true,
|
||||
overlap = true,
|
||||
|
||||
app = globals.terminal,
|
||||
app = 'alacritty',
|
||||
argname = '-t ' .. quake_terminal_name,
|
||||
name = quake_terminal_name,
|
||||
extra = '--class ' .. quake_terminal_name,
|
||||
|
@ -1,7 +1,7 @@
|
||||
return {
|
||||
modkey = 'Mod4',
|
||||
altkey = 'Mod1',
|
||||
terminal = 'alacritty',
|
||||
terminal = 'st',
|
||||
cycle_prev = true,
|
||||
editor = 'nvim',
|
||||
editor = 'nvim'
|
||||
}
|
||||
|
@ -3,6 +3,11 @@ local naughty = require('naughty')
|
||||
|
||||
local confdir = require('src.util.path').conf_dir
|
||||
|
||||
---@class Settings
|
||||
---@field wallpaper? string
|
||||
---@field systray_screen? integer
|
||||
---@field show_battery? boolean
|
||||
---@return Settings
|
||||
local function load_settings()
|
||||
local status, settings = pcall(function()
|
||||
return dofile(confdir .. '/settings.lua')
|
||||
@ -23,7 +28,7 @@ local settings = load_settings()
|
||||
|
||||
return {
|
||||
confdir = confdir,
|
||||
wallpaper = confdir .. '/wallpapers/' .. (settings['wallpaper'] or 'wall.png'),
|
||||
wallpaper = confdir .. '/wallpapers/' .. (settings.wallpaper or 'wall.png'),
|
||||
font = 'Terminus 8',
|
||||
font_mono = 'Mononoki Nerd Font Mono 10',
|
||||
bg_normal = '#000000',
|
||||
@ -102,5 +107,6 @@ return {
|
||||
tasklist_bg_minimize = '#4d4d4d',
|
||||
tasklist_plain_task_name = true,
|
||||
tasklist_disable_icon = true,
|
||||
systray_screen = settings.systray_screen or 1
|
||||
systray_screen = settings.systray_screen or 1,
|
||||
show_battery = settings.show_battery or false
|
||||
}
|
||||
|
@ -36,8 +36,11 @@ if _G.volume_control == nil then
|
||||
}
|
||||
|
||||
function volume_control:get_default_node() self.node_id = volume_control.pw_call.default_node(self.node_api._native) end
|
||||
---@param vol number
|
||||
---@param m boolean
|
||||
function volume_control:set_volume(vol, m) volume_control.pw_call.set_volume(self.mixer_api._native, self.node_id, vol, m) end
|
||||
function volume_control:toggle_mute() self:set_volume(self.volume, not self.mute) end
|
||||
---@param d number
|
||||
function volume_control:volume_delta(d) self:set_volume(self.volume + d, self.mute) end
|
||||
function volume_control:get_volume()
|
||||
self.volume, self.mute = volume_control.pw_call.get_volume(self.mixer_api._native, self.node_id)
|
||||
@ -98,4 +101,6 @@ return {
|
||||
toggle_mute = function() _G.volume_control:toggle_mute() end,
|
||||
vol_up = function() _G.volume_control:volume_delta(1) end,
|
||||
vol_down = function() _G.volume_control:volume_delta(-1) end,
|
||||
---@param delta number
|
||||
vol_delta = function (delta) _G.volume_control:volume_delta(delta) end
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ end)
|
||||
local volumebuttons = awful.util.table.join(
|
||||
awful.button({}, 1, volume.toggle_mute),
|
||||
awful.button({}, 4, volume.vol_up),
|
||||
awful.button({}, 5, volume.vol_down)
|
||||
awful.button({}, 5, volume.vol_down),
|
||||
awful.button({ 'Shift' }, 4, function() volume.vol_delta(5) end),
|
||||
awful.button({ 'Shift' }, 5, function() volume.vol_delta(-5) end)
|
||||
)
|
||||
|
||||
volume_widget:buttons(volumebuttons)
|
||||
|
32
src/widgets/7_battery.lua
Normal file
32
src/widgets/7_battery.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local theme = require('src.theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
|
||||
local baticon = wibox.widget.imagebox(nil)
|
||||
local bat = lain.widget.bat({
|
||||
settings = function()
|
||||
-- luacheck: globals widget bat_now
|
||||
if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then
|
||||
baticon:set_image(theme.widget_bat_charge)
|
||||
elseif bat_now.perc < 5 then
|
||||
baticon:set_image(theme.widget_bat_empty)
|
||||
elseif bat_now.perc < 15 then
|
||||
baticon:set_image(theme.widget_bat_low)
|
||||
elseif bat_now.perc < 50 then
|
||||
baticon:set_image(theme.widget_bat_mid)
|
||||
elseif bat_now.perc < 95 then
|
||||
baticon:set_image(theme.widget_bat_high)
|
||||
else
|
||||
baticon:set_image(theme.widget_bat_full)
|
||||
end
|
||||
local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc
|
||||
|
||||
if bat_now.ac_status == 1 then
|
||||
perc = perc .. ' plug'
|
||||
end
|
||||
|
||||
widget:set_text(perc)
|
||||
end
|
||||
})
|
||||
|
||||
return { wibox.layout.fixed.horizontal(baticon, bat.widget) }
|
@ -43,6 +43,12 @@ local function signal_cbk(_conn, _sender, _object_path, _interface_name, _signal
|
||||
local data = variant_strip(params)
|
||||
if type(data) ~= 'table' or type(data[2]) ~= 'table' then return end
|
||||
data = data[2]
|
||||
if data['Metadata'] then
|
||||
data = data['Metadata']
|
||||
local title = data['xesam:title'] or ''
|
||||
local artist = (data['xesam:artist'] or {})[1] or ''
|
||||
mpris_widget.text = artist .. ' -> ' .. title
|
||||
end
|
||||
if data['PlaybackStatus'] then
|
||||
if data['PlaybackStatus'] == 'Playing' then
|
||||
mpris_icon:set_image(theme.widget_play)
|
||||
@ -52,11 +58,6 @@ local function signal_cbk(_conn, _sender, _object_path, _interface_name, _signal
|
||||
mpris_icon:set_image(theme.widget_stop)
|
||||
mpris_widget.text = 'Nothing playing'
|
||||
end
|
||||
elseif data['Metadata'] then
|
||||
data = data['Metadata']
|
||||
local title = data['xesam:title'] or ''
|
||||
local artist = (data['xesam:artist'] or {})[1] or ''
|
||||
mpris_widget.text = artist .. ' -> ' .. title
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,5 @@
|
||||
local gears = require('gears')
|
||||
local theme = require('src.theme')
|
||||
|
||||
return gears.table.join(
|
||||
require('src.widgets.1_clock'),
|
||||
@ -7,5 +8,6 @@ return gears.table.join(
|
||||
require('src.widgets.4_mem'),
|
||||
require('src.widgets.5_vol'),
|
||||
require('src.widgets.6_net'),
|
||||
require('src.widgets.7_mpris')
|
||||
theme.show_battery and require('src.widgets.7_battery') or {},
|
||||
require('src.widgets.8_mpris')
|
||||
)
|
BIN
wallpapers/1626543115985_v1.jpg
Normal file
BIN
wallpapers/1626543115985_v1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 MiB |
BIN
wallpapers/1710892828042072.jpg
Normal file
BIN
wallpapers/1710892828042072.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 KiB |
BIN
wallpapers/wall7.png
Normal file
BIN
wallpapers/wall7.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 MiB |
BIN
wallpapers/wall8.png
Normal file
BIN
wallpapers/wall8.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
Loading…
Reference in New Issue
Block a user