Added battery, small fixes, idk
This commit is contained in:
		
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							@@ -6,10 +6,7 @@ test: build
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
.PHONY: deploy
 | 
					.PHONY: deploy
 | 
				
			||||||
deploy: build
 | 
					deploy: build
 | 
				
			||||||
	@echo Backing old config up
 | 
						rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' --exclude '*' ./ ~/.config/awesome/
 | 
				
			||||||
	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/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: build
 | 
					.PHONY: build
 | 
				
			||||||
build:
 | 
					build:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,11 @@
 | 
				
			|||||||
		],
 | 
							],
 | 
				
			||||||
		"Lua.workspace.library": [
 | 
							"Lua.workspace.library": [
 | 
				
			||||||
			"/usr/share/awesome/lib"
 | 
								"/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
 | 
					#define SOL_ALL_SAFETIES_ON 1
 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
#include <glib-object.h>
 | 
					#include <glib-object.h>
 | 
				
			||||||
@@ -21,21 +22,25 @@ static std::tuple<guint, bool> get_volume(gpointer api, guint32 id) {
 | 
				
			|||||||
    GVariant *variant = nullptr;
 | 
					    GVariant *variant = nullptr;
 | 
				
			||||||
    g_signal_emit(api, get_volume_sig, 0, id, &variant);
 | 
					    g_signal_emit(api, get_volume_sig, 0, id, &variant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gdouble volumed;
 | 
					    gdouble volumed = 0.5;
 | 
				
			||||||
    gboolean mute;
 | 
					    gboolean mute = false;
 | 
				
			||||||
    g_variant_lookup(variant, "volume", "d", &volumed);
 | 
					    if (variant) {
 | 
				
			||||||
    g_variant_lookup(variant, "mute", "b", &mute);
 | 
					        g_variant_lookup(variant, "volume", "d", &volumed);
 | 
				
			||||||
    if (variant) g_variant_unref(variant);
 | 
					        g_variant_lookup(variant, "mute", "b", &mute);
 | 
				
			||||||
 | 
					        g_variant_unref(variant);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return std::tuple<guint, bool>(std::round(volumed * 100.0), mute == 1);
 | 
					    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)
 | 
					    if (set_volume_sig == 0)
 | 
				
			||||||
        set_volume_sig = g_signal_lookup("set-volume", G_TYPE_FROM_INSTANCE(api));
 | 
					        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_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));
 | 
					    g_variant_builder_add(&b, "{sv}", "mute", g_variant_new_boolean(mute ? TRUE : FALSE));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GVariant *variant = g_variant_builder_end(&b);
 | 
					    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')
 | 
					local on_screen_connect = require('src.theme.wibar')
 | 
				
			||||||
require('awful').screen.connect_for_each_screen(function(s) on_screen_connect(s) end)
 | 
					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
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
current_wid=$(xdo id)
 | 
					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").*||")
 | 
					kaomoji=$(echo $selection | sed "s|$(echo -e "\ufeff").*||")
 | 
				
			||||||
echo -n "$kaomoji" | xclip -selection clipboard
 | 
					echo -n "$kaomoji" | xclip -selection clipboard
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,41 +4,48 @@
 | 
				
			|||||||
power="Power menu"
 | 
					power="Power menu"
 | 
				
			||||||
ssh="SSH Connect"
 | 
					ssh="SSH Connect"
 | 
				
			||||||
window="Window switcher"
 | 
					window="Window switcher"
 | 
				
			||||||
 | 
					drun_actions="DRun with actions"
 | 
				
			||||||
kaomoji="Kaomoji"
 | 
					kaomoji="Kaomoji"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Rofi CMD
 | 
					# Rofi CMD
 | 
				
			||||||
rofi_cmd() {
 | 
					rofi_cmd() {
 | 
				
			||||||
	rofi -dmenu \
 | 
					    rofi -dmenu \
 | 
				
			||||||
		-window-title "Launcher" \
 | 
					        -window-title "Launcher" \
 | 
				
			||||||
		-i \
 | 
					        -i \
 | 
				
			||||||
		-theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \
 | 
					        -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \
 | 
				
			||||||
        -theme-str 'listview {columns: 1;}'
 | 
					        -theme-str 'listview {columns: 1;}'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Pass variables to rofi dmenu
 | 
					# Pass variables to rofi dmenu
 | 
				
			||||||
run_rofi() {
 | 
					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
 | 
					# Actions
 | 
				
			||||||
chosen="$(run_rofi)"
 | 
					chosen="$(run_rofi)"
 | 
				
			||||||
case ${chosen} in
 | 
					case ${chosen} in
 | 
				
			||||||
    $power)
 | 
					    $power)
 | 
				
			||||||
		$HOME/.config/awesome/rofi/powermenu.sh
 | 
					        $HOME/.config/awesome/rofi/powermenu.sh
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    $ssh)
 | 
					    $ssh)
 | 
				
			||||||
		rofi \
 | 
					        rofi \
 | 
				
			||||||
			-show ssh \
 | 
					            -show ssh \
 | 
				
			||||||
			-theme $HOME/.config/awesome/rofi/launcher_launcher.rasi
 | 
					            -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    $window)
 | 
					    $window)
 | 
				
			||||||
		rofi \
 | 
					        rofi \
 | 
				
			||||||
			-show window \
 | 
					            -show window \
 | 
				
			||||||
			-theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \
 | 
					            -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \
 | 
				
			||||||
        	-theme-str 'listview {columns: 1; lines: 10;}'
 | 
					            -theme-str 'listview {columns: 1; lines: 10;}'
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    $drun_actions)
 | 
				
			||||||
 | 
					        rofi \
 | 
				
			||||||
 | 
					            -show drun \
 | 
				
			||||||
 | 
					            -theme $HOME/.config/awesome/rofi/launcher.rasi \
 | 
				
			||||||
 | 
					            -drun-show-actions
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    $kaomoji)
 | 
					    $kaomoji)
 | 
				
			||||||
		$HOME/.config/awesome/rofi/kaomoji.sh \
 | 
					        $HOME/.config/awesome/rofi/kaomoji.sh \
 | 
				
			||||||
			-theme $HOME/.config/awesome/rofi/launcher_launcher.rasi
 | 
					            -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
