Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new EasyJWM builtin, cutdown derivative of JWMDesk
- Loading branch information
Showing
246 changed files
with
7,814 additions
and
0 deletions.
There are no files selected for viewing
209 changes: 209 additions & 0 deletions
209
easyos/easy-code/rootfs-skeleton/usr/local/easyjwm/clock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
#!/bin/bash | ||
# change clock format | ||
# radky 20 Oct 2015: adjust for JWMDesk; support parsing of l and r parameters in 12 hr clock, and R and T parameters in 24 hr clock | ||
# radky 25 Dec 2015: if jwm_config environment, find clock code in jwmrc-tray1-4 | ||
# radky 30 Mar 2021: add support for day, date and year; adjust GUI | ||
|
||
export TEXTDOMAIN=jwmclock | ||
export OUTPUT_CHARSET=UTF-8 | ||
. gettext.sh | ||
|
||
[ ! $(pidof jwm 2>/dev/null) ] && Xdialog --title "$(gettext 'Alert')" --beep --msgbox "\n $(gettext 'This application requires the JWM window manager !') \n" 0 0 && exit 0 | ||
|
||
APPDIR=/usr/local/easyjwm | ||
ICONDIR=$APPDIR/icons | ||
ICONDIR2=$APPDIR/jwm_menu_icons | ||
|
||
[ "`which gtkdialog4 2>/dev/null`" ] && GTKDIALOG=gtkdialog4 || GTKDIALOG=gtkdialog | ||
export GTKDIALOG | ||
|
||
# set header | ||
XML_INFO_COLOR='#EDEBD7' # background color | ||
XML_INFO_OPACITY=0.5 # background opacity | ||
. $APPDIR/xml_info_easyjwm gtk > /dev/null # build bg_pixmap for gtk-theme | ||
|
||
BOX_HEIGHT=75 | ||
ICON=$ICONDIR2/clock_digital.svg | ||
ICON_HEIGHT=50 | ||
MSG_1="<b><span size='"'x-large'"'>$(gettext "JWMclock")</span></b>" | ||
MSG_2="<b>$(gettext "Set time format")</b>" | ||
ALIGN=center # center or left | ||
HEADER=" | ||
<hbox height-request="'"${BOX_HEIGHT}"'"> | ||
$(. $APPDIR/xml_info_easyjwm "$ICON" "$ICON_HEIGHT" "$MSG_1" "$MSG_2" "$ALIGN") | ||
</hbox>" | ||
|
||
# set icon-name | ||
[ ! -f /usr/share/icons/hicolor/48x48/apps/clock_digital.svg ] && \ | ||
ln -sf $APPDIR/jwm_menu_icons/clock_digital.svg /usr/share/icons/hicolor/48x48/apps && gtk-update-icon-cache -f -i /usr/share/icons/hicolor 2>/dev/null | ||
|
||
# find jwm tray with clock widget | ||
if [ -d /usr/local/jwm_config* ]; then #25 Dec 2015 | ||
JWM_HOME="/root/.jwm" | ||
if [ "`grep '<Clock' $HOME/.jwm/jwmrc-tray1`" ]; then | ||
jwmtray="jwmrc-tray1" | ||
elif [ "`grep '<Clock' $HOME/.jwm/jwmrc-tray2`" ]; then | ||
jwmtray="jwmrc-tray2" | ||
elif [ "`grep '<Clock' $HOME/.jwm/jwmrc-tray3`" ]; then | ||
jwmtray="jwmrc-tray3" | ||
elif [ "`grep '<Clock' $HOME/.jwm/jwmrc-tray4`" ]; then | ||
jwmtray="jwmrc-tray4" | ||
fi | ||
else | ||
JWM_HOME="/root" | ||
jwmtray=".jwmrc-tray" | ||
fi | ||
|
||
# find current time format | ||
CURCLOCK=$(grep "Clock format=" $JWM_HOME/$jwmtray|tr '"' '#'|awk -F# '{print $2}') | ||
H24=`echo $CURCLOCK|grep -E 'H|R|T'` #20 Oct 2015 | ||
[ "$H24" ] && HC24=true VIS1=disabled || HC24=false VIS1=enabled | ||
I24=`echo $CURCLOCK|grep -E 'I|l|r'` #20 Oct 2015 | ||
[ "$I24" ] && IC24=true || IC24=false | ||
S24=`echo $CURCLOCK|grep S` | ||
[ "$S24" ] && SC24=true || SC24=false | ||
p24=`echo $CURCLOCK|grep p` | ||
[ "$p24" ] && pC24=true || pC24=false | ||
a24=`echo $CURCLOCK|grep a` #30 Mar 2021 | ||
[ "$a24" ] && aC24=true || aC24=false | ||
d24=`echo $CURCLOCK|grep d` #30 Mar 2021 | ||
[ "$d24" ] && dC24=true VIS2=enabled || dC24=false VIS2=disabled | ||
y24=`echo $CURCLOCK|grep Y` #30 Mar 2021 | ||
[ "$y24" ] && yC24=true || yC24=false | ||
|
||
# apply new time format | ||
clock_func(){ | ||
|
||
[ "$r0" = "true" ] && NCLOCK=%H:%M | ||
[ "$r1" = "true" ] && NCLOCK=%l:%M | ||
[ "$c0" = "true" ] && AMPM=:%p | ||
[ "$c1" = "true" ] && SEC=:%S | ||
[ "$d0" = "true" ] && DAY="%a " | ||
[ "$d1" = "true" ] && DATE="%d %b " | ||
[ "$y0" = "true" ] && YEAR="%Y " | ||
NEWCLOCK=${DAY}${DATE}${YEAR}${NCLOCK}${SEC}${AMPM} | ||
sed -i "s|$CURCLOCK|$NEWCLOCK|" $JWM_HOME/$jwmtray | ||
} | ||
|
||
# set buttons for external applications | ||
[ "`which minixcal 2>/dev/null`" ] && calendar=minixcal || calendar=xcalendar | ||
|
||
[ "`which set-time-for-puppy 2>/dev/null`" ] && timeset=' | ||
<button use-underline="true" tooltip-text=" '"$(gettext 'Set date and time')"' "> | ||
<input file>'$ICONDIR2'/date_time.svg</input><height>24</height><width>24</width> | ||
<action>set-time-for-puppy &</action> | ||
</button>' | ||
|
||
[ "`which timezone-set 2>/dev/null`" ] && timezone=' | ||
<button use-underline="true" tooltip-text=" '"$(gettext 'Set timezone')"' "> | ||
<input file>'$ICONDIR2'/country_timezone.svg</input><height>24</height><width>24</width> | ||
<action>timezone-set &</action> | ||
</button>' | ||
|
||
psync_cmd=qsync | ||
[ "$psync_cmd" ] && timesync=' | ||
<button use-underline="true" tooltip-text=" '"$(gettext 'Sync with time server')"' "> | ||
<input file>'$ICONDIR2'/clock_countdown.svg</input><height>24</height><width>24</width> | ||
<action>'${psync_cmd}' &</action> | ||
</button>' | ||
|
||
# main dialog | ||
export GUI='<window title="'"$(gettext 'JWMclock')"'" icon-name="clock_digital" window-position="3" resizable="false" decorated="true"> | ||
<hbox> | ||
<vbox> | ||
'$HEADER' | ||
<pixmap><input file>'$ICONDIR'/blank1.png</input></pixmap> | ||
<hbox> | ||
<vbox width-request="122"> | ||
<text space-expand="true" space-fill="false"><label>" "</label></text> | ||
<text space-expand="true" space-fill="false"><label>" "</label></text> | ||
<hbox homogeneous="true"> | ||
<vbox> | ||
<radiobutton> | ||
<variable>r0</variable> | ||
<default>'$HC24'</default> | ||
<label>'$(gettext "24 h")'</label> | ||
<action>if true disable:c0</action> | ||
<action>if true clear:c0</action> | ||
</radiobutton> | ||
<radiobutton> | ||
<variable>r1</variable> | ||
<default>'$IC24'</default> | ||
<label>'$(gettext "12 h")'</label> | ||
<action>if true enable:c0</action> | ||
</radiobutton> | ||
</vbox> | ||
</hbox> | ||
<text space-expand="true" space-fill="false"><label>" "</label></text> | ||
<text space-expand="true" space-fill="false"><label>" "</label></text> | ||
</vbox> | ||
<vbox width-request="122"> | ||
<checkbox> | ||
<variable>c0</variable> | ||
<default>'$pC24'</default> | ||
<label>'$(gettext "am / pm")'</label> | ||
<visible>'$VIS1'</visible> | ||
</checkbox> | ||
<checkbox> | ||
<variable>c1</variable> | ||
<default>'$SC24'</default> | ||
<label>'$(gettext "seconds")'</label> | ||
</checkbox> | ||
<checkbox> | ||
<variable>d0</variable> | ||
<default>'$aC24'</default> | ||
<label>'$(gettext "day")'</label> | ||
</checkbox> | ||
<checkbox> | ||
<variable>d1</variable> | ||
<default>'$dC24'</default> | ||
<label>'$(gettext "date")'</label> | ||
<action>if true enable:y0</action> | ||
<action>if false disable:y0</action> | ||
<action>if false clear:y0</action> | ||
</checkbox> | ||
<checkbox> | ||
<variable>y0</variable> | ||
<default>'$yC24'</default> | ||
<label>'$(gettext "year")'</label> | ||
<visible>'$VIS2'</visible> | ||
</checkbox> | ||
</vbox> | ||
</hbox> | ||
<hseparator></hseparator> | ||
<hbox space-expand="true" space-fill="true"> | ||
<button has-focus="true" use-underline="true" tooltip-text=" '"$(gettext 'Calendar')"' "> | ||
<input file>'$ICONDIR2'/calendar.png</input><height>25</height><width>25</width> | ||
<action>'${calendar}' &</action> | ||
</button> | ||
'$timeset' | ||
'$timezone' | ||
'$timesync' | ||
</hbox> | ||
<hbox space-expand="true" space-fill="true" homogeneous="true"> | ||
<button use-underline="true" tooltip-text=" '"$(gettext 'Set time format')"' "> | ||
<label>'$(gettext "_Set")'</label> | ||
<input file>'$ICONDIR'/apply.svg</input><height>24</height><width>24</width> | ||
<action>exit:OK</action> | ||
</button> | ||
<button use-underline="true"> | ||
<label>'$(gettext "_Quit")'</label> | ||
<input file>'$ICONDIR'/quit.svg</input><height>24</height><width>24</width> | ||
<action>exit:Cancel</action> | ||
</button> | ||
</hbox> | ||
</vbox> | ||
</hbox> | ||
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">exit:EXIT</action> | ||
</window>' | ||
eval `$GTKDIALOG -p GUI --styles=/tmp/easyjwm/gtkrc_xml_info.css` | ||
case $EXIT in | ||
OK|Ok) clock_func | ||
jwm -restart & | ||
exit ;; | ||
*)exit ;; | ||
esac |
113 changes: 113 additions & 0 deletions
113
easyos/easy-code/rootfs-skeleton/usr/local/easyjwm/current_themes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/bin/sh | ||
# JWMDesk - define current desktop themes in JWM environment | ||
|
||
export TEXTDOMAIN=jwmdesk | ||
export OUTPUT_CHARSET=UTF-8 | ||
. gettext.sh | ||
|
||
[ "`which gtkdialog4 2>/dev/null`" ] && GTKDIALOG=gtkdialog4 || GTKDIALOG=gtkdialog | ||
|
||
# Background | ||
CURRENT_WALLPAPER=$(cat $HOME/.config/wallpaper/bg_img 2>/dev/null | awk -F'/' '{print $NF}') | ||
[ ! "$CURRENT_WALLPAPER" ] && CURRENT_WALLPAPER="NA" | ||
|
||
# GTK3 theme | ||
if [ -e "$HOME/.config/gtk-3.0/settings.ini" ]; then | ||
if [ "`grep 'gtk-theme-name' $HOME/.config/gtk-3.0/settings.ini 2>/dev/null`" ] ; then | ||
THEME=$(grep 'gtk-theme-name' $HOME/.config/gtk-3.0/settings.ini | cut -d '=' -f2 | awk '{$1=$1};1') | ||
[ "$THEME" ] && CURRENT_GTK3THEME=$THEME || CURRENT_GTK3THEME="NA" | ||
else | ||
CURRENT_GTK3THEME="NA" | ||
fi | ||
else | ||
CURRENT_GTK3THEME="NA" | ||
fi | ||
|
||
# GTK2 theme | ||
if [[ $(grep -a '^include "/usr/share/themes' $HOME/.gtkrc-2.0 2>/dev/null) ]]; then | ||
CURRENT_GTK2THEME=$(grep -a '^include "/usr/share/themes' $HOME/.gtkrc-2.0 2>/dev/null | sed -e 's/include \"\/usr\/share\/themes\///' -e 's/\/gtk-2.0\/gtkrc\"//') | ||
elif [[ $(grep -a '^gtk-theme-name=' $HOME/.gtkrc-2.0 2>/dev/null) ]]; then | ||
CURRENT_GTK2THEME=$(grep -a '^gtk-theme-name=' $HOME/.gtkrc-2.0 2>/dev/null | sed -e 's/gtk-theme-name\=//' -e 's/\"//g') | ||
else | ||
CURRENT_GTK2THEME="NA" | ||
fi | ||
|
||
# JWM theme | ||
if [ -d /usr/local/jwm_config* ]; then | ||
CURRENT_JWMPRESET=$(cat $HOME/.jwm/tray_active_preset 2>/dev/null) | ||
JWMTHEME="$(gettext 'Tray Theme'):" | ||
else | ||
CURRENT_JWMPRESET=$(cat $HOME/.jwm/theme 2>/dev/null) | ||
JWMTHEME="$(gettext 'JWM Theme'):" | ||
fi | ||
[ ! "$CURRENT_JWMPRESET" ] && CURRENT_JWMPRESET="NA" | ||
|
||
# Desk icon theme | ||
CURRENT_DESKICONS=$(cat /etc/desktop_icon_theme 2>/dev/null) | ||
[ ! "$CURRENT_DESKICONS" ] && CURRENT_DESKICONS="NA" | ||
|
||
# GTK icon theme | ||
if [[ $(grep -a 'gtk-icon-theme-name' $HOME/.gtkrc-2.0 2>/dev/null) ]]; then | ||
IFS='"' read C1 GTK_ICON_THEME C <<< "$(grep -F 'gtk-icon-theme-name' $HOME/.gtkrc-2.0)" | ||
if [ "$GTK_ICON_THEME" ]; then | ||
CURRENT_GTKICONS="$GTK_ICON_THEME" | ||
else | ||
CURRENT_GTKICONS="NA" | ||
fi | ||
elif [[ $(grep -a 'gtk-icon-theme-name' $HOME/.config/gtk-3.0/settings.ini 2>/dev/null) ]]; then | ||
GTK_ICON_THEME=$(grep -a 'gtk-icon-theme-name' $HOME/.config/gtk-3.0/settings.ini | cut -d '=' -f2 | awk '{$1=$1};1') | ||
if [ "$GTK_ICON_THEME" ]; then | ||
CURRENT_GTKICONS="$GTK_ICON_THEME" | ||
else | ||
CURRENT_GTKICONS="NA" | ||
fi | ||
else | ||
CURRENT_GTKICONS="NA" | ||
fi | ||
|
||
# Cursor theme | ||
CURRENT_CURSOR=$(readlink $HOME/.icons/default | rev | cut -d '/' -f1 | rev) | ||
[ ! "$CURRENT_CURSOR" ] && CURRENT_CURSOR="Default" | ||
|
||
# GUI | ||
export CURRENT_THEMES=" | ||
<window title=\"$(gettext 'Themes')\" icon-name=\"jwmdesk64\" resizable=\"false\" window-position=\"2\"> | ||
<vbox> | ||
<text height-request=\"3\"><label>\"\"</label></text> | ||
<hbox> | ||
<vbox> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $(gettext 'Background'):</span></b>\"</label></text> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $(gettext 'GTK3 Theme'):</span></b>\"</label></text> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $(gettext 'GTK2 Theme'):</span></b>\"</label></text> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $JWMTHEME</span></b>\"</label></text> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $(gettext 'Desk Icons'):</span></b>\"</label></text> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $(gettext 'GTK Icons'):</span></b>\"</label></text> | ||
<text xalign=\"0\" wrap=\"false\" use-markup=\"true\"><label>\"<b><span size='"'medium'"'> $(gettext 'Cursor'):</span></b>\"</label></text> | ||
</vbox> | ||
<vbox> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_WALLPAPER \"</label></text> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_GTK3THEME \"</label></text> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_GTK2THEME \"</label></text> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_JWMPRESET \"</label></text> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_DESKICONS \"</label></text> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_GTKICONS \"</label></text> | ||
<text xalign=\"0\" wrap=\"false\"><label>\" $CURRENT_CURSOR \"</label></text> | ||
</vbox> | ||
</hbox> | ||
<text height-request=\"3\"><label>\"\"</label></text> | ||
<hseparator></hseparator> | ||
<hbox homogeneous=\"true\"> | ||
<button width-request=\"120\"> | ||
<label>\"$(gettext 'Close')\"</label> | ||
<action type=\"exit\">quit_now</action> | ||
</button> | ||
</hbox> | ||
</vbox> | ||
</window>" | ||
|
||
$GTKDIALOG -p CURRENT_THEMES | ||
unset CURRENT_THEMES | ||
|
||
exit 0 | ||
|
||
###END### |
Oops, something went wrong.