From 972a400931a8737d9a2f9625ea34247a05652622 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Sat, 2 Apr 2022 01:18:22 +0800 Subject: [PATCH] =?UTF-8?q?awesomewm=20=E9=9F=B3=E9=87=8F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=20pulse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- awesome/pravitekeys.lua | 35 +++++++++++++++++++++++------------ awesome/rc.lua | 5 ++++- script/screenshot | 7 +++++++ 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 script/screenshot diff --git a/awesome/pravitekeys.lua b/awesome/pravitekeys.lua index 8ba3b93..181a210 100644 --- a/awesome/pravitekeys.lua +++ b/awesome/pravitekeys.lua @@ -1,5 +1,7 @@ -local awful = require("awful"); +local lain = require("lain") +local awful = require("awful") local beautiful = require("beautiful") +local volume = lain.widget.pulse() local altkey = "Mod1" local modkey = "Mod4" @@ -15,12 +17,12 @@ pravitekeys = awful.util.table.join( -- if app is running, raise it, otherwise launch it awful.key({ modkey }, "a", function () - run_or_raise("android-studio", {class = "jetbrains-studio"}) + run_or_raise("google-chrome-stable", {class = "Google-chrome"}) end), awful.key({ modkey }, "q", function () - run_or_raise("firefox", {class = "Firefox"}) + run_or_raise("firefox", {class = "firefox"}) end), awful.key({ modkey, "Shift" }, "v", @@ -50,37 +52,46 @@ pravitekeys = awful.util.table.join( run_or_raise("pcmanfm", {class = "Pcmanfm"}) end), - -- ALSA volume control + awful.key({ modkey }, "p", + function () + awful.spawn.with_shell("screenshot") + end), + + -- PulseAudio volume control awful.key({ }, "XF86AudioRaiseVolume", function () - os.execute(string.format("amixer set %s 1%%+", beautiful.volume.channel)) + os.execute(string.format("pactl set-sink-volume %s +1%%", volume.device)) + volume.update() beautiful.volume.update() end), awful.key({ modkey }, "Up", function () - os.execute(string.format("amixer set %s 1%%+", beautiful.volume.channel)) + os.execute(string.format("pactl set-sink-volume %s +1%%", volume.device)) + volume.update() beautiful.volume.update() end), awful.key({ }, "XF86AudioLowerVolume", function () - os.execute(string.format("amixer set %s 1%%-", beautiful.volume.channel)) + os.execute(string.format("pactl set-sink-volume %s -1%%", volume.device)) + volume.update() beautiful.volume.update() end), awful.key({ modkey }, "Down", function () - os.execute(string.format("amixer set %s 1%%-", beautiful.volume.channel)) + os.execute(string.format("pactl set-sink-volume %s -1%%", volume.device)) + volume.update() beautiful.volume.update() end), awful.key({ }, "XF86AudioMute", function () - os.execute(string.format("amixer set %s toggle", beautiful.volume.togglechannel - or beautiful.volume.channel)) + os.execute(string.format("pactl set-sink-mute %s toggle", volume.device)) + volume.update() beautiful.volume.update() end), awful.key({ modkey, "Shift" }, "m", function () - os.execute(string.format("amixer set %s toggle", beautiful.volume.togglechannel - or beautiful.volume.channel)) + os.execute(string.format("pactl set-sink-mute %s toggle", volume.device)) + volume.update() beautiful.volume.update() end) ) diff --git a/awesome/rc.lua b/awesome/rc.lua index 56c63cd..3a05546 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -756,7 +756,10 @@ awful.rules.rules = { properties = { titlebars_enabled = false } }, -- Set Firefox to always map on the second tag on screen 1. - { rule = { class = "Firefox" }, + { rule = { class = "firefox" }, + properties = { tag = mytags.specify.firefox }, maximized = true }, + + { rule = { class = "Google-chrome" }, properties = { tag = mytags.specify.firefox }, maximized = true }, { rule = { class = "mpv"}, diff --git a/script/screenshot b/script/screenshot new file mode 100644 index 0000000..06f97e3 --- /dev/null +++ b/script/screenshot @@ -0,0 +1,7 @@ +#!/bin/sh + +timestamp="$(date +%Y%m%d%H%M%S)" +targetbase="$HOME/screenshots" +mkdir -p $targetbase +[ -d $targetbase ] || exit 1 +scrot -s $targetbase/$timestamp.png