return {
 | 
					return {
 | 
				
			||||||
	wallpaper = 'wall2.png',
 | 
						wallpaper = 'wall2.png',
 | 
				
			||||||
 | 
						systray_screen = 1,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	--show_battery = false,
 | 
						show_battery = false
 | 
				
			||||||
	--show_volume = true
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,8 @@ local keys = gears.table.join(
 | 
				
			|||||||
local buttons = 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({}, 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 }, 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('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('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('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,
 | 
					            placement = awful.placement.no_overlap + awful.placement.no_offscreen,
 | 
				
			||||||
            size_hints_honor = false,
 | 
					            size_hints_honor = false,
 | 
				
			||||||
            no_border = 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 = {
 | 
					        rule_any = {
 | 
				
			||||||
            class = { 'Tor Browser' },
 | 
					            class = { 'Tor Browser' },
 | 
				
			||||||
@@ -32,10 +34,10 @@ rules.append_rules({
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        properties = { floating = true }
 | 
					        properties = { floating = true }
 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
        rule_any = { class = { 'firefox', 'factorio', 'Blender' } },
 | 
					        rule_any = { class = { 'firefox', 'factorio', 'Blender', 'Godot' } },
 | 
				
			||||||
        properties = { opacity = 1, maximized = false, floating = false },
 | 
					        properties = { opacity = 1, maximized = false, floating = false },
 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
        rule = { class = 'mpv' },
 | 
					        rule_any = { class = { 'mpv', 'jellyfinmediaplayer' } },
 | 
				
			||||||
        properties = { fullscreen = true },
 | 
					        properties = { fullscreen = true },
 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
        rule = { class = 'supcom-fa' },
 | 
					        rule = { class = 'supcom-fa' },
 | 
				
			||||||
@@ -47,5 +49,7 @@ rules.append_rules({
 | 
				
			|||||||
            no_border = true,
 | 
					            no_border = true,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    { rule = { class = { 'krusader' } }, properties = { ontop = true } },
 | 
				
			||||||
    { rule_any = { type = { 'normal', 'dialog' } }, properties = { titlebars_enabled = 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,
 | 
						followtag = true,
 | 
				
			||||||
	overlap = true,
 | 
						overlap = true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app = globals.terminal,
 | 
						app = 'alacritty',
 | 
				
			||||||
	argname = '-t ' .. quake_terminal_name,
 | 
						argname = '-t ' .. quake_terminal_name,
 | 
				
			||||||
	name = quake_terminal_name,
 | 
						name = quake_terminal_name,
 | 
				
			||||||
	extra = '--class ' .. quake_terminal_name,
 | 
						extra = '--class ' .. quake_terminal_name,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
return {
 | 
					return {
 | 
				
			||||||
	modkey = 'Mod4',
 | 
						modkey = 'Mod4',
 | 
				
			||||||
	altkey = 'Mod1',
 | 
						altkey = 'Mod1',
 | 
				
			||||||
	terminal = 'alacritty',
 | 
						terminal = 'st',
 | 
				
			||||||
	cycle_prev = true,
 | 
						cycle_prev = true,
 | 
				
			||||||
	editor = 'nvim',
 | 
						editor = 'nvim'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,11 @@ local naughty = require('naughty')
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
local confdir = require('src.util.path').conf_dir
 | 
					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 function load_settings()
 | 
				
			||||||
    local status, settings = pcall(function()
 | 
					    local status, settings = pcall(function()
 | 
				
			||||||
        return dofile(confdir .. '/settings.lua')
 | 
					        return dofile(confdir .. '/settings.lua')
 | 
				
			||||||
@@ -23,7 +28,7 @@ local settings = load_settings()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
return {
 | 
					return {
 | 
				
			||||||
    confdir = confdir,
 | 
					    confdir = confdir,
 | 
				
			||||||
    wallpaper = confdir .. '/wallpapers/' .. (settings['wallpaper'] or 'wall.png'),
 | 
					    wallpaper = confdir .. '/wallpapers/' .. (settings.wallpaper or 'wall.png'),
 | 
				
			||||||
    font = 'Terminus 8',
 | 
					    font = 'Terminus 8',
 | 
				
			||||||
    font_mono = 'Mononoki Nerd Font Mono 10',
 | 
					    font_mono = 'Mononoki Nerd Font Mono 10',
 | 
				
			||||||
    bg_normal = '#000000',
 | 
					    bg_normal = '#000000',
 | 
				
			||||||
@@ -102,5 +107,6 @@ return {
 | 
				
			|||||||
    tasklist_bg_minimize = '#4d4d4d',
 | 
					    tasklist_bg_minimize = '#4d4d4d',
 | 
				
			||||||
    tasklist_plain_task_name = true,
 | 
					    tasklist_plain_task_name = true,
 | 
				
			||||||
    tasklist_disable_icon = 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
 | 
					    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: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
 | 
					    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:volume_delta(d) self:set_volume(self.volume + d, self.mute) end
 | 
				
			||||||
    function volume_control:get_volume()
 | 
					    function volume_control:get_volume()
 | 
				
			||||||
        self.volume, self.mute = volume_control.pw_call.get_volume(self.mixer_api._native, self.node_id)
 | 
					        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,
 | 
					    toggle_mute = function() _G.volume_control:toggle_mute() end,
 | 
				
			||||||
    vol_up = function() _G.volume_control:volume_delta(1) end,
 | 
					    vol_up = function() _G.volume_control:volume_delta(1) end,
 | 
				
			||||||
    vol_down = 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(
 | 
					local volumebuttons = awful.util.table.join(
 | 
				
			||||||
    awful.button({}, 1, volume.toggle_mute),
 | 
					    awful.button({}, 1, volume.toggle_mute),
 | 
				
			||||||
    awful.button({}, 4, volume.vol_up),
 | 
					    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)
 | 
					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)
 | 
					    local data = variant_strip(params)
 | 
				
			||||||
    if type(data) ~= 'table' or type(data[2]) ~= 'table' then return end
 | 
					    if type(data) ~= 'table' or type(data[2]) ~= 'table' then return end
 | 
				
			||||||
    data = data[2]
 | 
					    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'] then
 | 
				
			||||||
        if data['PlaybackStatus'] == 'Playing' then
 | 
					        if data['PlaybackStatus'] == 'Playing' then
 | 
				
			||||||
            mpris_icon:set_image(theme.widget_play)
 | 
					            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_icon:set_image(theme.widget_stop)
 | 
				
			||||||
            mpris_widget.text = 'Nothing playing'
 | 
					            mpris_widget.text = 'Nothing playing'
 | 
				
			||||||
        end
 | 
					        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
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
local gears = require('gears')
 | 
					local gears = require('gears')
 | 
				
			||||||
 | 
					local theme = require('src.theme')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return gears.table.join(
 | 
					return gears.table.join(
 | 
				
			||||||
    require('src.widgets.1_clock'),
 | 
					    require('src.widgets.1_clock'),
 | 
				
			||||||
@@ -7,5 +8,6 @@ return gears.table.join(
 | 
				
			|||||||
    require('src.widgets.4_mem'),
 | 
					    require('src.widgets.4_mem'),
 | 
				
			||||||
    require('src.widgets.5_vol'),
 | 
					    require('src.widgets.5_vol'),
 | 
				
			||||||
    require('src.widgets.6_net'),
 | 
					    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  | 
		Reference in New Issue
	
	Block a user