From bde6836bb24129e9f55bec4eed5f88f59b88f661 Mon Sep 17 00:00:00 2001 From: Marcin Wozniak Date: Wed, 11 Sep 2019 14:04:24 +0200 Subject: [PATCH] Added fullscreen enable --- config.h | 7 ++++--- dwm.c | 16 ++++++++++++++++ dwm_status | 18 +++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/config.h b/config.h index 8d51d4b..14c6e53 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,6 @@ /* appearance */ static const unsigned int borderpx = 2; /* border pixel of windows */ -static const unsigned int gappx = 0; /* gaps between windows */ +static const unsigned int gappx = 10; /* gaps between windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ @@ -66,7 +66,7 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", NULL }; -static const char *termcmd[] = { "st","-ce", "/bin/fish" , NULL }; +static const char *termcmd[] = { "st","-ce", "/bin/zsh" , NULL }; static const char *print_screen_cmd[] = { "scrot", "%Y-%m-%d-%H%M%S.png", "-e", "mv $f ~/Screenshots", NULL }; static const char *cmdlock[] = { "slock", NULL }; static const char *dwmkill[] = { "dwm-kill", NULL }; @@ -110,7 +110,8 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_q, killclient, {0} }, /*{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },*/ /*{ MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} },*/ - { MODKEY, XK_f, setlayout, {.v = &layouts[2]} }, + /*{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },*/ + { MODKEY, XK_f, fullscreen, {0} }, /*{ MODKEY, XK_space, setlayout, {0} },*/ { MODKEY, XK_space, setlayout, {.v = &layouts[0]} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, diff --git a/dwm.c b/dwm.c index 0a7da2c..96c59ed 100644 --- a/dwm.c +++ b/dwm.c @@ -231,6 +231,7 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); +static void fullscreen(const Arg *arg); static void setgaps(const Arg *arg); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); @@ -1692,6 +1693,21 @@ setgaps(const Arg *arg) arrange(selmon); } +Layout *last_layout; +void +fullscreen(const Arg *arg) +{ + if (selmon->showbar) { + for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++); + setlayout(&((Arg) { .v = &layouts[2] })); + } else { + setlayout(&((Arg) { .v = last_layout })); + } + togglebar(arg); +} + + + void setlayout(const Arg *arg) { diff --git a/dwm_status b/dwm_status index b40a820..83ef61c 100755 --- a/dwm_status +++ b/dwm_status @@ -8,7 +8,7 @@ redshift -l 52.2327:18.3036 -t 6500:3200& #compton& nm-applet --sm-disable& #/usr/local/bin/st -e "/bin/fish"& -/usr/local/bin/st -e /bin/sh -c "tmux new-session -s BASE -n HOME '/bin/zsh'\; new-window -n GOTOP 'gotop'\; new-window -n MUSIC 'cmus'\; new-window -n SERVER 'ssh root@jaqu3.ddns.net -p 2222'"& +/usr/local/bin/st -e /bin/sh -c "tmux new-session -s BASE -n HOME '/bin/zsh'\; new-window -n HTOP 'htop'\; new-window -n MUSIC 'cmus'"& firefox& thunderbird& "/mnt/mega/Systems/Linux/apps/KeePass.AppImage"& @@ -18,13 +18,13 @@ dunst -config& #sh /home/yorune/.xsessionrc& transmission-daemon& pl& -#getforecast& +getforecast& testweather() { -[ "$(stat -c %y "/tmp/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && ping -q -c 1 1.1.1.1 >/dev/null && curl -s "wttr.in/$location" > "/tmp/weatherreport" && notify-send "🌞 Weather" "New weather forecast for today." +[ "$(stat -c %y "/home/yorune/.weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && ping -q -c 1 1.1.1.1 >/dev/null && curl -s "wttr.in/$location" > "/home/yorune/.weatherreport" && notify-send "🌞 Weather" "New weather forecast for today." + +printf "%s " "$(sed '16q;d' "/home/yorune/.weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && sed '13q;d' "/home/yorune/.weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "❄️",$1 "°","",$2 "°"}' -#printf "%s" "$(sed '16q;d' "/tmp/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && -sed '13q;d' "/tmp/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "❄️",$1 "°","🌞",$2 "°"}' } @@ -49,7 +49,7 @@ print_temp(){ } print_date(){ - echo -e " $(date +"%a %H:%M")" + echo -e " $(date +"%d/%m %H:%M")" #echo -e " $(date +"%m-%d %H:%M")" } print_mail(){ @@ -124,7 +124,7 @@ esac while true do - xsetroot -name "$(print_temp) | $(usageData) | $(testweather) | $(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)" - #xsetroot -name "$(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)" - sleep 2 + #xsetroot -name "$(print_temp) | $(usageData) | $(testweather) | $(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)" + xsetroot -name "$(testweather) |$(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)" + sleep 2 done