browser shortcut open or show

This commit is contained in:
vrd
2026-07-30 11:54:49 +03:00
committed by Venelin Dechkov
parent 78c4acca67
commit 34ca51a324
2 changed files with 33 additions and 27 deletions
+7 -7
View File
@@ -68,13 +68,13 @@ static const Layout layouts[] = {
// static const char* dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char* dmenucmd[] = { "dmenu_run", NULL };
static const char* termcmd[] = { "st", NULL };
static const char* screenshot [] = { "scrot", "-s", SCREEN_CAPS_DIR, NULL };
#if HAS_SW_BACKLIGHT
static const char* bright_up[] = { "brightnessctl", "s", "-q", "3%+", NULL };
static const char* bright_down[] = { "brightnessctl", "s", "-q", "3%-", NULL };
static const char* screenshot [] = { "scrot", "-s", SCREEN_CAPS_DIR, NULL };
#endif
static void webbookmark(const Arg* arg){
const Arg tag = {.ui = 1<<7};
/* view(&tag); */
static void webbookmark(const Arg* unused){
vene_webbookmark();
}
@@ -82,9 +82,9 @@ static const Key keys[] = {
/* modifier key function argument */
{ MODKEY|ShiftMask, XK_s, spawn, {.v = screenshot } }, //Take a screenshot
{ MODKEY|ShiftMask, XK_b, webbookmark, {0} }, //Open a web bookmark
{ 0, XF86XK_AudioRaiseVolume, vene_inc_vol, {0 } },
{ 0, XF86XK_AudioLowerVolume, vene_dec_vol, {0 } },
{ 0, XF86XK_AudioMute, vene_toggle_vol, {0 } },
{ 0, XF86XK_AudioRaiseVolume, vene_inc_vol, {0} },
{ 0, XF86XK_AudioLowerVolume, vene_dec_vol, {0} },
{ 0, XF86XK_AudioMute, vene_toggle_vol, {0} },
#if HAS_SW_BACKLIGHT
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = bright_up } },
{ 0, XF86XK_MonBrightnessDown,spawn, {.v = bright_down } },
+14 -8
View File
@@ -144,8 +144,12 @@ extern "C"
}
// Battery
string charge, state;
string charge;
ifstream("/sys/class/power_supply/BAT0/capacity") >> charge;
if( !charge.empty() ) // If we have a charge we have a battery
{
string state;
ifstream("/sys/class/power_supply/BAT0/status") >> state;
const char* remaining = "";
@@ -157,11 +161,14 @@ extern "C"
else
new_stat += "🔌";
new_stat += charge;
new_stat += "% ";
new_stat += remaining;
new_stat += ' ';
}
}
catch(...){ cerr << "EXCEPT\n"; }
// Volume
@@ -215,24 +222,23 @@ extern "C"
}
}
void vene_browser(const Arg* arg)
void vene_browser(const Arg* browser_tag)
{
bool browser_tag_used = false;
for(Client* c = selmon->clients; c; c = c->next)
if(c->tags & 1<<8)
if(c->tags & browser_tag->ui)
{
browser_tag_used = true;
break;
}
// if( browser_tag_used ) // browser tag is empty, start browser
if( browser_tag_used ) // browser tag is used, view it
{
view(arg);
view(browser_tag);
}
// else // view browser tag
else // start browser
{
// Cmd(BROWSER).detach();
Cmd(BROWSER).detach();
}
}