Compare commits
4 Commits
1a67540672
...
d16e33d223
Author | SHA1 | Date |
---|---|---|
Augusto Gunsch | d16e33d223 | |
Augusto Gunsch | 3fe2938b80 | |
Augusto Gunsch | eb2f40a95d | |
Augusto Gunsch | c7c90e89e1 |
|
@ -1 +0,0 @@
|
||||||
Subproject commit 8439ca7930e73e17746a1d6f0610417e8a42865f
|
|
|
@ -1,128 +0,0 @@
|
||||||
-------------------------------------------------
|
|
||||||
-- Cmus Widget for Awesome Window Manager
|
|
||||||
-- Show what's playing, play/pause, etc
|
|
||||||
|
|
||||||
-- @author Augusto Gunsch
|
|
||||||
-- @copyright 2022 Augusto Gunsch
|
|
||||||
-------------------------------------------------
|
|
||||||
|
|
||||||
local awful = require("awful")
|
|
||||||
local wibox = require("wibox")
|
|
||||||
local watch = require("awful.widget.watch")
|
|
||||||
local spawn = require("awful.spawn")
|
|
||||||
local naughty = require("naughty")
|
|
||||||
|
|
||||||
local cmus_widget = {}
|
|
||||||
|
|
||||||
local function show_warning(message)
|
|
||||||
naughty.notify{
|
|
||||||
preset = naughty.config.presets.critical,
|
|
||||||
title = "Cmus Widget",
|
|
||||||
text = message}
|
|
||||||
end
|
|
||||||
|
|
||||||
local function worker(user_args)
|
|
||||||
|
|
||||||
local args = user_args or {}
|
|
||||||
local font = args.font or "Play 8"
|
|
||||||
|
|
||||||
local path_to_icons = args.path_to_icons or "/usr/share/icons/Arc/actions/symbolic/"
|
|
||||||
local timeout = args.timeout or 10
|
|
||||||
local space = args.space or 3
|
|
||||||
|
|
||||||
cmus_widget.widget = wibox.widget {
|
|
||||||
{
|
|
||||||
{
|
|
||||||
id = "playback_icon",
|
|
||||||
resize = false,
|
|
||||||
widget = wibox.widget.imagebox,
|
|
||||||
},
|
|
||||||
layout = wibox.container.place
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id = "text",
|
|
||||||
font = font,
|
|
||||||
widget = wibox.widget.textbox
|
|
||||||
},
|
|
||||||
spacing = space,
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
update_icon = function(self, name)
|
|
||||||
self:get_children_by_id("playback_icon")[1]:set_image(path_to_icons .. name)
|
|
||||||
end,
|
|
||||||
set_title = function(self, title)
|
|
||||||
self:get_children_by_id("text")[1]:set_text(title)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_widget(widget, stdout, _, _, code)
|
|
||||||
if code == 0 then
|
|
||||||
local cmus_info = {}
|
|
||||||
|
|
||||||
for s in stdout:gmatch("[^\r\n]+") do
|
|
||||||
local key, val = string.match(s, "^tag (%a+) (.+)$")
|
|
||||||
|
|
||||||
if key and val then
|
|
||||||
cmus_info[key] = val
|
|
||||||
else
|
|
||||||
local key, val = string.match(s, "^set (%a+) (.+)$")
|
|
||||||
|
|
||||||
if key and val then
|
|
||||||
cmus_info[key] = val
|
|
||||||
else
|
|
||||||
local key, val = string.match(s, "^(%a+) (.+)$")
|
|
||||||
if key and val then
|
|
||||||
cmus_info[key] = val
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local title = cmus_info.title
|
|
||||||
|
|
||||||
if not title and cmus_info.file then
|
|
||||||
title = cmus_info.file:gsub("%..-$", "")
|
|
||||||
title = title:gsub("^.+/", "")
|
|
||||||
end
|
|
||||||
|
|
||||||
if title then
|
|
||||||
if cmus_info["status"] == "playing" then
|
|
||||||
widget:update_icon("media-playback-start-symbolic.svg")
|
|
||||||
elseif cmus_info["status"] == "paused" then
|
|
||||||
widget:update_icon("media-playback-pause-symbolic.svg")
|
|
||||||
else
|
|
||||||
widget:update_icon("media-playback-stop-symbolic.svg")
|
|
||||||
end
|
|
||||||
|
|
||||||
widget:set_title(title)
|
|
||||||
widget.visible = true
|
|
||||||
else
|
|
||||||
widget.visible = false
|
|
||||||
widget.width = 0
|
|
||||||
end
|
|
||||||
else
|
|
||||||
widget.visible = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function cmus_widget:play_pause()
|
|
||||||
spawn("cmus-remote -u")
|
|
||||||
spawn.easy_async_with_shell("cmus-remote -Q",
|
|
||||||
function(stdout, _, _, code)
|
|
||||||
update_widget(cmus_widget.widget, stdout, _, _, code)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
cmus_widget.widget:buttons(
|
|
||||||
awful.util.table.join(
|
|
||||||
awful.button({}, 1, function() cmus_widget:play_pause() end)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
watch("cmus-remote -Q", timeout, update_widget, cmus_widget.widget)
|
|
||||||
|
|
||||||
return cmus_widget.widget
|
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable(cmus_widget, { __call = function(_, ...)
|
|
||||||
return worker(...)
|
|
||||||
end })
|
|
|
@ -23,7 +23,7 @@ local is_deb, debian = pcall(require, "debian.menu")
|
||||||
local has_fdo, freedesktop = pcall(require, "freedesktop")
|
local has_fdo, freedesktop = pcall(require, "freedesktop")
|
||||||
|
|
||||||
-- awesome-wm-widgets
|
-- awesome-wm-widgets
|
||||||
local cmus_widget = require("cmus-widget.cmus")
|
local cmus_widget = require("awesome-wm-widgets.cmus-widget.cmus")
|
||||||
local volume_widget = require("awesome-wm-widgets.volume-widget.volume")
|
local volume_widget = require("awesome-wm-widgets.volume-widget.volume")
|
||||||
local battery_widget = require("awesome-wm-widgets.battery-widget.battery")
|
local battery_widget = require("awesome-wm-widgets.battery-widget.battery")
|
||||||
local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness")
|
local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness")
|
||||||
|
@ -321,8 +321,13 @@ globalkeys = gears.table.join(
|
||||||
awful.key({ }, "XF86MonBrightnessUp", function () brightness_widget:inc() end, {description = "increase brightness", group = "custom"}),
|
awful.key({ }, "XF86MonBrightnessUp", function () brightness_widget:inc() end, {description = "increase brightness", group = "custom"}),
|
||||||
awful.key({ }, "XF86MonBrightnessDown", function () brightness_widget:dec() end, {description = "decrease brightness", group = "custom"}),
|
awful.key({ }, "XF86MonBrightnessDown", function () brightness_widget:dec() end, {description = "decrease brightness", group = "custom"}),
|
||||||
|
|
||||||
-- cmus toggle paused
|
-- cmus
|
||||||
awful.key({ modkey, "Shift" }, "p", function () cmus_widget:play_pause() end, {description = "play/pause cmus", group = "custom"}),
|
awful.key({ modkey, "Shift" }, "p", function () cmus_widget:play_pause() end, {description = "toggle track", group = "cmus"}),
|
||||||
|
awful.key({ }, "XF86AudioPlay", function () cmus_widget:play() end, {description = "play track", group = "cmus"}),
|
||||||
|
awful.key({ }, "XF86AudioPause", function () cmus_widget:pause() end, {description = "pause track", group = "cmus"}),
|
||||||
|
awful.key({ }, "XF86AudioNext", function () cmus_widget:next_track() end, {description = "next track", group = "cmus"}),
|
||||||
|
awful.key({ }, "XF86AudioPrev", function () cmus_widget:prev_track() end, {description = "previous track", group = "cmus"}),
|
||||||
|
awful.key({ }, "XF86AudioStop", function () cmus_widget:stop() end, {description = "stop track", group = "cmus"}),
|
||||||
|
|
||||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||||
{description="show help", group="awesome"}),
|
{description="show help", group="awesome"}),
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
include "%L"
|
||||||
|
|
||||||
|
<Multi_key> <l> <l> : "ł" U0142 # LATIN SMALL LETTER L WITH STROKE
|
||||||
|
<Multi_key> <L> <L> : "Ł" U0142 # LATIN CAPITAL LETTER L WITH STROKE
|
||||||
|
|
||||||
|
<dead_acute> <c> : "ć" U0107 # LATIN SMALL LETTER C WITH ACUTE
|
||||||
|
<dead_acute> <C> : "Ć" U0107 # LATIN CAPITAL LETTER C WITH ACUTE
|
24
home/aliases
24
home/aliases
|
@ -42,6 +42,9 @@ ytmpv() {
|
||||||
yt-dlp -q -o - "$1" | mpv -
|
yt-dlp -q -o - "$1" | mpv -
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# timeking config
|
||||||
|
alias newsboat="timeking '11:00-24:00' && newsboat"
|
||||||
|
|
||||||
goto() {
|
goto() {
|
||||||
open="$(grepa "$@" | fzf --ansi -1)"
|
open="$(grepa "$@" | fzf --ansi -1)"
|
||||||
if [ ! -z "$open" ]; then
|
if [ ! -z "$open" ]; then
|
||||||
|
@ -53,5 +56,22 @@ goto() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# NVM - Dynamic loading trick
|
# NVM - Dynamic loading trick
|
||||||
alias nvm="unalias nvm && [ -z $NVM_LOADED ] && export NVM_LOADED=1 && source /usr/share/nvm/init-nvm.sh ; nvm"
|
alias nvm="load_nvm; nvm"
|
||||||
alias node="unalias node && [ -z $NVM_LOADED ] && export NVM_LOADED=1 && source /usr/share/nvm/init-nvm.sh ; node"
|
alias node="load_nvm; node"
|
||||||
|
alias npm="load_nvm; npm"
|
||||||
|
alias npx="load_nvm; npx"
|
||||||
|
alias create-react-app="load_nvm; create-react-app"
|
||||||
|
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
load_nvm() {
|
||||||
|
if [ -z $NVM_LOADED ]; then
|
||||||
|
export NVM_LOADED=1
|
||||||
|
unalias nvm
|
||||||
|
unalias node
|
||||||
|
unalias npm
|
||||||
|
unalias npx
|
||||||
|
unalias create-react-app
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
. "$NVM_DIR/bash_completion"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
[ -f /etc/xprofile ] && . /etc/xprofile
|
||||||
|
[ -f ~/.xprofile ] && . ~/.xprofile
|
||||||
|
|
||||||
xrandr --dpi 96
|
xrandr --dpi 96
|
||||||
xset s off -dpms
|
xset s off -dpms
|
||||||
customkeys
|
customkeys
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
export GTK_IM_MODULE=xim
|
||||||
|
export XMODIFIERS="@im=none"
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/python3.9
|
||||||
|
from datetime import datetime
|
||||||
|
from sys import argv, stderr
|
||||||
|
from os import system
|
||||||
|
import re
|
||||||
|
|
||||||
|
rules = argv[1].split('&')
|
||||||
|
|
||||||
|
pattern = re.compile(r'(\d{2}):(\d{2})-(\d{2}):(\d{2})')
|
||||||
|
now = datetime.now()
|
||||||
|
|
||||||
|
nm = now.hour * 60 + now.minute
|
||||||
|
|
||||||
|
for rule in rules:
|
||||||
|
m = pattern.match(rule)
|
||||||
|
if not m:
|
||||||
|
print('unrecognized time stamp "{}"'.format(rule), file=stderr)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
sh, sm, eh, em = map(int, m.groups())
|
||||||
|
|
||||||
|
sm = sh * 60 + sm
|
||||||
|
em = eh * 60 + em
|
||||||
|
|
||||||
|
if nm >= sm and nm <= em:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
print('You are not supposed to access this program now', file=stderr)
|
||||||
|
system('notify-send -u critical "You are not supposed to access this program now"')
|
||||||
|
exit(2)
|
Loading…
Reference in New Issue